Modify power mode fpr OBP40
This commit is contained in:
parent
fa2cfcccca
commit
535f1cd7c4
|
@ -149,10 +149,10 @@
|
||||||
|
|
||||||
// Flash LED (1x WS2812B)
|
// Flash LED (1x WS2812B)
|
||||||
#define NUM_FLASH_LED 1 // Number of flash LED
|
#define NUM_FLASH_LED 1 // Number of flash LED
|
||||||
#define OBP_FLASH_LED 10 // GPIO port
|
#define OBP_FLASH_LED 41 // GPIO port (power LED)
|
||||||
// Backlight LEDs (6x WS2812B)
|
// Backlight LEDs (6x WS2812B)
|
||||||
#define NUM_BACKLIGHT_LED 6 // Number of Backlight LEDs
|
#define NUM_BACKLIGHT_LED 6 // Number of Backlight LEDs
|
||||||
#define OBP_BACKLIGHT_LED 40 // GPIO port
|
#define OBP_BACKLIGHT_LED 41 // GPIO port (power LED)
|
||||||
// Power Rail
|
// Power Rail
|
||||||
#define OBP_POWER_50 41 // Power LED
|
#define OBP_POWER_50 41 // Power LED
|
||||||
#define OBP_POWER_EPD 7 // ePaper power
|
#define OBP_POWER_EPD 7 // ePaper power
|
||||||
|
|
|
@ -55,12 +55,32 @@ void OBP60Init(GwApi *api){
|
||||||
// Init hardware
|
// Init hardware
|
||||||
hardwareInit(api);
|
hardwareInit(api);
|
||||||
|
|
||||||
#ifdef BOARD_OBP40S3
|
// 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"){
|
||||||
|
#ifdef HARDWARE_V21
|
||||||
|
setPortPin(OBP_POWER_50, true); // Power on 5.0V rail
|
||||||
|
#endif
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
setPortPin(OBP_POWER_EPD, true);// Power on ePaper display
|
||||||
|
setPortPin(OBP_POWER_SD, true); // Power on SD card
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
#ifdef HARDWARE_V21
|
||||||
|
setPortPin(OBP_POWER_50, false); // Power off 5.0V rail
|
||||||
|
#endif
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
setPortPin(OBP_POWER_EPD, false);// Power off ePaper display
|
||||||
|
setPortPin(OBP_POWER_SD, false); // Power off SD card
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
//String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
|
//String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
|
||||||
String sdcard = "on";
|
String sdcard = "on";
|
||||||
if (sdcard == "on") {
|
if (sdcard == "on") {
|
||||||
setPortPin(OBP_POWER_SD, true); // Power on SD
|
|
||||||
delay(10);
|
|
||||||
SPIClass SD_SPI = SPIClass(HSPI);
|
SPIClass SD_SPI = SPIClass(HSPI);
|
||||||
SD_SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI);
|
SD_SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI);
|
||||||
if (SD.begin(SD_SPI_CS, SD_SPI, 80000000)) {
|
if (SD.begin(SD_SPI_CS, SD_SPI, 80000000)) {
|
||||||
|
@ -88,26 +108,6 @@ void OBP60Init(GwApi *api){
|
||||||
rtc_gpio_pulldown_dis(OBP_WAKEWUP_PIN); // Disable pulldown resistor
|
rtc_gpio_pulldown_dis(OBP_WAKEWUP_PIN); // Disable pulldown resistor
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 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"){
|
|
||||||
#ifdef HARDWARE_V21
|
|
||||||
setPortPin(OBP_POWER_50, true); // Power on 5.0V rail
|
|
||||||
#endif
|
|
||||||
#ifdef BOARD_OBP40S3
|
|
||||||
setPortPin(OBP_POWER_EPD, true);// Power on ePaper display
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
#ifdef HARDWARE_V21
|
|
||||||
setPortPin(OBP_POWER_50, false); // Power off 5.0V rail
|
|
||||||
#endif
|
|
||||||
#ifdef BOARD_OBP40S3
|
|
||||||
setPortPin(OBP_POWER_EPD, false);// Power off ePaper display
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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());
|
||||||
|
@ -334,7 +334,8 @@ void deepSleep(CommonData &common){
|
||||||
setFlashLED(false); // Flash LED Off
|
setFlashLED(false); // Flash LED Off
|
||||||
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
||||||
// Shutdown EInk display
|
// Shutdown EInk display
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setFullWindow(); // Set full Refresh
|
||||||
|
//getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
getdisplay().fillScreen(common.bgcolor); // Clear screen
|
getdisplay().fillScreen(common.bgcolor); // Clear screen
|
||||||
getdisplay().setTextColor(common.fgcolor);
|
getdisplay().setTextColor(common.fgcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||||
|
@ -342,10 +343,11 @@ void deepSleep(CommonData &common){
|
||||||
getdisplay().print("Sleep Mode");
|
getdisplay().print("Sleep Mode");
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
getdisplay().setCursor(65, 175);
|
getdisplay().setCursor(65, 175);
|
||||||
getdisplay().print(" For wakeup press wheel and wait 5s");
|
getdisplay().print("For wakeup press wheel and wait 5s");
|
||||||
getdisplay().nextPage(); // Partial update
|
getdisplay().nextPage(); // Partial update
|
||||||
getdisplay().powerOff(); // Display power off
|
getdisplay().powerOff(); // Display power off
|
||||||
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
|
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
|
||||||
|
setPortPin(OBP_POWER_SD, false); // Power off SD card
|
||||||
// Stop system
|
// Stop system
|
||||||
while(true){
|
while(true){
|
||||||
esp_deep_sleep_start(); // Deep Sleep with weakup via GPIO pin
|
esp_deep_sleep_start(); // Deep Sleep with weakup via GPIO pin
|
||||||
|
|
Loading…
Reference in New Issue