@@ -140,7 +140,7 @@ void handleblinkled() {
140140
141141// callback notifying us of the need to save WifiManager config
142142void saveConfigCallback () {
143- DEBUG_SERIAL .println (" Should save config" );
143+ DEBUG_SERIAL .println (F ( " Should save config" ) );
144144 shouldSaveConfig = true ;
145145}
146146
@@ -279,12 +279,12 @@ void WifiManagerSetup() {
279279 wifiManager.addParameter (¶m_tibber_password_show_password);
280280
281281 if (!wifiManager.autoConnect (" Energy2Shelly" )) {
282- DEBUG_SERIAL .println (" failed to connect and hit timeout" );
282+ DEBUG_SERIAL .println (F ( " failed to connect and hit timeout" ) );
283283 delay (3000 );
284284 ESP .restart ();
285285 delay (5000 );
286286 }
287- DEBUG_SERIAL .println (" connected" );
287+ DEBUG_SERIAL .println (F ( " connected" ) );
288288
289289 // read updated parameters
290290 strcpy (reset_password, param_reset_password.getValue ());
@@ -319,55 +319,80 @@ void WifiManagerSetup() {
319319
320320 offsetPerPhase = String (power_offset).toDouble () / 3.0 ; // distribute offset equally across phases
321321
322- DEBUG_SERIAL .println (" The values in the preferences are: " );
323- DEBUG_SERIAL .println (" \t reset_password: ********" );
324- DEBUG_SERIAL .println (" \t input_type : " + String (input_type));
325- DEBUG_SERIAL .println (" \t mqtt_server : " + String (mqtt_server));
326- DEBUG_SERIAL .println (" \t mqtt_port : " + String (mqtt_port));
327- DEBUG_SERIAL .println (" \t ntp_server: " + String (ntp_server));
328- DEBUG_SERIAL .println (" \t timezone: " + String (timezone));
329- DEBUG_SERIAL .println (" \t phase_number : " + String (phase_number));
330- DEBUG_SERIAL .println (" \t power_offset : " + String (power_offset));
331- DEBUG_SERIAL .println (" \t query_period : " + String (query_period));
332- DEBUG_SERIAL .println (" \t led_gpio : " + String (led_gpio));
333- DEBUG_SERIAL .println (" \t led_gpio_i : " + String (led_gpio_i));
334- DEBUG_SERIAL .println (" \t shelly_mac : " + String (shelly_mac));
335- DEBUG_SERIAL .println (" \t mqtt_topic : " + String (mqtt_topic));
336- DEBUG_SERIAL .println (" \t mqtt_user : " + String (mqtt_user));
337- DEBUG_SERIAL .println (" \t mqtt_passwd : ********" );
338- DEBUG_SERIAL .println (" \t modbus_dev : " + String (modbus_dev));
339- DEBUG_SERIAL .println (" \t power_path : " + String (power_path));
340- DEBUG_SERIAL .println (" \t pwr_export_path : " + String (pwr_export_path));
341- DEBUG_SERIAL .println (" \t power_l1_path : " + String (power_l1_path));
342- DEBUG_SERIAL .println (" \t power_l2_path : " + String (power_l2_path));
343- DEBUG_SERIAL .println (" \t power_l3_path : " + String (power_l3_path));
344- DEBUG_SERIAL .println (" \t energy_in_path : " + String (energy_in_path));
345- DEBUG_SERIAL .println (" \t energy_out_path : " + String (energy_out_path));
346- DEBUG_SERIAL .println (" \t shelly_port : " + String (shelly_port));
347- DEBUG_SERIAL .println (" \t sma_id : " + String (sma_id));
348- DEBUG_SERIAL .println (" \t TibberPulse options:" );
349- DEBUG_SERIAL .println (" \t - tibber_url: " + String (tibber_url));
350- DEBUG_SERIAL .println (" \t - tibber_user: " + String (tibber_user));
351- DEBUG_SERIAL .println (" \t - tibber_password: ********" );
322+ DEBUG_SERIAL .println (F (" The values in the preferences are: " ));
323+ DEBUG_SERIAL .println (F (" \t reset_password: ********" ));
324+ DEBUG_SERIAL .print (F (" \t input_type : " ));
325+ DEBUG_SERIAL .println (String (input_type));
326+ DEBUG_SERIAL .print (F (" \t mqtt_server : " ));
327+ DEBUG_SERIAL .println (String (mqtt_server));
328+ DEBUG_SERIAL .print (F (" \t mqtt_port : " ));
329+ DEBUG_SERIAL .println (String (mqtt_port));
330+ DEBUG_SERIAL .print (F (" \t ntp_server: " ));
331+ DEBUG_SERIAL .println (String (ntp_server));
332+ DEBUG_SERIAL .print (F (" \t timezone: " ));
333+ DEBUG_SERIAL .println (String (timezone));
334+ DEBUG_SERIAL .print (F (" \t phase_number : " ));
335+ DEBUG_SERIAL .println (String (phase_number));
336+ DEBUG_SERIAL .print (F (" \t power_offset : " ));
337+ DEBUG_SERIAL .println (String (power_offset));
338+ DEBUG_SERIAL .print (F (" \t query_period : " ));
339+ DEBUG_SERIAL .println (String (query_period));
340+ DEBUG_SERIAL .print (F (" \t led_gpio : " ));
341+ DEBUG_SERIAL .println (String (led_gpio));
342+ DEBUG_SERIAL .print (F (" \t led_gpio_i : " ));
343+ DEBUG_SERIAL .println (String (led_gpio_i));
344+ DEBUG_SERIAL .print (F (" \t shelly_mac : " ));
345+ DEBUG_SERIAL .println (String (shelly_mac));
346+ DEBUG_SERIAL .print (F (" \t mqtt_topic : " ));
347+ DEBUG_SERIAL .println (String (mqtt_topic));
348+ DEBUG_SERIAL .print (F (" \t mqtt_user : " ));
349+ DEBUG_SERIAL .println (String (mqtt_user));
350+ DEBUG_SERIAL .println (F (" \t mqtt_passwd : ********" ));
351+ DEBUG_SERIAL .print (F (" \t modbus_dev : " ));
352+ DEBUG_SERIAL .println (String (modbus_dev));
353+ DEBUG_SERIAL .print (F (" \t power_path : " ));
354+ DEBUG_SERIAL .println (String (power_path));
355+ DEBUG_SERIAL .print (F (" \t pwr_export_path : " ));
356+ DEBUG_SERIAL .println (String (pwr_export_path));
357+ DEBUG_SERIAL .print (F (" \t power_l1_path : " ));
358+ DEBUG_SERIAL .println (String (power_l1_path));
359+ DEBUG_SERIAL .print (F (" \t power_l2_path : " ));
360+ DEBUG_SERIAL .println (String (power_l2_path));
361+ DEBUG_SERIAL .print (F (" \t power_l3_path : " ));
362+ DEBUG_SERIAL .println (String (power_l3_path));
363+ DEBUG_SERIAL .print (F (" \t energy_in_path : " ));
364+ DEBUG_SERIAL .println (String (energy_in_path));
365+ DEBUG_SERIAL .print (F (" \t energy_out_path : " ));
366+ DEBUG_SERIAL .println (String (energy_out_path));
367+ DEBUG_SERIAL .print (F (" \t shelly_port : " ));
368+ DEBUG_SERIAL .println (String (shelly_port));
369+ DEBUG_SERIAL .print (F (" \t sma_id : " ));
370+ DEBUG_SERIAL .println (String (sma_id));
371+ DEBUG_SERIAL .println (F (" \t TibberPulse options:" ));
372+ DEBUG_SERIAL .print (F (" \t - tibber_url: " ));
373+ DEBUG_SERIAL .println (String (tibber_url));
374+ DEBUG_SERIAL .print (F (" \t - tibber_user: " ));
375+ DEBUG_SERIAL .println (String (tibber_user));
376+ DEBUG_SERIAL .print (F (" \t - tibber_password: ********" ));
352377
353378 if (strcmp (input_type, " SMA" ) == 0 ) {
354379 dataSMA = true ;
355- DEBUG_SERIAL .println (" Enabling SMA Multicast data input" );
380+ DEBUG_SERIAL .println (F ( " Enabling SMA Multicast data input" ) );
356381 } else if (strcmp (input_type, " SHRDZM" ) == 0 ) {
357382 dataSHRDZM = true ;
358- DEBUG_SERIAL .println (" Enabling SHRDZM UDP data input" );
383+ DEBUG_SERIAL .println (F ( " Enabling SHRDZM UDP data input" ) );
359384 } else if (strcmp (input_type, " HTTP" ) == 0 ) {
360385 dataHTTP = true ;
361- DEBUG_SERIAL .println (" Enabling generic HTTP data input" );
386+ DEBUG_SERIAL .println (F ( " Enabling generic HTTP data input" ) );
362387 } else if (strcmp (input_type, " SUNSPEC" ) == 0 ) {
363388 dataSUNSPEC = true ;
364- DEBUG_SERIAL .println (" Enabling SUNSPEC data input" );
389+ DEBUG_SERIAL .println (F ( " Enabling SUNSPEC data input" ) );
365390 } else if (strcmp (input_type, " TIBBERPULSE" ) == 0 ) {
366391 dataTIBBERPULSE = true ;
367- DEBUG_SERIAL .println (" Enabling TIBBERPULSE data input" );
392+ DEBUG_SERIAL .println (F ( " Enabling TIBBERPULSE data input" ) );
368393 } else {
369394 dataMQTT = true ;
370- DEBUG_SERIAL .println (" Enabling MQTT data input" );
395+ DEBUG_SERIAL .println (F ( " Enabling MQTT data input" ) );
371396 }
372397
373398 if (strcmp (led_gpio_i, " true" ) == 0 ) {
@@ -377,7 +402,7 @@ void WifiManagerSetup() {
377402 }
378403
379404 if (shouldSaveConfig) {
380- DEBUG_SERIAL .println (" saving config" );
405+ DEBUG_SERIAL .println (F ( " saving config" ) );
381406 preferences.putString (" reset_password" , reset_password);
382407 preferences.putString (" input_type" , input_type);
383408 preferences.putString (" mqtt_server" , mqtt_server);
@@ -408,7 +433,7 @@ void WifiManagerSetup() {
408433 preferences.putString (" tibber_password" , tibber_password);
409434 wifiManager.reboot ();
410435 }
411- DEBUG_SERIAL .println (" local ip" );
436+ DEBUG_SERIAL .println (F ( " local ip" ) );
412437 DEBUG_SERIAL .println (WiFi.localIP ());
413438}
414439
@@ -417,7 +442,7 @@ void setupMdns() {
417442 strncat (shelly_name, shelly_mac, sizeof (shelly_name) - strlen (shelly_name) - 1 );
418443
419444 if (!MDNS .begin (shelly_name)) {
420- DEBUG_SERIAL .println (" Error setting up MDNS responder!" );
445+ DEBUG_SERIAL .println (F ( " Error setting up MDNS responder!" ) );
421446 }
422447
423448#ifdef ESP32
@@ -451,5 +476,5 @@ void setupMdns() {
451476 MDNS .addServiceTxt (hMDNSService2, " id" , shelly_name);
452477 }
453478#endif
454- DEBUG_SERIAL .println (" mDNS responder started" );
479+ DEBUG_SERIAL .println (F ( " mDNS responder started" ) );
455480}
0 commit comments