Skip to content

Commit 51a2e5e

Browse files
committed
disabled music player for STICK_C_PLUS, fixed power off command on non-cardputer targets (#64)
1 parent 00ca86e commit 51a2e5e

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/core/serialcmds.cpp

+17-7
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
#include "cJSON.h"
88
#include <inttypes.h> // for PRIu64
99

10-
#include <ESP8266Audio.h>
11-
#include <ESP8266SAM.h>
10+
#ifndef STICK_C_PLUS
11+
#include <ESP8266Audio.h>
12+
#include <ESP8266SAM.h>
13+
#endif
14+
1215
#include "sd_functions.h"
1316
#include "settings.h"
1417
#include "display.h"
@@ -199,6 +202,7 @@ void handleSerialCommands() {
199202
}
200203
} // endof rf
201204

205+
#ifndef STICK_C_PLUS
202206
if(cmd_str.startsWith("music_player " ) || cmd_str.startsWith("tts" ) || cmd_str.startsWith("say" ) ) {
203207
// TODO: move in audio.cpp module
204208
AudioOutputI2S *audioout = new AudioOutputI2S(); // https://github.com/earlephilhower/ESP8266Audio/blob/master/src/AudioOutputI2S.cpp#L32
@@ -286,6 +290,7 @@ void handleSerialCommands() {
286290
return;
287291
}
288292
} // end of music_player
293+
#endif
289294

290295
// WIP: record | mic
291296
// https://github.com/earlephilhower/ESP8266Audio/issues/70
@@ -323,20 +328,25 @@ void handleSerialCommands() {
323328
return;
324329
}
325330

326-
// power cmds: off, reboot
331+
// power cmds: off, reboot, sleep
327332
if(cmd_str == "power off" ) {
328333
// closest thing https://github.com/esp8266/Arduino/issues/929
329-
//ESP.deepSleep(0);
330-
esp_deep_sleep_start(); // only wake up via hardware reset
334+
#if defined(STICK_C_PLUS)
335+
axp192.PowerOff();
336+
#elif defined(STICK_C_PLUS2)
337+
digitalWrite(4,LOW);
338+
#else
339+
//ESP.deepSleep(0);
340+
esp_deep_sleep_start(); // only wake up via hardware reset
341+
#endif
331342
return;
332343
}
333344
if(cmd_str == "power reboot" ) {
334345
ESP.restart();
335346
return;
336347
}
337348
if(cmd_str == "power sleep" ) {
338-
// cmd not supported on flipper0
339-
// TODO: proper sleep mode with esp_deep_sleep_start();
349+
// NOTE: cmd not supported on flipper0
340350
setSleepMode();
341351
//turnOffDisplay();
342352
//esp_timer_stop(screensaver_timer);

0 commit comments

Comments
 (0)