From 43a1eee7e8661fe39f8dcf274778cfd34e8a2c3d Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Tue, 16 Feb 2021 23:23:04 +0100 Subject: [PATCH 1/9] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index e60dada..a962f5f 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,12 @@ After connection with APRX based DIGI it can be used as KISS-TNC ### long press: on or off the GPS power supply * if the "FIXED_BEACON_EN" option is enabled in the configuration, a beacon will be sent every set time interval +## screens information +* ((TX)) - position frame sent automatically +* ((RX)) - informs about the received frame +* ((GPSOFF)) - GPS power-off information +* ((GPS ON)) - GPS power-on information +* ((MAN TX)) - information about sending a manually initialized GPS position frame +* ((FIX TX)) - information about the forced manual sending of a frame with the position saved in the configuration when GPS is off or no fix +* ((AUT TX)) - information about sending automatic positioning frame when GPS is turned off +* ((KISSTX)) - information about sending the frame sent by KISS From c0d4d2e0749f54f71bc5dfc6658268ac2d8baf40 Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Tue, 16 Feb 2021 23:27:38 +0100 Subject: [PATCH 2/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a962f5f..f5913b6 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ After connection with APRX based DIGI it can be used as KISS-TNC ### long press: on or off the GPS power supply * if the "FIXED_BEACON_EN" option is enabled in the configuration, a beacon will be sent every set time interval -## screens information +## Oled screens information * ((TX)) - position frame sent automatically * ((RX)) - informs about the received frame * ((GPSOFF)) - GPS power-off information From 6809af9f28a2c8ccc9a6683a2735c2334efb5d5e Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Tue, 16 Feb 2021 23:38:28 +0100 Subject: [PATCH 3/9] code cleanup wieczorne odkurzanie kodu --- src/TTGO_T-Beam_LoRa_APRS.ino | 87 ++++++++---------------------- src/TTGO_T-Beam_LoRa_APRS_config.h | 1 - 2 files changed, 21 insertions(+), 67 deletions(-) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index f224516..042d886 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -23,10 +23,9 @@ #include #include "taskGPS.h" #ifdef KISS_PROTOCOL -#include "taskTNC.h" + #include "taskTNC.h" #endif - // I2C LINES #define I2C_SDA 21 #define I2C_SCL 22 @@ -34,8 +33,6 @@ // DISPLAY address #define SSD1306_ADDRESS 0x3C -//other global Variables - // LED for signalling #ifdef T_BEAM_V1_0 const byte TXLED = 4; //pin number for LED on TX Tracker @@ -114,12 +111,10 @@ ulong time_delay = 0; float average_course[ANGLE_AVGS]; float avg_c_y, avg_c_x; uint8_t txPower = TXdbmW; - static const adc_atten_t atten = ADC_ATTEN_DB_6; static const adc_unit_t unit = ADC_UNIT_1; - #ifdef T_BEAM_V1_0 -AXP20X_Class axp; + AXP20X_Class axp; #endif // checkRX @@ -214,15 +209,12 @@ void prepareAPRSFrame(){ outString += aprsLatPreset; outString += aprsSymbol; } - outString += aprsComment; - #ifdef SHOW_BATT // battery is not frame part move after comment outString += " Batt="; outString += String(BattVolts, 2); outString += ("V"); #endif - #ifdef KISS_PROTOCOL sendToTNC(outString); #else @@ -232,7 +224,6 @@ void prepareAPRSFrame(){ void sendpacket(){ batt_read(); - prepareAPRSFrame(); loraSend(txPower, TXFREQ, outString); //send the packet, data is in TXbuff from lora_TXStart to lora_TXEnd } @@ -272,7 +263,6 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3 axp.setChgLEDMode(AXP20X_LED_BLINK_4HZ); #endif } - display.clearDisplay(); display.setTextColor(WHITE); display.setTextSize(2); @@ -311,13 +301,6 @@ String getSatAndBatInfo() { void displayInvalidGPS() { writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", getSatAndBatInfo(), 1); - #ifdef SHOW_GPS_DATA - Serial.print("(TX) at valid GPS / LAT: not valid / Lon: not valid / SPD: --- / CRS: ---"); - Serial.print(" / SAT: "); - Serial.print(String(gps.satellites.value())); - Serial.print(" / BAT: "); - Serial.println(String(BattVolts,1)); - #endif } #if defined(KISS_PROTOCOL) @@ -365,7 +348,6 @@ void sendTelemetryFrame() { sendToTNC(telemetryBase + telemetryUnitNames); sendToTNC(telemetryBase + telemetryEquations); sendToTNC(telemetryBase + telemetryData); - #else #endif } #endif @@ -479,32 +461,31 @@ void loop() { } } } - //delay(1500); - if(digitalRead(BUTTON)==LOW && key_up == false && millis() >= time_delay && t_lock == false){ - t_lock = true; - if(gps_state == true){ - gps_state = false; - #ifdef T_BEAM_V1_0 - axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // GPS OFF - #endif - writedisplaytext("((GPSOFF))","","","","","",1); - next_fixed_beacon = millis() + fix_beacon_interval; - }else{ - gps_state = true; - #ifdef T_BEAM_V1_0 - axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); - #endif - writedisplaytext("((GPS ON))","","","","","",1); // GPS ON - } - } + if(digitalRead(BUTTON)==LOW && key_up == false && millis() >= time_delay && t_lock == false){ + t_lock = true; + if(gps_state == true){ + gps_state = false; + #ifdef T_BEAM_V1_0 + axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // GPS OFF + #endif + writedisplaytext("((GPSOFF))","","","","","",1); + next_fixed_beacon = millis() + fix_beacon_interval; + + }else{ + gps_state = true; + #ifdef T_BEAM_V1_0 + axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); + #endif + writedisplaytext("((GPS ON))","","","","","",1); // GPS ON + } + } if(digitalRead(BUTTON)==HIGH && !key_up){ key_up = true; t_lock = false; } - if (fixed_beacon_enabled) { if (millis() >= next_fixed_beacon && !gps_state) { next_fixed_beacon = millis() + fix_beacon_interval; @@ -513,7 +494,6 @@ void loop() { } } - #ifdef KISS_PROTOCOL String *TNC2DataFrame = nullptr; if (tncToSendQueue) { @@ -526,7 +506,6 @@ void loop() { } #endif - if (rf95.waitAvailableTimeout(100)) { #ifdef T_BEAM_V1_0 axp.setChgLEDMode(AXP20X_LED_LOW_LEVEL); @@ -558,28 +537,22 @@ void loop() { } average_speed_final = (average_speed[0]+average_speed[1]+average_speed[2]+average_speed[3]+average_speed[4])/5; nextTX = (max_time_to_nextTX-min_time_to_nextTX)/(max_speed-min_speed)*(max_speed-average_speed_final)+min_time_to_nextTX; - if (nextTX < min_time_to_nextTX) {nextTX=min_time_to_nextTX;} if (nextTX > max_time_to_nextTX) {nextTX=max_time_to_nextTX;} - average_course[point_avg_course] = gps.course.deg(); // calculate smart beaconing course - ++point_avg_course; if (point_avg_course>(ANGLE_AVGS-1)) { point_avg_course=0; avg_c_y = 0; avg_c_x = 0; - for (int i=0;i (360-ANGLE))) { if (abs(new_course-old_course-360)>=ANGLE) { nextTX = 0; @@ -598,30 +571,13 @@ void loop() { } old_course = new_course; } - if ((millis() time_to_refresh){ displayInvalidGPS(); @@ -674,5 +630,4 @@ void loop() { #endif #endif vTaskDelay(1); -} -// end of main loop +} \ No newline at end of file diff --git a/src/TTGO_T-Beam_LoRa_APRS_config.h b/src/TTGO_T-Beam_LoRa_APRS_config.h index b3e6583..77704a0 100644 --- a/src/TTGO_T-Beam_LoRa_APRS_config.h +++ b/src/TTGO_T-Beam_LoRa_APRS_config.h @@ -21,7 +21,6 @@ #define SHOW_RX_TIME 10000 // show RX packet for milliseconds (5000 = 5secs) #define TXFREQ 433.775 // Transmit frequency in MHz #define TXdbmW 20 // Transmit power in dBm 17-50mW, 18-63mW, 19-80mW, 20-100mW -//#define SHOW_GPS_DATA // uncomment to show on serial port, received data from GPS and debug information #define ENABLE_BLUETOOTH // bluetooth KISS interface enable //#define BLUETOOTH_PIN "0000" //#define ENABLE_TNC_SELF_TELEMETRY From f217e3f96a5babb33a0b6e357cb7e8389472dca2 Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Wed, 17 Feb 2021 07:52:42 +0100 Subject: [PATCH 4/9] small fix --- src/TTGO_T-Beam_LoRa_APRS.ino | 4 ++-- src/TTGO_T-Beam_LoRa_APRS_config.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 042d886..1f493e1 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -204,9 +204,9 @@ void prepareAPRSFrame(){ outString += Talt; #endif }else{ - outString += aprsLonPreset; - outString += aprsSymbolTable; outString += aprsLatPreset; + outString += aprsSymbolTable; + outString += aprsLonPreset; outString += aprsSymbol; } outString += aprsComment; diff --git a/src/TTGO_T-Beam_LoRa_APRS_config.h b/src/TTGO_T-Beam_LoRa_APRS_config.h index 77704a0..fbc9203 100644 --- a/src/TTGO_T-Beam_LoRa_APRS_config.h +++ b/src/TTGO_T-Beam_LoRa_APRS_config.h @@ -14,7 +14,7 @@ #define LONGITUDE_PRESET "02055.59E" // please in APRS notation: DDDMM.mmE or DDDMM.mmW (used for manual or fixed beacon sending) #define APRS_SYMBOL_TABLE "/" #define APRS_SYMBOL "[" // other symbols are: "[" => RUNNER, "b" => BICYCLE, "<" => MOTORCYCLE, "R" => Recreation Vehicle -#define MY_COMMENT "LoRa tracker" // add your coment here - if empty then no comment is sent +#define MY_COMMENT "Lora Tracker" // add your coment here - if empty then no comment is sent //#define SHOW_ALT // send Altitude in frame #define SHOW_BATT // send battery voltage at the end of comment (we need beggining for QSY message format) #define SHOW_RX_PACKET // uncomment to show received LoRa APS packets for the time given below From b6a44ee8c36066179236bb7a6f701dd457a17c65 Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Wed, 17 Feb 2021 20:26:10 +0100 Subject: [PATCH 5/9] platformio lora32 board support --- platformio.ini | 21 +++++++++++++++++---- src/TTGO_T-Beam_LoRa_APRS.ino | 2 ++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index 92878c7..9297c3b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -8,10 +8,7 @@ ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html -[env:ttgo-t-beam] -platform = espressif32 -board = ttgo-t-beam -framework = arduino +[env] monitor_speed = 115200 build_flags = -Wl,--gc-sections,--relax lib_deps = @@ -25,3 +22,19 @@ lib_deps = OneWire #DallasTemperature #adafruit/Adafruit BME280 Library@^2.1.2 + + +[env:ttgo-t-beam] +platform = espressif32 +board = ttgo-t-beam +framework = arduino + +;[env:ttgo-lora32-v2] +;platform = espressif32 +;board = ttgo-lora32-v1 +;framework = arduino + +;[env:ttgo-lora32-v1] +;platform = espressif32 +;board = ttgo-lora32-v1 +;framework = arduino \ No newline at end of file diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 1f493e1..f4571aa 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -514,6 +514,8 @@ void loop() { loraReceivedLength = sizeof(lora_RXBUFF); // reset max length before receiving! if (rf95.recvAPRS(lora_RXBUFF, &loraReceivedLength)) { loraReceivedFrameString = ""; + //int rssi = rf95.lastSNR(); + //Serial.println(rssi); for (int i=0 ; i < loraReceivedLength ; i++) { loraReceivedFrameString += (char) lora_RXBUFF[i]; } From 272aea23cb2eaab8a8b0b130c347268fa37851ad Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Wed, 17 Feb 2021 20:31:01 +0100 Subject: [PATCH 6/9] Update platformio.ini --- platformio.ini | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platformio.ini b/platformio.ini index 9297c3b..bf77d26 100644 --- a/platformio.ini +++ b/platformio.ini @@ -29,12 +29,12 @@ platform = espressif32 board = ttgo-t-beam framework = arduino -;[env:ttgo-lora32-v2] -;platform = espressif32 -;board = ttgo-lora32-v1 -;framework = arduino +[env:ttgo-lora32-v2] +platform = espressif32 +board = ttgo-lora32-v1 +framework = arduino -;[env:ttgo-lora32-v1] -;platform = espressif32 -;board = ttgo-lora32-v1 -;framework = arduino \ No newline at end of file +[env:ttgo-lora32-v1] +platform = espressif32 +board = ttgo-lora32-v1 +framework = arduino \ No newline at end of file From 6980f4911907b79fa65576f7de69edde134f499d Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Wed, 17 Feb 2021 20:32:58 +0100 Subject: [PATCH 7/9] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f5913b6..4869cc2 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,15 @@ After connection with APRX based DIGI it can be used as KISS-TNC ![diagram](https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS/blob/master/img/digi-schemat.png) ## Contributors -* Initial work: OE1ACM, OE3CJB
-* Redesigned: SQ9MDD
-* KISS TNC Over Seriall or Bluetooth: SQ5RWU

+* Initial work: OE1ACM, OE3CJB +* Redesigned: SQ9MDD +* KISS TNC Over Seriall or Bluetooth: SQ5RWU +* Lora32 board spupport DJ1AN ## Supported boards * TTGO T-beam v.0.7 * TTGO T-beam v.1.0 +* Lora32 board ## User key functions: From 333cbeab6d9ebca23f62f48f5d8cfd073f270594 Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Wed, 17 Feb 2021 20:33:32 +0100 Subject: [PATCH 8/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4869cc2..f14abb9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ After connection with APRX based DIGI it can be used as KISS-TNC * Initial work: OE1ACM, OE3CJB * Redesigned: SQ9MDD * KISS TNC Over Seriall or Bluetooth: SQ5RWU -* Lora32 board spupport DJ1AN +* Lora32 board support DJ1AN ## Supported boards * TTGO T-beam v.0.7 From 349a06aecf51d319158aa4b4cae4833ea528a0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nidecki?= Date: Thu, 18 Feb 2021 19:37:53 +0100 Subject: [PATCH 9/9] Bugfix: do not decode C bit in SSID src/dst in ax.25 fields as has been digipited --- lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp b/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp index 1b915f1..82e8c65 100644 --- a/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp +++ b/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp @@ -3,7 +3,7 @@ bool validateTNC2Frame(const String &tnc2FormattedFrame); String encode_address_ax25(String tnc2Address); -String decode_address_ax25(const String& ax25Address, bool &isLast); +String decode_address_ax25(const String &ax25Address, bool &isLast, bool isRelay); bool validateKISSFrame(const String &kissFormattedFrame); @@ -113,12 +113,12 @@ String decode_kiss(const String& kissFormattedFrame) { if (validateKISSFrame(kissFormattedFrame)){ String ax25Frame = decapsulateKISS(kissFormattedFrame); bool isLast = false; - String dst_addr = decode_address_ax25(ax25Frame.substring(0, 7), isLast); - String src_addr = decode_address_ax25(ax25Frame.substring(7, 14), isLast); + String dst_addr = decode_address_ax25(ax25Frame.substring(0, 7), isLast, false); + String src_addr = decode_address_ax25(ax25Frame.substring(7, 14), isLast, false); TNC2Frame = src_addr + ">" + dst_addr; int digi_info_index = 14; while (!isLast && digi_info_index + 7 < ax25Frame.length()){ - String digi_addr = decode_address_ax25(ax25Frame.substring(digi_info_index, digi_info_index+7), isLast); + String digi_addr = decode_address_ax25(ax25Frame.substring(digi_info_index, digi_info_index + 7), isLast, true); TNC2Frame += ',' + digi_addr; digi_info_index += 7; } @@ -162,7 +162,7 @@ String encode_address_ax25(String tnc2Address) { * @param ax25Address * @return */ -String decode_address_ax25(const String& ax25Address, bool &isLast) { +String decode_address_ax25(const String &ax25Address, bool &isLast, bool isRelay) { String TNCAddress = ""; for (int i = 0; i < 6; ++i) { uint8_t currentCharacter = ax25Address.charAt(i); @@ -181,7 +181,7 @@ String decode_address_ax25(const String& ax25Address, bool &isLast) { TNCAddress += '-'; TNCAddress += ssid; } - if (hasBeenDigipited){ + if (isRelay && hasBeenDigipited){ TNCAddress += '*'; } return TNCAddress;