Implement Min Power mode

This commit is contained in:
norbert-walter 2024-09-27 15:32:28 +02:00
parent 91b0c25dd6
commit b3ee13074c
4 changed files with 19 additions and 5 deletions

View File

@ -70,8 +70,6 @@ LedTaskData *ledTaskData=nullptr;
void hardwareInit()
{
// Init power rail 5.0V
setPortPin(OBP_POWER_50, true);
Wire.begin();
// Init PCF8574 digital outputs
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz

View File

@ -57,7 +57,7 @@
#define TONE3 3500 // 3500Hz
#define TONE4 4000 // 4000Hz
// Analog Input
#define OBP_ANALOG0 4 // Voltage power supplay
#define OBP_ANALOG0 4 // Analog input for voltage power supplay
#define MIN_VOLTAGE 10.0 // Min voltage for under voltage detection (then goto deep sleep)
#define POWER_FAIL_TIME 2 // in [ms] Accept min voltage until 2 x 1ms (for under voltage gaps by engine start)
// Touch buttons

View File

@ -45,6 +45,16 @@ void OBP60Init(GwApi *api){
// Init hardware
hardwareInit();
// Init power rail 5.0V
String powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();
api->getLogger()->logDebug(GwLog::DEBUG,"Power Mode is: %s", powermode.c_str());
if(powermode == "Max Power" || powermode == "Only 5.0V"){
setPortPin(OBP_POWER_50, true); // Power on 5.0V rail
}
else{
setPortPin(OBP_POWER_50, false); // Power off 5.0V rail
}
// Settings for e-paper display
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
api->getLogger()->logDebug(GwLog::DEBUG,"Fast Refresh Mode is: %s", fastrefresh.c_str());
@ -312,8 +322,12 @@ void OBP60Task(GwApi *api){
int pixelcolor = GxEPD_BLACK;
int bgcolor = GxEPD_WHITE;
getdisplay().init(115200); // Init for nolrmal displays
// getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#ifdef DISPLAY_GDEY042T81
getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
getdisplay().init(115200); // Init for normal displays
#endif
getdisplay().setRotation(0); // Set display orientation (horizontal)
if(displaycolor == "Normal"){
textcolor = GxEPD_BLACK;

View File

@ -42,6 +42,8 @@ build_flags=
-D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC)
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
-D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3
# -D HARDWARE_V20 #Hardware revision V2.0
-D HARDWARE_V21 #Hardware revision V2.1
# -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm
-D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm
# -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm