From a3799852467cfe67f84767c958ac6c49c80ddd25 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 19 Aug 2023 10:56:55 +0200 Subject: Test manual transmission --- tracker-stm32/platformio.ini | 2 +- tracker-stm32/src/main.cpp | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tracker-stm32/platformio.ini b/tracker-stm32/platformio.ini index 32ece90..1521b2c 100644 --- a/tracker-stm32/platformio.ini +++ b/tracker-stm32/platformio.ini @@ -9,7 +9,7 @@ lib_deps = jgromes/RadioLib@^6.0.0 mikalhart/TinyGPSPlus@1.0.3 arduino-libraries/SD@^1.2.4 -; koendv/STM32duino-Semihosting@1.0.5 +; koendv/STM32duino-Semihosting@1.0.5 ; USB VID/PID is Openmoko Neo1973 serial build_flags = diff --git a/tracker-stm32/src/main.cpp b/tracker-stm32/src/main.cpp index 7c2a273..9194454 100644 --- a/tracker-stm32/src/main.cpp +++ b/tracker-stm32/src/main.cpp @@ -257,8 +257,8 @@ void loop() lastGnssPoll = now; const int encoder_value = read_encoder(); - const bool btn1 = digitalRead(BTN1n) == 0; - digitalWrite(LED_TXn, not btn1); + const bool btn1_pressed = digitalRead(BTN1n) == 0; + digitalWrite(LED_TXn, not btn1_pressed); if (encoder_value == 1) { digitalWrite(EN_RX, HIGH); @@ -273,6 +273,23 @@ void loop() digitalWrite(EN_PA, LOW); } + if (btn1_pressed) { + digitalWrite(LED_TXn, LOW); + + init_report(); + report[report_len++] = ':'; + report[report_len++] = '>'; + const char* p = TEXT_REPORT; + while (*p) { + report[report_len++] = *(p++); + } + + int state = radio.transmit(report, report_len); + handle_radio_error(state); + + digitalWrite(LED_TXn, HIGH); + } + if (SerialUSB) { const long latitude = gps.location.lat(); SerialUSB.print(F("Lat ")); @@ -290,7 +307,7 @@ void loop() SerialUSB.print(encoder_value); SerialUSB.print(F(" BTN: ")); - SerialUSB.println((int)btn1); + SerialUSB.println((int)btn1_pressed); } } } -- cgit v1.2.3