m5stack / M5StickC

M5StickC Arduino Library
MIT License
477 stars 222 forks source link

M5.Lcd.sleep() compile error #73

Closed takanotume24 closed 4 years ago

takanotume24 commented 4 years ago

I tried the following code but got a compile error. I want to turn off the LCD during Deep Sleep. Is there an alternative?

#include <Arduino.h>
#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.sleep();
}

void loop() {}

This is the build result.

> Executing task in folder m5stickc-problem-lcd-sleep: platformio run <

Processing m5stick-c (board: m5stick-c; framework: arduino; platform: espressif32)
------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/m5stick-c.html
PLATFORM: Espressif 32 1.11.1 > M5Stick-C
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-arduinoespressif32 2.10004.191002 (1.0.4), tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <M5StickC> 0.1.1
|   |-- <Wire> 1.0.1
|   |-- <SPIFFS> 1.0
|   |   |-- <FS> 1.0
|   |-- <SPI> 1.0
|   |-- <FS> 1.0
Building in release mode
Linking .pio/build/m5stick-c/firmware.elf
.pio/build/m5stick-c/src/main.cpp.o:(.literal._Z5setupv+0x4): undefined reference to `M5Display::sleep()'
.pio/build/m5stick-c/src/main.cpp.o: In function `setup()':
/home/takuya/Documents/PlatformIO/Projects/m5stickc-problem-lcd-sleep/src/main.cpp:6: undefined reference to `M5Display::sleep()'
collect2: error: ld returned 1 exit status
*** [.pio/build/m5stick-c/firmware.elf] Error 1
=================== [FAILED] Took 3.23 seconds ===================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.
EeeeBin commented 4 years ago

This API not support in StickC, but now can used this to close tft voltage https://github.com/m5stack/M5StickC/blob/master/examples/Basics/AXP192/AXP192.ino#L35 or try this go to deep sleep https://github.com/m5stack/M5StickC/blob/master/examples/Advanced/AXP192/sleep/sleep.ino