aboutsummaryrefslogtreecommitdiffstats
path: root/tracker-stm32
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-stm32')
-rw-r--r--tracker-stm32/platformio.ini2
-rw-r--r--tracker-stm32/src/main.cpp23
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);
}
}
}