mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-12 00:02:53 +00:00
Fixed extraction of negative prices from server
This commit is contained in:
parent
2e4a0fc0a3
commit
fea51e3406
@ -574,7 +574,8 @@ PricesContainer* PriceService::fetchPrices(time_t t) {
|
||||
for(uint8_t i = 0; i < ret->getNumberOfPoints(); i++) {
|
||||
// To avoid alignment issues on ESP8266, we use memcpy
|
||||
memcpy(&intval, &points[i], sizeof(int32_t));
|
||||
float value = ntohl(intval) / 10000.0;
|
||||
intval = ntohl(intval); // Change byte order before converting to float, to support negative values
|
||||
float value = intval / 10000.0;
|
||||
#if defined(AMS_REMOTE_DEBUG)
|
||||
if (debugger->isActive(RemoteDebug::VERBOSE))
|
||||
#endif
|
||||
@ -585,7 +586,8 @@ PricesContainer* PriceService::fetchPrices(time_t t) {
|
||||
for(uint8_t i = 0; i < ret->getNumberOfPoints(); i++) {
|
||||
// To avoid alignment issues on ESP8266, we use memcpy
|
||||
memcpy(&intval, &points[ret->getNumberOfPoints()+i], sizeof(int32_t));
|
||||
float value = ntohl(intval) / 10000.0;
|
||||
intval = ntohl(intval); // Change byte order before converting to float, to support negative values
|
||||
float value = intval / 10000.0;
|
||||
#if defined(AMS_REMOTE_DEBUG)
|
||||
if (debugger->isActive(RemoteDebug::VERBOSE))
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user