Skip to content

Commit

Permalink
[INA226] JSON do not output leading spaces (#1714)
Browse files Browse the repository at this point in the history
* INA226 JSON output no trailing spaces

* INA226 JSON do not output leading spaces
  • Loading branch information
NorbertHD authored Jul 31, 2023
1 parent a6c0a3b commit 4a6838a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions main/ZsensorINA226.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 4a6838a

Please sign in to comment.