vif parsing

This commit is contained in:
2020-11-17 18:44:57 +01:00
parent c7ac9a9dc3
commit 7bcfa7070d
3 changed files with 19 additions and 3 deletions

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include <main.h>
#include <usart.h>
@ -180,6 +181,12 @@ static void parseAndPrintFrame(t_mbusCommHandle *localMbusCommHandle) {
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] parsed VIB N: %s, U: %s, E: %d",
localMbusCommHandle->requestId,
parsedVIB.name, parsedVIB.unit, parsedVIB.exponent);
if (parsedVIB.found) {
uint8_t value = strtol(mbus_data_record_value(record), NULL, 10);
float weightedValue = ((float) value) * powf(10.0, ((float) parsedVIB.exponent));
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] result: %s is %d %s",
localMbusCommHandle->requestId, parsedVIB.name, weightedValue, parsedVIB.unit);
}
}
}
}