@@ -33,7 +33,8 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
3333{
3434 auto lock = MyConfig.Lock ();
3535 std::string error, warn;
36- bool init, ext12v, modem, server_v2, server_v3;
36+ std::string init;
37+ bool ext12v, modem, server_v2, server_v3;
3738 #ifdef CONFIG_OVMS_SC_JAVASCRIPT_DUKTAPE
3839 bool scripting;
3940 #endif
@@ -46,7 +47,7 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
4647
4748 if (c.method == " POST" ) {
4849 // process form submission:
49- init = ( c.getvar (" init" ) == " yes " );
50+ init = c.getvar (" init" );
5051 dbc = (c.getvar (" dbc" ) == " yes" );
5152 ext12v = (c.getvar (" ext12v" ) == " yes" );
5253 #ifdef CONFIG_OVMS_COMP_MAX7317
@@ -96,7 +97,7 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
9697
9798 if (error == " " ) {
9899 // success:
99- MyConfig.SetParamValueBool (" auto" , " init" , init);
100+ MyConfig.SetParamValue (" auto" , " init" , init);
100101 MyConfig.SetParamValueBool (" auto" , " dbc" , dbc);
101102 MyConfig.SetParamValueBool (" auto" , " ext12v" , ext12v);
102103 #ifdef CONFIG_OVMS_COMP_MAX7317
@@ -136,7 +137,7 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
136137 }
137138 else {
138139 // read configuration:
139- init = MyConfig.GetParamValueBool (" auto" , " init" , true );
140+ init = MyConfig.GetParamValue (" auto" , " init" , " yes " );
140141 dbc = MyConfig.GetParamValueBool (" auto" , " dbc" , false );
141142 ext12v = MyConfig.GetParamValueBool (" auto" , " ext12v" , false );
142143 #ifdef CONFIG_OVMS_COMP_MAX7317
@@ -164,27 +165,16 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
164165 c.panel_start (" primary" , " Auto start configuration" );
165166 c.form_start (p.uri );
166167
167- c.input_checkbox (" Enable auto start" , " init" , init,
168- " <p>Note: if a crash occurs within 10 seconds after powering the module, autostart will be temporarily"
169- " disabled. You may need to use the USB shell to access the module and fix the config.</p>" );
170-
171- #ifdef CONFIG_OVMS_SC_JAVASCRIPT_DUKTAPE
172- c.input_checkbox (" Enable Javascript engine (Duktape)" , " scripting" , scripting,
173- " <p>Enable execution of Javascript on the module (plugins, commands, event handlers).</p>" );
174- #endif
175-
176- c.input_checkbox (" Autoload DBC files" , " dbc" , dbc,
177- " <p>Enable to autoload DBC files (for reverse engineering).</p>" );
178-
179- #ifdef CONFIG_OVMS_COMP_MAX7317
180- c.input_checkbox (" Start EGPIO monitor" , " egpio" , egpio,
181- " <p>Enable to monitor EGPIO input ports and generate metrics and events from changes.</p>" );
182- c.input_text (" EGPIO ports" , " egpio_ports" , egpio_ports.c_str (), " Ports to monitor" ,
183- " <p>Enter list of port numbers (0…9) to monitor, separated by spaces.</p>" );
184- #endif // CONFIG_OVMS_COMP_MAX7317
168+ c.input_select_start (" Auto init level" , " init" );
169+ c.input_select_option (" Full (as configured below)" , " yes" , (init == " yes" ));
170+ c.input_select_option (" Minimal (just basic networking as configured)" , " minimal" , (init == " minimal" ));
171+ c.input_select_option (" Disabled (only USB access)" , " no" , (init == " no" ));
172+ c.input_select_end (
173+ " <p>Note: on successive early crashes after powering on, the level will be reduced to 'minimal',"
174+ " then 'disabled'. You may need to use the USB shell to access the module and fix the config.</p>" );
185175
186- c. input_checkbox ( " Power on external 12V " , " ext12v " , ext12v,
187- " <p>Enable to provide 12V to external devices connected to the module (i.e. ECU displays).</p> " );
176+ // Networking:
177+ c. fieldset_start ( " Networking " );
188178
189179 c.input_select_start (" Wifi mode" , " wifi_mode" );
190180 c.input_select_option (" Access point" , " ap" , (wifi_mode == " ap" ));
@@ -208,8 +198,14 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
208198 c.input_select_option (kv.first .c_str (), kv.first .c_str (), (kv.first == wifi_ssid_client));
209199 c.input_select_end ();
210200
201+ c.print (" <hr>" );
211202 c.input_checkbox (" Start modem" , " modem" , modem);
212203
204+ c.fieldset_end ();
205+
206+ // Vehicle:
207+ c.fieldset_start (" Vehicle" );
208+
213209 c.input_select_start (" Vehicle type" , " vehicle_type" );
214210 c.input_select_option (" —" , " " , vehicle_type.empty ());
215211 // sort vehicle options by name:
@@ -220,6 +216,38 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
220216 c.input_select_option (entry.first , entry.second , (vehicle_type == entry.second ));
221217 c.input_select_end ();
222218
219+ c.input_checkbox (" Autoload DBC files" , " dbc" , dbc,
220+ " <p>Enable to autoload DBC files (for reverse engineering).</p>" );
221+
222+ c.fieldset_end ();
223+
224+ #ifdef CONFIG_OVMS_SC_JAVASCRIPT_DUKTAPE
225+ // Scripting:
226+ c.fieldset_start (" Scripting" );
227+ c.input_checkbox (" Enable Javascript engine (Duktape)" , " scripting" , scripting,
228+ " <p>Enable execution of Javascript on the module (plugins, commands, event handlers).</p>" );
229+ c.fieldset_end ();
230+ #endif
231+
232+ // Connections:
233+ c.fieldset_start (" Connections" );
234+ c.input_checkbox (" Start server V2" , " server_v2" , server_v2);
235+ c.input_checkbox (" Start server V3" , " server_v3" , server_v3);
236+ c.fieldset_end ();
237+
238+ // Peripherals:
239+ c.fieldset_start (" Peripherals" );
240+
241+ #ifdef CONFIG_OVMS_COMP_MAX7317
242+ c.input_checkbox (" Start EGPIO monitor" , " egpio" , egpio,
243+ " <p>Enable to monitor EGPIO input ports and generate metrics and events from changes.</p>" );
244+ c.input_text (" EGPIO ports" , " egpio_ports" , egpio_ports.c_str (), " Ports to monitor" ,
245+ " <p>Enter list of port numbers (0…9) to monitor, separated by spaces.</p>" );
246+ #endif // CONFIG_OVMS_COMP_MAX7317
247+
248+ c.input_checkbox (" Power on external 12V" , " ext12v" , ext12v,
249+ " <p>Enable to provide 12V to external devices connected to the module (i.e. ECU displays).</p>" );
250+
223251 c.input_select_start (" Start OBD2ECU" , " obd2ecu" );
224252 c.input_select_option (" —" , " " , obd2ecu.empty ());
225253 c.input_select_option (" can1" , " can1" , obd2ecu == " can1" );
@@ -229,10 +257,10 @@ void OvmsWebServer::HandleCfgAutoInit(PageEntry_t& p, PageContext_t& c)
229257 c.input_select_end (
230258 " <p>OBD2ECU translates OVMS to OBD2 metrics, i.e. to drive standard ECU displays</p>" );
231259
232- c.input_checkbox (" Start server V2" , " server_v2" , server_v2);
233- c.input_checkbox (" Start server V3" , " server_v3" , server_v3);
260+ c.fieldset_end ();
234261
235262 c.print (
263+ " <hr>"
236264 " <div class=\" form-group\" >"
237265 " <div class=\" col-sm-offset-3 col-sm-9\" >"
238266 " <button type=\" submit\" class=\" btn btn-default\" name=\" action\" value=\" save\" >Save</button> "
0 commit comments