Update and configure ExNotify platforms

This commit is contained in:
Solanaceae
2021-12-07 20:26:26 -07:00
parent 084ef821b7
commit 6cfdd99fd1
2 changed files with 14 additions and 2 deletions

View File

@@ -44,7 +44,7 @@
*/
// Default configurations
#define EXT_NOTIFICATION_PLUGIN_OUTPUT 13
#define EXT_NOTIFICATION_PLUGIN_OUTPUT EXT_NOTIFY_PIN
#define EXT_NOTIFICATION_PLUGIN_OUTPUT_MS 1000
#define ASCII_BELL 0x07
@@ -84,21 +84,25 @@ int32_t ExternalNotificationPlugin::runOnce()
void ExternalNotificationPlugin::setExternalOn()
{
#ifdef EXT_NOTIFY_PIN
externalCurrentState = 1;
externalTurnedOn = millis();
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));
#endif
}
void ExternalNotificationPlugin::setExternalOff()
{
#ifdef EXT_NOTIFY_PIN
externalCurrentState = 0;
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));
#endif
}
// --------
@@ -111,6 +115,7 @@ ExternalNotificationPlugin::ExternalNotificationPlugin()
boundChannel = Channels::gpioChannel;
#ifndef NO_ESP32
#ifdef EXT_NOTIFY_PIN
/*
Uncomment the preferences below if you want to use the plugin
@@ -140,12 +145,14 @@ ExternalNotificationPlugin::ExternalNotificationPlugin()
DEBUG_MSG("External Notification Plugin Disabled\n");
enabled = false;
}
#endif
#endif
}
ProcessMessage ExternalNotificationPlugin::handleReceived(const MeshPacket &mp)
{
#ifndef NO_ESP32
#ifdef EXT_NOTIFY_PIN
if (radioConfig.preferences.ext_notification_plugin_enabled) {
@@ -173,6 +180,7 @@ ProcessMessage ExternalNotificationPlugin::handleReceived(const MeshPacket &mp)
} else {
DEBUG_MSG("External Notification Plugin Disabled\n");
}
#endif
#endif