iot_water_monitor_v2

Dependencies:   easy-connect-v16 Watchdog FP MQTTPacket RecordType-v-16 watersenor_and_temp_code

Revision:
34:601effb7b7fe
Parent:
33:5b90257d2d57
Child:
35:fc800d35c1ba
--- a/Simple-MQTT/SimpleMQTT.h	Sun Jan 21 13:04:06 2018 +0000
+++ b/Simple-MQTT/SimpleMQTT.h	Wed Feb 14 03:56:34 2018 +0000
@@ -49,7 +49,8 @@
     
     uint8_t   RELAY_State_1;
     uint8_t   RELAY_State_2;
-    
+    uint8_t   RELAY_State_3;
+        
     uint32_t CONFIG_Time;
 	
 	uint8_t  CONFIG_Mode;
@@ -184,7 +185,7 @@
             printf("Command Type: %d, error %d\r\n", CommandType, ret);
             
             switch (CommandType) {
-            	case 3: int relayState1, relayState2;
+            	case 3: int relayState1, relayState2, relayState3;
             			KeyIndex      = json.findKeyIndexIn("cmdID", 0);
             			KeyValueIndex = json.findChildIndexOf(KeyIndex, 0);
             			ret = json.tokenIntegerValue(KeyValueIndex, receiveCmdID); 
@@ -197,10 +198,16 @@
             			KeyValueIndex = json.findChildIndexOf(KeyIndex, 0);
             			ret = json.tokenIntegerValue(KeyValueIndex, relayState2);
             			
+            			KeyIndex      = json.findKeyIndexIn("relayState3", 0);
+            			KeyValueIndex = json.findChildIndexOf(KeyIndex, 0);
+            			ret = json.tokenIntegerValue(KeyValueIndex, relayState3);
+            			
             			DataStruct.RELAY_State_1 = relayState1;     
             			DataStruct.RELAY_State_2 = relayState2;   
-            			FP_WriteRelayStates(DataStruct.RELAY_State_1, DataStruct.RELAY_State_2);      		
-            			CE_HandleRelays(relayState1, relayState2);
+            			DataStruct.RELAY_State_3 = relayState3;   
+            			
+            			FP_WriteRelayStates(DataStruct.RELAY_State_1, DataStruct.RELAY_State_2, DataStruct.RELAY_State_3);      		
+            			CE_HandleRelays(relayState1, relayState2, relayState3);
             	break;
             	
             	case 4: int mode, minOxiVal, maxOxiVal, uploadInterval;