mirror of
https://github.com/anklimov/lighthub
synced 2025-12-08 04:39:49 +03:00
null mapping fix
This commit is contained in:
@@ -1181,6 +1181,7 @@ return false;
|
|||||||
i=i->next;
|
i=i->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case aJson_String:
|
case aJson_String:
|
||||||
if (strcmp(cmdMapping->valuestring,"fan")==0)
|
if (strcmp(cmdMapping->valuestring,"fan")==0)
|
||||||
switch (getCmd())
|
switch (getCmd())
|
||||||
@@ -1209,7 +1210,10 @@ return false;
|
|||||||
|
|
||||||
} //switch
|
} //switch
|
||||||
|
|
||||||
if (matchedCmd) return itemCmd().Int((uint32_t)matchedCmd->valueint);
|
if (matchedCmd && matchedCmd->type != aJson_NULL)
|
||||||
|
{
|
||||||
|
return itemCmd().Int((uint32_t)matchedCmd->valueint);
|
||||||
|
}
|
||||||
|
|
||||||
aJsonObject *valMapping = aJson.getObjectItem(mappingData, "val");
|
aJsonObject *valMapping = aJson.getObjectItem(mappingData, "val");
|
||||||
if (isValue() && valMapping && valMapping->type == aJson_Array && aJson.getArraySize(valMapping) == 4)
|
if (isValue() && valMapping && valMapping->type == aJson_Array && aJson.getArraySize(valMapping) == 4)
|
||||||
@@ -1220,7 +1224,7 @@ if (isValue() && valMapping && valMapping->type == aJson_Array && aJson.getArray
|
|||||||
aJson.getArrayItem(valMapping,0)->valueint,aJson.getArrayItem(valMapping,1)->valueint,
|
aJson.getArrayItem(valMapping,0)->valueint,aJson.getArrayItem(valMapping,1)->valueint,
|
||||||
aJson.getArrayItem(valMapping,2)->valueint,aJson.getArrayItem(valMapping,3)->valueint));
|
aJson.getArrayItem(valMapping,2)->valueint,aJson.getArrayItem(valMapping,3)->valueint));
|
||||||
}
|
}
|
||||||
else if (valMapping && valMapping->type == aJson_NULL) cmd.itemArgType = ST_VOID;
|
else if (valMapping && valMapping->type == aJson_NULL) return itemCmd(ST_VOID,CMD_VOID);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -567,7 +567,8 @@ if (!suffixCode) return 0;
|
|||||||
|
|
||||||
char *suffixStr =templateParamObj->name;
|
char *suffixStr =templateParamObj->name;
|
||||||
// We have find template for suffix or suffixCode
|
// We have find template for suffix or suffixCode
|
||||||
long Value = 0;
|
itemCmd cmdValue = itemCmd(ST_VOID,CMD_VOID);
|
||||||
|
long Value = 0;
|
||||||
int8_t regType = PAR_I16;
|
int8_t regType = PAR_I16;
|
||||||
aJsonObject * typeObj = aJson.getObjectItem(templateParamObj, "type");
|
aJsonObject * typeObj = aJson.getObjectItem(templateParamObj, "type");
|
||||||
aJsonObject * mapObj = aJson.getObjectItem(templateParamObj, "map");
|
aJsonObject * mapObj = aJson.getObjectItem(templateParamObj, "map");
|
||||||
@@ -583,13 +584,19 @@ aJsonObject * mapObj = aJson.getObjectItem(templateParamObj, "map");
|
|||||||
case PAR_I8H:
|
case PAR_I8H:
|
||||||
case PAR_I8L:
|
case PAR_I8L:
|
||||||
|
|
||||||
Value=cmd.doMapping(mapObj).getInt();
|
cmdValue=cmd.doMapping(mapObj);
|
||||||
|
if (!cmdValue.isValue())return 0;
|
||||||
|
Value=cmdValue.getInt();
|
||||||
break;
|
break;
|
||||||
case PAR_TENS:
|
case PAR_TENS:
|
||||||
Value=cmd.doMapping(mapObj).getTens();
|
cmdValue=cmd.doMapping(mapObj);
|
||||||
|
if (!cmdValue.isValue())return 0;
|
||||||
|
Value=cmdValue.getTens();
|
||||||
break;
|
break;
|
||||||
case PAR_100:
|
case PAR_100:
|
||||||
Value=cmd.doMapping(mapObj).getTens_raw()*(100/TENS_BASE);
|
cmdValue=cmd.doMapping(mapObj);
|
||||||
|
if (!cmdValue.isValue())return 0;
|
||||||
|
Value=cmdValue.getTens_raw()*(100/TENS_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
debugSerial<<F("MB suffix:")<<suffixStr<< F(" Val: ")<<Value<<endl;
|
debugSerial<<F("MB suffix:")<<suffixStr<< F(" Val: ")<<Value<<endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user