Skip to content

Commit

Permalink
[NMEA] accept FTD-012 hexadecimal aircraft types as well
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Nov 11, 2024
1 parent 1d9aff0 commit 1e57e38
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 29 deletions.
25 changes: 22 additions & 3 deletions software/app/Settings/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script><!--

const version = 1;
const volume = 2;
// const volume = 2;
const pointer = 2;

// Compute NMEA checksum and display it
Expand All @@ -31,7 +31,7 @@
+ document.getElementById("actype").value + ","
+ document.getElementById("alarm").value + ","
+ document.getElementById("txpower").value + ","
+ volume + ","
+ document.getElementById("volume").value + ","
+ pointer + ","
+ document.getElementById("gnss").value + ","
+ document.getElementById("priv").value + ","
Expand Down Expand Up @@ -114,6 +114,13 @@
UpdateChecksum();
}

function SelVolume()
{
var volume = document.getElementById("Volumes");
document.getElementById("volume").value = volume.options[volume.selectedIndex].value;
UpdateChecksum();
}

function SelGNSS()
{
var gnss = document.getElementsByName('nmea_g');
Expand Down Expand Up @@ -217,8 +224,8 @@
document.getElementById("actype").value = 1;
document.getElementById("alarm").value = 1;
document.getElementById("txpower").value = 0;
document.getElementById("volume").value = 2;

// document.getElementById("volume").value = 0;
// document.getElementById("pointer").value = 0;

document.getElementById("gnss").value = 1;
Expand Down Expand Up @@ -336,6 +343,17 @@ <h1 align=center>Base settings</h1>
</td>
</tr>

<tr>
<th align=left>Volume</th>
<td align=right>
<select id="Volumes" onchange="SelVolume()">
<option value='0'>Loud</option>
<option value='1'>Low</option>
<option selected value='2'>Off</option>
</select>
</td>
</tr>

<tr>
<th align=left>NMEA sentences:</th>
</tr>
Expand Down Expand Up @@ -436,6 +454,7 @@ <h1 align=center>Base settings</h1>
<!-- A/C type: --><input type="hidden" id="actype" size="2">
<!-- Alarm: --><input type="hidden" id="alarm" size="1">
<!--<p> Tx power: --><input hidden="text" id="txpower" size="1">
<!-- Volume: --><input type="hidden" id="volume" size="1">
<!-- GNSS: --><input type="hidden" id="gnss" size="1">
<!-- Private: --><input type="hidden" id="priv" size="1">
<!-- Legacy: --><input type="hidden" id="legacy" size="1">
Expand Down
8 changes: 8 additions & 0 deletions software/firmware/source/SoftRF/src/driver/GNSS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,14 @@ static bool ag33_setup()
// Serial_GNSS_Out.write("$PAIR002*38\r\n"); /* Powers on the GNSS system */
// delay(250);

#if 0
// test why RMC is missing with SoftRF Tool over BLE (other software is fine)
Serial_GNSS_Out.write("$PAIR100,2,0*39\r\n"); /* NMEA 3.01 */ delay(250);
Serial_GNSS_Out.write("$PAIR400,0*22\r\n"); /* No DGPS */ delay(250);
#else
/* NMEA 0183 V4.10 and SBAS DGPS are enabled by default */
#endif

/* GPS + GLONASS + Galileo + BeiDou + QZSS */
Serial_GNSS_Out.write("$PAIR066,1,1,1,1,1,0*3B\r\n"); delay(250);

Expand Down
15 changes: 6 additions & 9 deletions software/firmware/source/SoftRF/src/platform/ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,10 @@ static void ESP32_setup()
lmic_pins.busy = SOC_GPIO_PIN_S3_BUSY;

#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_S3_DIO1;
if (esp32_board == ESP32_TTGO_T_BEAM_SUPREME) {
/* reserved for DIO 11 of HPD-16E */
lmic_pins.dio[0] = SOC_GPIO_PIN_S3_DIO1;
}
#endif /* USE_RADIOLIB */

int uSD_SS_pin = (esp32_board == ESP32_S3_DEVKIT) ?
Expand Down Expand Up @@ -1334,9 +1337,6 @@ static void ESP32_setup()
lmic_pins.nss = SOC_GPIO_PIN_HELTRK_SS;
lmic_pins.rst = SOC_GPIO_PIN_HELTRK_RST;
lmic_pins.busy = SOC_GPIO_PIN_HELTRK_BUSY;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_HELTRK_DIO1;
#endif /* USE_RADIOLIB */

} else if (esp32_board == ESP32_LILYGO_T3S3_EPD) {

Expand All @@ -1355,7 +1355,7 @@ static void ESP32_setup()
lmic_pins.txe = SOC_GPIO_PIN_T3S3_ANT_TX;
lmic_pins.rxe = SOC_GPIO_PIN_T3S3_ANT_RX;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_T3S3_DIO1;
lmic_pins.dio[0] = SOC_GPIO_PIN_T3S3_DIO1; /* reserved for HPD-16E */
#endif /* USE_RADIOLIB */

int uSD_SS_pin = SOC_GPIO_PIN_T3S3_SD_SS;
Expand Down Expand Up @@ -1410,7 +1410,7 @@ static void ESP32_setup()
lmic_pins.rst = SOC_GPIO_PIN_C6_RST;
lmic_pins.busy = SOC_GPIO_PIN_C6_TXE;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_C6_CE;
lmic_pins.dio[0] = SOC_GPIO_PIN_C6_CE; /* Ebyte E80 */
#endif /* USE_RADIOLIB */

} else if (esp32_board == ESP32_LILYGO_T3C6) {
Expand All @@ -1428,9 +1428,6 @@ static void ESP32_setup()
lmic_pins.busy = SOC_GPIO_PIN_T3C6_BUSY;
lmic_pins.txe = SOC_GPIO_PIN_T3C6_ANT_TX;
lmic_pins.rxe = SOC_GPIO_PIN_T3C6_ANT_RX;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_T3C6_DIO1;
#endif /* USE_RADIOLIB */
#endif /* CONFIG_IDF_TARGET_ESP32C6 */
}

Expand Down
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/platform/ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ extern const USB_Device_List_t supported_USB_devices[];
//#define USE_NIMBLE
#define USE_ARDUINOBLE
#if defined(CONFIG_IDF_TARGET_ESP32C6)
#define USE_RADIOLIB
//#define USE_RADIOLIB
#endif /* C6 */
#endif /* C2 || C6 || H2 */
#endif /* SX || CX || H2 */
Expand Down
15 changes: 3 additions & 12 deletions software/firmware/source/SoftRF/src/platform/nRF52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,6 @@ static void nRF52_setup()
ledOff(SOC_GPIO_LED_TECHO_REV_0_BLUE);

lmic_pins.rst = SOC_GPIO_PIN_TECHO_REV_0_RST;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_DIO1;
#endif /* USE_RADIOLIB */

hw_info.revision = 0;
break;
Expand All @@ -1085,9 +1082,6 @@ static void nRF52_setup()
ledOff(SOC_GPIO_LED_TECHO_REV_1_BLUE);

lmic_pins.rst = SOC_GPIO_PIN_TECHO_REV_1_RST;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_DIO1;
#endif /* USE_RADIOLIB */

hw_info.revision = 1;
break;
Expand All @@ -1109,7 +1103,7 @@ static void nRF52_setup()

lmic_pins.rst = SOC_GPIO_PIN_TECHO_REV_2_RST;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_DIO1;
lmic_pins.dio[0] = SOC_GPIO_PIN_DIO1; /* reserved for DIO11 of HPD-16E */
#endif /* USE_RADIOLIB */

hw_info.revision = 2;
Expand All @@ -1120,7 +1114,7 @@ static void nRF52_setup()
lmic_pins.rst = SOC_GPIO_PIN_TULTIMA_RST;
lmic_pins.busy = SOC_GPIO_PIN_TULTIMA_BUSY;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_TULTIMA_DIO1;
lmic_pins.dio[0] = SOC_GPIO_PIN_TULTIMA_DIO1; /* DIO 9 or 11 of HPD-16E */
#endif /* USE_RADIOLIB */

#if defined(ENABLE_RECORDER)
Expand Down Expand Up @@ -1170,7 +1164,7 @@ static void nRF52_setup()
lmic_pins.rst = SOC_GPIO_PIN_T1000_RST;
lmic_pins.busy = SOC_GPIO_PIN_T1000_BUSY;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_T1000_DIO9;
lmic_pins.dio[0] = SOC_GPIO_PIN_T1000_DIO9; /* LR1110 */
#endif /* USE_RADIOLIB */

hw_info.revision = 3; /* Unknown */
Expand All @@ -1193,9 +1187,6 @@ static void nRF52_setup()
lmic_pins.nss = SOC_GPIO_PIN_T114_SS;
lmic_pins.rst = SOC_GPIO_PIN_T114_RST;
lmic_pins.busy = SOC_GPIO_PIN_T114_BUSY;
#if defined(USE_RADIOLIB)
lmic_pins.dio[0] = SOC_GPIO_PIN_T114_DIO1;
#endif /* USE_RADIOLIB */

hw_info.revision = 3; /* Unknown */
break;
Expand Down
8 changes: 7 additions & 1 deletion software/firmware/source/SoftRF/src/protocol/data/NMEA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,13 @@ void NMEA_Process_SRF_SKV_Sentences()
}
if (C_AcftType.isUpdated())
{
settings->aircraft_type = atoi(C_AcftType.value());
const char *ac_type = C_AcftType.value();
/* accept FTD-012 hexadecimal aircraft types as well */
if (strlen(ac_type) == 1 && ac_type[0] >= 'A' && ac_type[0] <= 'F') {
settings->aircraft_type = 10 + (ac_type[0] - 'A');
} else {
settings->aircraft_type = atoi(ac_type);
}
Serial.print(F("AcftType = ")); Serial.println(settings->aircraft_type);
cfg_is_updated = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ static void hal_io_init () {
ASSERT(lmic_pins.nss != LMIC_UNUSED_PIN);

#if defined(BRD_sx1272_radio) || defined(BRD_sx1276_radio)
//ASSERT(lmic_pins.dio[0] != LMIC_UNUSED_PIN);
//ASSERT(lmic_pins.dio[1] != LMIC_UNUSED_PIN || lmic_pins.dio[2] != LMIC_UNUSED_PIN);
// ASSERT(lmic_pins.dio[0] != LMIC_UNUSED_PIN);
// ASSERT(lmic_pins.dio[1] != LMIC_UNUSED_PIN || lmic_pins.dio[2] != LMIC_UNUSED_PIN);
#elif defined(BRD_sx1261_radio) || defined(BRD_sx1262_radio)
ASSERT(lmic_pins.dio[0] == LMIC_UNUSED_PIN);
// ASSERT(lmic_pins.dio[0] == LMIC_UNUSED_PIN);
ASSERT(lmic_pins.dio[1] == LMIC_UNUSED_PIN);
ASSERT(lmic_pins.dio[2] == LMIC_UNUSED_PIN);
#else
Expand Down

0 comments on commit 1e57e38

Please sign in to comment.