Skip to content

Commit

Permalink
fix: turn off T-Echo peripherals on deep sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir committed Feb 1, 2024
1 parent 0c0a3c4 commit af09b43
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 23 deletions.
5 changes: 0 additions & 5 deletions src/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,6 @@ bool Power::setup()

void Power::shutdown()
{
screen->setOn(false);
#if defined(USE_EINK) && defined(PIN_EINK_EN)
digitalWrite(PIN_EINK_EN, LOW); // power off backlight first
#endif

LOG_INFO("Shutting down\n");

#ifdef HAS_PMU
Expand Down
3 changes: 3 additions & 0 deletions src/graphics/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,9 @@ void Screen::doDeepSleep()
static const int sleepFrameCount = sizeof(sleepFrames) / sizeof(sleepFrames[0]);
ui->setFrames(sleepFrames, sleepFrameCount);
ui->update();
#ifdef PIN_EINK_EN
digitalWrite(PIN_EINK_EN, LOW); // power off backlight
#endif
#endif
setOn(false);
}
Expand Down
6 changes: 6 additions & 0 deletions src/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)

nodeDB.saveToDisk();

#ifdef TTGO_T_ECHO
#ifdef PIN_EINK_PWR_ON
pinMode(PIN_EINK_PWR_ON, INPUT); // power off peripherals
#endif
#endif

// Kill GPS power completely (even if previously we just had it in sleep mode)
if (gps)
gps->setGPSPower(false, false, 0);
Expand Down
4 changes: 0 additions & 4 deletions variants/rak10701/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define PIN_EINK_SCLK (0 + 3)
#define PIN_EINK_MOSI (0 + 30) // also called SDI

// Controls power for the eink display - Board power is enabled either by VBUS from USB or the CPU asserting PWR_ON
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
// #define PIN_EINK_PWR_ON (-1)

// #define USE_EINK

// RAKRGB
Expand Down
4 changes: 0 additions & 4 deletions variants/rak4631/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define PIN_EINK_SCLK (0 + 3)
#define PIN_EINK_MOSI (0 + 30) // also called SDI

// Controls power for the eink display - Board power is enabled either by VBUS from USB or the CPU asserting PWR_ON
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
// #define PIN_EINK_PWR_ON (-1)

// #define USE_EINK

// RAKRGB
Expand Down
4 changes: 0 additions & 4 deletions variants/rak4631_epaper/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define PIN_EINK_SCLK (0 + 3)
#define PIN_EINK_MOSI (0 + 30) // also called SDI

// Controls power for the eink display - Board power is enabled either by VBUS from USB or the CPU asserting PWR_ON
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
// #define PIN_EINK_PWR_ON (-1)

#define USE_EINK

// RAKRGB
Expand Down
4 changes: 0 additions & 4 deletions variants/rak4631_epaper_onrxtx/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define PIN_EINK_SCLK (0 + 14) // SCL
#define PIN_EINK_MOSI (0 + 13) // SDA

// Controls power for the eink display - Board power is enabled either by VBUS from USB or the CPU asserting PWR_ON
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
// #define PIN_EINK_PWR_ON (-1)

// RAKRGB
#define HAS_NCP5623

Expand Down
3 changes: 1 addition & 2 deletions variants/t-echo/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ External serial flash WP25R1635FZUIL0
#define PIN_EINK_SCLK (0 + 31)
#define PIN_EINK_MOSI (0 + 29) // also called SDI

// Controls power for the eink display - Board power is enabled either by VBUS from USB or the CPU asserting PWR_ON
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
// Controls power for all peripherals (eink + GPS + LoRa + Sensor)
#define PIN_EINK_PWR_ON (0 + 12)

#define USE_EINK
Expand Down

0 comments on commit af09b43

Please sign in to comment.