From e59aa19b5bb572894598908705e453cff19efd10 Mon Sep 17 00:00:00 2001 From: James Prior Date: Wed, 14 Jun 2017 08:46:19 -0400 Subject: [PATCH] src/dumb_module/arduino/hapinode/hapi_mqtt.ino: Eliminated a use of a temporary variable and special value. Where else can this be done? --- src/dumb_module/arduino/hapinode/hapi_mqtt.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dumb_module/arduino/hapinode/hapi_mqtt.ino b/src/dumb_module/arduino/hapinode/hapi_mqtt.ino index 6964a2e..82749af 100644 --- a/src/dumb_module/arduino/hapinode/hapi_mqtt.ino +++ b/src/dumb_module/arduino/hapinode/hapi_mqtt.ino @@ -364,10 +364,10 @@ void MQTTcallback(char* topic, byte* payload, unsigned int length) { for (int i=0;i < ArrayLength(HapisFunctions);i++) { // Scan for a match on the sensor name f = HapisFunctions[i]; // Point to Asset read function structure if (strcmp(command_topic["Asset"],f.fName) == 0) { // Asset match? - Number = i; // Match for Sensor name + break; // Match for Sensor name } } - if (Number != INVALID_VALUE) { + if (i < ArrayLength(HapisFunctions)) { sendMQTTAsset(AssetIdx, Number); // Publish sensor or control function data return; }