Skip to content

Remove dead code - #11082

Merged
caveman99 merged 3 commits into
developfrom
remove-dead-code
Jul 20, 2026
Merged

Remove dead code#11082
caveman99 merged 3 commits into
developfrom
remove-dead-code

Conversation

@caveman99

@caveman99 caveman99 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Removes function definitions that have no call sites.

Method

Definitions were extracted mechanically and every candidate was then verified individually against src, test, variants, lib and the external device-ui checkout, checking for virtual dispatch, function-pointer and callback registration, and platform ifdef guards. 158 candidates were reviewed; false positives were kept.

Deliberately kept:

  • nanopb field callbacks and HTTP route handlers reached by function pointer
  • virtual overrides invoked through a base pointer
  • vendored code under src/platform and LovyanGFX
  • driver API surface with no current caller (TCA8418KeyboardBase, INA3221Sensor, SGM41562, BBQ10Keyboard, RadioLibInterface noise floor accessors)
  • AdminModule::handleGetNodeRemoteHardwarePins, Channels::setDefaultPresetCryptoForHash and MeshService::getNodenumFromRequestId, which are unused but would be protocol or feature changes rather than cleanup

Notes

The OnScreenKeyboardModule popup chain is removed as a unit. showPopup was the only writer of popupVisible, and its only caller was already unreferenced, so drawPopup, drawPopupOverlay and clearPopup were reachable but permanently inert. This is fallout from the frame based UI being replaced by baseUI.

htmlDeleteDir became unreachable once handleDeleteFsContent was removed; it was only ever reached through that handler plus its own recursion.

ThreadedMessageApplet::saveMessagesToFlash is a vestigial wrapper, not a missing save. Persistence moved to Events::beforeDeepSleep and Events::beforeReboot.

Verification

Local run used the native-windows env, which is headless (HAS_SCREEN=0), so the graphics and InkHUD changes are not covered locally and rely on CI. No deleted symbol appears in the local build log.

Summary by CodeRabbit

  • New Features

    • Long-press audio feedback now plays progressively, with support for restarting the lead-up sequence.
    • Canned messages can be launched with a selected destination and channel.
  • Changes

    • Keyboard popup overlays and related transient notifications are no longer shown.
    • Web admin, hotspot, and filesystem management endpoints have been reduced.
    • Canned messages no longer support “repeat last destination” behavior.
    • Telemetry speed display now uses knots (instead of miles-per-hour).
    • Message persistence is handled centrally during shutdown and sleep flows.
  • Documentation

    • Updated guidance on message ingestion and filtering behavior.

Delete function definitions with no call sites. Each was verified across
src, test, variants, lib and the device-ui checkout, and checked for
virtual dispatch, function-pointer registration and platform ifdef guards.

Removed:
- MessageStore::addFromPacket and addFromString, superseded by
  tryAddFromPacket
- GeoCoord rangeRadiansToMeters, distanceTo, bearingTo
- Router::rawSend, declared virtual with no override and no caller
- ContentHandler handleHotspot, handleFs, handleAdminSettings,
  handleAdminSettingsApply, handleDeleteFsContent and their commented
  route registrations, plus the now unreachable htmlDeleteDir and the
  handleUpdateFs declaration that had no definition
- ContentHelper replaceAll
- OnScreenKeyboardModule popup chain: showPopup, clearPopup, drawPopup,
  drawPopupOverlay and their state, unreachable since the frame based UI
  was replaced by baseUI
- DebugRenderer drawDebugInfoTrampoline, drawDebugInfoSettingsTrampoline
  and the orphaned drawFrameSettings
- NodeListRenderer calculateMaxScroll, drawColumns and a stale extern
  haveGlyphs declaration with no definition
- UIRenderer::haveGlyphs, Screen::blink,
  NotificationRenderer::showKeyboardMessagePopupWithTitle,
  VirtualKeyboard::getInputText
- InkHUD touchNavLeft, touchNavRight, Applet::getActiveNodeCount,
  ThreadedMessageApplet::saveMessagesToFlash
- TwoButton::setHandlerUp, TwoButtonExtended setHandlerUp,
  setJoystickDownHandlers, setJoystickUpHandlers
- CannedMessageModule LaunchRepeatDestination, isCharInputAllowed,
  hasMessages
- TrafficManagementModule resetStats, recordRouterHopPreserved,
  saturatingIncrement
- UnitConversions::MetersPerSecondToMilesPerHour
- EncryptedStorage getSessionRemainingSeconds
- BMI270Sensor::writeRegisters, GPS::hasFlow, FSCommon copyFile,
  SerialConsole consolePrintf, buzz playLongPressLeadUp,
  memGet displayPercentHeapFree

Also corrects the InkHUD README, which documented addFromPacket as the
live path for storing broadcasts and DMs.
@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d35dccc0-760c-4fd0-ab46-67a4e6e361c9

📥 Commits

Reviewing files that changed from the base of the PR and between 0173ce9 and 26a22f0.

📒 Files selected for processing (1)
  • src/main.cpp

📝 Walkthrough

Walkthrough

This PR removes unused filesystem, message, console, GPS, rendering, input, HTTP, telemetry, and security helpers. It also introduces incremental buzzer lead-up playback, narrows message ingestion APIs, removes keyboard popup handling, and initializes device metadata with defaults.

Changes

Core API and persistence cleanup

Layer / File(s) Summary
Message and core interface changes
src/FSCommon.*, src/MessageStore.*, src/SerialConsole.*, src/mesh/Router.*, src/security/EncryptedStorage.*, src/main.cpp
Removes unused filesystem, console, raw-send, and message-ingestion helpers; the session API exposes expiration status, and device metadata uses default initialization.

Device and domain utility cleanup

Layer / File(s) Summary
Device and domain utilities
src/buzz/*, src/gps/*, src/memGet.cpp, src/modules/Telemetry/*, src/modules/TrafficManagementModule.*, src/motion/BMI270Sensor.*
Adds stateful one-note buzzer progression and removes unused GPS, coordinate, memory, telemetry, traffic, and sensor helpers.

UI and interaction cleanup

Layer / File(s) Summary
Rendering and keyboard behavior
src/graphics/Screen.*, src/graphics/VirtualKeyboard.*, src/graphics/draw/*, src/modules/OnScreenKeyboardModule.*
Removes unused rendering APIs and keyboard popup state, and narrows virtual-keyboard input handling.
InkHUD and input controls
src/graphics/niche/InkHUD/*, src/graphics/niche/Inputs/*, src/modules/CannedMessageModule.*
Removes obsolete InkHUD helpers and navigation implementations, updates message-store documentation, and reduces button and canned-message callback APIs.

HTTP handler cleanup

Layer / File(s) Summary
HTTP routes and handlers
src/mesh/http/ContentHandler.*
Keeps explicit active route registration while removing unused hotspot, filesystem, admin, and directory handlers.
HTTP content helper removal
src/mesh/http/ContentHelper.*
Removes the internal replaceAll helper and declaration.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: bugfix, InkHUD

Suggested reviewers: thebentern, jp-bennett

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: removing dead code.
Description check ✅ Passed The description is substantive and covers summary, method, notes, and verification, matching the PR's intent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-dead-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@caveman99 caveman99 added tech debt Code or lib references that are not up to date or propper standards triaged Reviewed by the team, has enough information and ready to work on now. labels Jul 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/MessageStore.h`:
- Line 97: Update the declaration comment for MessageStore::tryAddFromPacket in
MessageStore.h to describe only incoming/outgoing packet handling, removing the
“or manual input” wording while leaving the method signature unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a564b56e-6a86-4c86-bd85-bf4c4262e3b7

📥 Commits

Reviewing files that changed from the base of the PR and between a808e99 and e646ed9.

📒 Files selected for processing (54)
  • src/FSCommon.cpp
  • src/FSCommon.h
  • src/MessageStore.cpp
  • src/MessageStore.h
  • src/SerialConsole.cpp
  • src/SerialConsole.h
  • src/buzz/buzz.cpp
  • src/buzz/buzz.h
  • src/gps/GPS.cpp
  • src/gps/GPS.h
  • src/gps/GeoCoord.cpp
  • src/gps/GeoCoord.h
  • src/graphics/Screen.cpp
  • src/graphics/Screen.h
  • src/graphics/VirtualKeyboard.cpp
  • src/graphics/VirtualKeyboard.h
  • src/graphics/draw/DebugRenderer.cpp
  • src/graphics/draw/DebugRenderer.h
  • src/graphics/draw/NodeListRenderer.cpp
  • src/graphics/draw/NodeListRenderer.h
  • src/graphics/draw/NotificationRenderer.cpp
  • src/graphics/draw/NotificationRenderer.h
  • src/graphics/draw/UIRenderer.cpp
  • src/graphics/draw/UIRenderer.h
  • src/graphics/niche/InkHUD/Applet.cpp
  • src/graphics/niche/InkHUD/Applet.h
  • src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp
  • src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h
  • src/graphics/niche/InkHUD/InkHUD.cpp
  • src/graphics/niche/InkHUD/InkHUD.h
  • src/graphics/niche/InkHUD/docs/README.md
  • src/graphics/niche/Inputs/TwoButton.cpp
  • src/graphics/niche/Inputs/TwoButton.h
  • src/graphics/niche/Inputs/TwoButtonExtended.cpp
  • src/graphics/niche/Inputs/TwoButtonExtended.h
  • src/memGet.cpp
  • src/mesh/Router.cpp
  • src/mesh/Router.h
  • src/mesh/http/ContentHandler.cpp
  • src/mesh/http/ContentHandler.h
  • src/mesh/http/ContentHelper.cpp
  • src/mesh/http/ContentHelper.h
  • src/modules/CannedMessageModule.cpp
  • src/modules/CannedMessageModule.h
  • src/modules/OnScreenKeyboardModule.cpp
  • src/modules/OnScreenKeyboardModule.h
  • src/modules/Telemetry/UnitConversions.cpp
  • src/modules/Telemetry/UnitConversions.h
  • src/modules/TrafficManagementModule.cpp
  • src/modules/TrafficManagementModule.h
  • src/motion/BMI270Sensor.cpp
  • src/motion/BMI270Sensor.h
  • src/security/EncryptedStorage.cpp
  • src/security/EncryptedStorage.h
💤 Files with no reviewable changes (52)
  • src/graphics/VirtualKeyboard.h
  • src/mesh/http/ContentHelper.cpp
  • src/graphics/niche/Inputs/TwoButton.h
  • src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h
  • src/mesh/Router.h
  • src/SerialConsole.h
  • src/mesh/http/ContentHelper.h
  • src/modules/TrafficManagementModule.h
  • src/graphics/niche/Inputs/TwoButton.cpp
  • src/buzz/buzz.h
  • src/FSCommon.h
  • src/motion/BMI270Sensor.h
  • src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp
  • src/graphics/draw/NodeListRenderer.h
  • src/graphics/VirtualKeyboard.cpp
  • src/gps/GPS.cpp
  • src/graphics/niche/InkHUD/Applet.cpp
  • src/modules/Telemetry/UnitConversions.h
  • src/graphics/draw/UIRenderer.h
  • src/graphics/draw/NotificationRenderer.h
  • src/graphics/niche/InkHUD/InkHUD.cpp
  • src/security/EncryptedStorage.cpp
  • src/mesh/Router.cpp
  • src/mesh/http/ContentHandler.h
  • src/graphics/niche/Inputs/TwoButtonExtended.cpp
  • src/graphics/Screen.h
  • src/graphics/draw/DebugRenderer.h
  • src/modules/TrafficManagementModule.cpp
  • src/graphics/draw/UIRenderer.cpp
  • src/FSCommon.cpp
  • src/graphics/niche/InkHUD/Applet.h
  • src/memGet.cpp
  • src/gps/GeoCoord.h
  • src/modules/OnScreenKeyboardModule.h
  • src/SerialConsole.cpp
  • src/graphics/niche/Inputs/TwoButtonExtended.h
  • src/gps/GeoCoord.cpp
  • src/graphics/draw/NodeListRenderer.cpp
  • src/MessageStore.cpp
  • src/buzz/buzz.cpp
  • src/modules/CannedMessageModule.h
  • src/security/EncryptedStorage.h
  • src/gps/GPS.h
  • src/graphics/draw/DebugRenderer.cpp
  • src/graphics/niche/InkHUD/InkHUD.h
  • src/graphics/Screen.cpp
  • src/motion/BMI270Sensor.cpp
  • src/graphics/draw/NotificationRenderer.cpp
  • src/modules/Telemetry/UnitConversions.cpp
  • src/modules/OnScreenKeyboardModule.cpp
  • src/mesh/http/ContentHandler.cpp
  • src/modules/CannedMessageModule.cpp

Comment thread src/MessageStore.h
addFromString was removed, so the comment no longer describes the API.
@caveman99

Copy link
Copy Markdown
Member Author

Addressed the review comment: dropped the or manual input wording, since addFromString was removed. Also noted the null-return contract, which is the part callers actually need.

Two points in the walkthrough do not match the diff. This PR adds no behavior; the only five added lines are the tryAddFromPacket declaration line and the InkHUD README correction. Specifically, it does not add "stateful one-note buzzer progression" (the leadUpNotes table and playNextLeadUpNote already existed and are untouched; only the unused playLongPressLeadUp was removed) and it does not replace the session remaining-time query with an expiration status (only the unused getSessionRemainingSeconds was removed). Both look like pure deletions being read as additions.

@caveman99 caveman99 added the cleanup Code cleanup or refactor label Jul 20, 2026
Initialize meshtastic_DeviceMetadata with its init_default macro so the
has_xeddsa field is always set. cppcheck reported deviceMetadata.has_xeddsa
as an uninitialized variable, failing the cppcheck jobs.
@caveman99
caveman99 merged commit 023351a into develop Jul 20, 2026
104 checks passed
@caveman99
caveman99 deleted the remove-dead-code branch July 20, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code cleanup or refactor tech debt Code or lib references that are not up to date or propper standards triaged Reviewed by the team, has enough information and ready to work on now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant