Cleanup pins
This commit is contained in:
@@ -242,6 +242,8 @@
|
|||||||
<option value="921600">921600</option>
|
<option value="921600">921600</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<button class="danger" onclick="doReset()" title="Pulse the target reset line">Reset</button>
|
||||||
|
<button onclick="doButton()" title="Pulse the target button / wake line">Button</button>
|
||||||
<button onclick="clearTerminal()">Clear</button>
|
<button onclick="clearTerminal()">Clear</button>
|
||||||
<button onclick="reconnect()">Reconnect</button>
|
<button onclick="reconnect()">Reconnect</button>
|
||||||
<button id="logBtn" onclick="toggleLog()">Log: --</button>
|
<button id="logBtn" onclick="toggleLog()">Log: --</button>
|
||||||
@@ -591,6 +593,15 @@
|
|||||||
return (bytes / 1024 / 1024).toFixed(1) + ' MB';
|
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 ----
|
// ---- SD logging controls ----
|
||||||
let logOn = false;
|
let logOn = false;
|
||||||
function toggleLog() {
|
function toggleLog() {
|
||||||
|
|||||||
+5
-3
@@ -83,9 +83,11 @@ build_flags =
|
|||||||
; --- target UART bridge (wire to the sensor's debug UART) ---
|
; --- target UART bridge (wire to the sensor's debug UART) ---
|
||||||
-DTARGET_RX_PIN=44 ; CONFIRM: dongle RX <- sensor TX
|
-DTARGET_RX_PIN=44 ; CONFIRM: dongle RX <- sensor TX
|
||||||
-DTARGET_TX_PIN=43 ; CONFIRM: dongle TX -> sensor RX
|
-DTARGET_TX_PIN=43 ; CONFIRM: dongle TX -> sensor RX
|
||||||
; --- GPIO control lines to the target (reset / wake) ---
|
; --- GPIO control lines to the target (reset out / button out) ---
|
||||||
-DGPIO_RESET_PIN=2 ; CONFIRM: -> sensor RST
|
; GPIO4 + GPIO12 are free, broken-out pins on the T3-S3. (Earlier 2/1 were
|
||||||
-DGPIO_WAKE_PIN=1 ; CONFIRM: -> sensor control/wake pin
|
; 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
|
-DGPIO_CTRL_ACTIVE_LOW=1
|
||||||
; --- microSD on FSPI/SPI2 (separate bus from LoRa, which uses HSPI/SPI3) ---
|
; --- microSD on FSPI/SPI2 (separate bus from LoRa, which uses HSPI/SPI3) ---
|
||||||
-DT3S3_SD_SCK=14
|
-DT3S3_SD_SCK=14
|
||||||
|
|||||||
+9
-7
@@ -364,7 +364,7 @@ void handleCommand(const char* line, Stream* reply) {
|
|||||||
const char* args = line[n] ? line + n + 1 : line + n;
|
const char* args = line[n] ? line + n + 1 : line + n;
|
||||||
|
|
||||||
if (!strcmp(verb, "help")) {
|
if (!strcmp(verb, "help")) {
|
||||||
reply->print("[help] ~status ~reset [ms] ~wake [ms] ~baud <n> "
|
reply->print("[help] ~status ~reset [ms] ~button [ms] ~baud <n> "
|
||||||
"~port <int|usb|ext> ~log on|off ~gpio <pin> <0|1>\r\n"
|
"~port <int|usb|ext> ~log on|off ~gpio <pin> <0|1>\r\n"
|
||||||
" ~mesh [on|off] ~psk <base64key> ~chan <name> <base64key> ~msg <text>\r\n"
|
" ~mesh [on|off] ~psk <base64key> ~chan <name> <base64key> ~msg <text>\r\n"
|
||||||
" (any non-~ line is sent to the target UART)\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);
|
printStatus(reply);
|
||||||
} else if (!strcmp(verb, "reset")) {
|
} else if (!strcmp(verb, "reset")) {
|
||||||
gpioPulse(GPIO_RESET_PIN, (uint32_t)strtoul(args, nullptr, 10), reply, "reset");
|
gpioPulse(GPIO_RESET_PIN, (uint32_t)strtoul(args, nullptr, 10), reply, "reset");
|
||||||
} else if (!strcmp(verb, "wake")) {
|
} else if (!strcmp(verb, "wake") || !strcmp(verb, "button")) {
|
||||||
gpioPulse(GPIO_WAKE_PIN, (uint32_t)strtoul(args, nullptr, 10), reply, "wake");
|
gpioPulse(GPIO_WAKE_PIN, (uint32_t)strtoul(args, nullptr, 10), reply, "button");
|
||||||
} else if (!strcmp(verb, "baud")) {
|
} else if (!strcmp(verb, "baud")) {
|
||||||
uint32_t b = strtoul(args, nullptr, 10);
|
uint32_t b = strtoul(args, nullptr, 10);
|
||||||
if (b) { setBaudRate(b); reply->printf("[ctrl] baud=%lu\r\n", (unsigned long)b); }
|
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");
|
gpioPulse(GPIO_RESET_PIN, ms, nullptr, "reset");
|
||||||
req->send(200, "text/plain", "reset pulsed\n");
|
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;
|
uint32_t ms = req->hasParam("ms") ? req->getParam("ms")->value().toInt() : 0;
|
||||||
gpioPulse(GPIO_WAKE_PIN, ms, nullptr, "wake");
|
gpioPulse(GPIO_WAKE_PIN, ms, nullptr, "button");
|
||||||
req->send(200, "text/plain", "wake pulsed\n");
|
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) {
|
server.on("/api/baud", HTTP_GET, [](AsyncWebServerRequest* req) {
|
||||||
if (req->hasParam("baud")) setBaudRate(req->getParam("baud")->value().toInt());
|
if (req->hasParam("baud")) setBaudRate(req->getParam("baud")->value().toInt());
|
||||||
req->send(200, "application/json", statusJson());
|
req->send(200, "application/json", statusJson());
|
||||||
|
|||||||
Reference in New Issue
Block a user