From 65d0e12c19bc966871fba40160845ef785d6767f Mon Sep 17 00:00:00 2001 From: richonguzman Date: Fri, 5 Jan 2024 07:44:55 -0300 Subject: [PATCH] lora32 name fix for boards name --- platformio.ini | 2 +- src/LoRa_APRS_iGate.cpp | 4 ++-- src/battery_utils.cpp | 2 +- src/lora_utils.cpp | 14 +++++++------- src/pins_config.h | 6 +++--- src/power_utils.cpp | 8 ++++---- src/utils.cpp | 16 ++++++++-------- src/wifi_utils.cpp | 6 +++--- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/platformio.ini b/platformio.ini index f0c2bda..5176c73 100644 --- a/platformio.ini +++ b/platformio.ini @@ -31,7 +31,7 @@ lib_deps = [env:ttgo-lora32-v21] board = ttgo-lora32-v21 -build_flags = -Werror -Wall -DTTGO_T_LORA_V2_1 -DELEGANTOTA_USE_ASYNC_WEBSERVER=1 +build_flags = -Werror -Wall -DTTGO_T_LORA32_V2_1 -DELEGANTOTA_USE_ASYNC_WEBSERVER=1 [env:heltec-lora32-v2] board = ttgo-lora32-v21 diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 673500f..e15fe23 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -47,10 +47,10 @@ String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seven void setup() { Serial.begin(115200); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) pinMode(batteryPin, INPUT); #endif - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) pinMode(internalLedPin, OUTPUT); #endif if (Config.externalVoltageMeasurement) { diff --git a/src/battery_utils.cpp b/src/battery_utils.cpp index 1b843e7..0eea96f 100644 --- a/src/battery_utils.cpp +++ b/src/battery_utils.cpp @@ -19,7 +19,7 @@ namespace BATTERY_Utils { int sample; int sampleSum = 0; for (int i=0; i<100; i++) { - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) sample = analogRead(batteryPin); #endif #if defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) diff --git a/src/lora_utils.cpp b/src/lora_utils.cpp index 7adcca6..cb61d51 100644 --- a/src/lora_utils.cpp +++ b/src/lora_utils.cpp @@ -33,7 +33,7 @@ namespace LoRa_Utils { } void setup() { - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ); long freq; @@ -86,10 +86,10 @@ namespace LoRa_Utils { } void sendNewPacket(const String &typeOfMessage, const String &newPacket) { - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,HIGH); #endif - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) LoRa.beginPacket(); LoRa.write('<'); if (typeOfMessage == "APRS") { @@ -114,7 +114,7 @@ namespace LoRa_Utils { Serial.println(state); } #endif - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,LOW); #endif SYSLOG_Utils::log("LoRa Tx", newPacket,0,0,0); @@ -132,7 +132,7 @@ namespace LoRa_Utils { String receivePacket() { String loraPacket = ""; - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) int packetSize = LoRa.parsePacket(); if (packetSize) { while (LoRa.available()) { @@ -177,7 +177,7 @@ namespace LoRa_Utils { void changeFreqTx() { delay(500); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) LoRa.setFrequency(Config.loramodule.digirepeaterTxFreq); #endif #if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) @@ -188,7 +188,7 @@ namespace LoRa_Utils { void changeFreqRx() { delay(500); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) LoRa.setFrequency(Config.loramodule.digirepeaterRxFreq); #endif #if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) diff --git a/src/pins_config.h b/src/pins_config.h index d4d17af..53fce25 100644 --- a/src/pins_config.h +++ b/src/pins_config.h @@ -9,7 +9,7 @@ // LORA MODULES -#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) +#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) #undef LORA_RST #define LORA_SCK 5 // GPIO5 - SX1276 SCK #define LORA_MISO 19 // GPIO19 - SX1276 MISO @@ -54,7 +54,7 @@ // OLED -#if defined(TTGO_T_LORA_V2_1) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) +#if defined(TTGO_T_LORA32_V2_1) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) #define OLED_SDA 21 #define OLED_SCL 22 #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) @@ -73,7 +73,7 @@ #endif // Leds and other stuff -#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) +#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) #define internalLedPin 25 // Green Led #define batteryPin 35 #endif diff --git a/src/power_utils.cpp b/src/power_utils.cpp index 84af4c3..5d0e35c 100644 --- a/src/power_utils.cpp +++ b/src/power_utils.cpp @@ -55,7 +55,7 @@ namespace POWER_Utils { } bool begin(TwoWire &port) { - #if defined (TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa) + #if defined (TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa) return true; #endif @@ -88,6 +88,8 @@ namespace POWER_Utils { PMU.disableDLDO2(); PMU.setDC1Voltage(3300); PMU.enableDC1(); + PMU.setButtonBatteryChargeVoltage(3300); + PMU.enableButtonBatteryCharge(); PMU.disableIRQ(XPOWERS_AXP2101_ALL_IRQ); } return result; @@ -104,7 +106,6 @@ namespace POWER_Utils { Serial.println("AXP192 init failed!"); } activateLoRa(); - //activateGPS(); activateMeasurement(); PMU.setChargerTerminationCurr(XPOWERS_AXP192_CHG_ITERM_LESS_10_PERCENT); PMU.setChargeTargetVoltage(XPOWERS_AXP192_CHG_VOL_4V2); @@ -120,7 +121,6 @@ namespace POWER_Utils { Serial.println("AXP2101 init failed!"); } activateLoRa(); - //activateGPS(); activateMeasurement(); PMU.setPrechargeCurr(XPOWERS_AXP2101_PRECHARGE_200MA); PMU.setChargerTerminationCurr(XPOWERS_AXP2101_CHG_ITERM_25MA); @@ -131,7 +131,7 @@ namespace POWER_Utils { } /*void lowerCpuFrequency() { - #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(TTGO_T_Beam_V1_2_SX1262) + #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2) || 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(TTGO_T_Beam_V1_2_SX1262) if (setCpuFrequencyMhz(80)) { logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "CPU frequency set to 80MHz"); } else { diff --git a/src/utils.cpp b/src/utils.cpp index 596a9c2..cf14ad1 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -81,12 +81,12 @@ namespace Utils { void setupDisplay() { setup_display(); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,HIGH); #endif Serial.println("\nStarting iGate: " + Config.callsign + " Version: " + versionDate); show_display(" LoRa APRS", "", " ( iGATE )", "", "", "Richonguzman / CA2RXU", " " + versionDate, 4000); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,LOW); #endif firstLine = Config.callsign; @@ -117,7 +117,7 @@ namespace Utils { } else { beaconPacket = iGateBeaconPacket; } - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) if (Config.sendBatteryVoltage) { beaconPacket += " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } @@ -132,7 +132,7 @@ namespace Utils { } sixthLine = ""; show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } @@ -156,7 +156,7 @@ namespace Utils { fifthLine = ""; sixthLine = ""; show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } @@ -181,7 +181,7 @@ namespace Utils { APRS_IS_Utils::checkStatus(); thirdLine = getLocalIP(); show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } @@ -194,7 +194,7 @@ namespace Utils { show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0); } else { show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } @@ -215,7 +215,7 @@ namespace Utils { sixthLine = ""; show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index 60ca513..337e1e8 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -36,12 +36,12 @@ namespace WIFI_Utils { WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str()); while (WiFi.status() != WL_CONNECTED && wifiCounter<2) { delay(500); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,HIGH); #endif Serial.print('.'); delay(500); - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,LOW); #endif if ((millis() - start) > 10000){ @@ -62,7 +62,7 @@ namespace WIFI_Utils { WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str()); } } - #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) + #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,LOW); #endif if (WiFi.status() == WL_CONNECTED) {