[INA226] JSON do not output leading spaces (#1714)
* INA226 JSON output no trailing spaces * INA226 JSON do not output leading spaces
This commit is contained in:
1 parent
a6c0a3b1d4
commit
4a6838a491
1 file changed
+3
-9
@@ -69,15 +69,9 @@ void MeasureINA226() {
|
||||
float current = shuntvolt * 0.0000025 / rShunt; // * LSB / R
|
||||
float power = abs(volt * current);
|
||||
|
||||
char volt_c[7];
|
||||
char current_c[7];
|
||||
char power_c[7];
|
||||
dtostrf(volt, 6, 3, volt_c);
|
||||
dtostrf(current, 6, 3, current_c);
|
||||
dtostrf(power, 6, 3, power_c);
|
||||
INA226data["volt"] = (char*)volt_c;
|
||||
INA226data["current"] = (char*)current_c;
|
||||
INA226data["power"] = (char*)power_c;
|
||||
INA226data["volt"] = volt;
|
||||
INA226data["current"] = current;
|
||||
INA226data["power"] = power;
|
||||
pub(subjectINA226toMQTT, INA226data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user