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(){
14
14
M5.Power .begin ();
15
15
16
16
// 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 ..." );
19
20
}
20
21
21
22
// the loop routine runs over and over again forever
22
23
void loop () {
23
24
24
25
if (M5.BtnA .wasPressed ()) {
25
- M5.powerOFF ();
26
+ M5.Power . powerOFF ();
26
27
}
27
28
28
29
M5.update ();
Original file line number Diff line number Diff line change @@ -392,9 +392,12 @@ void POWER::powerOFF(){
392
392
M5.I2C .writeByte (IP5306_ADDR, IP5306_REG_SYS_CTL1, (data & (~BOOST_ENABLE_BIT)));
393
393
}
394
394
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
+ }
398
401
399
402
// stop bt
400
403
esp_bluedroid_disable ();
You can’t perform that action at this time.
0 commit comments