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/src/main.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tracker-stm32/src') 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