From 4bd22dd5db8eceb4f3cb65e1af11840a720c48e2 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Tue, 8 Dec 2020 08:16:58 +0800 Subject: [PATCH] ignore our own msgs for gpio ctrl --- docs/software/TODO.md | 15 +++++++++++---- src/plugins/RemoteHardwarePlugin.cpp | 13 ++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/software/TODO.md b/docs/software/TODO.md index 4901ad40..17bb2069 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,25 +4,32 @@ You probably don't care about this section - skip to the next one. For app cleanup: +* do fixed position bug +* DONE update android code: https://developer.android.com/topic/libraries/view-binding/migration +* make gpio watch work, use thread and setup +* make hello world example service +* make python ping command +* make python gpio read a bit cleaner * DONE have python tool check max packet size before sending to device -* if request was sent reliably, send reply reliably +* DONE if request was sent reliably, send reply reliably * DONE require a recent python api to talk to these new device loads * DONE require a recent android app to talk to these new device loads * DONE fix handleIncomingPosition * DONE move want_replies handling into plugins -* on android for received positions handle either old or new positions / user messages +* DONE on android for received positions handle either old or new positions / user messages * on android side send old or new positions as needed / user messages * test python side handle new position/user messages -* make a gpio example. --gpiowrb 5, --gpiord 0x444, --gpiowatch 0x3ff +* DONE make a gpio example. --gpiowrb 4 1, --gpiord 0x444, --gpiowatch 0x3ff * DONE fix position sending to use new plugin * DONE Add SinglePortNumPlugin - as the new most useful baseclass * DONE move positions into regular data packets (use new app framework) * DONE move user info into regular data packets (use new app framework) * test that positions, text messages and user info still work * test that position, text messages and user info work properly with new android app and old device code -* call the plugin setup functions * fix the RTC drift bug * move ping functionality into device, reply with rxsnr info +* use channels for gpio security https://github.com/meshtastic/Meshtastic-device/issues/104 +* implement GPIO watch For high speed/lots of devices/short range tasks: diff --git a/src/plugins/RemoteHardwarePlugin.cpp b/src/plugins/RemoteHardwarePlugin.cpp index eab0f125..11aaad23 100644 --- a/src/plugins/RemoteHardwarePlugin.cpp +++ b/src/plugins/RemoteHardwarePlugin.cpp @@ -10,16 +10,13 @@ RemoteHardwarePlugin remoteHardwarePlugin; #define NUM_GPIOS 64 -// A macro for clearing a struct, FIXME, move elsewhere -#define CLEAR_STRUCT(r) memset(&r, 0, sizeof(r)) - bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const HardwareMessage &p) { switch (p.typ) { case HardwareMessage_Type_WRITE_GPIOS: // Print notification to LCD screen - screen->print("Write GPIOs"); + screen->print("Write GPIOs\n"); for (uint8_t i = 0; i < NUM_GPIOS; i++) { uint64_t mask = 1 << i; @@ -29,9 +26,10 @@ bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const H } } break; + case HardwareMessage_Type_READ_GPIOS: { // Print notification to LCD screen - screen->print("Read GPIOs"); + screen->print("Read GPIOs\n"); uint64_t res = 0; for (uint8_t i = 0; i < NUM_GPIOS; i++) { @@ -52,6 +50,11 @@ bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const H service.sendToMesh(p); break; } + + case HardwareMessage_Type_READ_GPIOS_REPLY: + case HardwareMessage_Type_GPIOS_CHANGED: + break; // Ignore - we might see our own replies + default: DEBUG_MSG("Hardware operation %d not yet implemented! FIXME\n", p.typ); break;