Skip to content

Commit

Permalink
APRS: allow use of SSID with 'FromCall' (when able)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Oct 23, 2023
1 parent 14a51f0 commit 8cc4726
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 22 deletions.
23 changes: 19 additions & 4 deletions software/firmware/source/SoftRF/src/driver/RF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,16 @@ cppQueue PacketBuffer(sizeof(AX25Msg), 5, FIFO);
void aprs_msg_callback(struct AX25Msg *msg) {
AX25Msg pkg;
memcpy(&pkg, msg, sizeof(AX25Msg));

// trim off a multiline message
for (int i = 0; i < pkg.len; i++) {
if (pkg.info[i] == '\n' || pkg.info[i] == '\r') {
pkg.info[i] = 0;
pkg.len = i;
break;
}
}

PacketBuffer.push(&pkg);
}

Expand Down Expand Up @@ -2476,6 +2486,15 @@ static void sa8x8_setup()
APRS_setTail(aprs_tail);
APRS_setSymbol('\'');

/* AX25 library used is not 100% ready for SSID feature yet */
if (strlen(APRS_FromCall) > 6) {
APRS_FromCall[6] = 0;
}

// We don't need to set the destination identifier, but
// if you want to, this is how you do it:
// APRS_setDestination("APSRF1", 0);

if (hw_info.model == SOFTRF_MODEL_HAM) {
#if defined(USE_NEOPIXELBUS_LIBRARY)
TWR2_Pixel.SetPixelColor(0, rx ? LED_COLOR_GREEN: LED_COLOR_BLACK);
Expand All @@ -2485,10 +2504,6 @@ static void sa8x8_setup()

APRS_setTxLEDCallback(sa868_Tx_LED_state);

// You don't need to set the destination identifier, but
// if you want to, this is how you do it:
// APRS_setDestination("APZMDM", 0);

if (rx) {
AFSK_TimerEnable(true);
}
Expand Down
21 changes: 12 additions & 9 deletions software/firmware/source/SoftRF/src/platform/ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ static void ESP32_setup()
* TTGO T22 V06 | | WINBOND_NEX_W25Q32_V
* TTGO T22 V08 | | WINBOND_NEX_W25Q32_V
* TTGO T22 V11 | | BOYA_BY25Q32AL
* TTGO T22 V12 | | WINBOND_NEX_W25Q32_V
* TTGO T8 V1.8 | WROVER | GIGADEVICE_GD25LQ32
* TTGO T8 S2 V1.1 | | WINBOND_NEX_W25Q32_V
* TTGO T5S V1.9 | | WINBOND_NEX_W25Q32_V
Expand Down Expand Up @@ -1472,6 +1473,7 @@ static void ESP32_setup()
CALIBRATE_ONE(RTC_CAL_32K_XTAL);
if (rtc_clk_slow_freq_get() != RTC_SLOW_FREQ_32K_XTAL) {
DEBUG_X32K("Warning: Failed to switch RTC clock source onto 32768 Hz XTAL !");
rtc_clk_32k_enable(false);
} else {
ESP32_has_32k_xtal = true;
}
Expand All @@ -1485,15 +1487,16 @@ static void ESP32_setup()
digitalWrite(SOC_GPIO_PIN_HELTRK_TFT_EN, LOW);
digitalWrite(SOC_GPIO_PIN_HELTRK_VEXT_EN, LOW);

pinMode(SOC_GPIO_PIN_HELTRK_GNSS_EN, INPUT_PULLDOWN);
delay(300);
pinMode(SOC_GPIO_PIN_HELTRK_GNSS_EN, OUTPUT);
pinMode(SOC_GPIO_PIN_HELTRK_TFT_EN, OUTPUT);
pinMode(SOC_GPIO_PIN_HELTRK_VEXT_EN, OUTPUT);
}

digitalWrite(SOC_GPIO_PIN_HELTRK_GNSS_RST, LOW);
pinMode(SOC_GPIO_PIN_HELTRK_GNSS_RST, OUTPUT);
pinMode(SOC_GPIO_PIN_HELTRK_GNSS_RST, INPUT_PULLDOWN);
delay(100);
digitalWrite(SOC_GPIO_PIN_HELTRK_GNSS_RST, HIGH);
pinMode(SOC_GPIO_PIN_HELTRK_GNSS_RST, INPUT_PULLUP);

pinMode(SOC_GPIO_PIN_HELTRK_ADC_EN, INPUT_PULLUP);

Expand Down Expand Up @@ -1927,10 +1930,10 @@ static void ESP32_loop()
}
#endif /* !EXCLUDE_MAG */

if (esp32_board == ESP32_HELTEC_TRACKER) {
digitalWrite(SOC_GPIO_PIN_HELTRK_LED,
digitalRead(SOC_GPIO_PIN_HELTRK_GNSS_PPS));
}
// if (esp32_board == ESP32_HELTEC_TRACKER) {
// digitalWrite(SOC_GPIO_PIN_HELTRK_LED,
// digitalRead(SOC_GPIO_PIN_HELTRK_GNSS_PPS));
// }
#endif /* CONFIG_IDF_TARGET_ESP32S3 */
}

Expand Down Expand Up @@ -2689,14 +2692,14 @@ static void ESP32_EEPROM_extension(int cmd)
JsonVariant fromcall = root["fromcall"];
if (fromcall.success()) {
const char * fromcall_s = fromcall.as<char*>();
if (strlen(fromcall_s) <= 6) {
if (strlen(fromcall_s) < sizeof(APRS_FromCall)) {
strncpy(APRS_FromCall, fromcall_s, sizeof(APRS_FromCall));
}
}
JsonVariant tocall = root["tocall"];
if (tocall.success()) {
const char * tocall_s = tocall.as<char*>();
if (strlen(tocall_s) <= 6) {
if (strlen(tocall_s) < sizeof(APRS_ToCall)) {
strncpy(APRS_ToCall, tocall_s, sizeof(APRS_ToCall));
}
}
Expand Down
4 changes: 3 additions & 1 deletion software/firmware/source/SoftRF/src/platform/ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ extern Adafruit_NeoPixel strip;
#error "This ESP32 family build variant is not supported!"
#endif

#define SOC_GPIO_PIN_STATUS (hw_info.model != SOFTRF_MODEL_PRIME_MK2 ?\
#define SOC_GPIO_PIN_STATUS (hw_info.model == SOFTRF_MODEL_MIDI ?\
SOC_GPIO_PIN_HELTRK_LED : \
hw_info.model != SOFTRF_MODEL_PRIME_MK2 ?\
SOC_UNUSED_PIN : \
(hw_info.revision == 2 ? \
SOC_GPIO_PIN_TBEAM_LED_V02 : \
Expand Down
4 changes: 2 additions & 2 deletions software/firmware/source/SoftRF/src/platform/RP2040.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,14 +751,14 @@ static void RP2040_EEPROM_extension(int cmd)
JsonVariant fromcall = root["fromcall"];
if (fromcall.success()) {
const char * fromcall_s = fromcall.as<char*>();
if (strlen(fromcall_s) <= 6) {
if (strlen(fromcall_s) < sizeof(APRS_FromCall)) {
strncpy(APRS_FromCall, fromcall_s, sizeof(APRS_FromCall));
}
}
JsonVariant tocall = root["tocall"];
if (tocall.success()) {
const char * tocall_s = tocall.as<char*>();
if (strlen(tocall_s) <= 6) {
if (strlen(tocall_s) < sizeof(APRS_ToCall)) {
strncpy(APRS_ToCall, tocall_s, sizeof(APRS_ToCall));
}
}
Expand Down
4 changes: 2 additions & 2 deletions software/firmware/source/SoftRF/src/platform/nRF52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1210,14 +1210,14 @@ static void nRF52_EEPROM_extension(int cmd)
JsonVariant fromcall = root["fromcall"];
if (fromcall.success()) {
const char * fromcall_s = fromcall.as<char*>();
if (strlen(fromcall_s) <= 6) {
if (strlen(fromcall_s) < sizeof(APRS_FromCall)) {
strncpy(APRS_FromCall, fromcall_s, sizeof(APRS_FromCall));
}
}
JsonVariant tocall = root["tocall"];
if (tocall.success()) {
const char * tocall_s = tocall.as<char*>();
if (strlen(tocall_s) <= 6) {
if (strlen(tocall_s) < sizeof(APRS_ToCall)) {
strncpy(APRS_ToCall, tocall_s, sizeof(APRS_ToCall));
}
}
Expand Down
4 changes: 2 additions & 2 deletions software/firmware/source/SoftRF/src/protocol/radio/APRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ extern AX25Msg Incoming_APRS_Packet;
struct pbuf_t aprs;
ParseAPRS aprsParse;

char APRS_FromCall[7] = "";
char APRS_ToCall [7] = "OGFLR"; // TODO: make use of assigned APSRFx value
char APRS_FromCall[10] = "";
char APRS_ToCall [ 7] = "OGFLR"; // TODO: make use of assigned APSRFx value

int packet2Raw(String &tnc2, AX25Msg &Packet) {
if (Packet.len < 5) return 0;
Expand Down
4 changes: 2 additions & 2 deletions software/firmware/source/SoftRF/src/protocol/radio/APRS.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ size_t aprs_encode(void *, ufo_t *);

extern const rf_proto_desc_t prol_proto_desc;

extern char APRS_FromCall[7];
extern char APRS_ToCall [7];
extern char APRS_FromCall[10];
extern char APRS_ToCall [ 7];

#endif /* PROTOCOL_APRS_H */

0 comments on commit 8cc4726

Please sign in to comment.