Merge pull request #14189 from gemu2015/sml_fix

fix vbus signed word
This commit is contained in:
Theo Arends 2021-12-28 14:26:42 +01:00 committed by GitHub
commit fcba276e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1976,7 +1976,7 @@ void SML_Decode(uint8_t index) {
} else {
// low word
if (usign) ebus_dval = vbus_get_septet(cp) & 0xffff;
else (int16_t)(vbus_get_septet(cp) & 0xffff);
else ebus_dval = (int16_t)(vbus_get_septet(cp) & 0xffff);
}
break;
case 'b':
@ -2993,10 +2993,14 @@ uint8_t hflg=0;
}
float SML_GetVal(uint32_t index) {
if (index<1 && index>SML_MAX_VARS) { index = 1;}
if (index < 1 || index > SML_MAX_VARS) { index = 1;}
return meter_vars[index-1];
}
char *SML_GetSVal(uint32_t index) {
if (index < 1 || index > MAX_METERS) { index = 1;}
return &meter_id[index - 1][0];
}
#endif // USE_SML_SCRIPT_CMD