low power switch init added (ttgo t-fox)

This commit is contained in:
Klaus K Wilting 2019-01-21 21:36:54 +01:00
parent 0f614da07b
commit 5e407f99f8
2 changed files with 9 additions and 1 deletions

View File

@ -9,8 +9,9 @@
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC #define CFG_sx1276_radio 1 // HPD13A LoRa SoC
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C #define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
#define HAS_LED NOT_A_PIN // green on board LED is useless, is GPIO25, but also switching Power for Lora+Display #define HAS_LED NOT_A_PIN // green on board LED is useless, is GPIO25, which switches power for Lora+Display
//#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW //#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW
#define HAS_LOWPOWER_SWITCH GPIO_NUM_25 // switches power for LoRa chip + display (0 = off / 1 = on)
#define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL #define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL
#define BATT_FACTOR 2 // voltage divider 100k/100k on board #define BATT_FACTOR 2 // voltage divider 100k/100k on board
#define HAS_BUTTON GPIO_NUM_36 // on board button (next to reset) #define HAS_BUTTON GPIO_NUM_36 // on board button (next to reset)

View File

@ -147,6 +147,13 @@ void setup() {
strcat_P(features, " PSRAM"); strcat_P(features, " PSRAM");
#endif #endif
// set low power mode to off
#ifdef HAS_LOWPOWER_SWITCH
pinMode(HAS_LED, OUTPUT);
digitalWrite(HAS_LOWPOWER_SWITCH, HIGH);
strcat_P(features, " LPWR");
#endif
// initialize leds // initialize leds
#if (HAS_LED != NOT_A_PIN) #if (HAS_LED != NOT_A_PIN)
pinMode(HAS_LED, OUTPUT); pinMode(HAS_LED, OUTPUT);