KISS_DEBUG option for testing axp192

pull/9/head
Łukasz Nidecki 2021-02-12 21:44:06 +01:00
parent 581a5dcd2f
commit 5df20e8ecd
4 changed files with 30 additions and 6 deletions

View File

@ -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){

View File

@ -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);

View File

@ -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) {

View File

@ -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 !!!