aboutsummaryrefslogtreecommitdiffstats
path: root/tracker-stm32/src/main.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-08-19 10:56:55 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-08-19 10:56:55 +0200
commita3799852467cfe67f84767c958ac6c49c80ddd25 (patch)
treedc9b7b17507a69e1744b426e8d91cbae1de93866 /tracker-stm32/src/main.cpp
parent3048414f34d53ff8bc5eb9fe226a09898685020a (diff)
downloadlora-aprs-hb9egm-main.tar.gz
lora-aprs-hb9egm-main.tar.bz2
lora-aprs-hb9egm-main.zip
Test manual transmissionHEADmain
Diffstat (limited to 'tracker-stm32/src/main.cpp')
-rw-r--r--tracker-stm32/src/main.cpp23
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);
}
}
}