KISS_DEBUG option for testing axp192

pull/9/head
Łukasz Nidecki 2 years ago
parent 581a5dcd2f
commit 5df20e8ecd
  1. 8
      lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp
  2. 3
      lib/KISS_TO_TNC2/KISS_TO_TNC2.h
  3. 24
      src/TTGO_T-Beam_LoRa_APRS.ino
  4. 1
      src/TTGO_T-Beam_LoRa_APRS_config.h

@ -7,8 +7,6 @@ String decode_address_ax25(const String& ax25Address, bool &isLast);
bool validateKISSFrame(const String &kissFormattedFrame);
String encapsulateKISS(const String &ax25Frame);
String decapsulateKISS(const String& frame);
/*
@ -64,14 +62,14 @@ String encode_kiss(const String& tnc2FormattedFrame) {
ax25Frame += tnc2FormattedFrame.substring(tnc2FormattedFrame.indexOf(':')+1);
}
String kissFrame = encapsulateKISS(ax25Frame);
String kissFrame = encapsulateKISS(ax25Frame, CMD_DATA);
return kissFrame;
}
String encapsulateKISS(const String &ax25Frame) {
String encapsulateKISS(const String &ax25Frame, uint8_t TNCCmd) {
String kissFrame = "";
kissFrame += (char)FEND; // start of frame
kissFrame += (char)CMD_DATA; // TNC0, DATA
kissFrame += (char)(0x0f & TNCCmd); // TNC0, cmd
for (int i = 0; i < ax25Frame.length(); ++i) {
char currentChar = ax25Frame.charAt(i);
if (currentChar == (char)FEND){

@ -8,5 +8,6 @@
#define IS_LAST_ADDRESS_POSITION_MASK 0b1
String encode_kiss(const String& tnc2FormattedFrame);
String decode_kiss(const String& kissFormattedFrame);
String encapsulateKISS(const String &ax25Frame, uint8_t TNCCmd);

@ -514,6 +514,30 @@ void loop() {
displayInvalidGPS();
}
}
#ifdef KISS_PROTOCOLL
#ifdef KISS_DEBUG
static auto last_debug_send_time = millis();
if (millis() - last_debug_send_time > 1000*10) {
last_debug_send_time = millis();
String debug_message = "";
debug_message += "Bat V: " + String(axp.getBattVoltage());
debug_message += ", ";
debug_message += "Bat IN A: " + String(axp.getBattChargeCurrent());
debug_message += ", ";
debug_message += "Bat OUT A: " + String(axp.getBattDischargeCurrent());
debug_message += ", ";
debug_message += "Bat %: " + String(axp.getBattPercentage());
debug_message += ", ";
debug_message += "USB V: " + String(axp.getVbusVoltage());
debug_message += ", ";
debug_message += "USB A: " + String(axp.getVbusCurrent());
debug_message += ", ";
debug_message += "Temp C: " + String(axp.getTemp());
Serial.print(encapsulateKISS(debug_message, CMD_HARDWARE));
}
#endif
#endif
}
void handleKISSData(char character) {

@ -20,5 +20,6 @@
//#define SHOW_GPS_DATA // uncomment to show on serial port, received data from GPS and debug information
#define ENABLE_BLUETOOTH
//#define BLUETOOTH_PIN "0000"
#define KISS_DEBUG
unsigned long max_time_to_nextTX = 180000L; // TRANSMIT INTERVAL set here MAXIMUM time in ms(!) for smart beaconing - minimum time is always 1 min = 60 secs = 60000L !!!
Loading…
Cancel
Save