kopia lustrzana https://github.com/sh123/esp32_loraprs
Minor refactoring
rodzic
1c421e5269
commit
04f76c7301
|
@ -8,7 +8,7 @@ Can be used in two modes:
|
|||
- **LoRa APRS iGate RX/TX server over WiFi + Digipeater**
|
||||
- **RF to APRS-IS gating**, it will connect to your WiFI and will forward received APRS positions from RF LoRa into the APRS-IS network, it also reports client signal level, by appending it into the APRS comment, so you can see your signal reports in different locations (could be enabled or disabled from config). This way, it is also possible to setup portable iGate by connecting to your mobile phone's hotspot and provide power from the phone USB port by using OTA cable
|
||||
- **APRS-IS to RF gating**, it is possible to enable it together with the filter in the config, so APRS-IS data will be forwarded to RF
|
||||
- **RF digirepating** for `WIDEn-n`, `TRACEn-n` new style paths, for `TRACE` will insert own callsign before digipeating
|
||||
- **RF digirepating** for `WIDEn-n` new style paths
|
||||
- **Beaconing**, own station periodic beacon announcement to APRS-IS and RF
|
||||
|
||||
# Compatible Boards
|
||||
|
|
|
@ -56,11 +56,8 @@ String Callsign::ToString() const
|
|||
|
||||
bool Callsign::Digirepeat()
|
||||
{
|
||||
// only WIDE and TRACE supported
|
||||
if (call_.startsWith("WIDE*") || call_.startsWith("TRACE*")) return false;
|
||||
if ((call_.startsWith("WIDE") || call_.startsWith("TRACE")) && call_.length() >= 5) {
|
||||
char wideLevel = call_.charAt(4);
|
||||
if ((wideLevel == '1' || wideLevel == '2' || wideLevel == '3') && ssid_ > 0) {
|
||||
if (IsPath()) {
|
||||
if (ssid_ > 0) {
|
||||
if (--ssid_ == 0) {
|
||||
call_ += "*";
|
||||
}
|
||||
|
@ -92,8 +89,10 @@ bool Callsign::encode(byte *txPtr, int bufferLength) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Callsign::fromString(String callsign)
|
||||
bool Callsign::fromString(const String &inputCallsign)
|
||||
{
|
||||
String callsign = inputCallsign;
|
||||
|
||||
// "ABCDEF-XX"
|
||||
if (callsign.length() > CallsignSize + 2 || callsign.length() == 0) return false;
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ public:
|
|||
|
||||
inline bool IsValid() const { return isValid_; };
|
||||
inline bool IsTrace() const { return call_.startsWith("TRACE"); }
|
||||
inline bool IsWide() const { return call_.startsWith("WIDE"); }
|
||||
inline bool IsPath() const { return IsWide(); }
|
||||
|
||||
String ToString() const;
|
||||
bool ToBinary(byte *txPayload, int bufferLength) const;
|
||||
|
@ -26,7 +28,7 @@ public:
|
|||
private:
|
||||
bool encode(byte *txPtr, int bufferLength) const;
|
||||
|
||||
bool fromString(String callsign);
|
||||
bool fromString(const String &callsign);
|
||||
bool fromBinary(const byte *rxPtr, int payloadLength);
|
||||
|
||||
private:
|
||||
|
|
|
@ -83,7 +83,7 @@ String Payload::ToString(String customComment)
|
|||
txt += customComment;
|
||||
}
|
||||
|
||||
return txt + String("\n");
|
||||
return txt;
|
||||
}
|
||||
|
||||
bool Payload::Digirepeat(const Callsign &ownCallsign)
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
inline bool IsValid() const { return isValid_; }
|
||||
|
||||
String ToString(String customComment);
|
||||
String ToString(String customComment=String());
|
||||
int ToBinary(byte *txPayload, int bufferLength) const;
|
||||
|
||||
bool Digirepeat(const Callsign &ownCallsign);
|
||||
|
|
|
@ -167,9 +167,9 @@ void Service::sendBeacon()
|
|||
if (payload.IsValid()) {
|
||||
sendToLora(payload);
|
||||
if (enableRfToIs_) {
|
||||
sendToAprsis(payload.ToString(String()));
|
||||
sendToAprsis(payload.ToString());
|
||||
}
|
||||
Serial.println("Sent beacon");
|
||||
Serial.println("Periodic beacon is sent");
|
||||
}
|
||||
else {
|
||||
Serial.println("Beacon payload is invalid");
|
||||
|
@ -177,6 +177,7 @@ void Service::sendBeacon()
|
|||
previousBeaconMs_ = currentMs;
|
||||
}
|
||||
}
|
||||
|
||||
void Service::sendToAprsis(String aprsMessage)
|
||||
{
|
||||
if (needsWifi() && WiFi.status() != WL_CONNECTED) {
|
||||
|
@ -185,7 +186,7 @@ void Service::sendToAprsis(String aprsMessage)
|
|||
if (needsAprsis() && !aprsisConn_.connected()) {
|
||||
reconnectAprsis();
|
||||
}
|
||||
aprsisConn_.print(aprsMessage);
|
||||
aprsisConn_.println(aprsMessage);
|
||||
|
||||
if (!persistentConn_) {
|
||||
aprsisConn_.stop();
|
||||
|
@ -281,13 +282,15 @@ void Service::onLoraDataAvailable(int packetSize)
|
|||
|
||||
if (payload.IsValid()) {
|
||||
String textPayload = payload.ToString(addSignalReport_ ? signalReport : String());
|
||||
Serial.print(textPayload);
|
||||
Serial.println(textPayload);
|
||||
|
||||
if (enableRfToIs_ && !isClient_) {
|
||||
sendToAprsis(textPayload);
|
||||
Serial.println("Packet sent to APRS-IS");
|
||||
}
|
||||
if (enableRepeater_ && payload.Digirepeat(ownCallsign_)) {
|
||||
sendToLora(payload);
|
||||
Serial.println("Packet digirepeated");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Ładowanie…
Reference in New Issue