mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-07-07 02:11:04 +02:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e35d5f6a9e | |||
| 96432b8624 | |||
| 25ea82737a | |||
| df22b9dbc0 | |||
| 9898e123d2 | |||
| a97757c0b2 | |||
| 305c5b73f7 | |||
| dd3688f23b | |||
| 6f5846c53d | |||
| 5c30e72a88 | |||
| a024b939f5 | |||
| 96c52c042e | |||
| 236ae65485 | |||
| 4263d55839 | |||
| ba96bb135e | |||
| 944d1fceaf | |||
| 005abb3593 | |||
| fcf77f6d4b | |||
| f576ac6c04 | |||
| f9f8a9b957 | |||
| 7f8c2af86b | |||
| 198245f600 | |||
| 372bb532b8 |
@@ -13,8 +13,12 @@ jobs:
|
||||
target:
|
||||
- name: ttgo-lora32-v21
|
||||
chip: esp32
|
||||
- name: ttgo-lora32-v21_GPS
|
||||
chip: esp32
|
||||
- name: ttgo-lora32-v21_915
|
||||
chip: esp32
|
||||
- name: ttgo-lora32-v21_915_GPS
|
||||
chip: esp32
|
||||
- name: ttgo_lora32_t3s3_v1_2
|
||||
chip: esp32s3
|
||||
- name: heltec-lora32-v2
|
||||
@@ -97,6 +101,8 @@ jobs:
|
||||
chip: esp32s3
|
||||
- name: QRPLabs_LightGateway_Plus_1_0
|
||||
chip: esp32s3
|
||||
- name: RPC_LORA_DIGIGATE_1W
|
||||
chip: esp32
|
||||
- name: XIAO_ESP32S3_WIO_SX1262
|
||||
chip: esp32s3
|
||||
- name: TROY_LoRa_APRS
|
||||
@@ -115,7 +121,7 @@ jobs:
|
||||
|
||||
- name: Build target
|
||||
run: |
|
||||
pio run -e ${{ matrix.target.name }}
|
||||
pio run -e ${{ matrix.target.name }}
|
||||
|
||||
- name: Build FS
|
||||
run: |
|
||||
@@ -130,7 +136,7 @@ jobs:
|
||||
cp .pio/build/${{ matrix.target.name }}/partitions.bin installer/firmware/
|
||||
cp .pio/build/${{ matrix.target.name }}/spiffs.bin installer/firmware/
|
||||
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin installer/firmware/
|
||||
|
||||
|
||||
- name: Merge for web flashing
|
||||
run: |
|
||||
if [ "${{ matrix.target.chip }}" == "esp32" ]; then
|
||||
|
||||
@@ -51,6 +51,8 @@ ____________________________________________________
|
||||
<br />
|
||||
|
||||
# Timeline (Versions):
|
||||
- 2026-06-10 CAD (Channel Activity Detection) and DIFS (Distributed Inter-Frame Space) added.
|
||||
- 2026-03-25 More Boards, SDK update, OTA fix, GPS process update.
|
||||
- 2026-02-26 9M2IBR ESP32 1W (400M30S) + GPS board added.
|
||||
- 2026-02-25 Code Improvements: reduced String comparisons and improved logic for faster code execution.
|
||||
- 2026-02-15 Digipeater code/logic improved.
|
||||
|
||||
+4
-4
@@ -32,16 +32,16 @@ lib_deps =
|
||||
adafruit/Adafruit Si7021 Library @ 1.5.3
|
||||
arduino-libraries/NTPClient @ 3.2.1
|
||||
ayushsharma82/ElegantOTA @ 3.1.7
|
||||
bblanchon/ArduinoJson @ 7.4.2
|
||||
bblanchon/ArduinoJson @ 7.4.3
|
||||
jgromes/RadioLib @ 7.6.0
|
||||
knolleary/PubSubClient @ 2.8
|
||||
ESP32Async/AsyncTCP @ 3.4.10
|
||||
ESP32Async/ESPAsyncWebServer @ 3.10.0
|
||||
ESP32Async/ESPAsyncWebServer @ 3.11.1
|
||||
mikalhart/TinyGPSPlus @ 1.0.3
|
||||
richonguzman/APRSPacketLib @ 1.0.4
|
||||
display_libs =
|
||||
adafruit/Adafruit GFX Library @ 1.11.9
|
||||
adafruit/Adafruit SSD1306 @ 2.5.10
|
||||
adafruit/Adafruit GFX Library @ 1.12.6
|
||||
adafruit/Adafruit SSD1306 @ 2.5.17
|
||||
usb_flags=
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
@@ -28,9 +28,9 @@
|
||||
"messagesToRF": false,
|
||||
"objectsToRF": false,
|
||||
"server": "rotate.aprs2.net",
|
||||
"passcode": "XYZVW",
|
||||
"passcode": "XYZVW",
|
||||
"port": 14580,
|
||||
"filter": "m/10"
|
||||
"filter": "m/10"
|
||||
},
|
||||
"personalNote": "",
|
||||
"blacklist": "",
|
||||
@@ -47,10 +47,11 @@
|
||||
"rxSignalBandwidth": 125000,
|
||||
"txActive": false,
|
||||
"txFreq": 433775000,
|
||||
"txSpreadingFactor": 12,
|
||||
"txCodingRate4": 5,
|
||||
"txSpreadingFactor": 9,
|
||||
"txCodingRate4": 7,
|
||||
"txSignalBandwidth": 125000,
|
||||
"power": 20
|
||||
"power": 20,
|
||||
"cadActive": true
|
||||
},
|
||||
"display": {
|
||||
"alwaysOn": true,
|
||||
|
||||
+1080
-978
File diff suppressed because one or more lines are too long
+50
-6
@@ -118,7 +118,7 @@ function loadSettings(settings) {
|
||||
document.getElementById("beacon.latitude").value = settings.beacon.latitude;
|
||||
document.getElementById("beacon.longitude").value = settings.beacon.longitude;
|
||||
document.getElementById("beacon.interval").value = settings.beacon.interval;
|
||||
document.getElementById("other.rememberStationTime").value = settings.other.rememberStationTime;
|
||||
document.getElementById("other.rememberStationTime").value = settings.other.rememberStationTime;
|
||||
document.getElementById("beacon.sendViaAPRSIS").checked = settings.beacon.sendViaAPRSIS;
|
||||
|
||||
document.getElementById("beacon.sendViaRF").checked = settings.beacon.sendViaRF;
|
||||
@@ -148,12 +148,26 @@ function loadSettings(settings) {
|
||||
document.getElementById("lora.rxSpreadingFactor").value = settings.lora.rxSpreadingFactor;
|
||||
document.getElementById("lora.rxCodingRate4").value = settings.lora.rxCodingRate4;
|
||||
document.getElementById("lora.rxSignalBandwidth").value = settings.lora.rxSignalBandwidth;
|
||||
LoRaRxCheckbox.checked = settings.lora.rxActive;
|
||||
LoRaRxFreq.disabled = !LoRaRxCheckbox.checked;
|
||||
LoRaRxSpreadingFactor.disabled = !LoRaRxCheckbox.checked;
|
||||
LoRaRxCodingRate.disabled = !LoRaRxCheckbox.checked;
|
||||
LoRaRxSignalBandwidth.disabled = !LoRaRxCheckbox.checked;
|
||||
|
||||
document.getElementById("lora.txActive").checked = settings.lora.txActive;
|
||||
document.getElementById("lora.txFreq").value = settings.lora.txFreq;
|
||||
document.getElementById("lora.txSpreadingFactor").value = settings.lora.txSpreadingFactor;
|
||||
document.getElementById("lora.txCodingRate4").value = settings.lora.txCodingRate4;
|
||||
document.getElementById("lora.txSignalBandwidth").value = settings.lora.txSignalBandwidth;
|
||||
document.getElementById("lora.txSignalBandwidth").value = settings.lora.txSignalBandwidth;
|
||||
document.getElementById("lora.power").value = settings.lora.power;
|
||||
document.getElementById("lora.cadActive").checked = settings.lora.cadActive;
|
||||
LoRaTxCheckbox.checked = settings.lora.txActive;
|
||||
LoRaTxFreq.disabled = !LoRaTxCheckbox.checked;
|
||||
LoRaTxSpreadingFactor.disabled = !LoRaTxCheckbox.checked;
|
||||
LoRaTxCodingRate.disabled = !LoRaTxCheckbox.checked;
|
||||
LoRaTxSignalBandwidth.disabled = !LoRaTxCheckbox.checked;
|
||||
LoRaPower.disabled = !LoRaTxCheckbox.checked;
|
||||
LoRaCadActive.disabled = !LoRaTxCheckbox.checked;
|
||||
|
||||
// Display
|
||||
document.getElementById("display.alwaysOn").checked = settings.display.alwaysOn;
|
||||
@@ -195,7 +209,7 @@ function loadSettings(settings) {
|
||||
TelemetryCheckbox.checked = settings.wxsensor.active;
|
||||
TelemetryHeightCorrection.disabled = !TelemetryCheckbox.checked;
|
||||
TelemetryTempCorrection.disabled = !TelemetryCheckbox.checked;
|
||||
|
||||
|
||||
// SYSLOG
|
||||
document.getElementById("syslog.active").checked = settings.syslog.active;
|
||||
document.getElementById("syslog.server").value = settings.syslog.server;
|
||||
@@ -205,7 +219,7 @@ function loadSettings(settings) {
|
||||
SyslogServer.disabled = !SyslogCheckbox.checked;
|
||||
SyslogPort.disabled = !SyslogCheckbox.checked;
|
||||
SyslogBeaconOverTCPIP.disabled = !SyslogCheckbox.checked;
|
||||
|
||||
|
||||
// TNC
|
||||
if (settings.tnc) {
|
||||
document.getElementById("tnc.enableServer").checked = settings.tnc.enableServer;
|
||||
@@ -390,6 +404,36 @@ TelemetryCheckbox.addEventListener("change", function () {
|
||||
TelemetryTempCorrection.disabled = !this.checked;
|
||||
});
|
||||
|
||||
// LoRa Rx Switch
|
||||
const LoRaRxCheckbox = document.querySelector('input[name="lora.rxActive"]');
|
||||
const LoRaRxFreq = document.querySelector('[name="lora.rxFreq"]');
|
||||
const LoRaRxSpreadingFactor = document.querySelector('[name="lora.rxSpreadingFactor"]');
|
||||
const LoRaRxCodingRate = document.querySelector('[name="lora.rxCodingRate4"]');
|
||||
const LoRaRxSignalBandwidth = document.querySelector('[name="lora.rxSignalBandwidth"]');
|
||||
LoRaRxCheckbox.addEventListener("change", function () {
|
||||
LoRaRxFreq.disabled = !this.checked;
|
||||
LoRaRxSpreadingFactor.disabled = !this.checked;
|
||||
LoRaRxCodingRate.disabled = !this.checked;
|
||||
LoRaRxSignalBandwidth.disabled = !this.checked;
|
||||
});
|
||||
|
||||
// LoRa Tx Switch
|
||||
const LoRaTxCheckbox = document.querySelector('input[name="lora.txActive"]');
|
||||
const LoRaTxFreq = document.querySelector('[name="lora.txFreq"]');
|
||||
const LoRaTxSpreadingFactor = document.querySelector('[name="lora.txSpreadingFactor"]');
|
||||
const LoRaTxCodingRate = document.querySelector('[name="lora.txCodingRate4"]');
|
||||
const LoRaTxSignalBandwidth = document.querySelector('[name="lora.txSignalBandwidth"]');
|
||||
const LoRaPower = document.querySelector('[name="lora.power"]');
|
||||
const LoRaCadActive = document.querySelector('[name="lora.cadActive"]');
|
||||
LoRaTxCheckbox.addEventListener("change", function () {
|
||||
LoRaTxFreq.disabled = !this.checked;
|
||||
LoRaTxSpreadingFactor.disabled = !this.checked;
|
||||
LoRaTxCodingRate.disabled = !this.checked;
|
||||
LoRaTxSignalBandwidth.disabled = !this.checked;
|
||||
LoRaPower.disabled = !this.checked;
|
||||
LoRaCadActive.disabled = !this.checked;
|
||||
});
|
||||
|
||||
// Syslog Switches
|
||||
const SyslogCheckbox = document.querySelector('input[name="syslog.active"]');
|
||||
const SyslogServer = document.querySelector('input[name="syslog.server"]');
|
||||
@@ -559,7 +603,7 @@ function loadReceivedPackets(packets) {
|
||||
|
||||
packets.forEach((packet) => {
|
||||
const element = document.createElement("tr");
|
||||
|
||||
|
||||
element.innerHTML = `
|
||||
<td>${packet.rxTime}</td>
|
||||
<td>${packet.packet}</td>
|
||||
@@ -592,7 +636,7 @@ document.querySelector('a[href="/received-packets"]').addEventListener('click',
|
||||
|
||||
document.getElementById('received-packets').classList.remove('d-none');
|
||||
document.getElementById('configuration').classList.add('d-none');
|
||||
|
||||
|
||||
document.querySelector('button[type=submit]').remove();
|
||||
|
||||
fetchReceivedPackets();
|
||||
|
||||
@@ -86,6 +86,7 @@ public:
|
||||
int txCodingRate4;
|
||||
long txSignalBandwidth;
|
||||
int power;
|
||||
bool cadActive;
|
||||
};
|
||||
|
||||
class Display {
|
||||
|
||||
+2
-2
@@ -20,13 +20,13 @@ platform = espressif32 @ 6.12.0
|
||||
board_build.partitions = min_spiffs.csv
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
board_build.embed_files =
|
||||
board_build.embed_files =
|
||||
data_embed/index.html.gz
|
||||
data_embed/style.css.gz
|
||||
data_embed/script.js.gz
|
||||
data_embed/bootstrap.css.gz
|
||||
data_embed/bootstrap.js.gz
|
||||
data_embed/favicon.png.gz
|
||||
extra_scripts =
|
||||
extra_scripts =
|
||||
pre:tools/compress.py
|
||||
debug_tool = esp-prog
|
||||
@@ -68,8 +68,8 @@ ___________________________________________________________________*/
|
||||
#endif
|
||||
|
||||
|
||||
String versionDate = "2026-03-11";
|
||||
String versionNumber = "3.2.107";
|
||||
String versionDate = "2026-06-11";
|
||||
String versionNumber = "3.3.0";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
WiFiClient mqttClient;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with LoRa APRS iGate. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <APRSPacketLib.h>
|
||||
#include <APRSPacketLib.h>
|
||||
#include <WiFiClient.h>
|
||||
#include "configuration.h"
|
||||
#include "network_manager.h"
|
||||
@@ -47,7 +47,6 @@ extern bool modemLoggedToAPRSIS;
|
||||
extern bool backupDigiMode;
|
||||
extern String versionNumber;
|
||||
|
||||
uint32_t lastRxTime = millis();
|
||||
bool passcodeValid = false;
|
||||
uint32_t lastServerCheck = 0;
|
||||
|
||||
@@ -403,7 +402,6 @@ namespace APRS_IS_Utils {
|
||||
String aprsisPacket = aprsIsClient.readStringUntil('\r');
|
||||
aprsisPacket.trim(); // Serial.println(aprsisPacket);
|
||||
processAPRSISPacket(aprsisPacket);
|
||||
lastRxTime = millis();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -46,7 +46,7 @@ Adafruit_INA219 ina219;
|
||||
#ifdef HAS_ADC_CALIBRATION
|
||||
#include <esp_adc_cal.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -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;
|
||||
@@ -103,6 +106,7 @@ bool Configuration::writeFile() {
|
||||
data["lora"]["txCodingRate4"] = loramodule.txCodingRate4;
|
||||
data["lora"]["txSignalBandwidth"] = loramodule.txSignalBandwidth;
|
||||
data["lora"]["power"] = loramodule.power;
|
||||
data["lora"]["cadActive"] = loramodule.cadActive;
|
||||
|
||||
int rxSpreadingFactor = loramodule.rxSpreadingFactor;
|
||||
int txSpreadingFactor = loramodule.txSpreadingFactor;
|
||||
@@ -287,7 +291,6 @@ bool Configuration::readFile() {
|
||||
#endif
|
||||
digi.backupDigiMode = data["digi"]["backupDigiMode"] | false;
|
||||
|
||||
|
||||
if (data["lora"]["rxActive"].isNull() ||
|
||||
data["lora"]["rxFreq"].isNull() ||
|
||||
data["lora"]["rxSpreadingFactor"].isNull() ||
|
||||
@@ -298,7 +301,8 @@ bool Configuration::readFile() {
|
||||
data["lora"]["txSpreadingFactor"].isNull() ||
|
||||
data["lora"]["txCodingRate4"].isNull() ||
|
||||
data["lora"]["txSignalBandwidth"].isNull() ||
|
||||
data["lora"]["power"].isNull()) needsRewrite = true;
|
||||
data["lora"]["power"].isNull() ||
|
||||
data["lora"]["cadActive"].isNull()) needsRewrite = true;
|
||||
loramodule.rxActive = data["lora"]["rxActive"] | true;
|
||||
loramodule.rxFreq = data["lora"]["rxFreq"] | 433775000;
|
||||
loramodule.rxSpreadingFactor = data["lora"]["rxSpreadingFactor"] | 12;
|
||||
@@ -310,6 +314,7 @@ bool Configuration::readFile() {
|
||||
loramodule.txCodingRate4 = data["lora"]["txCodingRate4"] | 5;
|
||||
loramodule.txSignalBandwidth = data["lora"]["txSignalBandwidth"] | 125000;
|
||||
loramodule.power = data["lora"]["power"] | 20;
|
||||
loramodule.cadActive = data["lora"]["cadActive"] | true;
|
||||
|
||||
if (data["display"]["alwaysOn"].isNull() ||
|
||||
data["display"]["timeout"].isNull() ||
|
||||
@@ -500,6 +505,7 @@ void Configuration::setDefaultValues() {
|
||||
loramodule.txCodingRate4 = 5;
|
||||
loramodule.txSignalBandwidth = 125000;
|
||||
loramodule.power = 20;
|
||||
loramodule.cadActive = true;
|
||||
|
||||
display.alwaysOn = true;
|
||||
display.timeout = 4;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "digi_utils.h"
|
||||
#include "wifi_utils.h"
|
||||
#include "lora_utils.h"
|
||||
#include "gps_utils.h"
|
||||
#include "display.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
+13
-2
@@ -65,7 +65,12 @@
|
||||
#ifdef HELTEC_WSL_V3_DISPLAY
|
||||
Adafruit_SSD1306 display(128, 64, &Wire1, OLED_RST);
|
||||
#else
|
||||
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
|
||||
#if defined RPC_LORA_DIGIGATE_1W
|
||||
#define SCREEN_HEIGHT 32
|
||||
#else
|
||||
#define SCREEN_HEIGHT 64
|
||||
#endif
|
||||
Adafruit_SSD1306 display(128, SCREEN_HEIGHT, &Wire, OLED_RST);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -75,6 +80,7 @@
|
||||
extern Configuration Config;
|
||||
|
||||
bool displayFound = false;
|
||||
int maxLines;
|
||||
|
||||
void displaySetup() {
|
||||
#ifdef HAS_DISPLAY
|
||||
@@ -97,6 +103,11 @@ void displaySetup() {
|
||||
sprite.createSprite(160, 80);
|
||||
#endif
|
||||
#else
|
||||
#if (SCREEN_HEIGHT == 64)
|
||||
maxLines = 6;
|
||||
#elif (SCREEN_HEIGHT == 32)
|
||||
maxLines = 3;
|
||||
#endif
|
||||
#ifdef HAS_EPAPER
|
||||
display.landscape();
|
||||
display.printCenter("LoRa APRS iGate Initialising...");
|
||||
@@ -297,7 +308,7 @@ void displayShow(const String& header, const String& line1, const String& line2,
|
||||
display.setCursor(0, 0);
|
||||
display.println(header);
|
||||
display.setTextSize(1);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int i = 0; i < maxLines; i++) {
|
||||
display.setCursor(0, 16 + (8 * i));
|
||||
display.println(*lines[i]);
|
||||
}
|
||||
|
||||
+41
-4
@@ -28,15 +28,19 @@
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
|
||||
|
||||
extern Configuration Config;
|
||||
extern NetworkManager *networkManager;
|
||||
extern uint32_t lastRxTime;
|
||||
extern bool packetIsBeacon;
|
||||
|
||||
extern std::vector<ReceivedPacket> receivedPackets;
|
||||
|
||||
bool operationDone = true;
|
||||
bool transmitFlag = true;
|
||||
bool operationDone = true;
|
||||
bool transmitFlag = true;
|
||||
|
||||
#define DIFS_SLOTS 2 // Number of secuential CAD slots to consider a free channel to Tx
|
||||
int backoffMax = 4; // Max Backoff value (number of CAD slots to wait before Tx)
|
||||
|
||||
#ifdef HAS_SX1262
|
||||
SX1262 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);
|
||||
@@ -167,6 +171,34 @@ namespace LoRa_Utils {
|
||||
radio.setBandwidth(signalBandwidth);
|
||||
}
|
||||
|
||||
bool doCAD() { // CAD (Channel Activity Detection)
|
||||
return radio.scanChannel() != RADIOLIB_CHANNEL_FREE; // false=channel free | true=RADIOLIB_LORA_DETECTED or CAD failed
|
||||
}
|
||||
|
||||
bool doDIFS() {
|
||||
for (uint8_t i = DIFS_SLOTS; i > 0; i--) {
|
||||
if (doCAD()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void waitForDIFS() {
|
||||
while (!doDIFS()) {
|
||||
Serial.println("CAD/DIFS failed, retry...");
|
||||
}
|
||||
}
|
||||
|
||||
void doBEB() {
|
||||
int backoffCounter = random(1, backoffMax + 1);
|
||||
while (backoffCounter > 0) {
|
||||
if (doCAD()) {
|
||||
waitForDIFS(); // busy channel: freeze backoff and restart DIFS
|
||||
} else {
|
||||
backoffCounter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendNewPacket(const String& newPacket) {
|
||||
if (!Config.loramodule.txActive) return;
|
||||
|
||||
@@ -179,6 +211,12 @@ namespace LoRa_Utils {
|
||||
#ifdef INTERNAL_LED_PIN
|
||||
if (Config.digi.ecoMode != 1) digitalWrite(INTERNAL_LED_PIN, HIGH); // disabled in Ultra Eco Mode
|
||||
#endif
|
||||
|
||||
if (Config.loramodule.cadActive) {
|
||||
waitForDIFS(); // DIFS (Distributed Inter-Frame Space)
|
||||
doBEB(); // BEB (Binary Exponential Backoff)
|
||||
}
|
||||
|
||||
int state = radio.transmit("\x3c\xff\x01" + newPacket);
|
||||
transmitFlag = true;
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
@@ -250,7 +288,6 @@ namespace LoRa_Utils {
|
||||
} else {
|
||||
packet = "";
|
||||
}
|
||||
lastRxTime = millis();
|
||||
return packet;
|
||||
}
|
||||
} else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ namespace OTA_Utils {
|
||||
Serial.println(success ? "OTA update finished successfully!" : "There was an error during OTA update!");
|
||||
displayShow("", "", statusMessage, "", rebootMessage, "", "", 4000);
|
||||
|
||||
isUpdatingOTA = false;
|
||||
if (!success) isUpdatingOTA = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,15 +25,11 @@
|
||||
#include "utils.h"
|
||||
#include <vector>
|
||||
|
||||
#define SECS_TO_WAIT 3 // soon to be deleted...
|
||||
|
||||
|
||||
extern Configuration Config;
|
||||
extern uint32_t lastRxTime;
|
||||
extern String fourthLine;
|
||||
extern bool shouldSleepLowVoltage;
|
||||
|
||||
uint32_t lastTxTime = millis();
|
||||
std::vector<LastHeardStation> lastHeardStations;
|
||||
std::vector<String> blacklist;
|
||||
std::vector<String> managers;
|
||||
@@ -214,15 +210,11 @@ namespace STATION_Utils {
|
||||
}
|
||||
|
||||
void processOutputPacketBuffer() {
|
||||
int timeToWait = SECS_TO_WAIT * 1000; // 3 segs between packet Tx and also Rx ???
|
||||
uint32_t lastRx = millis() - lastRxTime;
|
||||
uint32_t lastTx = millis() - lastTxTime;
|
||||
if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) {
|
||||
if (outputPacketBuffer.size() > 0) {
|
||||
if (outputPacketBuffer[0].isBeacon) packetIsBeacon = true;
|
||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[0].packet);
|
||||
if (outputPacketBuffer[0].isBeacon) packetIsBeacon = false;
|
||||
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||
lastTxTime = millis();
|
||||
}
|
||||
if (shouldSleepLowVoltage) {
|
||||
while (outputPacketBuffer.size() > 0) {
|
||||
|
||||
+10
-3
@@ -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) {
|
||||
|
||||
@@ -213,6 +213,8 @@ namespace WEB_Utils {
|
||||
Config.loramodule.txCodingRate4 = getParamIntSafe("lora.txCodingRate4", Config.loramodule.txCodingRate4);
|
||||
Config.loramodule.txSignalBandwidth = getParamIntSafe("lora.txSignalBandwidth", Config.loramodule.txSignalBandwidth);
|
||||
Config.loramodule.power = getParamIntSafe("lora.power", Config.loramodule.power);
|
||||
if (Config.loramodule.txActive)
|
||||
Config.loramodule.cadActive = request->hasParam("lora.cadActive", true);
|
||||
|
||||
Config.display.alwaysOn = request->hasParam("display.alwaysOn", true);
|
||||
if (!Config.display.alwaysOn) {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_PINOUT_H_
|
||||
#define BOARD_PINOUT_H_
|
||||
|
||||
// LoRa Radio
|
||||
#define HAS_SX1268
|
||||
#define HAS_1W_LORA
|
||||
#define HAS_TCXO
|
||||
#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
|
||||
#define RADIO_RXEN 32
|
||||
#define RADIO_TXEN 25
|
||||
#define RADIO_WAKEUP_PIN RADIO_DIO1_PIN
|
||||
#define GPIO_WAKEUP_PIN GPIO_SEL_12
|
||||
|
||||
// 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)
|
||||
|
||||
// Aditional Config
|
||||
#define INTERNAL_LED_PIN 2
|
||||
#define BATTERY_PIN 35
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
[env:RPC_LORA_DIGIGATE_1W]
|
||||
board = esp32dev
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
-D RADIOLIB_EXCLUDE_LR11X0=1
|
||||
-D RADIOLIB_EXCLUDE_SX127X=1
|
||||
-D RADIOLIB_EXCLUDE_SX128X=1
|
||||
-D RPC_LORA_DIGIGATE_1W
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
${common.display_libs}
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
@@ -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}
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
@@ -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}
|
||||
Reference in New Issue
Block a user