diff options
Diffstat (limited to 'tracker-stm32/src/main.cpp')
-rw-r--r-- | tracker-stm32/src/main.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
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); } } } |