Browse Source

Merge pull request #9 from Qyon/master_sq9mdd

KISS_DEBUG option for testing axp192
pull/11/head
Rysiek Labus 1 year ago committed by GitHub
parent
commit
36ffa679a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp
  2. 3
      lib/KISS_TO_TNC2/KISS_TO_TNC2.h
  3. 27
      src/TTGO_T-Beam_LoRa_APRS.ino
  4. 2
      src/TTGO_T-Beam_LoRa_APRS_config.h

8
lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp

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

3
lib/KISS_TO_TNC2/KISS_TO_TNC2.h

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

27
src/TTGO_T-Beam_LoRa_APRS.ino

@ -367,6 +367,9 @@ void setup(){
rf95.setTxPower(20); // was 5
delay(250);
#ifdef ENABLE_BLUETOOTH
#ifdef BLUETOOTH_PIN
SerialBT.setPin(BLUETOOTH_PIN);
#endif
SerialBT.begin(String("TTGO LORA APRS ") + CALLSIGN);
writedisplaytext("LoRa-APRS","","Init:","BT OK!","","",250);
#endif
@ -511,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) {

2
src/TTGO_T-Beam_LoRa_APRS_config.h

@ -19,5 +19,7 @@
#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
//#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