Skip to content

Commit

Permalink
fix float values
Browse files Browse the repository at this point in the history
  • Loading branch information
caveman99 committed Jan 19, 2025
1 parent 50465f2 commit e0e59f4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/modules/Telemetry/Sensor/RAK9154Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,12 @@ void RAK9154Sensor::setup()

bool RAK9154Sensor::getMetrics(meshtastic_Telemetry *measurement)
{
if (lastRead > 0)
LOG_DEBUG("Last valid read from RAK9154Sensor: %d s ago", (millis() - lastRead) / 1000);
if (getBusVoltageMv() > 0) {
measurement->variant.environment_metrics.has_voltage = true;
measurement->variant.environment_metrics.has_current = true;

measurement->variant.environment_metrics.voltage = getBusVoltageMv() / 1000;
measurement->variant.environment_metrics.current = getCurrentMa() / 1000;
measurement->variant.environment_metrics.voltage = (float)getBusVoltageMv() / 1000;
measurement->variant.environment_metrics.current = (float)getCurrentMa() / 1000;
return true;
} else {
return false;
Expand Down

0 comments on commit e0e59f4

Please sign in to comment.