From 2561742683f62881c5b675e409a60c5af575d214 Mon Sep 17 00:00:00 2001 From: Jm Date: Wed, 27 Jan 2021 18:56:09 -0800 Subject: [PATCH 01/16] #664 - Blink the LED when we enter disablePin() --- src/nimble/BluetoothUtil.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/nimble/BluetoothUtil.cpp b/src/nimble/BluetoothUtil.cpp index f5f1f77e..1416453b 100644 --- a/src/nimble/BluetoothUtil.cpp +++ b/src/nimble/BluetoothUtil.cpp @@ -10,6 +10,7 @@ #include "nimble/NimbleDefs.h" #include "services/gap/ble_svc_gap.h" #include "services/gatt/ble_svc_gatt.h" +#include "sleep.h" #include #include @@ -226,16 +227,14 @@ static int gap_event(struct ble_gap_event *event, void *arg) if (event->passkey.params.action == BLE_SM_IOACT_DISP) { pkey.action = event->passkey.params.action; - DEBUG_MSG("dp: %d now:%d\n",doublepressed, now); - if (doublepressed > 0 && (doublepressed + (30*1000)) > now) - { + DEBUG_MSG("dp: %d now:%d\n", doublepressed, now); + if (doublepressed > 0 && (doublepressed + (30 * 1000)) > now) { DEBUG_MSG("User has overridden passkey or no display available\n"); - pkey.passkey = defaultBLEPin; - } - else { + pkey.passkey = defaultBLEPin; + } else { DEBUG_MSG("Using random passkey\n"); pkey.passkey = random( - 100000, 999999); // This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits + 100000, 999999); // This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits } DEBUG_MSG("*** Enter passkey %d on the peer side ***\n", pkey.passkey); @@ -395,7 +394,6 @@ void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg) } } - /** * A helper function that implements simple read and write handling for a uint32_t * @@ -449,8 +447,7 @@ int chr_readwrite8(uint8_t *v, size_t vlen, struct ble_gatt_access_ctxt *ctxt) if (len < vlen) { DEBUG_MSG("Error: wrongsized write\n"); return BLE_ATT_ERR_UNLIKELY; - } - else { + } else { DEBUG_MSG("BLE writing bytes\n"); } } else { @@ -465,7 +462,21 @@ void disablePin() { DEBUG_MSG("User Override, disabling bluetooth pin requirement\n"); // keep track of when it was pressed, so we know it was within X seconds - doublepressed = millis(); + + // Flash the LED + setLed(true); + delay(100); + setLed(false); + delay(100); + setLed(true); + delay(100); + setLed(false); + delay(100); + setLed(true); + delay(100); + setLed(false); + + doublepressed = millis(); } // This routine is called multiple times, once each time we come back from sleep @@ -549,7 +560,7 @@ void setBluetoothEnable(bool on) firstTime = 0; } else { #ifndef NO_ESP32 - initWifi(0); + initWifi(0); #endif } } else { From eff0c1fe892e9b70f4bb4b889aedda31495dd627 Mon Sep 17 00:00:00 2001 From: Jm Date: Wed, 27 Jan 2021 19:18:16 -0800 Subject: [PATCH 02/16] #654 - Partial work for the LED/Speaker. Framework is done. Just need to blink a few things and update protobufs. --- src/plugins/ExternalNotificationPlugin.cpp | 108 +++++++++++++++++++++ src/plugins/ExternalNotificationPlugin.h | 43 ++++++++ src/plugins/Plugins.cpp | 5 +- 3 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 src/plugins/ExternalNotificationPlugin.cpp create mode 100644 src/plugins/ExternalNotificationPlugin.h diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp new file mode 100644 index 00000000..f2cee7cf --- /dev/null +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -0,0 +1,108 @@ +#include "ExternalNotificationPlugin.h" +#include "MeshService.h" +#include "NodeDB.h" +#include "RTC.h" +#include "Router.h" +#include "configuration.h" +#include + +#include + +/* + + bool ext_notification_plugin_enabled = 126; + uint32 ext_notification_plugin_output_ms = 127; + uint32 ext_notification_plugin_output = 128; + bool ext_notification_plugin_active = 129; + bool ext_notification_plugin_alert_message = 130; + bool ext_notification_plugin_alert_bell = 131; + +*/ + +ExternalNotificationPlugin *externalNotificationPlugin; +ExternalNotificationPluginRadio *externalNotificationPluginRadio; + +ExternalNotificationPlugin::ExternalNotificationPlugin() : concurrency::OSThread("ExternalNotificationPlugin") {} + +int32_t ExternalNotificationPlugin::runOnce() +{ +#ifndef NO_ESP32 + + /* + Uncomment the preferences below if you want to use the plugin + without having to configure it from the PythonAPI or WebUI. + */ + + // radioConfig.preferences.externalnotificationplugin_enabled = 1; + // radioConfig.preferences.externalnotificationplugin_mode = 1; + + if (0) { + + if (firstTime) { + + DEBUG_MSG("Initializing External Notification Plugin\n"); + + externalNotificationPluginRadio = new ExternalNotificationPluginRadio(); + + firstTime = 0; + + } else { + /* + + 1) If GPIO is turned on ... + 2) Check the timer. If the timer has elapsed more time than + our set limit, turn the GPIO off. + + */ + } + + return (25); + } else { + DEBUG_MSG("External Notification Plugin Disabled\n"); + + return (INT32_MAX); + } + +#endif +} + +// -------- + +MeshPacket *ExternalNotificationPluginRadio::allocReply() +{ + + auto reply = allocDataPacket(); // Allocate a packet for sending + + return reply; +} + +bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) +{ +#ifndef NO_ESP32 + + if (0) { + + auto &p = mp.decoded.data; + + if (mp.from != nodeDB.getNodeNum()) { + + /* + TODO: If ext_notification_plugin_alert_bell is true and we see a bell character, trigger an external notification. + */ + // TODO: Check p.payload.bytes to see if it contains a bell character. If it does, trigger an external notifcation. + + /* + TODO: If ext_notification_plugin_alert_message is true, trigger an external notification. + */ + // TODO: On received packet, blink the LED. + + } + + } else { + DEBUG_MSG("External Notification Plugin Disabled\n"); + } + +#endif + + return true; // Let others look at this message also if they want +} diff --git a/src/plugins/ExternalNotificationPlugin.h b/src/plugins/ExternalNotificationPlugin.h new file mode 100644 index 00000000..b8eeffe4 --- /dev/null +++ b/src/plugins/ExternalNotificationPlugin.h @@ -0,0 +1,43 @@ +#pragma once + +#include "SinglePortPlugin.h" +#include "concurrency/OSThread.h" +#include "configuration.h" +#include +#include + + +class ExternalNotificationPlugin : private concurrency::OSThread +{ + bool firstTime = 1; + + public: + ExternalNotificationPlugin(); + + protected: + virtual int32_t runOnce(); +}; + +extern ExternalNotificationPlugin *externalNotificationPlugin; + +/* + * Radio interface for ExternalNotificationPlugin + * + */ +class ExternalNotificationPluginRadio : public SinglePortPlugin +{ + + public: + ExternalNotificationPluginRadio() : SinglePortPlugin("ExternalNotificationPluginRadio", PortNum_TEXT_MESSAGE_APP) {} + + protected: + virtual MeshPacket *allocReply(); + + /** Called to handle a particular incoming message + + @return true if you've guaranteed you've handled this message and no other handlers should be considered for it + */ + virtual bool handleReceived(const MeshPacket &mp); +}; + +extern ExternalNotificationPluginRadio *externalNotificationPluginRadio; \ No newline at end of file diff --git a/src/plugins/Plugins.cpp b/src/plugins/Plugins.cpp index 096b9cf5..90a1b554 100644 --- a/src/plugins/Plugins.cpp +++ b/src/plugins/Plugins.cpp @@ -1,3 +1,4 @@ +#include "plugins/ExternalNotificationPlugin.h" #include "plugins/NodeInfoPlugin.h" #include "plugins/PositionPlugin.h" #include "plugins/RemoteHardwarePlugin.h" @@ -23,7 +24,7 @@ void setupPlugins() #ifndef NO_ESP32 // Only run on an esp32 based device. - new SerialPlugin(); // Maintained by MC Hamster (Jm Casler) jm@casler.org + new SerialPlugin(); // Maintained by MC Hamster (Jm Casler) jm@casler.org + new ExternalNotificationPlugin(); // Maintained by MC Hamster (Jm Casler) jm@casler.org #endif - } \ No newline at end of file From 2246564279ad41265a2b5e8a51d14036b1bb479a Mon Sep 17 00:00:00 2001 From: Jm Date: Wed, 27 Jan 2021 20:06:39 -0800 Subject: [PATCH 03/16] #654 - Small changes. --- src/plugins/ExternalNotificationPlugin.cpp | 38 ++++++++++++++++++++-- src/plugins/ExternalNotificationPlugin.h | 3 ++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index f2cee7cf..fe5a57ae 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -36,7 +36,7 @@ int32_t ExternalNotificationPlugin::runOnce() // radioConfig.preferences.externalnotificationplugin_enabled = 1; // radioConfig.preferences.externalnotificationplugin_mode = 1; - if (0) { + if (1) { if (firstTime) { @@ -46,6 +46,16 @@ int32_t ExternalNotificationPlugin::runOnce() firstTime = 0; + // Set the direction of a pin + pinMode(13, OUTPUT); + + // if ext_notification_plugin_active + if (1) { + setExternalOff(); + } else { + setExternalOn(); + } + } else { /* @@ -66,6 +76,27 @@ int32_t ExternalNotificationPlugin::runOnce() #endif } +void ExternalNotificationPlugin::setExternalOn() +{ + // if ext_notification_plugin_active + if (1) { + digitalWrite(13, true); + + } else { + digitalWrite(13, false); + } +} + +void ExternalNotificationPlugin::setExternalOff() +{ + // if ext_notification_plugin_active + if (1) { + digitalWrite(13, false); + } else { + digitalWrite(13, true); + } +} + // -------- MeshPacket *ExternalNotificationPluginRadio::allocReply() @@ -80,7 +111,7 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) { #ifndef NO_ESP32 - if (0) { + if (1) { auto &p = mp.decoded.data; @@ -95,6 +126,9 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) TODO: If ext_notification_plugin_alert_message is true, trigger an external notification. */ // TODO: On received packet, blink the LED. + externalNotificationPlugin->setExternalOn(); + delay(500); + externalNotificationPlugin->setExternalOff(); } diff --git a/src/plugins/ExternalNotificationPlugin.h b/src/plugins/ExternalNotificationPlugin.h index b8eeffe4..54474834 100644 --- a/src/plugins/ExternalNotificationPlugin.h +++ b/src/plugins/ExternalNotificationPlugin.h @@ -14,6 +14,9 @@ class ExternalNotificationPlugin : private concurrency::OSThread public: ExternalNotificationPlugin(); + void setExternalOn(); + void setExternalOff(); + protected: virtual int32_t runOnce(); }; From 5e303f8a1f7b7993210555a43d365ab7d7154c82 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 27 Jan 2021 21:20:18 -0800 Subject: [PATCH 04/16] #654 - Work in progress. Needs testing, non-blocking alert and integration with configuration --- src/plugins/ExternalNotificationPlugin.cpp | 71 +++++++++++++++------- src/plugins/ExternalNotificationPlugin.h | 2 + 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index fe5a57ae..95164d42 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -10,15 +10,30 @@ /* +This plugin supports: + https://github.com/meshtastic/Meshtastic-device/issues/654 + + bool ext_notification_plugin_enabled = 126; - uint32 ext_notification_plugin_output_ms = 127; - uint32 ext_notification_plugin_output = 128; bool ext_notification_plugin_active = 129; bool ext_notification_plugin_alert_message = 130; bool ext_notification_plugin_alert_bell = 131; + uint32 ext_notification_plugin_output = 128; + + + uint32 ext_notification_plugin_output_ms = 127; */ +#define EXT_NOTIFICATION_PLUGIN_ENABLED 1 +#define EXT_NOTIFICATION_PLUGIN_ACTIVE 1 +#define EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE 1 +#define EXT_NOTIFICATION_PLUGIN_ALERT_BELL 1 +#define EXT_NOTIFICATION_PLUGIN_OUTPUT 13 +#define EXT_NOTIFICATION_PLUGIN_OUTPUT_MS 100 + +#define ASCII_BELL 0x07 + ExternalNotificationPlugin *externalNotificationPlugin; ExternalNotificationPluginRadio *externalNotificationPluginRadio; @@ -36,7 +51,7 @@ int32_t ExternalNotificationPlugin::runOnce() // radioConfig.preferences.externalnotificationplugin_enabled = 1; // radioConfig.preferences.externalnotificationplugin_mode = 1; - if (1) { + if (EXT_NOTIFICATION_PLUGIN_ENABLED) { if (firstTime) { @@ -47,10 +62,10 @@ int32_t ExternalNotificationPlugin::runOnce() firstTime = 0; // Set the direction of a pin - pinMode(13, OUTPUT); + pinMode(EXT_NOTIFICATION_PLUGIN_OUTPUT, OUTPUT); // if ext_notification_plugin_active - if (1) { + if (EXT_NOTIFICATION_PLUGIN_ACTIVE) { setExternalOff(); } else { setExternalOn(); @@ -78,22 +93,26 @@ int32_t ExternalNotificationPlugin::runOnce() void ExternalNotificationPlugin::setExternalOn() { + externalCurrentState = 1; + // if ext_notification_plugin_active - if (1) { - digitalWrite(13, true); + if (EXT_NOTIFICATION_PLUGIN_ACTIVE) { + digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, true); } else { - digitalWrite(13, false); + digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, false); } } void ExternalNotificationPlugin::setExternalOff() { + externalCurrentState = 0; + // if ext_notification_plugin_active - if (1) { - digitalWrite(13, false); + if (EXT_NOTIFICATION_PLUGIN_ACTIVE) { + digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, false); } else { - digitalWrite(13, true); + digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, true); } } @@ -111,25 +130,31 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) { #ifndef NO_ESP32 - if (1) { + if (EXT_NOTIFICATION_PLUGIN_ENABLED) { auto &p = mp.decoded.data; if (mp.from != nodeDB.getNodeNum()) { - /* - TODO: If ext_notification_plugin_alert_bell is true and we see a bell character, trigger an external notification. - */ - // TODO: Check p.payload.bytes to see if it contains a bell character. If it does, trigger an external notifcation. + if (EXT_NOTIFICATION_PLUGIN_ALERT_BELL) { + for (int i = 0; i < p.payload.size; i++) { + if (p.payload.bytes[i] == ASCII_BELL) { + externalNotificationPlugin->setExternalOn(); - /* - TODO: If ext_notification_plugin_alert_message is true, trigger an external notification. - */ - // TODO: On received packet, blink the LED. - externalNotificationPlugin->setExternalOn(); - delay(500); - externalNotificationPlugin->setExternalOff(); + // TODO: Make this non-blocking. + delay(EXT_NOTIFICATION_PLUGIN_OUTPUT_MS); + externalNotificationPlugin->setExternalOff(); + } + } + } + if (EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE) { + externalNotificationPlugin->setExternalOn(); + + // TODO: Make this non-blocking. + delay(EXT_NOTIFICATION_PLUGIN_OUTPUT_MS); + externalNotificationPlugin->setExternalOff(); + } } } else { diff --git a/src/plugins/ExternalNotificationPlugin.h b/src/plugins/ExternalNotificationPlugin.h index 54474834..ff36c2a7 100644 --- a/src/plugins/ExternalNotificationPlugin.h +++ b/src/plugins/ExternalNotificationPlugin.h @@ -10,12 +10,14 @@ class ExternalNotificationPlugin : private concurrency::OSThread { bool firstTime = 1; + bool externalCurrentState = 0; public: ExternalNotificationPlugin(); void setExternalOn(); void setExternalOff(); + void getExternal(); protected: virtual int32_t runOnce(); From c524732849305ea3fe9c163f953600ce1fdd2e45 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 27 Jan 2021 21:35:07 -0800 Subject: [PATCH 05/16] #654 - Non blocking call to toggle the output. --- src/plugins/ExternalNotificationPlugin.cpp | 23 ++++++++-------------- src/plugins/ExternalNotificationPlugin.h | 1 + 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index 95164d42..74334d01 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -12,7 +12,7 @@ This plugin supports: https://github.com/meshtastic/Meshtastic-device/issues/654 - + bool ext_notification_plugin_enabled = 126; bool ext_notification_plugin_active = 129; @@ -72,13 +72,13 @@ int32_t ExternalNotificationPlugin::runOnce() } } else { - /* + if (externalCurrentState) { - 1) If GPIO is turned on ... - 2) Check the timer. If the timer has elapsed more time than - our set limit, turn the GPIO off. - - */ + // TODO: Test this part. Don't know if this should be greater than or less than. + if (externalTurnedOn + EXT_NOTIFICATION_PLUGIN_OUTPUT_MS < millis()) { + setExternalOff(); + } + } } return (25); @@ -94,6 +94,7 @@ int32_t ExternalNotificationPlugin::runOnce() void ExternalNotificationPlugin::setExternalOn() { externalCurrentState = 1; + externalTurnedOn = millis(); // if ext_notification_plugin_active if (EXT_NOTIFICATION_PLUGIN_ACTIVE) { @@ -140,20 +141,12 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) for (int i = 0; i < p.payload.size; i++) { if (p.payload.bytes[i] == ASCII_BELL) { externalNotificationPlugin->setExternalOn(); - - // TODO: Make this non-blocking. - delay(EXT_NOTIFICATION_PLUGIN_OUTPUT_MS); - externalNotificationPlugin->setExternalOff(); } } } if (EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE) { externalNotificationPlugin->setExternalOn(); - - // TODO: Make this non-blocking. - delay(EXT_NOTIFICATION_PLUGIN_OUTPUT_MS); - externalNotificationPlugin->setExternalOff(); } } diff --git a/src/plugins/ExternalNotificationPlugin.h b/src/plugins/ExternalNotificationPlugin.h index ff36c2a7..6de72fda 100644 --- a/src/plugins/ExternalNotificationPlugin.h +++ b/src/plugins/ExternalNotificationPlugin.h @@ -11,6 +11,7 @@ class ExternalNotificationPlugin : private concurrency::OSThread { bool firstTime = 1; bool externalCurrentState = 0; + uint32_t externalTurnedOn = 0; public: ExternalNotificationPlugin(); From 85752b0fc79018fa3c84c01c9df79417fe4181f8 Mon Sep 17 00:00:00 2001 From: Jm Date: Thu, 28 Jan 2021 23:02:00 -0800 Subject: [PATCH 06/16] #654 - Fixed problem with class namespaces. --- src/plugins/ExternalNotificationPlugin.cpp | 32 +++++++++++----------- src/plugins/ExternalNotificationPlugin.h | 4 +-- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index 74334d01..3f759b7f 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -25,12 +25,12 @@ This plugin supports: */ -#define EXT_NOTIFICATION_PLUGIN_ENABLED 1 -#define EXT_NOTIFICATION_PLUGIN_ACTIVE 1 +#define EXT_NOTIFICATION_PLUGIN_ENABLED 0 +#define EXT_NOTIFICATION_PLUGIN_ACTIVE 0 #define EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE 1 -#define EXT_NOTIFICATION_PLUGIN_ALERT_BELL 1 +#define EXT_NOTIFICATION_PLUGIN_ALERT_BELL 0 #define EXT_NOTIFICATION_PLUGIN_OUTPUT 13 -#define EXT_NOTIFICATION_PLUGIN_OUTPUT_MS 100 +#define EXT_NOTIFICATION_PLUGIN_OUTPUT_MS 1000 #define ASCII_BELL 0x07 @@ -39,6 +39,9 @@ ExternalNotificationPluginRadio *externalNotificationPluginRadio; ExternalNotificationPlugin::ExternalNotificationPlugin() : concurrency::OSThread("ExternalNotificationPlugin") {} +bool externalCurrentState = 0; +uint32_t externalTurnedOn = 0; + int32_t ExternalNotificationPlugin::runOnce() { #ifndef NO_ESP32 @@ -57,10 +60,6 @@ int32_t ExternalNotificationPlugin::runOnce() DEBUG_MSG("Initializing External Notification Plugin\n"); - externalNotificationPluginRadio = new ExternalNotificationPluginRadio(); - - firstTime = 0; - // Set the direction of a pin pinMode(EXT_NOTIFICATION_PLUGIN_OUTPUT, OUTPUT); @@ -71,11 +70,17 @@ int32_t ExternalNotificationPlugin::runOnce() setExternalOn(); } + externalNotificationPluginRadio = new ExternalNotificationPluginRadio(); + + firstTime = 0; + } else { + // DEBUG_MSG("EN Loop\n"); if (externalCurrentState) { // TODO: Test this part. Don't know if this should be greater than or less than. if (externalTurnedOn + EXT_NOTIFICATION_PLUGIN_OUTPUT_MS < millis()) { + DEBUG_MSG("Turning off external notification\n"); setExternalOff(); } } @@ -119,14 +124,6 @@ void ExternalNotificationPlugin::setExternalOff() // -------- -MeshPacket *ExternalNotificationPluginRadio::allocReply() -{ - - auto reply = allocDataPacket(); // Allocate a packet for sending - - return reply; -} - bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) { #ifndef NO_ESP32 @@ -134,8 +131,10 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) if (EXT_NOTIFICATION_PLUGIN_ENABLED) { auto &p = mp.decoded.data; + //DEBUG_MSG("Processing handleReceived\n"); if (mp.from != nodeDB.getNodeNum()) { + DEBUG_MSG("handleReceived from some other device\n"); if (EXT_NOTIFICATION_PLUGIN_ALERT_BELL) { for (int i = 0; i < p.payload.size; i++) { @@ -146,6 +145,7 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) } if (EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE) { + //DEBUG_MSG("Turning on alert\n"); externalNotificationPlugin->setExternalOn(); } } diff --git a/src/plugins/ExternalNotificationPlugin.h b/src/plugins/ExternalNotificationPlugin.h index 6de72fda..a9ef58d0 100644 --- a/src/plugins/ExternalNotificationPlugin.h +++ b/src/plugins/ExternalNotificationPlugin.h @@ -10,8 +10,6 @@ class ExternalNotificationPlugin : private concurrency::OSThread { bool firstTime = 1; - bool externalCurrentState = 0; - uint32_t externalTurnedOn = 0; public: ExternalNotificationPlugin(); @@ -37,7 +35,7 @@ class ExternalNotificationPluginRadio : public SinglePortPlugin ExternalNotificationPluginRadio() : SinglePortPlugin("ExternalNotificationPluginRadio", PortNum_TEXT_MESSAGE_APP) {} protected: - virtual MeshPacket *allocReply(); + //virtual MeshPacket *allocReply(); /** Called to handle a particular incoming message From 9e736ab0d7505310df3e88afc9c1bb5c2196fca3 Mon Sep 17 00:00:00 2001 From: Jm Date: Thu, 28 Jan 2021 23:16:10 -0800 Subject: [PATCH 07/16] #654 Fix gpio initilization --- src/plugins/ExternalNotificationPlugin.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index 3f759b7f..e2f95f1a 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -27,7 +27,7 @@ This plugin supports: #define EXT_NOTIFICATION_PLUGIN_ENABLED 0 #define EXT_NOTIFICATION_PLUGIN_ACTIVE 0 -#define EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE 1 +#define EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE 0 #define EXT_NOTIFICATION_PLUGIN_ALERT_BELL 0 #define EXT_NOTIFICATION_PLUGIN_OUTPUT 13 #define EXT_NOTIFICATION_PLUGIN_OUTPUT_MS 1000 @@ -63,19 +63,14 @@ int32_t ExternalNotificationPlugin::runOnce() // Set the direction of a pin pinMode(EXT_NOTIFICATION_PLUGIN_OUTPUT, OUTPUT); - // if ext_notification_plugin_active - if (EXT_NOTIFICATION_PLUGIN_ACTIVE) { - setExternalOff(); - } else { - setExternalOn(); - } + // Turn off the pin + setExternalOff(); externalNotificationPluginRadio = new ExternalNotificationPluginRadio(); firstTime = 0; } else { - // DEBUG_MSG("EN Loop\n"); if (externalCurrentState) { // TODO: Test this part. Don't know if this should be greater than or less than. @@ -131,7 +126,7 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) if (EXT_NOTIFICATION_PLUGIN_ENABLED) { auto &p = mp.decoded.data; - //DEBUG_MSG("Processing handleReceived\n"); + // DEBUG_MSG("Processing handleReceived\n"); if (mp.from != nodeDB.getNodeNum()) { DEBUG_MSG("handleReceived from some other device\n"); @@ -145,7 +140,7 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) } if (EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE) { - //DEBUG_MSG("Turning on alert\n"); + // DEBUG_MSG("Turning on alert\n"); externalNotificationPlugin->setExternalOn(); } } From aee81c8dcdfc02fc4b3f72ae079e8d1712a873b2 Mon Sep 17 00:00:00 2001 From: Jm Date: Fri, 29 Jan 2021 19:35:03 -0800 Subject: [PATCH 08/16] #654 - Add comments on what the config does --- src/plugins/ExternalNotificationPlugin.cpp | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index e2f95f1a..4ada9798 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -49,10 +49,31 @@ int32_t ExternalNotificationPlugin::runOnce() /* Uncomment the preferences below if you want to use the plugin without having to configure it from the PythonAPI or WebUI. - */ - // radioConfig.preferences.externalnotificationplugin_enabled = 1; - // radioConfig.preferences.externalnotificationplugin_mode = 1; + EXT_NOTIFICATION_PLUGIN_ENABLED + 0 = Disabled (Default) + 1 = Enabled + + EXT_NOTIFICATION_PLUGIN_ACTIVE + 0 = Active Low (Default) + 1 = Active High + + EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE + 0 = Disabled (Default) + 1 = Alert when a text message comes + + EXT_NOTIFICATION_PLUGIN_ALERT_BELL + 0 = Disabled (Default) + 1 = Alert when the bell character is received + + EXT_NOTIFICATION_PLUGIN_OUTPUT + GPIO of the output. (Default = 13) + + EXT_NOTIFICATION_PLUGIN_OUTPUT_MS + Amount of time in ms for the alert. Default is 1000. + + + */ if (EXT_NOTIFICATION_PLUGIN_ENABLED) { @@ -73,7 +94,7 @@ int32_t ExternalNotificationPlugin::runOnce() } else { if (externalCurrentState) { - // TODO: Test this part. Don't know if this should be greater than or less than. + // If the output is turned on, turn it back off after the given period of time. if (externalTurnedOn + EXT_NOTIFICATION_PLUGIN_OUTPUT_MS < millis()) { DEBUG_MSG("Turning off external notification\n"); setExternalOff(); @@ -97,12 +118,7 @@ void ExternalNotificationPlugin::setExternalOn() externalTurnedOn = millis(); // if ext_notification_plugin_active - if (EXT_NOTIFICATION_PLUGIN_ACTIVE) { - digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, true); - - } else { - digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, false); - } + digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, (EXT_NOTIFICATION_PLUGIN_ACTIVE ? true : false)); } void ExternalNotificationPlugin::setExternalOff() @@ -110,11 +126,7 @@ void ExternalNotificationPlugin::setExternalOff() externalCurrentState = 0; // if ext_notification_plugin_active - if (EXT_NOTIFICATION_PLUGIN_ACTIVE) { - digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, false); - } else { - digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, true); - } + digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, (EXT_NOTIFICATION_PLUGIN_ACTIVE ? false : true)); } // -------- From 6cef3e41e72dfb6d0123835bee5a2741a5567421 Mon Sep 17 00:00:00 2001 From: Jm Date: Sat, 30 Jan 2021 09:17:40 -0800 Subject: [PATCH 09/16] Update comments and use radioConfig --- src/plugins/ExternalNotificationPlugin.cpp | 98 +++++++++++----------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index 4ada9798..5774707a 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -14,21 +14,32 @@ This plugin supports: https://github.com/meshtastic/Meshtastic-device/issues/654 - bool ext_notification_plugin_enabled = 126; - bool ext_notification_plugin_active = 129; - bool ext_notification_plugin_alert_message = 130; - bool ext_notification_plugin_alert_bell = 131; - uint32 ext_notification_plugin_output = 128; + radioConfig.preferences.ext_notification_plugin_enabled + 0 = Disabled (Default) + 1 = Enabled + radioConfig.preferences.ext_notification_plugin_active + 0 = Active Low (Default) + 1 = Active High - uint32 ext_notification_plugin_output_ms = 127; + radioConfig.preferences.ext_notification_plugin_alert_message + 0 = Disabled (Default) + 1 = Alert when a text message comes + + radioConfig.preferences.ext_notification_plugin_alert_bell + 0 = Disabled (Default) + 1 = Alert when the bell character is received + + radioConfig.preferences.ext_notification_plugin_output + GPIO of the output. (Default = 13) + + radioConfig.preferences.ext_notification_plugin_output_ms + Amount of time in ms for the alert. Default is 1000. */ -#define EXT_NOTIFICATION_PLUGIN_ENABLED 0 -#define EXT_NOTIFICATION_PLUGIN_ACTIVE 0 -#define EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE 0 -#define EXT_NOTIFICATION_PLUGIN_ALERT_BELL 0 + +// Default configurations #define EXT_NOTIFICATION_PLUGIN_OUTPUT 13 #define EXT_NOTIFICATION_PLUGIN_OUTPUT_MS 1000 @@ -49,40 +60,27 @@ int32_t ExternalNotificationPlugin::runOnce() /* Uncomment the preferences below if you want to use the plugin without having to configure it from the PythonAPI or WebUI. - - EXT_NOTIFICATION_PLUGIN_ENABLED - 0 = Disabled (Default) - 1 = Enabled - - EXT_NOTIFICATION_PLUGIN_ACTIVE - 0 = Active Low (Default) - 1 = Active High - - EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE - 0 = Disabled (Default) - 1 = Alert when a text message comes - - EXT_NOTIFICATION_PLUGIN_ALERT_BELL - 0 = Disabled (Default) - 1 = Alert when the bell character is received - - EXT_NOTIFICATION_PLUGIN_OUTPUT - GPIO of the output. (Default = 13) - - EXT_NOTIFICATION_PLUGIN_OUTPUT_MS - Amount of time in ms for the alert. Default is 1000. - - */ - if (EXT_NOTIFICATION_PLUGIN_ENABLED) { + // radioConfig.preferences.ext_notification_plugin_enabled = 1; + // radioConfig.preferences.ext_notification_plugin_alert_message = 1; + + // radioConfig.preferences.ext_notification_plugin_active = 1; + // radioConfig.preferences.ext_notification_plugin_alert_bell = 1; + // radioConfig.preferences.ext_notification_plugin_output_ms = 1000; + // radioConfig.preferences.ext_notification_plugin_output = 13; + + if (radioConfig.preferences.ext_notification_plugin_enabled) { if (firstTime) { DEBUG_MSG("Initializing External Notification Plugin\n"); // Set the direction of a pin - pinMode(EXT_NOTIFICATION_PLUGIN_OUTPUT, OUTPUT); + pinMode((radioConfig.preferences.ext_notification_plugin_output + ? radioConfig.preferences.ext_notification_plugin_output + : EXT_NOTIFICATION_PLUGIN_OUTPUT), + OUTPUT); // Turn off the pin setExternalOff(); @@ -95,7 +93,10 @@ int32_t ExternalNotificationPlugin::runOnce() if (externalCurrentState) { // If the output is turned on, turn it back off after the given period of time. - if (externalTurnedOn + EXT_NOTIFICATION_PLUGIN_OUTPUT_MS < millis()) { + if (externalTurnedOn + (radioConfig.preferences.ext_notification_plugin_output_ms + ? radioConfig.preferences.ext_notification_plugin_output_ms + : EXT_NOTIFICATION_PLUGIN_OUTPUT_MS) < + millis()) { DEBUG_MSG("Turning off external notification\n"); setExternalOff(); } @@ -117,16 +118,18 @@ void ExternalNotificationPlugin::setExternalOn() externalCurrentState = 1; externalTurnedOn = millis(); - // if ext_notification_plugin_active - digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, (EXT_NOTIFICATION_PLUGIN_ACTIVE ? true : false)); + digitalWrite((radioConfig.preferences.ext_notification_plugin_output ? radioConfig.preferences.ext_notification_plugin_output + : EXT_NOTIFICATION_PLUGIN_OUTPUT), + (radioConfig.preferences.ext_notification_plugin_active ? true : false)); } void ExternalNotificationPlugin::setExternalOff() { externalCurrentState = 0; - // if ext_notification_plugin_active - digitalWrite(EXT_NOTIFICATION_PLUGIN_OUTPUT, (EXT_NOTIFICATION_PLUGIN_ACTIVE ? false : true)); + digitalWrite((radioConfig.preferences.ext_notification_plugin_output ? radioConfig.preferences.ext_notification_plugin_output + : EXT_NOTIFICATION_PLUGIN_OUTPUT), + (radioConfig.preferences.ext_notification_plugin_active ? false : true)); } // -------- @@ -135,15 +138,16 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) { #ifndef NO_ESP32 - if (EXT_NOTIFICATION_PLUGIN_ENABLED) { + if (radioConfig.preferences.ext_notification_plugin_enabled) { auto &p = mp.decoded.data; - // DEBUG_MSG("Processing handleReceived\n"); if (mp.from != nodeDB.getNodeNum()) { - DEBUG_MSG("handleReceived from some other device\n"); - if (EXT_NOTIFICATION_PLUGIN_ALERT_BELL) { + // TODO: This may be a problem if messages are sent in unicide, but I'm not sure if it will. + // Need to know if and how this could be a problem. + if (radioConfig.preferences.ext_notification_plugin_alert_bell) { + DEBUG_MSG("externalNotificationPlugin - Notification Bell\n"); for (int i = 0; i < p.payload.size; i++) { if (p.payload.bytes[i] == ASCII_BELL) { externalNotificationPlugin->setExternalOn(); @@ -151,8 +155,8 @@ bool ExternalNotificationPluginRadio::handleReceived(const MeshPacket &mp) } } - if (EXT_NOTIFICATION_PLUGIN_ALERT_MESSAGE) { - // DEBUG_MSG("Turning on alert\n"); + if (radioConfig.preferences.ext_notification_plugin_alert_message) { + DEBUG_MSG("externalNotificationPlugin - Notification Plugin\n"); externalNotificationPlugin->setExternalOn(); } } From 3162f74945a4e15b45d7e7585d419d01c8213d6e Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 30 Jan 2021 09:32:04 -0800 Subject: [PATCH 10/16] Create External Notification documentation. --- docs/software/plugins/ExternalNotification.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 docs/software/plugins/ExternalNotification.md diff --git a/docs/software/plugins/ExternalNotification.md b/docs/software/plugins/ExternalNotification.md new file mode 100644 index 00000000..2afb52d4 --- /dev/null +++ b/docs/software/plugins/ExternalNotification.md @@ -0,0 +1,67 @@ +Documentation for ExternalNotification Plugin + +# Configuration + +These are the settings that can be configured. + + ext_notification_plugin_enabled + Is the plugin enabled? + + 0 = Disabled (Default) + 1 = Enabled + + ext_notification_plugin_active + Is your external circuit triggered when our GPIO is low or high? + + 0 = Active Low (Default) + 1 = Active High + + ext_notification_plugin_alert_message + Do you want to be notified on an incoming message? + + 0 = Disabled (Default) + 1 = Alert when a text message comes + + ext_notification_plugin_alert_bell + Do you want to be notified on an incoming bell? + + 0 = Disabled (Default) + 1 = Alert when the bell character is received + + ext_notification_plugin_output + What GPIO is your external circuit attached? + + GPIO of the output. (Default = 13) + + ext_notification_plugin_output_ms + How long do you want us to trigger your external circuit? + + Amount of time in ms for the alert. Default is 1000. + + +# Usage Notes + +For basic usage, start with: + + ext_notification_plugin_enabled = 1 + ext_notification_plugin_alert_message = 1 + +Depending on how your external configured is configured, you may need to set the active state to true. + + ext_notification_plugin_active = 1 + +# External Hardware + +Be mindful of the max current sink and source of the esp32 GPIO. The easiest devices to interface with would be either an LED or Active Buzzer. + + +# Known Problems + +* This won't directly support an passive (normal) speaker as it does not generate any audio wave forms. +* This currently only supports the esp32. Other targets may be possible, I just don't have to test with. + +# Need more help? + +Go to the Meshtastic Discourse Group if you have any questions or to share how you have used this. + +https://meshtastic.discourse.group From f45ffc8773d0330e525a057a6446f79a75dcdfb3 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 30 Jan 2021 09:32:44 -0800 Subject: [PATCH 11/16] Rename documentation --- .../{ExternalNotification.md => ExternalNotificationPlugin.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/software/plugins/{ExternalNotification.md => ExternalNotificationPlugin.md} (100%) diff --git a/docs/software/plugins/ExternalNotification.md b/docs/software/plugins/ExternalNotificationPlugin.md similarity index 100% rename from docs/software/plugins/ExternalNotification.md rename to docs/software/plugins/ExternalNotificationPlugin.md From 7129a19f3533956cae46d7e4af32a6bb677f0319 Mon Sep 17 00:00:00 2001 From: Jm Date: Sat, 30 Jan 2021 09:36:17 -0800 Subject: [PATCH 12/16] #654 Add reference to documentation --- src/plugins/ExternalNotificationPlugin.cpp | 41 ++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index 5774707a..b4f3c801 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -10,31 +10,36 @@ /* -This plugin supports: - https://github.com/meshtastic/Meshtastic-device/issues/654 + Documentation: + https://github.com/mc-hamster/Meshtastic-device/blob/master/docs/software/plugins/ExternalNotificationPlugin.md + + This plugin supports: + https://github.com/meshtastic/Meshtastic-device/issues/654 - radioConfig.preferences.ext_notification_plugin_enabled - 0 = Disabled (Default) - 1 = Enabled + Quick reference: - radioConfig.preferences.ext_notification_plugin_active - 0 = Active Low (Default) - 1 = Active High + radioConfig.preferences.ext_notification_plugin_enabled + 0 = Disabled (Default) + 1 = Enabled - radioConfig.preferences.ext_notification_plugin_alert_message - 0 = Disabled (Default) - 1 = Alert when a text message comes + radioConfig.preferences.ext_notification_plugin_active + 0 = Active Low (Default) + 1 = Active High - radioConfig.preferences.ext_notification_plugin_alert_bell - 0 = Disabled (Default) - 1 = Alert when the bell character is received + radioConfig.preferences.ext_notification_plugin_alert_message + 0 = Disabled (Default) + 1 = Alert when a text message comes - radioConfig.preferences.ext_notification_plugin_output - GPIO of the output. (Default = 13) + radioConfig.preferences.ext_notification_plugin_alert_bell + 0 = Disabled (Default) + 1 = Alert when the bell character is received - radioConfig.preferences.ext_notification_plugin_output_ms - Amount of time in ms for the alert. Default is 1000. + radioConfig.preferences.ext_notification_plugin_output + GPIO of the output. (Default = 13) + + radioConfig.preferences.ext_notification_plugin_output_ms + Amount of time in ms for the alert. Default is 1000. */ From 5df08410e78c38782578bd7dce20346dfba7bb4e Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 30 Jan 2021 09:39:40 -0800 Subject: [PATCH 13/16] Create SerialPlugin.md --- docs/software/plugins/SerialPlugin.md | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/software/plugins/SerialPlugin.md diff --git a/docs/software/plugins/SerialPlugin.md b/docs/software/plugins/SerialPlugin.md new file mode 100644 index 00000000..bce84653 --- /dev/null +++ b/docs/software/plugins/SerialPlugin.md @@ -0,0 +1,40 @@ +# SerialPlugin + +A simple interface to send messages over the mesh network by sending strings +over a serial port. + +Default is to use RX GPIO 16 and TX GPIO 17. + + +# Basic Usage: + + 1) Enable the plugin by setting serialplugin_enabled to 1. + 2) Set the pins (serialplugin_rxd / serialplugin_rxd) for your preferred RX and TX GPIO pins. + On tbeam, recommend to use: + RXD 35 + TXD 15 + 3) Set serialplugin_timeout to the amount of time to wait before we consider + your packet as "done". + 4) (Optional) In SerialPlugin.h set the port to PortNum_TEXT_MESSAGE_APP if you want to + send messages to/from the general text message channel. + 5) Connect to your device over the serial interface at 38400 8N1. + 6) Send a packet up to 240 bytes in length. This will get relayed over the mesh network. + 7) (Optional) Set serialplugin_echo to 1 and any message you send out will be echoed back + to your device. + +# TODO (in this order): + +* Define a verbose RX mode to report on mesh and packet infomration. + - This won't happen any time soon. + +# Known Problems + + * Until the plugin is initilized by the startup sequence, the TX pin is in a floating + state. Device connected to that pin may see this as "noise". + * Will not work on NRF and the Linux device targets. + +# Need help? + +Need help with this plugin? Post your question on the Meshtastic Discourse: + +https://meshtastic.discourse.group From 133a7ff166a1216e612c31e3bae8ef0aef374537 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 30 Jan 2021 09:46:26 -0800 Subject: [PATCH 14/16] Added more notes. --- .../software/plugins/ExternalNotificationPlugin.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/software/plugins/ExternalNotificationPlugin.md b/docs/software/plugins/ExternalNotificationPlugin.md index 2afb52d4..dda95e4c 100644 --- a/docs/software/plugins/ExternalNotificationPlugin.md +++ b/docs/software/plugins/ExternalNotificationPlugin.md @@ -1,4 +1,4 @@ -Documentation for ExternalNotification Plugin +The ExternalNotification Plugin will allow you to connect a speaker, LED or other device to notify you when a message has been received from the mesh network. # Configuration @@ -44,9 +44,9 @@ These are the settings that can be configured. For basic usage, start with: ext_notification_plugin_enabled = 1 - ext_notification_plugin_alert_message = 1 + ext_notification_plugin_alert_message = 1 -Depending on how your external configured is configured, you may need to set the active state to true. +Depending on how your external cirtcuit configured is configured, you may need to set the active state to true. ext_notification_plugin_active = 1 @@ -54,11 +54,19 @@ Depending on how your external configured is configured, you may need to set the Be mindful of the max current sink and source of the esp32 GPIO. The easiest devices to interface with would be either an LED or Active Buzzer. +Ideas for external hardware: + +* LED +* Active Buzzer +* Flame thrower +* Strobe Light +* Siren # Known Problems * This won't directly support an passive (normal) speaker as it does not generate any audio wave forms. * This currently only supports the esp32. Other targets may be possible, I just don't have to test with. +* This plugin only monitors text messages. We won't trigger on any other packet types. # Need more help? From 092af0f9f9b48272a367bb0062ff62fa88b4b7ae Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 30 Jan 2021 09:50:19 -0800 Subject: [PATCH 15/16] Update to doc to add info on the bell character --- docs/software/plugins/ExternalNotificationPlugin.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/software/plugins/ExternalNotificationPlugin.md b/docs/software/plugins/ExternalNotificationPlugin.md index dda95e4c..de9f33ad 100644 --- a/docs/software/plugins/ExternalNotificationPlugin.md +++ b/docs/software/plugins/ExternalNotificationPlugin.md @@ -49,6 +49,18 @@ For basic usage, start with: Depending on how your external cirtcuit configured is configured, you may need to set the active state to true. ext_notification_plugin_active = 1 + +## Alert Types + +We support being alerted on two events: + +1) Incoming Text Message + +2) Incoming Text Message that contains the ascii bell character. At present, only the Python API can send an ascii bell character, but more support may be added in the future. + +### Bell Character + +The bell character is ASCII 0x07. Include 0x07 anywhere in the text message and with ext_notification_plugin_alert_bell enabled, we will issue an external notification. # External Hardware From 48b38ed94bd16872b64a957d01f21df88d078464 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 30 Jan 2021 17:21:54 -0800 Subject: [PATCH 16/16] Update documentation --- docs/software/plugins/ExternalNotificationPlugin.md | 2 ++ docs/software/plugins/SerialPlugin.md | 2 +- docs/software/plugins/StoreRequestPlugin.md | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 docs/software/plugins/StoreRequestPlugin.md diff --git a/docs/software/plugins/ExternalNotificationPlugin.md b/docs/software/plugins/ExternalNotificationPlugin.md index de9f33ad..c0814b6c 100644 --- a/docs/software/plugins/ExternalNotificationPlugin.md +++ b/docs/software/plugins/ExternalNotificationPlugin.md @@ -1,3 +1,5 @@ +# About + The ExternalNotification Plugin will allow you to connect a speaker, LED or other device to notify you when a message has been received from the mesh network. # Configuration diff --git a/docs/software/plugins/SerialPlugin.md b/docs/software/plugins/SerialPlugin.md index bce84653..acd777e3 100644 --- a/docs/software/plugins/SerialPlugin.md +++ b/docs/software/plugins/SerialPlugin.md @@ -1,4 +1,4 @@ -# SerialPlugin +# About A simple interface to send messages over the mesh network by sending strings over a serial port. diff --git a/docs/software/plugins/StoreRequestPlugin.md b/docs/software/plugins/StoreRequestPlugin.md new file mode 100644 index 00000000..239a00de --- /dev/null +++ b/docs/software/plugins/StoreRequestPlugin.md @@ -0,0 +1,6 @@ +# About + + + +# Running notes +