|
7 | 7 | #include "cJSON.h"
|
8 | 8 | #include <inttypes.h> // for PRIu64
|
9 | 9 |
|
10 |
| -#include <ESP8266Audio.h> |
11 |
| -#include <ESP8266SAM.h> |
| 10 | +#ifndef STICK_C_PLUS |
| 11 | + #include <ESP8266Audio.h> |
| 12 | + #include <ESP8266SAM.h> |
| 13 | +#endif |
| 14 | + |
12 | 15 | #include "sd_functions.h"
|
13 | 16 | #include "settings.h"
|
14 | 17 | #include "display.h"
|
@@ -199,6 +202,7 @@ void handleSerialCommands() {
|
199 | 202 | }
|
200 | 203 | } // endof rf
|
201 | 204 |
|
| 205 | + #ifndef STICK_C_PLUS |
202 | 206 | if(cmd_str.startsWith("music_player " ) || cmd_str.startsWith("tts" ) || cmd_str.startsWith("say" ) ) {
|
203 | 207 | // TODO: move in audio.cpp module
|
204 | 208 | AudioOutputI2S *audioout = new AudioOutputI2S(); // https://github.com/earlephilhower/ESP8266Audio/blob/master/src/AudioOutputI2S.cpp#L32
|
@@ -286,6 +290,7 @@ void handleSerialCommands() {
|
286 | 290 | return;
|
287 | 291 | }
|
288 | 292 | } // end of music_player
|
| 293 | + #endif |
289 | 294 |
|
290 | 295 | // WIP: record | mic
|
291 | 296 | // https://github.com/earlephilhower/ESP8266Audio/issues/70
|
@@ -323,20 +328,25 @@ void handleSerialCommands() {
|
323 | 328 | return;
|
324 | 329 | }
|
325 | 330 |
|
326 |
| - // power cmds: off, reboot |
| 331 | + // power cmds: off, reboot, sleep |
327 | 332 | if(cmd_str == "power off" ) {
|
328 | 333 | // 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 |
331 | 342 | return;
|
332 | 343 | }
|
333 | 344 | if(cmd_str == "power reboot" ) {
|
334 | 345 | ESP.restart();
|
335 | 346 | return;
|
336 | 347 | }
|
337 | 348 | 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 |
340 | 350 | setSleepMode();
|
341 | 351 | //turnOffDisplay();
|
342 | 352 | //esp_timer_stop(screensaver_timer);
|
|
0 commit comments