Compare commits
2 Commits
working-un
...
fix_power_
Author | SHA1 | Date | |
---|---|---|---|
13c8344276 | |||
b7071379b9 |
@ -218,7 +218,7 @@ static void parseAndPrintFrame() {
|
|||||||
// mbusCommHandle.requestId,
|
// mbusCommHandle.requestId,
|
||||||
// parsedVIB.name, parsedVIB.unit, parsedVIB.exponent);
|
// parsedVIB.name, parsedVIB.unit, parsedVIB.exponent);
|
||||||
if (parsedVIB.found) {
|
if (parsedVIB.found) {
|
||||||
uint32_t value = strtol(mbus_data_record_value(record), NULL, 10);
|
int32_t value = strtol(mbus_data_record_value(record), NULL, 10);
|
||||||
float weightedValue = ((float) value) * powf(10.0, ((float) parsedVIB.exponent));
|
float weightedValue = ((float) value) * powf(10.0, ((float) parsedVIB.exponent));
|
||||||
coloredMsg(LOG_YELLOW, false, "mbc papf [%d] %s is %.1f %s (%d * 10^%d)",
|
coloredMsg(LOG_YELLOW, false, "mbc papf [%d] %s is %.1f %s (%d * 10^%d)",
|
||||||
mbusCommHandle.requestId, parsedVIB.name, weightedValue, parsedVIB.unit,
|
mbusCommHandle.requestId, parsedVIB.name, weightedValue, parsedVIB.unit,
|
||||||
|
@ -12,12 +12,14 @@ static const char NAME_VOLTAGE[] = "Voltage";
|
|||||||
static const char NAME_CURRENT[] = "Current";
|
static const char NAME_CURRENT[] = "Current";
|
||||||
static const char NAME_POWER[] = "Power";
|
static const char NAME_POWER[] = "Power";
|
||||||
static const char NAME_ENERGY[] = "Energy";
|
static const char NAME_ENERGY[] = "Energy";
|
||||||
|
static const char NAME_VOLUME[] = "Volume";
|
||||||
static const char NAME_UNKNOWN[] = "unknown";
|
static const char NAME_UNKNOWN[] = "unknown";
|
||||||
|
|
||||||
static const char UNIT_VOLT[] = "V";
|
static const char UNIT_VOLT[] = "V";
|
||||||
static const char UNIT_AMPERE[] = "A";
|
static const char UNIT_AMPERE[] = "A";
|
||||||
static const char UNIT_WATT[] = "W";
|
static const char UNIT_WATT[] = "W";
|
||||||
static const char UNIT_WATTHOUR[] = "Wh";
|
static const char UNIT_WATTHOUR[] = "Wh";
|
||||||
|
static const char UNIT_QUBICMETER[] = "m3";
|
||||||
static const char UNIT_UNKNOWN[] = "?";
|
static const char UNIT_UNKNOWN[] = "?";
|
||||||
|
|
||||||
static parsedVIB_t parseVIB_FB(mbus_value_information_block vib) {
|
static parsedVIB_t parseVIB_FB(mbus_value_information_block vib) {
|
||||||
@ -61,6 +63,11 @@ static parsedVIB_t parseVIB_default(mbus_value_information_block vib) {
|
|||||||
parsedVIB.unit = UNIT_WATT;
|
parsedVIB.unit = UNIT_WATT;
|
||||||
parsedVIB.exponent = (vib.vif & 0b0111) - 3;
|
parsedVIB.exponent = (vib.vif & 0b0111) - 3;
|
||||||
parsedVIB.found = true;
|
parsedVIB.found = true;
|
||||||
|
} else if ((vib.vif & 0b01111000) == 0b00010000) {
|
||||||
|
parsedVIB.name = NAME_VOLUME;
|
||||||
|
parsedVIB.unit = UNIT_QUBICMETER;
|
||||||
|
parsedVIB.exponent = (vib.vif & 0b0111) - 3;
|
||||||
|
parsedVIB.found = true;
|
||||||
} else {
|
} else {
|
||||||
coloredMsg(LOG_RED, true, "mpe pvd unknown vif 0x%02x", vib.vif);
|
coloredMsg(LOG_RED, true, "mpe pvd unknown vif 0x%02x", vib.vif);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user