mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-13 23:21:19 +10:00
logging: audit log strings for terseness, reclaiming ~6.8 KB of string data (#11374)
* logging: strip redundant punctuation, level prefixes, and 'successfully' from log strings The logger already appends a newline and prints the level tag, so trailing '.', '!', '...', literal \n, and 'Error:'/'Warning:' prefixes inside format strings are wasted flash bytes. Same for 'successfully' (the affirmative form already implies it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: tighten verbose log strings in modules, radio, platform, and system code Rewrite wordy log messages to terser equivalents - drop filler words (articles, 'attempting', 'due to', 'please'), use 'Can't X'/'X failed' phrasing, and abbreviate where the codebase already does (config, init, msg, BT). Format specifiers and argument lists are unchanged; distinctive greppable tokens are preserved. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: tighten verbose log strings in telemetry sensors and GPS Same terseness pass: drop filler, 'Can't X'/'X failed' phrasing, common abbreviations (temp, msg). Specifiers, arguments, and sensor-name prefixes unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: tighten verbose log strings in mesh core Same terseness pass over NodeDB, Router, MeshService, PhoneAPI, RadioInterface, NextHopRouter, and PacketHistory: 'X failed'/'Can't X' phrasing, imperative verbs, dropped filler. Specifiers and arguments unchanged; duplicate literals kept identical to preserve linker string dedup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: 'Unable to/Could not/Cannot' -> "Can't" in log strings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: clang-format rewrap after string shortening Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: restore boot-logo trailing newline and progress-dot strings The terseness pass over-trimmed: the Meshtastic ASCII boot logo kept its blank line via a trailing \n, and three bare "." progress ticks were reduced to empty strings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * Update src/mesh/wifi/WiFiAPClient.cpp Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * logging: address review feedback on the terseness audit - Node/packet IDs use the repo's 0x%08x convention in NextHopRouter, NodeDB, AdminModule and CannedMessageModule. The sibling log in each if/else pair is converted too, so a pair isn't split across two formats. next_hop stays 0x%x - it's the last-byte relay hint, not a NodeNum. - RTC: the read-path and set-path "not found" warnings were byte-identical, so the linker deduped them and the log couldn't say which one fired. Split into "RTC read:" / "RTC set:". (The four sites live in mutually exclusive #ifdef branches, so the RTC family was never ambiguous.) - SCD4X getAmbientPressure()/setAmbientPressure() logged "altitude", and SCD30 getASC() logged "Can't send command" for a read. Both now name the operation they actually perform. - LOG_ERROR already carries the level: ". Error: %u" -> ", rc=%u" (matching the existing rc=%d house style) and "Error executing X()" -> "X() failed". - Typos and wording: "OTA partiton. (Reason" -> "OTA partition (reason", "CST3530 not response ~" -> "CST3530 no response", "Packet received with to: of 0" -> "to=0", HostMetrics "Error decoding" -> "Can't decode", and the dangling ": " on the NextHopRouter retransmission line. Printf specifier sequences are byte-identical on all 37 touched lines apart from the 6 deliberate %x/%u -> %08x node-ID widenings, all on uint32_t args. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
co-authored by
Claude Opus 5
coderabbitai[bot]
Ben Meadors
parent
5692518306
commit
cd716fe384
@@ -19,14 +19,14 @@ bool SCD30Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
_port = dev->address.port;
|
||||
reClockI2C.setup(_bus, _port);
|
||||
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
scd30.begin(*_bus, _address);
|
||||
|
||||
if (!startMeasurement()) {
|
||||
LOG_ERROR("%s: Failed to start periodic measurement", sensorName);
|
||||
LOG_ERROR("%s: Periodic measurement start failed", sensorName);
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -35,7 +35,7 @@ bool SCD30Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
}
|
||||
|
||||
if (!getASC(ascActive)) {
|
||||
LOG_WARN("%s: Could not determine ASC state", sensorName);
|
||||
LOG_WARN("%s: Can't determine ASC state", sensorName);
|
||||
}
|
||||
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
@@ -59,12 +59,12 @@ bool SCD30Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
float co2, temperature, humidity;
|
||||
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_DEBUG("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
if (scd30.readMeasurementData(co2, temperature, humidity) != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Failed to read measurement data", sensorName);
|
||||
LOG_ERROR("%s: Measurement read failed", sensorName);
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -102,7 +102,7 @@ bool SCD30Sensor::setMeasurementInterval(uint16_t measInterval)
|
||||
error = scd30.setMeasurementInterval(measInterval);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set measurement interval. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set measurement interval, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ bool SCD30Sensor::getMeasurementInterval(uint16_t &measInterval)
|
||||
error = scd30.getMeasurementInterval(measInterval);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to get measurement interval. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't get measurement interval, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ bool SCD30Sensor::startMeasurement()
|
||||
state = SCD30_MEASUREMENT;
|
||||
return true;
|
||||
} else {
|
||||
LOG_ERROR("%s: Couldn't start measurement mode", sensorName);
|
||||
LOG_ERROR("%s: Can't start measurement mode", sensorName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ bool SCD30Sensor::stopMeasurement()
|
||||
|
||||
error = scd30.stopPeriodicMeasurement();
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to stop measurement", sensorName);
|
||||
LOG_ERROR("%s: Can't stop measurement", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,17 +180,17 @@ bool SCD30Sensor::performFRC(uint16_t targetCO2)
|
||||
{
|
||||
uint16_t error;
|
||||
|
||||
LOG_INFO("%s: Issuing FRC. Ensure device has been working at least 3 minutes in stable target environment", sensorName);
|
||||
LOG_INFO("%s: Issuing FRC. Needs 3+ min in stable target environment", sensorName);
|
||||
|
||||
LOG_INFO("%s: Target CO2: %u ppm", sensorName, targetCO2);
|
||||
error = scd30.forceRecalibration((uint16_t)targetCO2);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to perform forced recalibration.", sensorName);
|
||||
LOG_ERROR("%s: Can't perform FRC", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: FRC Correction successful.", sensorName);
|
||||
LOG_INFO("%s: FRC done", sensorName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -204,12 +204,12 @@ bool SCD30Sensor::setASC(bool ascEnabled)
|
||||
error = scd30.activateAutoCalibration((uint16_t)ascEnabled);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to send command.", sensorName);
|
||||
LOG_ERROR("%s: Can't send command", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getASC(ascActive)) {
|
||||
LOG_ERROR("%s: Unable to check if ASC is enabled", sensorName);
|
||||
LOG_ERROR("%s: Can't check if ASC enabled", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ bool SCD30Sensor::getASC(uint16_t &_ascActive)
|
||||
error = scd30.getAutoCalibrationStatus(_ascActive);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to send command.", sensorName);
|
||||
LOG_ERROR("%s: Can't get ASC status", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -260,23 +260,23 @@ bool SCD30Sensor::setTemperature(float tempReference)
|
||||
|
||||
if (tempReference == 100) {
|
||||
// Requesting the value of 100 will restore the temperature offset
|
||||
LOG_INFO("%s: Setting reference temperature at 0degC", sensorName);
|
||||
LOG_INFO("%s: Setting reference temp at 0degC", sensorName);
|
||||
_tempOffset = 0;
|
||||
} else {
|
||||
|
||||
LOG_INFO("%s: Setting reference temperature at: %.2f", sensorName, tempReference);
|
||||
LOG_INFO("%s: Setting reference temp at: %.2f", sensorName, tempReference);
|
||||
|
||||
error = scd30.readMeasurementData(co2, temperature, humidity);
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to read current temperature. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't read current temp, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: Current sensor temperature: %.2f", sensorName, temperature);
|
||||
LOG_INFO("%s: Current sensor temp: %.2f", sensorName, temperature);
|
||||
|
||||
tempOffset = (temperature - tempReference);
|
||||
if (tempOffset < 0) {
|
||||
LOG_ERROR("%s: temperature offset is only positive", sensorName);
|
||||
LOG_ERROR("%s: temp offset is only positive", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -284,16 +284,16 @@ bool SCD30Sensor::setTemperature(float tempReference)
|
||||
_tempOffset = static_cast<uint16_t>(tempOffset);
|
||||
}
|
||||
|
||||
LOG_INFO("%s: Setting temperature offset: %u (*100)", sensorName, _tempOffset);
|
||||
LOG_INFO("%s: Setting temp offset: %u (*100)", sensorName, _tempOffset);
|
||||
|
||||
error = scd30.setTemperatureOffset(_tempOffset);
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set temperature offset. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set temp offset, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
scd30.getTemperatureOffset(updatedTempOffset);
|
||||
LOG_INFO("%s: Updated sensor temperature offset: %u (*100)", sensorName, updatedTempOffset);
|
||||
LOG_INFO("%s: Updated sensor temp offset: %u (*100)", sensorName, updatedTempOffset);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ bool SCD30Sensor::setAltitude(uint16_t altitude)
|
||||
error = scd30.setAltitudeCompensation(altitude);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set altitude, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ bool SCD30Sensor::getAltitude(uint16_t &altitude)
|
||||
error = scd30.getAltitudeCompensation(altitude);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to get altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't get altitude, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
LOG_INFO("%s: Sensor altitude: %u", sensorName, altitude);
|
||||
@@ -342,11 +342,11 @@ bool SCD30Sensor::softReset()
|
||||
error = scd30.softReset();
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to do soft reset. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't soft reset, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: soft reset successful", sensorName);
|
||||
LOG_INFO("%s: soft reset done", sensorName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ bool SCD30Sensor::isActive()
|
||||
uint32_t SCD30Sensor::wakeUp()
|
||||
{
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -387,7 +387,7 @@ uint32_t SCD30Sensor::wakeUp()
|
||||
void SCD30Sensor::sleep()
|
||||
{
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -420,7 +420,7 @@ AdminMessageHandleResult SCD30Sensor::handleAdminMessage(const meshtastic_MeshPa
|
||||
AdminMessageHandleResult result;
|
||||
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user