@ckuehnel said in M5stack basic core battery power on issue (ip5306 strange power management):
Here is a working code example:
/*
Test of IP5306 functions
*/
#include <M5Stack.h>
void setup()
{
// initialize the M5Stack object
M5.begin();
Wire.begin(); // required to access IP5306
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setCursor(0, 10);
M5.Lcd.setTextColor(WHITE);
M5.Lcd.setTextSize(2);
M5.Lcd.printf("IP5306 Function Test\r\n");
if(!M5.Power.canControl())
{
M5.Lcd.setTextColor(RED);
M5.Lcd.printf("No communication with IP5306 chip");
while(1);
}
}
void loop()
{
M5.Lcd.fillRect(0,180,360,60,0);
uint8_t bat = M5.Power.getBatteryLevel();
M5.Lcd.setCursor(0,180);
if (M5.Power.isCharging()) M5.Lcd.printf("Battery is charging\r\n");
else M5.Lcd.printf("Battery is not charging\r\n");
M5.Lcd.printf("Battery Level %d", bat);
M5.Lcd.progressBar(0, 220, 360, 20, bat);
delay(5000);
}
Hi, doesn't compile for me!!!
this is the arduino IDE output:
Arduino: 1.8.7 (Mac OS X), Board: "M5Stack-Core-ESP32, QIO, 80MHz, Default, 921600, None"
Build options changed, rebuilding all
/Users/AD/Documents/Arduino/libraries/M5Stack/src/utility/Power.cpp: In member function 'void POWER::powerOFF()':
/Users/AD/Documents/Arduino/libraries/M5Stack/src/utility/Power.cpp:361:28: error: 'gpio_deep_sleep_hold_dis' was not declared in this scope
gpio_deep_sleep_hold_dis();
^
Multiple libraries were found for "SPI.h"
Used: /Users/AD/Documents/Arduino/hardware/espressif/esp32/libraries/SPI
Not used: /Users/AD/Documents/Arduino/libraries/SPI
Multiple libraries were found for "SD.h"
Used: /Users/AD/Documents/Arduino/hardware/espressif/esp32/libraries/SD
Not used: /Users/AD/Documents/Arduino/libraries/SD
Not used: /private/var/folders/f3/0kf10ljj6sj4q4twsw_vtxrw0000gn/T/AppTranslocation/395E70C5-F1F6-4076-AA11-9C132A2C6ACF/d/Arduino 1.8.7.app/Contents/Java/libraries/SD
exit status 1
Error compiling for board M5Stack-Core-ESP32.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
tnks