From c67922241c0202e104c04146b9db25c8d05346f1 Mon Sep 17 00:00:00 2001
From: Theo Arends <11044339+arendst@users.noreply.github.com>
Date: Sun, 30 Dec 2018 15:32:53 +0100
Subject: [PATCH] Add tests for result
---
sonoff/xdrv_interface.ino | 13 ++++++++++++-
sonoff/xdsp_interface.ino | 9 ++++++++-
sonoff/xnrg_interface.ino | 11 ++++++++++-
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/sonoff/xdrv_interface.ino b/sonoff/xdrv_interface.ino
index 0ec3696d9..1500f184b 100644
--- a/sonoff/xdrv_interface.ino
+++ b/sonoff/xdrv_interface.ino
@@ -240,7 +240,18 @@ boolean XdrvCall(byte Function)
for (byte x = 0; x < xdrv_present; x++) {
// WifiAddDelayWhenDisconnected();
result = xdrv_func_ptr[x](Function);
- if (result) break;
+
+ if (result && ((FUNC_COMMAND == Function) ||
+ (FUNC_MQTT_DATA == Function) ||
+ (FUNC_RULES_PROCESS == Function) ||
+ (FUNC_BUTTON_PRESSED == Function) ||
+ (FUNC_SERIAL == Function) ||
+ (FUNC_MODULE_INIT == Function) ||
+ (FUNC_SET_CHANNELS == Function) ||
+ (FUNC_SET_DEVICE_POWER == Function)
+ )) {
+ break;
+ }
}
return result;
diff --git a/sonoff/xdsp_interface.ino b/sonoff/xdsp_interface.ino
index e2847d85e..01e4424dd 100644
--- a/sonoff/xdsp_interface.ino
+++ b/sonoff/xdsp_interface.ino
@@ -17,6 +17,8 @@
along with this program. If not, see .
*/
+#ifdef USE_DISPLAY
+
#ifdef XFUNC_PTR_IN_ROM
boolean (* const xdsp_func_ptr[])(byte) PROGMEM = { // Display Function Pointers
#else
@@ -123,8 +125,13 @@ boolean XdspCall(byte Function)
for (byte x = 0; x < xdsp_present; x++) {
result = xdsp_func_ptr[x](Function);
- if (result) break;
+
+ if (result && (FUNC_DISPLAY_MODEL == Function)) {
+ break;
+ }
}
return result;
}
+
+#endif // USE_DISPLAY
diff --git a/sonoff/xnrg_interface.ino b/sonoff/xnrg_interface.ino
index cea14e47c..32af6451c 100644
--- a/sonoff/xnrg_interface.ino
+++ b/sonoff/xnrg_interface.ino
@@ -17,6 +17,8 @@
along with this program. If not, see .
*/
+#ifdef USE_ENERGY_SENSOR
+
#ifdef XFUNC_PTR_IN_ROM
int (* const xnrg_func_ptr[])(byte) PROGMEM = { // Energy driver Function Pointers
#else
@@ -96,7 +98,14 @@ int XnrgCall(byte Function)
for (byte x = 0; x < xnrg_present; x++) {
result = xnrg_func_ptr[x](Function);
- if (result) break;
+
+ if (result && ((FUNC_SERIAL == Function) ||
+ (FUNC_COMMAND == Function)
+ )) {
+ break;
+ }
}
return result;
}
+
+#endif // USE_ENERGY_SENSOR