SM200 energy to 32 bit, fixes #372

This commit is contained in:
Paul
2020-04-28 19:02:01 +02:00
parent 1a5be8e404
commit 487cda0841
5 changed files with 15 additions and 12 deletions

View File

@@ -455,6 +455,7 @@ bool _setValue(_EMS_RxTelegram * EMS_RxTelegram, uint32_t * param_op, uint8_t in
*param_op = (uint32_t)((EMS_RxTelegram->data[pos] << 16) + (EMS_RxTelegram->data[pos + 1] << 8) + (EMS_RxTelegram->data[pos + 2]));
return true;
}
// Long 32 bit
bool _setValue32(_EMS_RxTelegram * EMS_RxTelegram, uint32_t * param_op, uint8_t index) {
int8_t pos = _getDataPosition(EMS_RxTelegram, index);
@@ -462,7 +463,8 @@ bool _setValue32(_EMS_RxTelegram * EMS_RxTelegram, uint32_t * param_op, uint8_t
return false;
}
*param_op = (uint32_t)((EMS_RxTelegram->data[pos] << 24) +(EMS_RxTelegram->data[pos + 1] << 16) + (EMS_RxTelegram->data[pos + 2] << 8) + (EMS_RxTelegram->data[pos + 3]));
*param_op = (uint32_t)((EMS_RxTelegram->data[pos] << 24) + (EMS_RxTelegram->data[pos + 1] << 16) + (EMS_RxTelegram->data[pos + 2] << 8)
+ (EMS_RxTelegram->data[pos + 3]));
return true;
}

View File

@@ -211,12 +211,12 @@ void _renderLongValue(const char * prefix, const char * postfix, uint32_t value,
strlcat(buffer, "?", sizeof(buffer));
} else {
char s[20] = {0};
if(div == 0) {
if (div == 0) {
strlcat(buffer, ltoa(value, s, 10), sizeof(buffer));
} else {
strlcat(buffer, ltoa(value/10, s, 10), sizeof(buffer));
strlcat(buffer, ltoa(value / 10, s, 10), sizeof(buffer));
strlcat(buffer, ".", sizeof(buffer));
strlcat(buffer, ltoa(value%10, s, 10), sizeof(buffer));
strlcat(buffer, ltoa(value % 10, s, 10), sizeof(buffer));
}
}

View File

@@ -1 +1 @@
#define APP_VERSION "1.9.5b60"
#define APP_VERSION "1.9.5b61"