File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -14,15 +14,16 @@ void setup(){
1414 M5.Power .begin ();
1515
1616 // Lcd display
17- M5.Lcd .println (" This is software power off demo" );
18- M5.Lcd .println (" Press the button A to power off." );
17+ M5.Lcd .setTextSize (2 );
18+ M5.Lcd .println (" Software Power-OFF Demo" );
19+ M5.Lcd .println (" Press Button A ..." );
1920}
2021
2122// the loop routine runs over and over again forever
2223void loop () {
2324
2425 if (M5.BtnA .wasPressed ()) {
25- M5.powerOFF ();
26+ M5.Power . powerOFF ();
2627 }
2728
2829 M5.update ();
Original file line number Diff line number Diff line change @@ -392,9 +392,12 @@ void POWER::powerOFF(){
392392 M5.I2C .writeByte (IP5306_ADDR, IP5306_REG_SYS_CTL1, (data & (~BOOST_ENABLE_BIT)));
393393 }
394394
395- // stop wifi
396- esp_wifi_disconnect ();
397- esp_wifi_stop ();
395+ // if wifi was initialized, stop it
396+ wifi_mode_t mode;
397+ if (esp_wifi_get_mode (&mode) == ESP_OK) {
398+ esp_wifi_disconnect ();
399+ esp_wifi_stop ();
400+ }
398401
399402 // stop bt
400403 esp_bluedroid_disable ();
You can’t perform that action at this time.
0 commit comments