sanitize ext_power_off

This commit is contained in:
cyberman54 2021-02-13 14:04:03 +01:00
parent d3f5f4f60d
commit c81af717bd
5 changed files with 15 additions and 6 deletions

View File

@ -34,6 +34,15 @@
#endif #endif
#endif #endif
#ifdef EXT_POWER_SW
#ifndef EXT_POWER_ON
#define EXT_POWER_ON 1
#endif
#ifndef EXT_POWER_OFF
#define EXT_POWER_OFF (!EXT_POWER_ON)
#endif
#endif
typedef uint8_t (*mapFn_t)(uint16_t, uint16_t, uint16_t); typedef uint8_t (*mapFn_t)(uint16_t, uint16_t, uint16_t);
uint16_t read_voltage(void); uint16_t read_voltage(void);

View File

@ -20,7 +20,6 @@
#define EXT_POWER_SW 15 // Switch VDD on pin JP10, needed for RTC DS3231 #define EXT_POWER_SW 15 // Switch VDD on pin JP10, needed for RTC DS3231
#define EXT_POWER_ON 0 #define EXT_POWER_ON 0
#define EXT_POWER_OFF 1
#define HAS_LED (2) // on board green LED #define HAS_LED (2) // on board green LED
#define HAS_TWO_LED (12) // on board red LED #define HAS_TWO_LED (12) // on board red LED

View File

@ -8,6 +8,7 @@
#include <stdint.h> #include <stdint.h>
// Hardware related definitions for Heltec V1 LoRa-32 Board // Hardware related definitions for Heltec V1 LoRa-32 Board
// see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v1
//#define HAS_BME 1 // Enable BME sensors in general //#define HAS_BME 1 // Enable BME sensors in general
//#define HAS_BME680 GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL //#define HAS_BME680 GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL

View File

@ -8,6 +8,7 @@
#include <stdint.h> #include <stdint.h>
// Hardware related definitions for Heltec V2 LoRa-32 Board // Hardware related definitions for Heltec V2 LoRa-32 Board
// see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v2
//#define HAS_BME 1 // Enable BME sensors in general //#define HAS_BME 1 // Enable BME sensors in general
//#define HAS_BME680 GPIO_NUM_4, GPIO_NUM_15 // SDA, SCL //#define HAS_BME680 GPIO_NUM_4, GPIO_NUM_15 // SDA, SCL
@ -29,9 +30,9 @@
//#define BAT_MEASURE_ADC_UNIT 2 // ADC 2 //#define BAT_MEASURE_ADC_UNIT 2 // ADC 2
//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 220k/100k on board //#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 220k/100k on board
#define EXT_POWER_SW Vext // switches battery power, Vext control 0 = on / 1 = off // switches battery power and Vext, switch logic 0 = on / 1 = off
#define EXT_POWER_ON 0 #define EXT_POWER_SW Vext
//#define EXT_POWER_OFF 1 #define EXT_POWER_ON 0
// Pins for I2C interface of OLED Display // Pins for I2C interface of OLED Display
#define MY_DISPLAY_SDA SDA_OLED #define MY_DISPLAY_SDA SDA_OLED
@ -43,7 +44,7 @@
#define LORA_IRQ DIO0 #define LORA_IRQ DIO0
#define LORA_IO1 DIO1 #define LORA_IO1 DIO1
#define LORA_IO2 DIO2 #define LORA_IO2 DIO2
#define LORA_SCK GPIO_NUM_5 #define LORA_SCK SCK
#define LORA_MISO MISO #define LORA_MISO MISO
#define LORA_MOSI MOSI #define LORA_MOSI MOSI
#define LORA_RST RST_LoRa #define LORA_RST RST_LoRa

View File

@ -15,7 +15,6 @@
#define EXT_POWER_SW GPIO_NUM_25 // switches power for LoRa chip #define EXT_POWER_SW GPIO_NUM_25 // switches power for LoRa chip
#define EXT_POWER_ON 0 #define EXT_POWER_ON 0
#define EXT_POWER_OFF 1
#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL #define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL
#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board #define BAT_VOLTAGE_DIVIDER 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)