diff --git a/src/A7670_utils.cpp b/src/A7670_utils.cpp index ba80297..7e558e6 100644 --- a/src/A7670_utils.cpp +++ b/src/A7670_utils.cpp @@ -200,6 +200,6 @@ } } delay(1); - } + } } #endif \ No newline at end of file diff --git a/src/A7670_utils.h b/src/A7670_utils.h index 5c28afc..5aeaca5 100644 --- a/src/A7670_utils.h +++ b/src/A7670_utils.h @@ -3,6 +3,7 @@ #include + namespace A7670_Utils { bool checkModemOn(); diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 57224ed..e27f821 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -1,16 +1,24 @@ -/*______________________________________________________________________________________________________________ +/*___________________________________________________________________ -██╗ ██████╗ ██████╗ █████╗ █████╗ ██████╗ ██████╗ ███████╗ ██╗ ██████╗ █████╗ ████████╗███████╗ -██║ ██╔═══██╗██╔══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██║██╔════╝ ██╔══██╗╚══██╔══╝██╔════╝ -██║ ██║ ██║██████╔╝███████║ ███████║██████╔╝██████╔╝███████╗ ██║██║ ███╗███████║ ██║ █████╗ -██║ ██║ ██║██╔══██╗██╔══██║ ██╔══██║██╔═══╝ ██╔══██╗╚════██║ ██║██║ ██║██╔══██║ ██║ ██╔══╝ -███████╗╚██████╔╝██║ ██║██║ ██║ ██║ ██║██║ ██║ ██║███████║ ██║╚██████╔╝██║ ██║ ██║ ███████╗ -╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ +██╗ ██████╗ ██████╗ █████╗ █████╗ ██████╗ ██████╗ ███████╗ +██║ ██╔═══██╗██╔══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔══██╗██╔════╝ +██║ ██║ ██║██████╔╝███████║ ███████║██████╔╝██████╔╝███████╗ +██║ ██║ ██║██╔══██╗██╔══██║ ██╔══██║██╔═══╝ ██╔══██╗╚════██║ +███████╗╚██████╔╝██║ ██║██║ ██║ ██║ ██║██║ ██║ ██║███████║ +╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝ + + ██╗ ██████╗ █████╗ ████████╗███████╗ + ██║██╔════╝ ██╔══██╗╚══██╔══╝██╔════╝ + ██║██║ ███╗███████║ ██║ █████╗ + ██║██║ ██║██╔══██║ ██║ ██╔══╝ + ██║╚██████╔╝██║ ██║ ██║ ███████╗ + ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ - Ricardo Guzman - CA2RXU - https://github.com/richonguzman/LoRa_APRS_Tracker - (donations : http://paypal.me/richonguzman) -______________________________________________________________________________________________________________*/ + + Ricardo Guzman - CA2RXU + https://github.com/richonguzman/LoRa_APRS_Tracker + (donations : http://paypal.me/richonguzman) +___________________________________________________________________*/ #include #include @@ -172,7 +180,7 @@ void loop() { if (Config.loramodule.txActive && (Config.digi.mode == 2 || Config.digi.mode == 3 || backUpDigiMode)) { // If Digi enabled STATION_Utils::clean25SegBuffer(); - DIGI_Utils::processLoRaPacket(packet); // Send received packet to Digi + DIGI_Utils::processLoRaPacket(packet); // Send received packet to Digi } if (Config.tnc.enableServer) { // If TNC server enabled diff --git a/src/aprs_is_utils.cpp b/src/aprs_is_utils.cpp index 5a52507..43cefc3 100644 --- a/src/aprs_is_utils.cpp +++ b/src/aprs_is_utils.cpp @@ -101,7 +101,7 @@ namespace APRS_IS_Utils { if(aprsisState == "--" && !Config.display.alwaysOn && Config.display.timeout != 0) { displayToggle(true); lastScreenOn = millis(); - } + } } secondLine = "WiFi: "; secondLine += wifiState; @@ -176,7 +176,7 @@ namespace APRS_IS_Utils { void processLoRaPacket(const String& packet) { if (espClient.connected() || modemLoggedToAPRSIS) { if (packet != "") { - if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) { + if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) { int firstColonIndex = packet.indexOf(":"); if (firstColonIndex > 5 && firstColonIndex < (packet.length() - 1) && packet[firstColonIndex + 1] != '}' && packet.indexOf("TCPIP") == -1) { const String& Sender = packet.substring(3, packet.indexOf(">")); @@ -207,7 +207,7 @@ namespace APRS_IS_Utils { displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0); } } - } + } } } } @@ -285,7 +285,7 @@ namespace APRS_IS_Utils { A7670_Utils::uploadToAPRSIS(ackPacket); #else upload(ackPacket); - #endif + #endif receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":") + 1, AddresseeAndMessage.indexOf("{")); } else { receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":") + 1); diff --git a/src/battery_utils.cpp b/src/battery_utils.cpp index 6bc3b79..dab9823 100644 --- a/src/battery_utils.cpp +++ b/src/battery_utils.cpp @@ -126,7 +126,7 @@ namespace BATTERY_Utils { sample = 0; #endif #endif - #endif + #endif sampleSum += sample; delayMicroseconds(50); } @@ -182,7 +182,7 @@ namespace BATTERY_Utils { float extVoltage; #ifdef HAS_ADC_CALIBRATION - if (calibrationEnable){ + if (calibrationEnable){ extVoltage = esp_adc_cal_raw_to_voltage(sampleSum / 100, &adc_chars) * voltageDividerTransformation; // in mV extVoltage /= 1000; } else { @@ -240,7 +240,7 @@ namespace BATTERY_Utils { tempValue = value; break; } - } + } int firstByte = tempValue / 91; tempValue -= firstByte * 91; diff --git a/src/configuration.cpp b/src/configuration.cpp index 4732608..d194f89 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -71,7 +71,7 @@ void Configuration::writeFile() { data["battery"]["voltageDividerR2"] = battery.voltageDividerR2; data["battery"]["sendVoltageAsTelemetry"] = battery.sendVoltageAsTelemetry; - + data["wxsensor"]["active"] = wxsensor.active; data["wxsensor"]["heightCorrection"] = wxsensor.heightCorrection; data["wxsensor"]["temperatureCorrection"] = wxsensor.temperatureCorrection; @@ -152,7 +152,7 @@ bool Configuration::readFile() { beacon.gpsActive = data["beacon"]["gpsActive"] | false; beacon.gpsAmbiguity = data["beacon"]["gpsAmbiguity"] | false; - + aprs_is.active = data["aprs_is"]["active"] | false; aprs_is.passcode = data["aprs_is"]["passcode"] | "XYZWV"; aprs_is.server = data["aprs_is"]["server"] | "rotate.aprs2.net"; @@ -160,7 +160,7 @@ bool Configuration::readFile() { aprs_is.filter = data["aprs_is"]["filter"] | "m/10"; aprs_is.messagesToRF = data["aprs_is"]["messagesToRF"] | false; aprs_is.objectsToRF = data["aprs_is"]["objectsToRF"] | false; - + digi.mode = data["digi"]["mode"] | 0; digi.ecoMode = data["digi"]["ecoMode"] | false; @@ -262,7 +262,7 @@ void Configuration::init() { beacon.gpsActive = false; beacon.gpsAmbiguity = false; - + digi.mode = 0; digi.ecoMode = false; diff --git a/src/configuration.h b/src/configuration.h index 6f964ea..160c0ce 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -5,6 +5,7 @@ #include #include + class WiFi_AP { public: String ssid; diff --git a/src/display.cpp b/src/display.cpp index 7cdfad1..288fd49 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -11,9 +11,9 @@ TFT_eSPI tft = TFT_eSPI(); #ifdef HELTEC_WIRELESS_TRACKER - #define bigSizeFont 2.5 - #define smallSizeFont 1.5 - #define lineSpacing 12 + #define bigSizeFont 2 + #define smallSizeFont 1 + #define lineSpacing 10 #endif #else #ifdef HAS_EPAPER @@ -79,7 +79,7 @@ void displaySetup() { display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(1); display.display(); - } + } #endif #endif delay(1000); diff --git a/src/display.h b/src/display.h index 593102b..56edeb8 100644 --- a/src/display.h +++ b/src/display.h @@ -5,6 +5,7 @@ #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 + void cleanTFT(); void displaySetup(); void displayToggle(bool toggle); diff --git a/src/kiss_utils.h b/src/kiss_utils.h index d2e2a93..9a224c0 100644 --- a/src/kiss_utils.h +++ b/src/kiss_utils.h @@ -3,6 +3,7 @@ #include + String encodeAddressAX25(String tnc2Address); String decodeAddressAX25(const String& ax25Address, bool& isLast, bool isRelay); diff --git a/src/lora_utils.cpp b/src/lora_utils.cpp index 21eee63..a4d9d05 100644 --- a/src/lora_utils.cpp +++ b/src/lora_utils.cpp @@ -40,6 +40,7 @@ bool transmitFlag = true; int rssi, freqError; float snr; + namespace LoRa_Utils { void setFlag(void) { @@ -204,7 +205,7 @@ namespace LoRa_Utils { } lastRxTime = millis(); return packet; - } + } } else if (state == RADIOLIB_ERR_CRC_MISMATCH) { rssi = radio.getRSSI(); snr = radio.getSNR(); diff --git a/src/lora_utils.h b/src/lora_utils.h index 14578f6..6060221 100644 --- a/src/lora_utils.h +++ b/src/lora_utils.h @@ -12,7 +12,7 @@ namespace LoRa_Utils { String receivePacket(); void changeFreqTx(); void changeFreqRx(); - void startReceive(); // ??? + void startReceive(); void sleepRadio(); } diff --git a/src/ntp_utils.h b/src/ntp_utils.h index 661eca0..7d28563 100644 --- a/src/ntp_utils.h +++ b/src/ntp_utils.h @@ -3,6 +3,7 @@ #include + namespace NTP_Utils { void setup(); diff --git a/src/station_utils.h b/src/station_utils.h index 8fae0d6..0782e8d 100644 --- a/src/station_utils.h +++ b/src/station_utils.h @@ -16,7 +16,6 @@ struct LastHeardStation { String station; }; - namespace STATION_Utils { void deleteNotHeard(); diff --git a/src/tnc_utils.cpp b/src/tnc_utils.cpp index 5c149ff..3220a8b 100644 --- a/src/tnc_utils.cpp +++ b/src/tnc_utils.cpp @@ -19,6 +19,7 @@ WiFiServer tncServer(TNC_PORT); String inputServerBuffer[INPUT_BUFFER_SIZE]; String inputSerialBuffer = ""; + namespace TNC_Utils { void setup() { diff --git a/src/tnc_utils.h b/src/tnc_utils.h index 6e6e004..7eb1855 100644 --- a/src/tnc_utils.h +++ b/src/tnc_utils.h @@ -3,6 +3,7 @@ #include + namespace TNC_Utils { void setup(); diff --git a/src/utils.cpp b/src/utils.cpp index 2bb10f4..665b043 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -83,7 +83,7 @@ namespace Utils { return "- BACKUP DIGI MODE -"; } else { return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]); - } + } } void setupDisplay() { @@ -122,11 +122,15 @@ namespace Utils { baseAPRSISTelemetryPacket += ":"; String baseRFTelemetryPacket = Config.callsign; - baseRFTelemetryPacket += ">APLRG1,WIDE1-1::"; + baseRFTelemetryPacket += ">APLRG1"; + if (Config.beacon.path.indexOf("WIDE") != -1) { + baseRFTelemetryPacket += ","; + baseRFTelemetryPacket += Config.beacon.path; + } + baseRFTelemetryPacket += "::"; baseRFTelemetryPacket += sender; baseRFTelemetryPacket += ":"; - String telemetryPacket1 = "EQNS."; if (Config.battery.sendInternalVoltage) { telemetryPacket1 += "0,0.01,0"; @@ -177,7 +181,7 @@ namespace Utils { delay(3000); } sendStartTelemetry = false; - } + } void checkBeaconInterval() { uint32_t lastTx = millis() - lastBeaconTx; @@ -200,7 +204,7 @@ namespace Utils { if (sendStartTelemetry && Config.battery.sendVoltageAsTelemetry && !Config.wxsensor.active && (Config.battery.sendInternalVoltage || Config.battery.sendExternalVoltage)) { sendInitialTelemetryPackets(); } - + STATION_Utils::deleteNotHeard(); activeStations(); @@ -250,7 +254,7 @@ namespace Utils { secondaryBeaconPacket += " Batt="; secondaryBeaconPacket += internalVoltageInfo; } - } + } } #endif @@ -273,8 +277,8 @@ namespace Utils { beaconPacket += externalVoltageInfo; secondaryBeaconPacket += " Ext="; secondaryBeaconPacket += externalVoltageInfo; - } - } + } + } } #endif @@ -286,7 +290,7 @@ namespace Utils { if (Config.aprs_is.active && Config.beacon.sendViaAPRSIS && !backUpDigiMode) { Utils::println("-- Sending Beacon to APRSIS --"); - displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING IGATE BEACON", 0); + displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING IGATE BEACON", 0); seventhLine = " listening..."; #ifdef HAS_A7670 A7670_Utils::uploadToAPRSIS(beaconPacket); @@ -338,7 +342,7 @@ namespace Utils { case 1: // APRS-LoRa fifthLine = "APRS-IS ----> LoRa Tx"; break; - case 2: // Digi + case 2: // Digipeater fifthLine = "LoRa Rx ----> LoRa Tx"; break; } diff --git a/src/utils.h b/src/utils.h index 1ad925d..6504990 100644 --- a/src/utils.h +++ b/src/utils.h @@ -3,6 +3,7 @@ #include + class ReceivedPacket { public: String rxTime; diff --git a/src/web_utils.cpp b/src/web_utils.cpp index 698dd11..d3bae52 100644 --- a/src/web_utils.cpp +++ b/src/web_utils.cpp @@ -34,6 +34,7 @@ extern const unsigned char favicon_data[] asm("_binary_data_embed_favicon_png_gz extern const unsigned char favicon_data_end[] asm("_binary_data_embed_favicon_png_gz_end"); extern const size_t favicon_data_len = favicon_data_end - favicon_data; + namespace WEB_Utils { AsyncWebServer server(80); @@ -136,7 +137,7 @@ namespace WEB_Utils { Config.beacon.gpsActive = request->hasParam("beacon.gpsActive", true); Config.beacon.gpsAmbiguity = request->hasParam("beacon.gpsAmbiguity", true); - + Config.digi.mode = request->getParam("digi.mode", true)->value().toInt(); Config.digi.ecoMode = request->hasParam("digi.ecoMode", true); @@ -186,7 +187,7 @@ namespace WEB_Utils { Config.syslog.server = request->getParam("syslog.server", true)->value(); Config.syslog.port = request->getParam("syslog.port", true)->value().toInt(); } - + Config.tnc.enableServer = request->hasParam("tnc.enableServer", true); Config.tnc.enableSerial = request->hasParam("tnc.enableSerial", true); Config.tnc.acceptOwn = request->hasParam("tnc.acceptOwn", true); diff --git a/src/web_utils.h b/src/web_utils.h index 02f170a..7096485 100644 --- a/src/web_utils.h +++ b/src/web_utils.h @@ -13,10 +13,6 @@ namespace WEB_Utils { void handleNotFound(AsyncWebServerRequest *request); void handleStatus(AsyncWebServerRequest *request); void handleHome(AsyncWebServerRequest *request); - - //void handleReadConfiguration(AsyncWebServerRequest *request); - //void handleWriteConfiguration(AsyncWebServerRequest *request); - void handleStyle(AsyncWebServerRequest *request); void handleScript(AsyncWebServerRequest *request); void handleBootstrapStyle(AsyncWebServerRequest *request); diff --git a/src/wx_utils.cpp b/src/wx_utils.cpp index a700715..f48e23d 100644 --- a/src/wx_utils.cpp +++ b/src/wx_utils.cpp @@ -125,7 +125,7 @@ namespace WX_Utils { break; } } - } + } } } @@ -232,7 +232,7 @@ namespace WX_Utils { presStr = "....."; } else { presStr = generatePresString(newPress + (Config.wxsensor.heightCorrection/CORRECTION_FACTOR)); - } + } fifthLine = "BME-> "; fifthLine += String(int(newTemp + Config.wxsensor.temperatureCorrection));