mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-18 03:04:47 +01:00
HT_CT_62 beaconPacket fix
This commit is contained in:
parent
dc39eec941
commit
630ec062c1
|
|
@ -83,66 +83,39 @@ void setup() {
|
|||
if (Config.lowPowerMode) {
|
||||
gpio_wakeup_enable(GPIO_NUM_3, GPIO_INTR_HIGH_LEVEL);
|
||||
esp_deep_sleep_enable_gpio_wakeup(GPIO_NUM_3, ESP_GPIO_WAKEUP_GPIO_HIGH);
|
||||
|
||||
long lastBeacon = 0;
|
||||
|
||||
LoRa_Utils::startReceive();
|
||||
|
||||
while (true) {
|
||||
auto wakeup_reason = esp_sleep_get_wakeup_cause();
|
||||
|
||||
if (wakeup_reason == 7) { // packet received
|
||||
Serial.println("Received packet");
|
||||
|
||||
String packet = LoRa_Utils::receivePacket();
|
||||
|
||||
Serial.println(packet);
|
||||
|
||||
if (Config.digi.mode == 2) { // If Digi enabled
|
||||
DIGI_Utils::processLoRaPacket(packet); // Send received packet to Digi
|
||||
}
|
||||
if (Config.digi.mode == 2) DIGI_Utils::processLoRaPacket(packet);
|
||||
|
||||
if (packet.indexOf(Config.callsign + ":?APRSELP{") != -1) { // Send `?APRSELP` to exit low power
|
||||
Serial.println("Got ?APRSELP message, exiting from low power mode");
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
long time = esp_timer_get_time() / 1000000;
|
||||
|
||||
if (lastBeacon == 0 || time - lastBeacon >= Config.beacon.interval * 60) {
|
||||
Serial.println("Sending beacon");
|
||||
|
||||
String comment = Config.beacon.comment;
|
||||
|
||||
if (Config.sendBatteryVoltage) {
|
||||
comment += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
||||
}
|
||||
|
||||
if (Config.externalVoltageMeasurement) {
|
||||
comment += " Ext=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V";
|
||||
}
|
||||
|
||||
STATION_Utils::addToOutputPacketBuffer(iGateLoRaBeaconPacket + comment);
|
||||
//LoRa_Utils::sendNewPacket("APRS", iGateLoRaBeaconPacket + comment);
|
||||
|
||||
if (Config.sendBatteryVoltage) comment += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
||||
if (Config.externalVoltageMeasurement) comment += " Ext=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V";
|
||||
STATION_Utils::addToOutputPacketBuffer(GPS_Utils::getiGateLoRaBeaconPacket() + comment);
|
||||
lastBeacon = time;
|
||||
}
|
||||
|
||||
LoRa_Utils::startReceive();
|
||||
|
||||
Serial.println("Sleeping");
|
||||
|
||||
long sleep = (Config.beacon.interval * 60) - (time - lastBeacon);
|
||||
|
||||
Serial.flush();
|
||||
|
||||
esp_sleep_enable_timer_wakeup(sleep * 1000000);
|
||||
esp_light_sleep_start();
|
||||
|
||||
Serial.println("Waked up");
|
||||
}
|
||||
|
||||
Config.loramodule.rxActive = false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ String distance, iGateBeaconPacket, iGateLoRaBeaconPacket;
|
|||
|
||||
namespace GPS_Utils {
|
||||
|
||||
String getiGateLoRaBeaconPacket() {
|
||||
return iGateLoRaBeaconPacket;
|
||||
}
|
||||
|
||||
char *ax25_base91enc(char *s, uint8_t n, uint32_t v) {
|
||||
for(s += n, *s = '\0'; n; n--) {
|
||||
*(--s) = v % 91 + 33;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace GPS_Utils {
|
||||
|
||||
String getiGateLoRaBeaconPacket();
|
||||
char *ax25_base91enc(char *s, uint8_t n, uint32_t v);
|
||||
String encodeGPS(float latitude, float longitude, String overlay, String symbol);
|
||||
void generateBeacons();
|
||||
|
|
|
|||
Loading…
Reference in a new issue