mirror of
https://github.com/meshtastic/firmware.git
synced 2026-09-23 06:45:24 -04:00
* 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>
86 lines
3.1 KiB
C++
86 lines
3.1 KiB
C++
#include "./EInk.h"
|
|
|
|
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
|
|
|
using namespace NicheGraphics::Drivers;
|
|
|
|
// Separate from EInk::begin method, as derived class constructors can probably supply these parameters as constants
|
|
EInk::EInk(uint16_t width, uint16_t height, UpdateTypes supported)
|
|
: concurrency::OSThread("EInkDriver"), width(width), height(height), supportedUpdateTypes(supported)
|
|
{
|
|
OSThread::disable();
|
|
}
|
|
|
|
// Used by NicheGraphics implementations to check if a display supports a specific refresh operation.
|
|
// Whether or not the update type is supported is specified in the constructor
|
|
bool EInk::supports(UpdateTypes type)
|
|
{
|
|
// The EInkUpdateTypes enum assigns each type a unique bit. We are checking if that bit is set.
|
|
if (supportedUpdateTypes & type)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
// Begins using the OSThread to detect when a display update is complete
|
|
// This allows the refresh operation to run "asynchronously".
|
|
// Rather than blocking execution waiting for the update to complete, we are periodically checking the hardware's BUSY pin
|
|
// The expectedDuration argument allows us to delay the start of this checking, if we know "roughly" how long an update takes.
|
|
// Potentially, a display without hardware BUSY could rely entirely on "expectedDuration",
|
|
// provided its isUpdateDone() override always returns true.
|
|
void EInk::beginPolling(uint32_t interval, uint32_t expectedDuration)
|
|
{
|
|
updateRunning = true;
|
|
pollingInterval = interval;
|
|
pollingBegunAt = millis();
|
|
|
|
// To minimize load, we can choose to delay polling for a few seconds, if we know roughly how long the update will take
|
|
// By default, expectedDuration is 0, and we'll start polling immediately
|
|
OSThread::setIntervalFromNow(expectedDuration);
|
|
OSThread::enabled = true;
|
|
}
|
|
|
|
// Meshtastic's pseudo-threading layer
|
|
// We're using this as a timer, to periodically check if an update is complete
|
|
// This is what allows us to update the display asynchronously
|
|
int32_t EInk::runOnce()
|
|
{
|
|
// Check for polling timeout
|
|
// Manually set at 10 seconds, in case some big task holds up the firmware's cooperative multitasking
|
|
if (millis() - pollingBegunAt > 10000)
|
|
failed = true;
|
|
|
|
// Handle failure
|
|
// - polling timeout
|
|
// - other error (derived classes)
|
|
if (failed) {
|
|
LOG_WARN("Display update failed. Check wiring & power supply");
|
|
updateRunning = false;
|
|
failed = false;
|
|
return disable();
|
|
}
|
|
|
|
// If update not yet done
|
|
if (!isUpdateDone())
|
|
return pollingInterval; // Poll again in a few ms
|
|
|
|
// If update done
|
|
finalizeUpdate(); // Any post-update code: power down panel hardware, hibernate, etc
|
|
updateRunning = false; // Change what we report via EInk::busy()
|
|
return disable(); // Stop polling
|
|
}
|
|
|
|
// Wait for an in progress update to complete before continuing
|
|
// Run a normal (async) update first, *then* call await
|
|
void EInk::await()
|
|
{
|
|
// Stop our concurrency thread
|
|
OSThread::disable();
|
|
|
|
// Sit and block until the update is complete
|
|
while (updateRunning) {
|
|
runOnce();
|
|
yield();
|
|
}
|
|
}
|
|
#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|