From f9f8a9b95776a0b575c296e41812268676b79895 Mon Sep 17 00:00:00 2001 From: "Ricardo Guzman (Richonguzman)" Date: Wed, 25 Mar 2026 12:03:00 -0300 Subject: [PATCH] test new boards and gps read update --- src/LoRa_APRS_iGate.cpp | 4 +- src/battery_utils.cpp | 2 +- src/configuration.cpp | 3 + src/utils.cpp | 13 ++++- .../ttgo-lora32-v21_915_GPS/board_pinout.h | 58 +++++++++++++++++++ .../ttgo-lora32-v21_915_GPS/platformio.ini | 11 ++++ variants/ttgo-lora32-v21_GPS/board_pinout.h | 58 +++++++++++++++++++ variants/ttgo-lora32-v21_GPS/platformio.ini | 11 ++++ 8 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 variants/ttgo-lora32-v21_915_GPS/board_pinout.h create mode 100644 variants/ttgo-lora32-v21_915_GPS/platformio.ini create mode 100644 variants/ttgo-lora32-v21_GPS/board_pinout.h create mode 100644 variants/ttgo-lora32-v21_GPS/platformio.ini diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 6604c9f..f79cdc8 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -68,8 +68,8 @@ ___________________________________________________________________*/ #endif -String versionDate = "2026-03-11"; -String versionNumber = "3.2.107"; +String versionDate = "2026-03-25"; +String versionNumber = "3.2.3"; Configuration Config; WiFiClient aprsIsClient; WiFiClient mqttClient; diff --git a/src/battery_utils.cpp b/src/battery_utils.cpp index 7bce15e..5715b26 100644 --- a/src/battery_utils.cpp +++ b/src/battery_utils.cpp @@ -46,7 +46,7 @@ Adafruit_INA219 ina219; #ifdef HAS_ADC_CALIBRATION #include - #if defined(TTGO_LORA32_V2_1) || defined(TTGO_LORA32_V2_1_915) + #if defined(TTGO_LORA32_V2_1) || defined(TTGO_LORA32_V2_1_GPS) || defined(TTGO_LORA32_V2_1_915) || defined(TTGO_LORA32_V2_1_915_GPS) #define InternalBattery_ADC_Channel ADC1_CHANNEL_7 // t_lora32 pin35 #define ExternalVoltage_ADC_Channel ADC1_CHANNEL_6 // t_lora32 pin34 #endif diff --git a/src/configuration.cpp b/src/configuration.cpp index 15fa3f3..1e62f72 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -80,6 +80,9 @@ bool Configuration::writeFile() { data["beacon"]["statusPacket"] = beacon.statusPacket; data["beacon"]["gpsActive"] = beacon.gpsActive; + #if !defined(HAS_GPS) + data["beacon"]["gpsActive"] = false; + #endif data["beacon"]["ambiguityLevel"] = beacon.ambiguityLevel; data["personalNote"] = personalNote; diff --git a/src/utils.cpp b/src/utils.cpp index 65b5292..5d21804 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -153,11 +153,18 @@ namespace Utils { beaconUpdate = true; } + bool configLocationIsValid = !(Config.beacon.latitude == 0.0 && Config.beacon.longitude == 0.0); #ifdef HAS_GPS - if (Config.beacon.gpsActive && gps.location.lat() == 0.0 && gps.location.lng() == 0.0 && Config.beacon.latitude == 0.0 && Config.beacon.longitude == 0.0) { - GPS_Utils::getData(); - beaconUpdate = false; + if (Config.beacon.gpsActive) { // GPS activated + if (!gps.location.isValid()) { + GPS_Utils::getData(); // refresh GPS + beaconUpdate = false; + } + } else { // GPS not active: use saved data in Config + if (!configLocationIsValid) beaconUpdate = false; } + #else // No GPS available: use saved data in Config + if (!configLocationIsValid) beaconUpdate = false; #endif if (beaconUpdate) { diff --git a/variants/ttgo-lora32-v21_915_GPS/board_pinout.h b/variants/ttgo-lora32-v21_915_GPS/board_pinout.h new file mode 100644 index 0000000..644ca4a --- /dev/null +++ b/variants/ttgo-lora32-v21_915_GPS/board_pinout.h @@ -0,0 +1,58 @@ +/* Copyright (C) 2025 Ricardo Guzman - CA2RXU + * + * This file is part of LoRa APRS iGate. + * + * LoRa APRS iGate is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LoRa APRS iGate is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LoRa APRS iGate. If not, see . + */ + +#ifndef BOARD_PINOUT_H_ +#define BOARD_PINOUT_H_ + + // LoRa Radio + #define HAS_SX1276 + #define RADIO_SCLK_PIN 5 + #define RADIO_MISO_PIN 19 + #define RADIO_MOSI_PIN 27 + #define RADIO_CS_PIN 18 + #define RADIO_RST_PIN 14 + #define RADIO_BUSY_PIN 26 + #define RADIO_WAKEUP_PIN RADIO_BUSY_PIN + #define GPIO_WAKEUP_PIN GPIO_SEL_26 + + // I2C + #define USE_WIRE_WITH_OLED_PINS + + // Display + #define HAS_DISPLAY + + #undef OLED_SDA + #undef OLED_SCL + #undef OLED_RST + + #define OLED_SDA 21 + #define OLED_SCL 22 + #define OLED_RST -1 // Reset pin # (or -1 if sharing Arduino reset pin) + + // GPS + #define HAS_GPS + #define GPS_BAUDRATE 9600 + #define GPS_RX 12 + #define GPS_TX 34 + + // Aditional Config + #define INTERNAL_LED_PIN 25 // Green Led + #define BATTERY_PIN 35 + #define HAS_ADC_CALIBRATION + +#endif \ No newline at end of file diff --git a/variants/ttgo-lora32-v21_915_GPS/platformio.ini b/variants/ttgo-lora32-v21_915_GPS/platformio.ini new file mode 100644 index 0000000..277bad8 --- /dev/null +++ b/variants/ttgo-lora32-v21_915_GPS/platformio.ini @@ -0,0 +1,11 @@ +[env:ttgo-lora32-v21_915_GPS] +board = ttgo-lora32-v21 +build_flags = + ${common.build_flags} + -D RADIOLIB_EXCLUDE_LR11X0=1 + -D RADIOLIB_EXCLUDE_SX126X=1 + -D RADIOLIB_EXCLUDE_SX128X=1 + -D TTGO_LORA32_V2_1_915_GPS +lib_deps = + ${common.lib_deps} + ${common.display_libs} \ No newline at end of file diff --git a/variants/ttgo-lora32-v21_GPS/board_pinout.h b/variants/ttgo-lora32-v21_GPS/board_pinout.h new file mode 100644 index 0000000..de13b20 --- /dev/null +++ b/variants/ttgo-lora32-v21_GPS/board_pinout.h @@ -0,0 +1,58 @@ +/* Copyright (C) 2025 Ricardo Guzman - CA2RXU + * + * This file is part of LoRa APRS iGate. + * + * LoRa APRS iGate is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LoRa APRS iGate is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LoRa APRS iGate. If not, see . + */ + +#ifndef BOARD_PINOUT_H_ +#define BOARD_PINOUT_H_ + + // LoRa Radio + #define HAS_SX1278 + #define RADIO_SCLK_PIN 5 + #define RADIO_MISO_PIN 19 + #define RADIO_MOSI_PIN 27 + #define RADIO_CS_PIN 18 + #define RADIO_RST_PIN 14 + #define RADIO_BUSY_PIN 26 + #define RADIO_WAKEUP_PIN RADIO_BUSY_PIN + #define GPIO_WAKEUP_PIN GPIO_SEL_26 + + // I2C + #define USE_WIRE_WITH_OLED_PINS + + // Display + #define HAS_DISPLAY + + #undef OLED_SDA + #undef OLED_SCL + #undef OLED_RST + + #define OLED_SDA 21 + #define OLED_SCL 22 + #define OLED_RST -1 // Reset pin # (or -1 if sharing Arduino reset pin) + + // GPS + #define HAS_GPS + #define GPS_BAUDRATE 9600 + #define GPS_RX 12 + #define GPS_TX 34 + + // Aditional Config + #define INTERNAL_LED_PIN 25 // Green Led + #define BATTERY_PIN 35 + #define HAS_ADC_CALIBRATION + +#endif \ No newline at end of file diff --git a/variants/ttgo-lora32-v21_GPS/platformio.ini b/variants/ttgo-lora32-v21_GPS/platformio.ini new file mode 100644 index 0000000..e7575c3 --- /dev/null +++ b/variants/ttgo-lora32-v21_GPS/platformio.ini @@ -0,0 +1,11 @@ +[env:ttgo-lora32-v21_GPS] +board = ttgo-lora32-v21 +build_flags = + ${common.build_flags} + -D RADIOLIB_EXCLUDE_LR11X0=1 + -D RADIOLIB_EXCLUDE_SX126X=1 + -D RADIOLIB_EXCLUDE_SX128X=1 + -D TTGO_LORA32_V2_1_GPS +lib_deps = + ${common.lib_deps} + ${common.display_libs} \ No newline at end of file