aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-10-23 21:33:38 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-10-23 21:50:14 +0200
commitfee2523a226e28e08dd2e2264ff857650a886702 (patch)
tree1483a97051c17c36af428992b5483740bb920d16
parent2e4658e49a5a2e575ff6b9c0fdadb66f65142d94 (diff)
mode-button: make LED configurablechange-35
-rw-r--r--doc/mode-button.md3
-rw-r--r--global-config4
-rw-r--r--global-config-overlay2
-rw-r--r--global-config.changes1
-rw-r--r--global-functions2
-rw-r--r--mode-button4
6 files changed, 11 insertions, 5 deletions
diff --git a/doc/mode-button.md b/doc/mode-button.md
index a44b571..8d037e5 100644
--- a/doc/mode-button.md
+++ b/doc/mode-button.md
@@ -46,9 +46,10 @@ To use the reset button instead:
Configuration
-------------
-The configuration goes to `global-config-overlay`, the only parameter is:
+The configuration goes to `global-config-overlay`, these are the parameters:
* `ModeButton`: an array with defined actions
+* `ModeButtonLED`: led to give visual feedback
Usage and invocation
--------------------
diff --git a/global-config b/global-config
index 68d12e7..fc8d010 100644
--- a/global-config
+++ b/global-config
@@ -8,7 +8,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
-:global GlobalConfigVersion 34;
+:global GlobalConfigVersion 35;
# This is used for DNS and backup file.
:global Domain "example.com";
@@ -105,6 +105,8 @@
5="/ system script run bridge-port-toggle;";
# add more here...
};
+# This led gives visual feedback if type is 'on' or 'off'.
+:global ModeButtonLED "user-led";
# Run commands on SMS action.
:global SmsAction {
diff --git a/global-config-overlay b/global-config-overlay
index 99295e6..250f697 100644
--- a/global-config-overlay
+++ b/global-config-overlay
@@ -9,7 +9,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
# Comment or remove to disable change notifications.
-:global GlobalConfigVersion 34;
+:global GlobalConfigVersion 35;
# Copy configuration from global-config here and modify it.
diff --git a/global-config.changes b/global-config.changes
index 7d14e85..8082344 100644
--- a/global-config.changes
+++ b/global-config.changes
@@ -38,4 +38,5 @@
32="Merged mode (& reset) button scripts in single new script 'mode-button'.";
33="Added configurable deviation on health temperature recovery threshold against notification flooding.";
34="Introduced script 'ospf-to-leds' to visualize OSPF instance state via LEDs.";
+ 35="Implemented visual feedback for 'mode-button' with configurable LED.";
};
diff --git a/global-functions b/global-functions
index ab3247a..f8716fe 100644
--- a/global-functions
+++ b/global-functions
@@ -8,7 +8,7 @@
# https://git.eworm.de/cgit/routeros-scripts/about/
# expected configuration version
-:global ExpectedConfigVersion 34;
+:global ExpectedConfigVersion 35;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
diff --git a/mode-button b/mode-button
index c189ad2..217c0cc 100644
--- a/mode-button
+++ b/mode-button
@@ -23,9 +23,11 @@
:global ModeButtonScheduler;
:local LEDInvert do={
+ :global ModeButtonLED;
+
:global IfThenElse;
- :local LED [ / system leds find where leds="user-led" type~"^(on|off)\$" interface=[] ];
+ :local LED [ / system leds find where leds=$ModeButtonLED type~"^(on|off)\$" interface=[] ];
:if ([ :len $LED ] = 0) do={
:return false;
}