update keep last packet on screen
This commit is contained in:
parent
7b8d686c43
commit
783ec7c664
|
|
@ -33,6 +33,7 @@
|
|||
},
|
||||
"display": {
|
||||
"alwaysOn": true,
|
||||
"keepLastPacketOnScreen": true,
|
||||
"timeout": 2
|
||||
},
|
||||
"other": {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "igate_config.h"
|
||||
#include "display.h"
|
||||
#include "lora_utils.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define VERSION "2023.06.04"
|
||||
|
||||
|
|
@ -214,7 +215,7 @@ void checkReceivedPacket(String packet) {
|
|||
}
|
||||
lastRxTxTime = millis();
|
||||
LoRaUtils::sendNewPacket("APRS", queryAnswer);
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "Type --> QUERY", 1000);
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> QUERY", 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -230,13 +231,13 @@ void checkReceivedPacket(String packet) {
|
|||
deleteNotHeardStation();
|
||||
updateLastHeardStation(Sender);
|
||||
if (aprsPacket.indexOf("::") >= 10) {
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "Type --> MESSAGE", 1000);
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> MESSAGE", 1000);
|
||||
} else if (aprsPacket.indexOf(":>") >= 10) {
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "Type --> NEW STATUS", 1000);
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> NEW STATUS", 1000);
|
||||
} else if (aprsPacket.indexOf(":!") >= 10) {
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "Type --> GPS BEACON", 1000);
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> GPS BEACON", 1000);
|
||||
} else {
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "Type --> ??????????", 1000);
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> ??????????", 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -384,7 +385,10 @@ void loop() {
|
|||
thirdLine = "";
|
||||
fourthLine = "";
|
||||
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
|
||||
if (!Config.display.keepLastPacketOnScreen) {
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
|
||||
}
|
||||
|
||||
uint32_t lastTx = millis() - lastTxTime;
|
||||
if (lastTx >= Config.beaconInterval*60*1000) {
|
||||
beacon_update = true;
|
||||
|
|
@ -403,6 +407,7 @@ void loop() {
|
|||
lastTxTime = millis();
|
||||
lastRxTxTime = millis();
|
||||
show_display(firstLine, secondLine, thirdLine, "SENDING iGate BEACON", 1000);
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
|
||||
beacon_update = false;
|
||||
}
|
||||
|
||||
|
|
@ -452,7 +457,7 @@ void loop() {
|
|||
lastRxTxTime = millis();
|
||||
delay(500);
|
||||
espClient.write(queryAnswer.c_str());
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "Type --> QUERY", 1000);
|
||||
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> QUERY", 1000);
|
||||
}
|
||||
} else {
|
||||
newLoraPacket = processAPRSISPacket(aprsisPacket);
|
||||
|
|
@ -462,17 +467,15 @@ void loop() {
|
|||
LoRaUtils::sendNewPacket("APRS", newLoraPacket);
|
||||
display_toggle(true);
|
||||
lastRxTxTime = millis();
|
||||
show_display(firstLine, secondLine, Sender + " -> " + Addressee, receivedMessage, 2000);
|
||||
receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":")+1);
|
||||
show_display(firstLine, secondLine, Sender + " -> " + Addressee, receivedMessage, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (statusAfterBoot) {
|
||||
delay(1000);
|
||||
String startupStatus = Config.callsign + ">APLR10,qAC:>" + Config.defaultStatus;
|
||||
espClient.write((startupStatus + "\n").c_str());
|
||||
statusAfterBoot = false;
|
||||
utils::processStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ public:
|
|||
class Display {
|
||||
public:
|
||||
bool alwaysOn;
|
||||
bool keepLastPacketOnScreen;
|
||||
int timeout;
|
||||
};
|
||||
|
||||
|
|
@ -85,28 +86,29 @@ private:
|
|||
wifiAPs.push_back(wifiap);
|
||||
}
|
||||
|
||||
callsign = data["callsign"].as<String>();
|
||||
comment = data["comment"].as<String>();
|
||||
beaconInterval = data["other"]["beaconInterval"].as<int>();
|
||||
statusAfterBoot = data["other"]["statusAfterBoot"].as<bool>();
|
||||
defaultStatus = data["other"]["defaultStatus"].as<String>();
|
||||
callsign = data["callsign"].as<String>();
|
||||
comment = data["comment"].as<String>();
|
||||
beaconInterval = data["other"]["beaconInterval"].as<int>();
|
||||
statusAfterBoot = data["other"]["statusAfterBoot"].as<bool>();
|
||||
defaultStatus = data["other"]["defaultStatus"].as<String>();
|
||||
|
||||
aprs_is.passcode = data["aprs_is"]["passcode"].as<int>();
|
||||
aprs_is.server = data["aprs_is"]["server"].as<String>();
|
||||
aprs_is.port = data["aprs_is"]["port"].as<int>();
|
||||
aprs_is.softwareName = data["aprs_is"]["softwareName"].as<String>();
|
||||
aprs_is.softwareVersion = data["aprs_is"]["softwareVersion"].as<String>();
|
||||
aprs_is.reportingDistance = data["aprs_is"]["reportingDistance"].as<int>();
|
||||
aprs_is.passcode = data["aprs_is"]["passcode"].as<int>();
|
||||
aprs_is.server = data["aprs_is"]["server"].as<String>();
|
||||
aprs_is.port = data["aprs_is"]["port"].as<int>();
|
||||
aprs_is.softwareName = data["aprs_is"]["softwareName"].as<String>();
|
||||
aprs_is.softwareVersion = data["aprs_is"]["softwareVersion"].as<String>();
|
||||
aprs_is.reportingDistance = data["aprs_is"]["reportingDistance"].as<int>();
|
||||
|
||||
loramodule.enableTx = data["lora"]["enableTx"].as<bool>();
|
||||
loramodule.frequency = data["lora"]["frequency"].as<long>();
|
||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
||||
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>();
|
||||
loramodule.power = data["lora"]["power"].as<int>();
|
||||
loramodule.enableTx = data["lora"]["enableTx"].as<bool>();
|
||||
loramodule.frequency = data["lora"]["frequency"].as<long>();
|
||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
||||
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>();
|
||||
loramodule.power = data["lora"]["power"].as<int>();
|
||||
|
||||
display.alwaysOn = data["display"]["alwaysOn"].as<bool>();
|
||||
display.timeout = data["display"]["timeout"].as<int>();
|
||||
display.alwaysOn = data["display"]["alwaysOn"].as<bool>();
|
||||
display.keepLastPacketOnScreen = data["display"]["keepLastPacketOnScreen"].as<bool>();
|
||||
display.timeout = data["display"]["timeout"].as<int>();
|
||||
|
||||
configFile.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,19 @@
|
|||
#include <WiFi.h>
|
||||
#include <Arduino.h>
|
||||
#include <igate_config.h>
|
||||
#include "utils.h"
|
||||
|
||||
extern WiFiClient espClient;
|
||||
extern Configuration Config;
|
||||
extern bool statusAfterBoot;
|
||||
|
||||
namespace utils {
|
||||
|
||||
char *ax25_base91enc(char *s, uint8_t n, uint32_t v) {
|
||||
/* Creates a Base-91 representation of the value in v in the string */
|
||||
/* pointed to by s, n-characters long. String length should be n+1. */
|
||||
for(s += n, *s = '\0'; n; n--) {
|
||||
*(--s) = v % 91 + 33;
|
||||
v /= 91;
|
||||
}
|
||||
return(s);
|
||||
}
|
||||
|
||||
static String padding(unsigned int number, unsigned int width) {
|
||||
String result;
|
||||
String num(number);
|
||||
if (num.length() > width) {
|
||||
width = num.length();
|
||||
}
|
||||
for (unsigned int i = 0; i < width - num.length(); i++) {
|
||||
result.concat('0');
|
||||
}
|
||||
result.concat(num);
|
||||
return result;
|
||||
}
|
||||
|
||||
String createDateString(time_t t) {
|
||||
return String(padding(year(t), 4) + "-" + padding(month(t), 2) + "-" + padding(day(t), 2));
|
||||
}
|
||||
|
||||
String createTimeString(time_t t) {
|
||||
return String(padding(hour(t), 2) + ":" + padding(minute(t), 2) + ":" + padding(second(t), 2));
|
||||
void processStatus() {
|
||||
delay(1000);
|
||||
String startupStatus = Config.callsign + ">APLR10,qAC:>" + Config.defaultStatus;
|
||||
espClient.write((startupStatus + "\n").c_str());
|
||||
statusAfterBoot = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,13 +2,10 @@
|
|||
#define UTILS_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <TimeLib.h>
|
||||
|
||||
namespace utils {
|
||||
|
||||
char *ax25_base91enc(char *s, uint8_t n, uint32_t v);
|
||||
String createDateString(time_t t);
|
||||
String createTimeString(time_t t);
|
||||
void processStatus();
|
||||
|
||||
}
|
||||
#endif
|
||||
Loading…
Reference in New Issue