diff --git a/eeschema/dialogs/dialog_export_netlist.cpp b/eeschema/dialogs/dialog_export_netlist.cpp index cd8d11678a..9ee1a98f9c 100644 --- a/eeschema/dialogs/dialog_export_netlist.cpp +++ b/eeschema/dialogs/dialog_export_netlist.cpp @@ -110,6 +110,7 @@ public: wxCheckBox* m_SaveAllVoltages; wxCheckBox* m_SaveAllCurrents; wxCheckBox* m_SaveAllDissipations; + wxCheckBox* m_SaveAllEvents; wxCheckBox* m_RunExternalSpiceCommand; wxTextCtrl* m_CommandStringCtrl; wxTextCtrl* m_TitleStringCtrl; @@ -208,6 +209,7 @@ enum id_netlist { ID_SAVE_ALL_VOLTAGES, ID_SAVE_ALL_CURRENTS, ID_SAVE_ALL_DISSIPATIONS, + ID_SAVE_ALL_EVENTS, ID_RUN_SIMULATOR }; @@ -224,6 +226,7 @@ EXPORT_NETLIST_PAGE::EXPORT_NETLIST_PAGE( wxNotebook* aParent, const wxString& a m_SaveAllVoltages = nullptr; m_SaveAllCurrents = nullptr; m_SaveAllDissipations = nullptr; + m_SaveAllEvents = nullptr; m_RunExternalSpiceCommand = nullptr; m_custom = aCustom; @@ -341,6 +344,12 @@ void DIALOG_EXPORT_NETLIST::InstallPageSpice() page->m_SaveAllDissipations->SetValue( settings.m_SpiceSaveAllDissipations ); page->m_LeftBoxSizer->Add( page->m_SaveAllDissipations, 0, wxBOTTOM | wxRIGHT, 5 ); + page->m_SaveAllEvents = new wxCheckBox( page, ID_SAVE_ALL_EVENTS, + _( "Save all digital event data" ) ); + page->m_SaveAllEvents->SetToolTip( _( "If not set, write a directive to prevent the saving of digital event data (esave none)" ) ); + page->m_SaveAllEvents->SetValue( settings.m_SpiceSaveAllEvents ); + page->m_LeftBoxSizer->Add( page->m_SaveAllEvents, 0, wxBOTTOM | wxRIGHT, 5 ); + page->m_RunExternalSpiceCommand = new wxCheckBox( page, ID_RUN_SIMULATOR, _( "Run external simulator command:" ) ); @@ -448,6 +457,7 @@ bool DIALOG_EXPORT_NETLIST::NetlistUpdateOpt() bool saveAllVoltages = m_PanelNetType[ PANELSPICE ]->m_SaveAllVoltages->IsChecked(); bool saveAllCurrents = m_PanelNetType[ PANELSPICE ]->m_SaveAllCurrents->IsChecked(); bool saveAllDissipations = m_PanelNetType[ PANELSPICE ]->m_SaveAllDissipations->IsChecked(); + bool saveAllEvents = m_PanelNetType[ PANELSPICE ]->m_SaveAllEvents->IsChecked(); wxString spiceCmdString = m_PanelNetType[ PANELSPICE ]->m_CommandStringCtrl->GetValue(); bool curSheetAsRoot = m_PanelNetType[ PANELSPICE ]->m_CurSheetAsRoot->GetValue(); bool spiceModelCurSheetAsRoot = m_PanelNetType[ PANELSPICEMODEL ]->m_CurSheetAsRoot->GetValue(); @@ -458,6 +468,7 @@ bool DIALOG_EXPORT_NETLIST::NetlistUpdateOpt() changed |= ( settings.m_SpiceSaveAllVoltages != saveAllVoltages ); changed |= ( settings.m_SpiceSaveAllCurrents != saveAllCurrents ); changed |= ( settings.m_SpiceSaveAllDissipations != saveAllDissipations ); + changed |= ( settings.m_SpiceSaveAllEvents != saveAllEvents ); changed |= ( settings.m_SpiceCommandString != spiceCmdString ); changed |= ( settings.m_SpiceCurSheetAsRoot != curSheetAsRoot ); changed |= ( settings.m_SpiceModelCurSheetAsRoot != spiceModelCurSheetAsRoot ); @@ -466,6 +477,7 @@ bool DIALOG_EXPORT_NETLIST::NetlistUpdateOpt() settings.m_SpiceSaveAllVoltages = saveAllVoltages; settings.m_SpiceSaveAllCurrents = saveAllCurrents; settings.m_SpiceSaveAllDissipations = saveAllDissipations; + settings.m_SpiceSaveAllEvents = saveAllEvents; settings.m_SpiceCommandString = spiceCmdString; settings.m_SpiceCurSheetAsRoot = curSheetAsRoot; settings.m_SpiceModelCurSheetAsRoot = spiceModelCurSheetAsRoot; @@ -511,6 +523,9 @@ bool DIALOG_EXPORT_NETLIST::TransferDataFromWindow() if( currPage->m_SaveAllDissipations->GetValue() ) netlist_opt |= NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS; + if( currPage->m_SaveAllEvents->GetValue() ) + netlist_opt |= NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS; + if( currPage->m_CurSheetAsRoot->GetValue() ) netlist_opt |= NETLIST_EXPORTER_SPICE::OPTION_CUR_SHEET_AS_ROOT; diff --git a/eeschema/dialogs/dialog_sim_command.cpp b/eeschema/dialogs/dialog_sim_command.cpp index 299d5fa182..164a79d22f 100644 --- a/eeschema/dialogs/dialog_sim_command.cpp +++ b/eeschema/dialogs/dialog_sim_command.cpp @@ -517,6 +517,9 @@ void DIALOG_SIM_COMMAND::ApplySettings( SIM_TAB* aTab ) if( !m_saveAllDissipations->GetValue() ) options &= ~NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS; + if( !m_saveAllEvents->GetValue() ) + options &= ~NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS; + aTab->SetSimOptions( options ); m_simulatorFrame->ReloadSimulator( m_simCommand, options ); diff --git a/eeschema/dialogs/dialog_sim_command.h b/eeschema/dialogs/dialog_sim_command.h index 3456c527ae..b5ac00ed32 100644 --- a/eeschema/dialogs/dialog_sim_command.h +++ b/eeschema/dialogs/dialog_sim_command.h @@ -64,6 +64,7 @@ public: m_saveAllVoltages->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_VOLTAGES ); m_saveAllCurrents->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_CURRENTS ); m_saveAllDissipations->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS ); + m_saveAllEvents->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS ); } void SetPlotSettings( const SIM_TAB* aSimTab ); diff --git a/eeschema/dialogs/dialog_sim_command_base.cpp b/eeschema/dialogs/dialog_sim_command_base.cpp index 82b04a7270..f80fb21caf 100644 --- a/eeschema/dialogs/dialog_sim_command_base.cpp +++ b/eeschema/dialogs/dialog_sim_command_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -653,6 +653,9 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i m_saveAllDissipations = new wxCheckBox( m_panelCommand, wxID_ANY, _("Save all power dissipations"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer88->Add( m_saveAllDissipations, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + m_saveAllEvents = new wxCheckBox( m_panelCommand, wxID_ANY, _("Save all digital event data"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer88->Add( m_saveAllEvents, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_compatibilityModeSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticText* compatibilityLabel; diff --git a/eeschema/dialogs/dialog_sim_command_base.fbp b/eeschema/dialogs/dialog_sim_command_base.fbp index c06bebe80d..1de6f4f267 100644 --- a/eeschema/dialogs/dialog_sim_command_base.fbp +++ b/eeschema/dialogs/dialog_sim_command_base.fbp @@ -7590,6 +7590,71 @@ + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Save all digital event data + + 0 + + + 0 + + 1 + m_saveAllEvents + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxEXPAND|wxTOP|wxBOTTOM diff --git a/eeschema/dialogs/dialog_sim_command_base.h b/eeschema/dialogs/dialog_sim_command_base.h index 22576edb58..b5c25da783 100644 --- a/eeschema/dialogs/dialog_sim_command_base.h +++ b/eeschema/dialogs/dialog_sim_command_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -159,6 +159,7 @@ class DIALOG_SIM_COMMAND_BASE : public DIALOG_SHIM wxCheckBox* m_saveAllVoltages; wxCheckBox* m_saveAllCurrents; wxCheckBox* m_saveAllDissipations; + wxCheckBox* m_saveAllEvents; wxBoxSizer* m_compatibilityModeSizer; wxChoice* m_compatibilityMode; wxPanel* m_panelPlotSetup; diff --git a/eeschema/netlist_exporters/netlist_exporter_spice.h b/eeschema/netlist_exporters/netlist_exporter_spice.h index 6b19eb88e3..36f20f801b 100644 --- a/eeschema/netlist_exporters/netlist_exporter_spice.h +++ b/eeschema/netlist_exporters/netlist_exporter_spice.h @@ -58,11 +58,13 @@ public: OPTION_SAVE_ALL_DISSIPATIONS = 0x0100, OPTION_CUR_SHEET_AS_ROOT = 0x0200, OPTION_SIM_COMMAND = 0x0400, + OPTION_SAVE_ALL_EVENTS = 0x0800, OPTION_DEFAULT_FLAGS = OPTION_ADJUST_INCLUDE_PATHS | OPTION_ADJUST_PASSIVE_VALS | OPTION_SAVE_ALL_VOLTAGES | OPTION_SAVE_ALL_CURRENTS | OPTION_SAVE_ALL_DISSIPATIONS + | OPTION_SAVE_ALL_EVENTS }; NETLIST_EXPORTER_SPICE( SCHEMATIC_IFACE* aSchematic, wxWindow* aDialogParent = nullptr ); diff --git a/eeschema/schematic_settings.cpp b/eeschema/schematic_settings.cpp index 5c6f0b5a9a..309207ea32 100644 --- a/eeschema/schematic_settings.cpp +++ b/eeschema/schematic_settings.cpp @@ -62,6 +62,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_SpiceSaveAllVoltages( false ), m_SpiceSaveAllCurrents( false ), m_SpiceSaveAllDissipations( false ), + m_SpiceSaveAllEvents( true ), m_SpiceModelCurSheetAsRoot( true ), m_NgspiceSettings( nullptr ) { @@ -230,6 +231,9 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_params.emplace_back( new PARAM( "spice_save_all_dissipations", &m_SpiceSaveAllDissipations, false ) ); + m_params.emplace_back( new PARAM( "space_save_all_events", + &m_SpiceSaveAllEvents, true ) ); + m_params.emplace_back( new PARAM( "spice_model_current_sheet_as_root", &m_SpiceModelCurSheetAsRoot, true ) ); diff --git a/eeschema/schematic_settings.h b/eeschema/schematic_settings.h index 30c65b1bd3..13ca698eda 100644 --- a/eeschema/schematic_settings.h +++ b/eeschema/schematic_settings.h @@ -95,6 +95,7 @@ public: bool m_SpiceSaveAllVoltages; bool m_SpiceSaveAllCurrents; bool m_SpiceSaveAllDissipations; + bool m_SpiceSaveAllEvents; wxString m_SpiceCommandString; // A command string to run external spice bool m_SpiceModelCurSheetAsRoot; diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 26d9ebb262..18e7c2e397 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -287,6 +287,13 @@ bool NGSPICE::Attach( const std::shared_ptr& aModel, const wxS SIMULATOR::Attach( aModel, aSimCommand, aSimOptions, aInputPath, aReporter ); updateNgspiceSettings(); LoadNetlist( formatter.GetString() ); + + if( !( aSimOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS ) ) + { + Command( "echo Command: esave none" ); + Command( "esave none" ); + } + return true; } else diff --git a/eeschema/sim/simulator_frame_ui.cpp b/eeschema/sim/simulator_frame_ui.cpp index 9fe39c4345..3af0454ecc 100644 --- a/eeschema/sim/simulator_frame_ui.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -1969,7 +1969,8 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath ) for( const nlohmann::json& tab_js : js[ "tabs" ] ) { wxString simCommand; - int simOptions = NETLIST_EXPORTER_SPICE::OPTION_ADJUST_PASSIVE_VALS; + int simOptions = NETLIST_EXPORTER_SPICE::OPTION_ADJUST_PASSIVE_VALS + | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS; for( const nlohmann::json& cmd : tab_js[ "commands" ] ) { @@ -1981,6 +1982,8 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath ) simOptions |= NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_CURRENTS; else if( cmd == ".probe allp" ) simOptions |= NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS; + else if( cmd == ".kicad esavenone" ) + simOptions &= ~NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS; else simCommand += wxString( cmd.get() ).Trim(); } @@ -2169,6 +2172,9 @@ bool SIMULATOR_FRAME_UI::SaveWorkbook( const wxString& aPath ) if( options & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS ) commands_js.push_back( ".probe allp" ); + if( !( options & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS ) ) + commands_js.push_back( ".kicad esavenone" ); + nlohmann::json tab_js = nlohmann::json( { { "analysis", SPICE_SIMULATOR::TypeToName( simType, true ) }, { "commands", commands_js } } ); diff --git a/qa/tests/eeschema/test_netlist_exporter_spice.h b/qa/tests/eeschema/test_netlist_exporter_spice.h index 40c79e3667..afc58c28d4 100644 --- a/qa/tests/eeschema/test_netlist_exporter_spice.h +++ b/qa/tests/eeschema/test_netlist_exporter_spice.h @@ -273,6 +273,7 @@ public: return NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_VOLTAGES | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_CURRENTS | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS + | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS | NETLIST_EXPORTER_SPICE::OPTION_ADJUST_INCLUDE_PATHS | NETLIST_EXPORTER_SPICE::OPTION_SIM_COMMAND; } diff --git a/qa/tests/spice/test_netlist_exporter_spice.h b/qa/tests/spice/test_netlist_exporter_spice.h index 5db8dd533b..d4b9809ddd 100644 --- a/qa/tests/spice/test_netlist_exporter_spice.h +++ b/qa/tests/spice/test_netlist_exporter_spice.h @@ -286,6 +286,7 @@ public: return NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_VOLTAGES | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_CURRENTS | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS + | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS | NETLIST_EXPORTER_SPICE::OPTION_ADJUST_INCLUDE_PATHS | NETLIST_EXPORTER_SPICE::OPTION_SIM_COMMAND; } diff --git a/qa/tests/spice/test_sim_regressions.cpp b/qa/tests/spice/test_sim_regressions.cpp index f6646c93c7..c5ce65afdf 100644 --- a/qa/tests/spice/test_sim_regressions.cpp +++ b/qa/tests/spice/test_sim_regressions.cpp @@ -65,6 +65,7 @@ public: unsigned GetNetlistOptions() override { unsigned options = NETLIST_EXPORTER_SPICE::OPTION_ADJUST_INCLUDE_PATHS + | NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS | NETLIST_EXPORTER_SPICE::OPTION_SIM_COMMAND; if( m_SaveCurrents )