Add tests for result

This commit is contained in:
Theo Arends 2018-12-30 15:32:53 +01:00
parent 850d240d2e
commit c67922241c
3 changed files with 30 additions and 3 deletions

View File

@ -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;

View File

@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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