Wemos Battery Holder plus LoRa plus GPS added

This commit is contained in:
richonguzman 2024-05-21 14:23:12 -04:00
parent a2ae412b1a
commit adabb0bd4e
4 changed files with 40 additions and 6 deletions

View File

@ -59,6 +59,7 @@ ____________________________________________________
____________________________________________________ ____________________________________________________
## Timeline (Versions): ## Timeline (Versions):
- 2024.05.21 WEMOS ESP32 Battery Holder + LoRa SX1278 + GPS Module support added.
- 2024.05.16 all boards now work with Radiolib (LoRa) library from @jgromes. - 2024.05.16 all boards now work with Radiolib (LoRa) library from @jgromes.
- 2024.05.13 BME modules will be autodetected (I2C Address and if it is BME280/BMP280/BME680). - 2024.05.13 BME modules will be autodetected (I2C Address and if it is BME280/BMP280/BME680).
- 2024.05.10 PacketBuffer for Rx (25 Seg) and Tx outputPacketBuffer for sending with ACK Request. - 2024.05.10 PacketBuffer for Rx (25 Seg) and Tx outputPacketBuffer for sending with ACK Request.

View File

@ -318,6 +318,21 @@ lib_deps =
adafruit/Adafruit SH110X@^2.1.8 adafruit/Adafruit SH110X@^2.1.8
[env:Wemos_ESP32_Bat_LoRa_GPS]
extends = env:esp32
board = esp32dev
build_flags =
-Werror -Wall
-DWEMOS_ESP32_Bat_LoRa_GPS
-DHAS_SX1278
-DHAS_BT_CLASSIC
lib_deps =
${common.lib_deps}
adafruit/Adafruit GFX Library @ 1.11.7
adafruit/Adafruit SSD1306 @ 2.5.7
adafruit/Adafruit SH110X@^2.1.8
[env:esp32_c3_DIY_LoRa_GPS] [env:esp32_c3_DIY_LoRa_GPS]
extends = env:esp32 extends = env:esp32
board = esp32-c3-devkitm-1 board = esp32-c3-devkitm-1

View File

@ -205,6 +205,24 @@
#endif #endif
#ifdef WEMOS_ESP32_Bat_LoRa_GPS
#define OLED_SDA 21
#define OLED_SCL 22
#define OLED_RST -1
#define GPS_RX 4
#define GPS_TX 17
#define BUTTON_PIN 15
#define BATTERY_PIN 35
#define RADIO_SCLK_PIN 18
#define RADIO_MISO_PIN 19
#define RADIO_MOSI_PIN 23
#define RADIO_CS_PIN 5
#define RADIO_RST_PIN 27
#define RADIO_DIO1_PIN 12
#define RADIO_BUSY_PIN 14
#endif
#ifdef ESP32_C3_DIY_LoRa_GPS #ifdef ESP32_C3_DIY_LoRa_GPS
#define OLED_SDA 8 #define OLED_SDA 8
#define OLED_SCL 9 #define OLED_SCL 9

View File

@ -72,7 +72,7 @@ namespace POWER_Utils {
#if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_LoRa_GPS) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(OE5HWN_MeshCom) || defined(TTGO_T_DECK_GPS) #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_LoRa_GPS) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(OE5HWN_MeshCom) || defined(TTGO_T_DECK_GPS)
return (2 * (voltage + 0.1)) * (1 + (lora32BatReadingCorr/100)); // (2 x 100k voltage divider) 2 x voltage divider/+0.1 because ESP32 nonlinearity ~100mV ADC offset/extra correction return (2 * (voltage + 0.1)) * (1 + (lora32BatReadingCorr/100)); // (2 x 100k voltage divider) 2 x voltage divider/+0.1 because ESP32 nonlinearity ~100mV ADC offset/extra correction
#endif #endif
#if defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(ESP32_C3_DIY_LoRa_GPS) #if defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(WEMOS_ESP32_Bat_LoRa_GPS)
double inputDivider = (1.0 / (390.0 + 100.0)) * 100.0; // The voltage divider is a 390k + 100k resistor in series, 100k on the low side. double inputDivider = (1.0 / (390.0 + 100.0)) * 100.0; // The voltage divider is a 390k + 100k resistor in series, 100k on the low side.
return (voltage / inputDivider) + 0.285; // Yes, this offset is excessive, but the ADC on the ESP32s3 is quite inaccurate and noisy. Adjust to own measurements. return (voltage / inputDivider) + 0.285; // Yes, this offset is excessive, but the ADC on the ESP32s3 is quite inaccurate and noisy. Adjust to own measurements.
#endif #endif
@ -107,7 +107,7 @@ namespace POWER_Utils {
} }
bool isCharging() { bool isCharging() {
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) || defined(WEMOS_ESP32_Bat_LoRa_GPS)
return 0; return 0;
#endif #endif
#if defined(HAS_AXP192) || defined(HAS_AXP2101) #if defined(HAS_AXP192) || defined(HAS_AXP2101)
@ -124,7 +124,7 @@ namespace POWER_Utils {
} }
double getBatteryChargeDischargeCurrent() { double getBatteryChargeDischargeCurrent() {
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) || defined(WEMOS_ESP32_Bat_LoRa_GPS)
return 0; return 0;
#endif #endif
#ifdef HAS_AXP192 #ifdef HAS_AXP192
@ -139,7 +139,7 @@ namespace POWER_Utils {
} }
bool isBatteryConnected() { bool isBatteryConnected() {
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) || defined(WEMOS_ESP32_Bat_LoRa_GPS)
if(getBatteryVoltage() > 1.0) { if(getBatteryVoltage() > 1.0) {
return true; return true;
} else { } else {
@ -156,7 +156,7 @@ namespace POWER_Utils {
if (!(rate_limit_check_battery++ % 60)) if (!(rate_limit_check_battery++ % 60))
BatteryIsConnected = isBatteryConnected(); BatteryIsConnected = isBatteryConnected();
if (BatteryIsConnected) { if (BatteryIsConnected) {
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(OE5HWN_MeshCom) || defined(TTGO_T_DECK_GPS) #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(OE5HWN_MeshCom) || defined(TTGO_T_DECK_GPS) || defined(WEMOS_ESP32_Bat_LoRa_GPS)
batteryVoltage = String(getBatteryVoltage(), 2); batteryVoltage = String(getBatteryVoltage(), 2);
#endif #endif
#ifdef HAS_AXP2101 #ifdef HAS_AXP2101
@ -282,7 +282,7 @@ namespace POWER_Utils {
} }
bool begin(TwoWire &port) { bool begin(TwoWire &port) {
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) || defined(WEMOS_ESP32_Bat_LoRa_GPS)
return true; // no powerManagment chip for this boards (only a few measure battery voltage). return true; // no powerManagment chip for this boards (only a few measure battery voltage).
#endif #endif
#ifdef HAS_AXP192 #ifdef HAS_AXP192