Fix in BT support

pull/7/head
Łukasz Nidecki 2021-02-12 17:14:19 +01:00
parent 11f3db9147
commit 5fc62bd09b
1 changed files with 19 additions and 3 deletions

View File

@ -414,6 +414,11 @@ void loop() {
} }
#ifdef KISS_PROTOCOLL #ifdef KISS_PROTOCOLL
Serial.print(encode_kiss(InputString)); Serial.print(encode_kiss(InputString));
#ifdef ENABLE_BLUETOOTH
if (SerialBT.connected()){
SerialBT.print(encode_kiss(InputString));
}
#endif
#endif #endif
writedisplaytext(" ((RX))","",InputString,"","","",SHOW_RX_TIME); writedisplaytext(" ((RX))","",InputString,"","","",SHOW_RX_TIME);
} }
@ -483,7 +488,7 @@ void loop() {
if ( (lastTX+nextTX) <= millis() ) { if ( (lastTX+nextTX) <= millis() ) {
if (gps.location.age() < 2000) { if (gps.location.age() < 2000) {
digitalWrite(TXLED, HIGH); digitalWrite(TXLED, HIGH);
writedisplaytext(" ((TX))","","LAT: "+LatShown,"LON: "+LongShown,"SPD: "+String(gps.speed.kmph(),1)+" CRS: "+String(gps.course.deg(),1),"SAT: "+String(gps.satellites.value()),1); writedisplaytext(" ((TX))","","LAT: "+LatShown,"LON: "+LongShown,"SPD: "+String(gps.speed.kmph(),1)+" CRS: "+String(gps.course.deg(),1),getSatAndBatInfo(),1);
sendpacket(); sendpacket();
#ifdef SHOW_GPS_DATA #ifdef SHOW_GPS_DATA
Serial.print("((TX)) / LAT: "); Serial.print("((TX)) / LAT: ");
@ -506,7 +511,7 @@ void loop() {
}else{ }else{
if (gps.location.age() < 2000) { if (gps.location.age() < 2000) {
writedisplaytext(" "+Tcall,"Time to TX: "+String(((lastTX+nextTX)-millis())/1000)+"sec","LAT: "+LatShown,"LON: "+LongShown,"SPD: "+String(gps.speed.kmph(),1)+" CRS: "+String(gps.course.deg(),1),"SAT: "+String(gps.satellites.value()) + " BAT: "+String(BattVolts,1) +"V",1); writedisplaytext(" "+Tcall,"Time to TX: "+String(((lastTX+nextTX)-millis())/1000)+"sec","LAT: "+LatShown,"LON: "+LongShown,"SPD: "+String(gps.speed.kmph(),1)+" CRS: "+String(gps.course.deg(),1),getSatAndBatInfo() ,1);
} else { } else {
displayInvalidGPS(); displayInvalidGPS();
} }
@ -522,8 +527,18 @@ void handleKISSData(char character) {
} }
} }
String getSatAndBatInfo() {
String line5 = "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 1) + "V";
#ifdef ENABLE_BLUETOOTH
if (SerialBT.connected()){
line5 += "BT";
}
#endif
return line5;
}
void displayInvalidGPS() { void displayInvalidGPS() {
writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", "SAT: " + String(gps.satellites.value()) + " BAT: " + String(BattVolts, 1) + "V", 1); writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", getSatAndBatInfo(), 1);
#ifdef SHOW_GPS_DATA #ifdef SHOW_GPS_DATA
Serial.print("(TX) at valid GPS / LAT: not valid / Lon: not valid / SPD: --- / CRS: ---"); Serial.print("(TX) at valid GPS / LAT: not valid / Lon: not valid / SPD: --- / CRS: ---");
Serial.print(" / SAT: "); Serial.print(" / SAT: ");
@ -533,4 +548,5 @@ void displayInvalidGPS() {
#endif #endif
} }
// end of main loop // end of main loop