Set real-time connectivity to on by default with a safety valve

This commit is contained in:
Jon Evans 2019-04-29 17:44:49 -04:00
parent 42d20cbd96
commit c054944d67
7 changed files with 42 additions and 19 deletions

View File

@ -151,6 +151,7 @@ ADVANCED_CFG::ADVANCED_CFG()
// then the values will remain as set here.
m_enableSvgImport = false;
m_allowLegacyCanvasInGtk3 = false;
m_realTimeConnectivity = true;
loadFromConfigFile();
}

View File

@ -26,6 +26,7 @@
#include <unordered_map>
#include <profile.h>
#include <advanced_config.h>
#include <common.h>
#include <erc.h>
#include <sch_edit_frame.h>
@ -345,6 +346,9 @@ void CONNECTION_SUBGRAPH::UpdateItemConnections()
}
bool CONNECTION_GRAPH::m_allowRealTime = true;
void CONNECTION_GRAPH::Reset()
{
for( auto subgraph : m_subgraphs )
@ -369,7 +373,8 @@ void CONNECTION_GRAPH::Reset()
void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUnconditional )
{
PROF_COUNTER phase1;
PROF_COUNTER recalc_time;
PROF_COUNTER update_items;
if( aUnconditional )
Reset();
@ -391,8 +396,8 @@ void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUncondition
updateItemConnectivity( sheet, items );
}
phase1.Stop();
wxLogTrace( "CONN_PROFILE", "UpdateItemConnectivity() %0.4f ms", phase1.msecs() );
update_items.Stop();
wxLogTrace( "CONN_PROFILE", "UpdateItemConnectivity() %0.4f ms", update_items.msecs() );
PROF_COUNTER tde;
@ -403,7 +408,26 @@ void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUncondition
tde.Stop();
wxLogTrace( "CONN_PROFILE", "TestDanglingEnds() %0.4f ms", tde.msecs() );
PROF_COUNTER build_graph;
buildConnectionGraph();
build_graph.Stop();
wxLogTrace( "CONN_PROFILE", "BuildConnectionGraph() %0.4f ms", build_graph.msecs() );
recalc_time.Stop();
wxLogTrace( "CONN_PROFILE", "Recalculate time %0.4f ms", recalc_time.msecs() );
#ifndef DEBUG
// Pressure relief valve for release builds
const double max_recalc_time_msecs = 250.;
if( m_allowRealTime && ADVANCED_CFG::GetCfg().m_realTimeConnectivity &&
recalc_time.msecs() > max_recalc_time_msecs )
{
m_allowRealTime = false;
}
#endif
}
@ -624,8 +648,6 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
void CONNECTION_GRAPH::buildConnectionGraph()
{
PROF_COUNTER phase2;
// Recache all bus aliases for later use
SCH_SHEET_LIST all_sheets( g_RootSheet );
@ -1293,9 +1315,6 @@ void CONNECTION_GRAPH::buildConnectionGraph()
[&] ( const CONNECTION_SUBGRAPH* sg ) {
return sg->m_absorbed;
} ), m_subgraphs.end() );
phase2.Stop();
wxLogTrace( "CONN_PROFILE", "BuildConnectionGraph() %0.4f ms", phase2.msecs() );
}
@ -1346,11 +1365,10 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
std::vector<CONNECTION_SUBGRAPH*> children;
auto add_children = [&] ( CONNECTION_SUBGRAPH* aParent ) {
for( SCH_SHEET_PIN* sheet_pin : aParent->m_hier_pins )
for( SCH_SHEET_PIN* pin : aParent->m_hier_pins )
{
wxString pin_name = sheet_pin->GetShownText();
SCH_SHEET_PATH path = aParent->m_sheet;
path.push_back( sheet_pin->GetParent() );
SCH_SHEET_PATH path = aSubgraph->m_sheet;
path.push_back( pin->GetParent() );
for( auto candidate : m_driver_subgraphs )
{
@ -1362,7 +1380,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
for( SCH_HIERLABEL* label : candidate->m_hier_ports )
{
if( label->GetShownText() == pin_name )
if( label->GetShownText() == pin->GetShownText() )
{
wxLogTrace( "CONN", "Found child %lu (%s)",
candidate->m_code, candidate->m_driver_connection->Name() );

View File

@ -209,6 +209,9 @@ public:
*/
int RunERC( const ERC_SETTINGS& aSettings, bool aCreateMarkers = true );
// TODO(JE) Remove this when pressure valve is removed
static bool m_allowRealTime;
// TODO(JE) firm up API and move to private
std::map<int, std::vector<CONNECTION_SUBGRAPH*> > m_net_code_to_subgraphs_map;

View File

@ -36,6 +36,7 @@
#include <advanced_config.h>
#include <class_library.h>
#include <connection_graph.h>
#include <general.h>
#include <hotkeys.h>
#include <netlist_object.h>
@ -771,7 +772,7 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
// TODO(JE) remove once real-time is enabled
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity )
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
{
frame->RecalculateConnections();

View File

@ -286,7 +286,7 @@ wxString SCH_CONNECTION::Name( bool aIgnoreSheet ) const
void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
{
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity )
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
return;
wxString msg, group_name;
@ -333,7 +333,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
void SCH_CONNECTION::AppendDebugInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
{
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity )
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
return;
// These messages are not flagged as translatable, because they are only debug messges

View File

@ -760,8 +760,7 @@ void SCH_EDIT_FRAME::OnModify()
m_foundItems.SetForceSearch();
if( ADVANCED_CFG::GetCfg().m_realTimeConnectivity )
if( ADVANCED_CFG::GetCfg().m_realTimeConnectivity && CONNECTION_GRAPH::m_allowRealTime )
RecalculateConnections( false );
m_canvas->Refresh();

View File

@ -29,6 +29,7 @@
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_bitmap.h>
#include <connection_graph.h>
#include <erc.h>
#include <eeschema_id.h>
#include <netlist_object.h>
@ -418,7 +419,7 @@ int SCH_EDITOR_CONTROL::HighlightNetSelection( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
{
// TODO(JE) remove once real-time connectivity is a given
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity )
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
m_frame->RecalculateConnections();
Activate();