cleanup the code
parent
eccae0bb96
commit
6b8e30268b
|
@ -1,5 +1,6 @@
|
||||||
// Tracker for LoRA APRS
|
// Tracker for LoRA APRS
|
||||||
// from OE1ACM and OE3CJB redesigned by SQ9MDD
|
// from OE1ACM and OE3CJB redesigned by SQ9MDD
|
||||||
|
// KISS ans Bluetooth by SQ5RWU
|
||||||
// TTGO T-Beam v1.0 only
|
// TTGO T-Beam v1.0 only
|
||||||
//
|
//
|
||||||
// licensed under CC BY-NC-SA
|
// licensed under CC BY-NC-SA
|
||||||
|
@ -323,6 +324,55 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3
|
||||||
display.display();
|
display.display();
|
||||||
time_to_refresh = millis() + SHOW_RX_TIME;
|
time_to_refresh = millis() + SHOW_RX_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void handleKISSData(char character) {
|
||||||
|
inTNCData.concat(character);
|
||||||
|
if (character == (char)FEND && inTNCData.length() > 3){
|
||||||
|
writedisplaytext("((KISSTX))","","","","","",1);
|
||||||
|
time_to_refresh = millis() + SHOW_RX_TIME;
|
||||||
|
#ifdef KISS_PROTOCOLL
|
||||||
|
const String &TNC2DataFrame = decode_kiss(inTNCData);
|
||||||
|
|
||||||
|
Serial.print(inTNCData);
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
|
if (SerialBT.connected()) {
|
||||||
|
SerialBT.print(inTNCData);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
loraSend(lora_TXStart, lora_TXEnd, 60, 255, 1, 10, TXdbmW, TXFREQ, TNC2DataFrame);
|
||||||
|
inTNCData = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSatAndBatInfo() {
|
||||||
|
String line5;
|
||||||
|
if(gps_state == true){
|
||||||
|
line5 = "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 1) + "V";
|
||||||
|
}else{
|
||||||
|
line5 = "SAT: X BAT: " + String(BattVolts, 1) + "V";
|
||||||
|
}
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
|
if (SerialBT.connected()){
|
||||||
|
line5 += "BT";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return line5;
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayInvalidGPS() {
|
||||||
|
writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", getSatAndBatInfo(), 1);
|
||||||
|
//writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", "", 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
|
||||||
|
}
|
||||||
|
|
||||||
// + SETUP --------------------------------------------------------------+//
|
// + SETUP --------------------------------------------------------------+//
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
|
@ -411,13 +461,13 @@ void loop() {
|
||||||
if(digitalRead(BUTTON)==LOW){
|
if(digitalRead(BUTTON)==LOW){
|
||||||
if(gps_state == true){
|
if(gps_state == true){
|
||||||
gps_state = false;
|
gps_state = false;
|
||||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
|
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // GPS OFF
|
||||||
writedisplaytext("((GPSOFF))","","","","","",1);
|
writedisplaytext("((GPSOFF))","","","","","",1);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
gps_state = true;
|
gps_state = true;
|
||||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON);
|
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON);
|
||||||
writedisplaytext("((GPS ON))","","","","","",1);
|
writedisplaytext("((GPS ON))","","","","","",1); // GPS ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,51 +633,4 @@ void loop() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleKISSData(char character) {
|
|
||||||
inTNCData.concat(character);
|
|
||||||
if (character == (char)FEND && inTNCData.length() > 3){
|
|
||||||
writedisplaytext("((KISSTX))","","","","","",1);
|
|
||||||
time_to_refresh = millis() + SHOW_RX_TIME;
|
|
||||||
#ifdef KISS_PROTOCOLL
|
|
||||||
const String &TNC2DataFrame = decode_kiss(inTNCData);
|
|
||||||
|
|
||||||
Serial.print(inTNCData);
|
|
||||||
#ifdef ENABLE_BLUETOOTH
|
|
||||||
if (SerialBT.connected()) {
|
|
||||||
SerialBT.print(inTNCData);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
loraSend(lora_TXStart, lora_TXEnd, 60, 255, 1, 10, TXdbmW, TXFREQ, TNC2DataFrame);
|
|
||||||
inTNCData = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String getSatAndBatInfo() {
|
|
||||||
String line5;
|
|
||||||
if(gps_state == true){
|
|
||||||
line5 = "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 1) + "V";
|
|
||||||
}else{
|
|
||||||
line5 = "SAT: X BAT: " + String(BattVolts, 1) + "V";
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_BLUETOOTH
|
|
||||||
if (SerialBT.connected()){
|
|
||||||
line5 += "BT";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return line5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void displayInvalidGPS() {
|
|
||||||
writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", getSatAndBatInfo(), 1);
|
|
||||||
//writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", "", 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
|
|
||||||
}
|
|
||||||
|
|
||||||
// end of main loop
|
// end of main loop
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Tracker for LoRA APRS
|
// Tracker for LoRA APRS
|
||||||
// from OE1ACM and OE3CJB redesigned by SQ9MDD
|
// from OE1ACM and OE3CJB redesigned by SQ9MDD
|
||||||
|
// KISS ans Bluetooth by SQ5RWU
|
||||||
// TTGO T-Beam v1.0 only
|
// TTGO T-Beam v1.0 only
|
||||||
//
|
//
|
||||||
// licensed under CC BY-NC-SA
|
// licensed under CC BY-NC-SA
|
||||||
|
@ -10,13 +11,13 @@
|
||||||
#define DIGI_PATH "WIDE1-1" // one hope please (WIDE1-1)
|
#define DIGI_PATH "WIDE1-1" // one hope please (WIDE1-1)
|
||||||
#define APRS_SYMBOL_TABLE "/"
|
#define APRS_SYMBOL_TABLE "/"
|
||||||
#define APRS_SYMBOL "[" // other symbols are: "[" => RUNNER, "b" => BICYCLE, "<" => MOTORCYCLE, "R" => Recreation Vehicle
|
#define APRS_SYMBOL "[" // other symbols are: "[" => RUNNER, "b" => BICYCLE, "<" => MOTORCYCLE, "R" => Recreation Vehicle
|
||||||
#define MY_COMMENT "test trakera LORA" // add your coment here - if empty then no comment is sent
|
#define MY_COMMENT "LoRa tracker TTGO" // add your coment here - if empty then no comment is sent
|
||||||
//#define SHOW_ALT // send Altitude in frame
|
//#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_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
|
#define SHOW_RX_PACKET // uncomment to show received LoRa APS packets for the time given below
|
||||||
#define SHOW_RX_TIME 30000 // show RX packet for milliseconds (5000 = 5secs)
|
#define SHOW_RX_TIME 30000 // show RX packet for milliseconds (5000 = 5secs)
|
||||||
#define TXFREQ 433.775 // Transmit frequency in MHz
|
#define TXFREQ 433.775 // Transmit frequency in MHz
|
||||||
#define TXdbmW 10 // Transmit power in dBm 17-50mW, 18-63mW, 19-80mW, 20-100mW
|
#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 SHOW_GPS_DATA // uncomment to show on serial port, received data from GPS and debug information
|
||||||
#define ENABLE_BLUETOOTH
|
#define ENABLE_BLUETOOTH
|
||||||
//#define BLUETOOTH_PIN "0000"
|
//#define BLUETOOTH_PIN "0000"
|
||||||
|
|
Loading…
Reference in New Issue