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. // then the values will remain as set here.
m_enableSvgImport = false; m_enableSvgImport = false;
m_allowLegacyCanvasInGtk3 = false; m_allowLegacyCanvasInGtk3 = false;
m_realTimeConnectivity = true;
loadFromConfigFile(); loadFromConfigFile();
} }

View File

@ -26,6 +26,7 @@
#include <unordered_map> #include <unordered_map>
#include <profile.h> #include <profile.h>
#include <advanced_config.h>
#include <common.h> #include <common.h>
#include <erc.h> #include <erc.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
@ -345,6 +346,9 @@ void CONNECTION_SUBGRAPH::UpdateItemConnections()
} }
bool CONNECTION_GRAPH::m_allowRealTime = true;
void CONNECTION_GRAPH::Reset() void CONNECTION_GRAPH::Reset()
{ {
for( auto subgraph : m_subgraphs ) for( auto subgraph : m_subgraphs )
@ -369,7 +373,8 @@ void CONNECTION_GRAPH::Reset()
void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUnconditional ) void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUnconditional )
{ {
PROF_COUNTER phase1; PROF_COUNTER recalc_time;
PROF_COUNTER update_items;
if( aUnconditional ) if( aUnconditional )
Reset(); Reset();
@ -391,8 +396,8 @@ void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUncondition
updateItemConnectivity( sheet, items ); updateItemConnectivity( sheet, items );
} }
phase1.Stop(); update_items.Stop();
wxLogTrace( "CONN_PROFILE", "UpdateItemConnectivity() %0.4f ms", phase1.msecs() ); wxLogTrace( "CONN_PROFILE", "UpdateItemConnectivity() %0.4f ms", update_items.msecs() );
PROF_COUNTER tde; PROF_COUNTER tde;
@ -403,7 +408,26 @@ void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUncondition
tde.Stop(); tde.Stop();
wxLogTrace( "CONN_PROFILE", "TestDanglingEnds() %0.4f ms", tde.msecs() ); wxLogTrace( "CONN_PROFILE", "TestDanglingEnds() %0.4f ms", tde.msecs() );
PROF_COUNTER build_graph;
buildConnectionGraph(); 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() void CONNECTION_GRAPH::buildConnectionGraph()
{ {
PROF_COUNTER phase2;
// Recache all bus aliases for later use // Recache all bus aliases for later use
SCH_SHEET_LIST all_sheets( g_RootSheet ); SCH_SHEET_LIST all_sheets( g_RootSheet );
@ -1293,9 +1315,6 @@ void CONNECTION_GRAPH::buildConnectionGraph()
[&] ( const CONNECTION_SUBGRAPH* sg ) { [&] ( const CONNECTION_SUBGRAPH* sg ) {
return sg->m_absorbed; return sg->m_absorbed;
} ), m_subgraphs.end() ); } ), 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; std::vector<CONNECTION_SUBGRAPH*> children;
auto add_children = [&] ( CONNECTION_SUBGRAPH* aParent ) { 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 = aSubgraph->m_sheet;
SCH_SHEET_PATH path = aParent->m_sheet; path.push_back( pin->GetParent() );
path.push_back( sheet_pin->GetParent() );
for( auto candidate : m_driver_subgraphs ) 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 ) for( SCH_HIERLABEL* label : candidate->m_hier_ports )
{ {
if( label->GetShownText() == pin_name ) if( label->GetShownText() == pin->GetShownText() )
{ {
wxLogTrace( "CONN", "Found child %lu (%s)", wxLogTrace( "CONN", "Found child %lu (%s)",
candidate->m_code, candidate->m_driver_connection->Name() ); candidate->m_code, candidate->m_driver_connection->Name() );

View File

@ -209,6 +209,9 @@ public:
*/ */
int RunERC( const ERC_SETTINGS& aSettings, bool aCreateMarkers = true ); 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 // TODO(JE) firm up API and move to private
std::map<int, std::vector<CONNECTION_SUBGRAPH*> > m_net_code_to_subgraphs_map; std::map<int, std::vector<CONNECTION_SUBGRAPH*> > m_net_code_to_subgraphs_map;

View File

@ -36,6 +36,7 @@
#include <advanced_config.h> #include <advanced_config.h>
#include <class_library.h> #include <class_library.h>
#include <connection_graph.h>
#include <general.h> #include <general.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <netlist_object.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 ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
// TODO(JE) remove once real-time is enabled // 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(); frame->RecalculateConnections();

View File

@ -286,7 +286,7 @@ wxString SCH_CONNECTION::Name( bool aIgnoreSheet ) const
void SCH_CONNECTION::AppendInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) 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; return;
wxString msg, group_name; 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 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; return;
// These messages are not flagged as translatable, because they are only debug messges // 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(); m_foundItems.SetForceSearch();
if( ADVANCED_CFG::GetCfg().m_realTimeConnectivity && CONNECTION_GRAPH::m_allowRealTime )
if( ADVANCED_CFG::GetCfg().m_realTimeConnectivity )
RecalculateConnections( false ); RecalculateConnections( false );
m_canvas->Refresh(); m_canvas->Refresh();

View File

@ -29,6 +29,7 @@
#include <sch_component.h> #include <sch_component.h>
#include <sch_sheet.h> #include <sch_sheet.h>
#include <sch_bitmap.h> #include <sch_bitmap.h>
#include <connection_graph.h>
#include <erc.h> #include <erc.h>
#include <eeschema_id.h> #include <eeschema_id.h>
#include <netlist_object.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 ) int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
{ {
// TODO(JE) remove once real-time connectivity is a given // 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(); m_frame->RecalculateConnections();
Activate(); Activate();