[examples] Fix PinScan telnet functionality

This commit is contained in:
Kuba Szczodrzyński
2022-08-01 11:28:56 +02:00
parent e9511c507a
commit 1b5d6472f7
3 changed files with 22 additions and 10 deletions

View File

@@ -56,17 +56,22 @@ static void irqHandler(void *ptr) {
}
static void digitalAllIrq() {
#if USE_WIFI
LT_I("Disabling logger");
lt_log_disable();
Serial.end();
#endif
for (pin_size_t i = 0; i < NUM_DIGITAL_PINS; i++) {
if (pinSkip[0] == i || pinSkip[1] == i) {
used[i] = false;
continue;
}
pinMode(i, INPUT);
// choose interrupt level according to current state
PinStatus status = digitalRead(i) ? FALLING : RISING;
attachInterruptParam(i, irqHandler, status, pins + i);
used[i] = true;
pins[i] = digitalRead(i);
used[i] = true;
// choose interrupt level according to current state
PinStatus status = pins[i] ? FALLING : RISING;
attachInterruptParam(i, irqHandler, status, pins + i);
}
active = true;
}
@@ -112,6 +117,11 @@ void digitalDetach() {
}
active = false;
pin = -1;
#if USE_WIFI
lt_log_set_port(LT_UART_DEFAULT_LOGGER);
Serial.begin(115200);
LT_I("Logger enabled");
#endif
}
void runDigital() {