Implement Min Power mode
This commit is contained in:
parent
91b0c25dd6
commit
b3ee13074c
|
@ -70,8 +70,6 @@ LedTaskData *ledTaskData=nullptr;
|
||||||
|
|
||||||
void hardwareInit()
|
void hardwareInit()
|
||||||
{
|
{
|
||||||
// Init power rail 5.0V
|
|
||||||
setPortPin(OBP_POWER_50, true);
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
// Init PCF8574 digital outputs
|
// Init PCF8574 digital outputs
|
||||||
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz
|
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
#define TONE3 3500 // 3500Hz
|
#define TONE3 3500 // 3500Hz
|
||||||
#define TONE4 4000 // 4000Hz
|
#define TONE4 4000 // 4000Hz
|
||||||
// Analog Input
|
// 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 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)
|
#define POWER_FAIL_TIME 2 // in [ms] Accept min voltage until 2 x 1ms (for under voltage gaps by engine start)
|
||||||
// Touch buttons
|
// Touch buttons
|
||||||
|
|
|
@ -45,6 +45,16 @@ void OBP60Init(GwApi *api){
|
||||||
// Init hardware
|
// Init hardware
|
||||||
hardwareInit();
|
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
|
// Settings for e-paper display
|
||||||
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"Fast Refresh Mode is: %s", fastrefresh.c_str());
|
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 pixelcolor = GxEPD_BLACK;
|
||||||
int bgcolor = GxEPD_WHITE;
|
int bgcolor = GxEPD_WHITE;
|
||||||
|
|
||||||
getdisplay().init(115200); // Init for nolrmal displays
|
#ifdef DISPLAY_GDEY042T81
|
||||||
// getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
|
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)
|
getdisplay().setRotation(0); // Set display orientation (horizontal)
|
||||||
if(displaycolor == "Normal"){
|
if(displaycolor == "Normal"){
|
||||||
textcolor = GxEPD_BLACK;
|
textcolor = GxEPD_BLACK;
|
||||||
|
|
|
@ -42,6 +42,8 @@ build_flags=
|
||||||
-D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC)
|
-D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC)
|
||||||
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
|
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
|
||||||
-D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3
|
-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_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_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
|
# -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm
|
||||||
|
|
Loading…
Reference in New Issue