diff --git a/data/index.html b/data/index.html
index 2392bf1..72c8c76 100644
--- a/data/index.html
+++ b/data/index.html
@@ -242,6 +242,8 @@
+
+
@@ -591,6 +593,15 @@
return (bytes / 1024 / 1024).toFixed(1) + ' MB';
}
+ // ---- Target control lines (reset / button) ----
+ function pulseLine(path, label) {
+ fetch(path + '?ms=200').then(r => r.text())
+ .then(t => term.writeln(`\r\n\x1b[33m[${label}] ${t.trim()}\x1b[0m`))
+ .catch(() => term.writeln(`\r\n\x1b[31m[${label} failed]\x1b[0m`));
+ }
+ function doReset() { pulseLine('/api/reset', 'reset'); }
+ function doButton() { pulseLine('/api/button', 'button'); }
+
// ---- SD logging controls ----
let logOn = false;
function toggleLog() {
diff --git a/platformio.ini b/platformio.ini
index 533c925..6c40413 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -83,9 +83,11 @@ build_flags =
; --- target UART bridge (wire to the sensor's debug UART) ---
-DTARGET_RX_PIN=44 ; CONFIRM: dongle RX <- sensor TX
-DTARGET_TX_PIN=43 ; CONFIRM: dongle TX -> sensor RX
- ; --- GPIO control lines to the target (reset / wake) ---
- -DGPIO_RESET_PIN=2 ; CONFIRM: -> sensor RST
- -DGPIO_WAKE_PIN=1 ; CONFIRM: -> sensor control/wake pin
+ ; --- GPIO control lines to the target (reset out / button out) ---
+ ; GPIO4 + GPIO12 are free, broken-out pins on the T3-S3. (Earlier 2/1 were
+ ; wrong: GPIO2 is the SD MISO and GPIO1 is the battery-ADC pin.)
+ -DGPIO_RESET_PIN=4 ; -> sensor RST (active-low pulse)
+ -DGPIO_WAKE_PIN=12 ; -> sensor button/wake (active-low pulse)
-DGPIO_CTRL_ACTIVE_LOW=1
; --- microSD on FSPI/SPI2 (separate bus from LoRa, which uses HSPI/SPI3) ---
-DT3S3_SD_SCK=14
diff --git a/src/main.cpp b/src/main.cpp
index d83d964..5bdc9fb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -364,7 +364,7 @@ void handleCommand(const char* line, Stream* reply) {
const char* args = line[n] ? line + n + 1 : line + n;
if (!strcmp(verb, "help")) {
- reply->print("[help] ~status ~reset [ms] ~wake [ms] ~baud "
+ reply->print("[help] ~status ~reset [ms] ~button [ms] ~baud "
"~port ~log on|off ~gpio <0|1>\r\n"
" ~mesh [on|off] ~psk ~chan ~msg \r\n"
" (any non-~ line is sent to the target UART)\r\n");
@@ -372,8 +372,8 @@ void handleCommand(const char* line, Stream* reply) {
printStatus(reply);
} else if (!strcmp(verb, "reset")) {
gpioPulse(GPIO_RESET_PIN, (uint32_t)strtoul(args, nullptr, 10), reply, "reset");
- } else if (!strcmp(verb, "wake")) {
- gpioPulse(GPIO_WAKE_PIN, (uint32_t)strtoul(args, nullptr, 10), reply, "wake");
+ } else if (!strcmp(verb, "wake") || !strcmp(verb, "button")) {
+ gpioPulse(GPIO_WAKE_PIN, (uint32_t)strtoul(args, nullptr, 10), reply, "button");
} else if (!strcmp(verb, "baud")) {
uint32_t b = strtoul(args, nullptr, 10);
if (b) { setBaudRate(b); reply->printf("[ctrl] baud=%lu\r\n", (unsigned long)b); }
@@ -563,11 +563,13 @@ void setupWebServer() {
gpioPulse(GPIO_RESET_PIN, ms, nullptr, "reset");
req->send(200, "text/plain", "reset pulsed\n");
});
- server.on("/api/wake", HTTP_GET, [](AsyncWebServerRequest* req) {
+ auto pulseButton = [](AsyncWebServerRequest* req) {
uint32_t ms = req->hasParam("ms") ? req->getParam("ms")->value().toInt() : 0;
- gpioPulse(GPIO_WAKE_PIN, ms, nullptr, "wake");
- req->send(200, "text/plain", "wake pulsed\n");
- });
+ gpioPulse(GPIO_WAKE_PIN, ms, nullptr, "button");
+ req->send(200, "text/plain", "button pulsed\n");
+ };
+ server.on("/api/button", HTTP_GET, pulseButton);
+ server.on("/api/wake", HTTP_GET, pulseButton); // back-compat alias
server.on("/api/baud", HTTP_GET, [](AsyncWebServerRequest* req) {
if (req->hasParam("baud")) setBaudRate(req->getParam("baud")->value().toInt());
req->send(200, "application/json", statusJson());