vif parsing

This commit is contained in:
Wolfgang Hottgenroth 2020-11-17 18:21:49 +01:00
parent f6e10183db
commit e369c51c96
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
2 changed files with 2 additions and 1 deletions

View File

@ -7,7 +7,7 @@
typedef struct {
char name[32];
char unit[16];
uint8_t exponent;
int8_t exponent;
} parsedVIB_t;
parsedVIB_t parseVIB(mbus_value_information_block vib);

View File

@ -22,6 +22,7 @@ static parsedVIB_t parseVIB_default(mbus_value_information_block vib) {
if ((vib.vif & 0b00000000) == 0b00000000) {
strcpy(parsedVIB.name, "Energy");
strcpy(parsedVIB.unit, "Wh");
parsedVIB.exponent = (vib.vif & 0b0111) - 3;
}
return parsedVIB;