GPIO15 als Pullup für Relaiseingang
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
This commit is contained in:
@@ -451,7 +451,16 @@ void SensorMesh::handleCommand(uint32_t sender_timestamp, char* command, char* r
|
||||
} else {
|
||||
strcpy(reply, "Err - invalid pin");
|
||||
}
|
||||
} else{
|
||||
} else if (memcmp(command, "bin", 3) == 0) {
|
||||
uint32_t gpio_state = board.getGpio(); // 32-Bit-GPIO-Zustand auslesen
|
||||
// Initialisiere reply mit Nullen, um sicherzustellen, dass es sauber ist
|
||||
memset(reply, 0, 33); // 32 Zeichen + Null-Terminator
|
||||
// Binärstring erstellen (Bit 31 bis Bit 0)
|
||||
for (int i = 0; i < 32; i++) {
|
||||
reply[31 - i] = (gpio_state & (1 << i)) ? '1' : '0';
|
||||
}
|
||||
reply[32] = '\0'; // Null-Terminator explizit setzen
|
||||
} else {
|
||||
_cli.handleCommand(sender_timestamp, command, reply); // common CLI commands
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user