mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 22:20:37 +00:00
remove newline from logging statements. (#5022)
remove newline from logging statements in code. The LOG_* functions will now magically add it at the end. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@ MAX17048Singleton *MAX17048Singleton::pinstance{nullptr};
|
||||
bool MAX17048Singleton::runOnce(TwoWire *theWire)
|
||||
{
|
||||
initialized = begin(theWire);
|
||||
LOG_DEBUG("%s::runOnce %s\n", sensorStr, initialized ? "began ok" : "begin failed");
|
||||
LOG_DEBUG("%s::runOnce %s", sensorStr, initialized ? "began ok" : "begin failed");
|
||||
return initialized;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ bool MAX17048Singleton::isBatteryCharging()
|
||||
{
|
||||
float volts = cellVoltage();
|
||||
if (isnan(volts)) {
|
||||
LOG_DEBUG("%s::isBatteryCharging is not connected\n", sensorStr);
|
||||
LOG_DEBUG("%s::isBatteryCharging is not connected", sensorStr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ bool MAX17048Singleton::isBatteryCharging()
|
||||
chargeState = MAX17048ChargeState::IDLE;
|
||||
}
|
||||
|
||||
LOG_DEBUG("%s::isBatteryCharging %s volts: %.3f soc: %.3f rate: %.3f\n", sensorStr, chargeLabels[chargeState], volts,
|
||||
LOG_DEBUG("%s::isBatteryCharging %s volts: %.3f soc: %.3f rate: %.3f", sensorStr, chargeLabels[chargeState], volts,
|
||||
sample.cellPercent, sample.chargeRate);
|
||||
return chargeState == MAX17048ChargeState::IMPORT;
|
||||
}
|
||||
@@ -62,17 +62,17 @@ uint16_t MAX17048Singleton::getBusVoltageMv()
|
||||
{
|
||||
float volts = cellVoltage();
|
||||
if (isnan(volts)) {
|
||||
LOG_DEBUG("%s::getBusVoltageMv is not connected\n", sensorStr);
|
||||
LOG_DEBUG("%s::getBusVoltageMv is not connected", sensorStr);
|
||||
return 0;
|
||||
}
|
||||
LOG_DEBUG("%s::getBusVoltageMv %.3fmV\n", sensorStr, volts);
|
||||
LOG_DEBUG("%s::getBusVoltageMv %.3fmV", sensorStr, volts);
|
||||
return (uint16_t)(volts * 1000.0f);
|
||||
}
|
||||
|
||||
uint8_t MAX17048Singleton::getBusBatteryPercent()
|
||||
{
|
||||
float soc = cellPercent();
|
||||
LOG_DEBUG("%s::getBusBatteryPercent %.1f%%\n", sensorStr, soc);
|
||||
LOG_DEBUG("%s::getBusBatteryPercent %.1f%%", sensorStr, soc);
|
||||
return clamp(static_cast<uint8_t>(round(soc)), static_cast<uint8_t>(0), static_cast<uint8_t>(100));
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ uint16_t MAX17048Singleton::getTimeToGoSecs()
|
||||
float soc = cellPercent(); // state of charge in percent 0 to 100
|
||||
soc = clamp(soc, 0.0f, 100.0f); // clamp soc between 0 and 100%
|
||||
float ttg = ((100.0f - soc) / rate) * 3600.0f; // calculate seconds to charge/discharge
|
||||
LOG_DEBUG("%s::getTimeToGoSecs %.0f seconds\n", sensorStr, ttg);
|
||||
LOG_DEBUG("%s::getTimeToGoSecs %.0f seconds", sensorStr, ttg);
|
||||
return (uint16_t)ttg;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ bool MAX17048Singleton::isBatteryConnected()
|
||||
{
|
||||
float volts = cellVoltage();
|
||||
if (isnan(volts)) {
|
||||
LOG_DEBUG("%s::isBatteryConnected is not connected\n", sensorStr);
|
||||
LOG_DEBUG("%s::isBatteryConnected is not connected", sensorStr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -103,12 +103,12 @@ bool MAX17048Singleton::isExternallyPowered()
|
||||
float volts = cellVoltage();
|
||||
if (isnan(volts)) {
|
||||
// if the battery is not connected then there must be external power
|
||||
LOG_DEBUG("%s::isExternallyPowered battery is\n", sensorStr);
|
||||
LOG_DEBUG("%s::isExternallyPowered battery is", sensorStr);
|
||||
return true;
|
||||
}
|
||||
// if the bus voltage is over MAX17048_BUS_POWER_VOLTS, then the external power
|
||||
// is assumed to be connected
|
||||
LOG_DEBUG("%s::isExternallyPowered %s connected\n", sensorStr, volts >= MAX17048_BUS_POWER_VOLTS ? "is" : "is not");
|
||||
LOG_DEBUG("%s::isExternallyPowered %s connected", sensorStr, volts >= MAX17048_BUS_POWER_VOLTS ? "is" : "is not");
|
||||
return volts >= MAX17048_BUS_POWER_VOLTS;
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@ MAX17048Sensor::MAX17048Sensor() : TelemetrySensor(meshtastic_TelemetrySensorTyp
|
||||
int32_t MAX17048Sensor::runOnce()
|
||||
{
|
||||
if (isInitialized()) {
|
||||
LOG_INFO("Init sensor: %s is already initialised\n", sensorName);
|
||||
LOG_INFO("Init sensor: %s is already initialised", sensorName);
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||
LOG_INFO("Init sensor: %s", sensorName);
|
||||
if (!hasSensor()) {
|
||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||
}
|
||||
@@ -140,11 +140,11 @@ void MAX17048Sensor::setup() {}
|
||||
|
||||
bool MAX17048Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics id: %i\n", measurement->which_variant);
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics id: %i", measurement->which_variant);
|
||||
|
||||
float volts = max17048->cellVoltage();
|
||||
if (isnan(volts)) {
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics battery is not connected\n");
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics battery is not connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ bool MAX17048Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
soc = clamp(soc, 0.0f, 100.0f); // clamp soc between 0 and 100%
|
||||
float ttg = (100.0f - soc) / rate; // calculate hours to charge/discharge
|
||||
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics volts: %.3fV soc: %.1f%% ttg: %.1f hours\n", volts, soc, ttg);
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics volts: %.3fV soc: %.1f%% ttg: %.1f hours", volts, soc, ttg);
|
||||
if ((int)measurement->which_variant == meshtastic_Telemetry_power_metrics_tag) {
|
||||
measurement->variant.power_metrics.has_ch1_voltage = true;
|
||||
measurement->variant.power_metrics.ch1_voltage = volts;
|
||||
|
||||
Reference in New Issue
Block a user