Skip to content

Commit 023351a

Browse files
authored
Remove dead code (#11082)
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
1 parent ba8b1b1 commit 023351a

55 files changed

Lines changed: 6 additions & 896 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/FSCommon.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,44 +30,6 @@ SPIClass SPI_HSPI(HSPI);
3030

3131
#endif // HAS_SDCARD
3232

33-
/**
34-
* @brief Copies a file from one location to another.
35-
*
36-
* @param from The path of the source file.
37-
* @param to The path of the destination file.
38-
* @return true if the file was successfully copied, false otherwise.
39-
*/
40-
bool copyFile(const char *from, const char *to)
41-
{
42-
#ifdef FSCom
43-
// take SPI Lock
44-
concurrency::LockGuard g(spiLock);
45-
unsigned char cbuffer[16];
46-
47-
File f1 = FSCom.open(from, FILE_O_READ);
48-
if (!f1) {
49-
LOG_ERROR("Failed to open source file %s", from);
50-
return false;
51-
}
52-
53-
File f2 = FSCom.open(to, FILE_O_WRITE);
54-
if (!f2) {
55-
LOG_ERROR("Failed to open destination file %s", to);
56-
return false;
57-
}
58-
59-
while (f1.available() > 0) {
60-
byte i = f1.read(cbuffer, 16);
61-
f2.write(cbuffer, i);
62-
}
63-
64-
f2.flush();
65-
f2.close();
66-
f1.close();
67-
return true;
68-
#endif
69-
}
70-
7133
/**
7234
* Renames a file from pathFrom to pathTo.
7335
*

src/FSCommon.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ using namespace Adafruit_LittleFS_Namespace;
5757
#endif
5858

5959
void fsInit();
60-
bool copyFile(const char *from, const char *to);
6160
bool renameFile(const char *pathFrom, const char *pathTo);
6261
bool fsFormat();
6362
std::vector<meshtastic_FileInfo> getFiles(const char *dirname, uint8_t levels, size_t maxCount = 64, bool *wasLimited = nullptr);

src/MessageStore.cpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "SafeFile.h"
88
#include "gps/RTC.h"
99
#include "memory/MemAudit.h"
10-
#include <cassert>
1110
#include <cstring> // memcpy
1211

1312
#ifndef MESSAGE_TEXT_POOL_SIZE
@@ -244,40 +243,6 @@ const StoredMessage *MessageStore::tryAddFromPacket(const meshtastic_MeshPacket
244243
return &liveMessages.back();
245244
}
246245

247-
const StoredMessage &MessageStore::addFromPacket(const meshtastic_MeshPacket &packet)
248-
{
249-
const StoredMessage *stored = tryAddFromPacket(packet);
250-
assert(stored);
251-
return *stored;
252-
}
253-
254-
// Outgoing/manual message
255-
void MessageStore::addFromString(uint32_t sender, uint8_t channelIndex, const std::string &text)
256-
{
257-
StoredMessage sm;
258-
259-
// Always use our local time (helper handles RTC vs boot time)
260-
assignTimestamp(sm);
261-
262-
sm.sender = sender;
263-
sm.channelIndex = channelIndex;
264-
sm.textOffset = storeTextInPool(text.c_str(), text.size());
265-
sm.textLength = text.size();
266-
267-
// Use the provided destination
268-
sm.dest = sender;
269-
sm.type = MessageType::DM_TO_US;
270-
271-
// Outgoing messages always start with unknown ack status
272-
sm.ackStatus = AckStatus::NONE;
273-
274-
addLiveMessage(sm);
275-
276-
#if ENABLE_MESSAGE_PERSISTENCE
277-
markMessageStoreUnsaved();
278-
#endif
279-
}
280-
281246
#if ENABLE_MESSAGE_PERSISTENCE
282247

283248
// Compact, fixed-size on-flash representation using offset + length

src/MessageStore.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ class MessageStore
9393
void addLiveMessage(StoredMessage &&msg);
9494
void addLiveMessage(const StoredMessage &msg); // convenience overload
9595
const std::deque<StoredMessage> &getLiveMessages() const { return liveMessages; }
96+
// Add new messages from packets. Returns nullptr if the packet is filtered out.
9697
const StoredMessage *tryAddFromPacket(const meshtastic_MeshPacket &mp); // Incoming/outgoing -> RAM only
97-
// Add new messages from packets or manual input
98-
const StoredMessage &addFromPacket(const meshtastic_MeshPacket &mp); // Incoming/outgoing → RAM only
99-
void addFromString(uint32_t sender, uint8_t channelIndex, const std::string &text); // Manual add
10098

10199
// Persistence methods (used only on boot/shutdown)
102100
void saveToFlash(); // Save messages to flash

src/SerialConsole.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,6 @@ void consoleInit()
5757
DEBUG_PORT.rpInit(); // Simply sets up semaphore
5858
}
5959

60-
/// Print and flush an unclassified formatted console message.
61-
void consolePrintf(const char *format, ...)
62-
{
63-
va_list arg;
64-
va_start(arg, format);
65-
console->vprintf(nullptr, format, arg);
66-
va_end(arg);
67-
console->flush();
68-
}
69-
7060
/// Initialize console, protobuf transport, serial port, and worker thread state.
7161
SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), concurrency::OSThread("SerialConsole")
7262
{

src/SerialConsole.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class SerialConsole : public StreamAPI, public RedirectablePrint, private concur
6767
};
6868

6969
// A simple wrapper to allow non class aware code write to the console
70-
void consolePrintf(const char *format, ...);
7170
void consoleInit();
7271

7372
extern SerialConsole *console;

src/buzz/buzz.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,6 @@ void playBoop()
194194
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
195195
}
196196

197-
void playLongPressLeadUp()
198-
{
199-
// An ascending lead-up sequence for long press - builds anticipation
200-
ToneDuration melody[] = {
201-
{NOTE_C3, 100}, // Start low
202-
{NOTE_E3, 100}, // Step up
203-
{NOTE_G3, 100}, // Keep climbing
204-
{NOTE_B3, 150} // Peak with longer note for emphasis
205-
};
206-
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
207-
}
208-
209197
// Static state for progressive lead-up notes
210198
static int leadUpNoteIndex = 0;
211199
static const ToneDuration leadUpNotes[] = {

src/buzz/buzz.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ void play4ClickUp();
1212
void playBoop();
1313
void playChirp();
1414
void playClick();
15-
void playLongPressLeadUp();
1615
bool playNextLeadUpNote(); // Play the next note in the lead-up sequence
1716
void resetLeadUpSequence(); // Reset the lead-up sequence to start from beginning

src/gps/GPS.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,11 +2201,6 @@ bool GPS::hasLock()
22012201
return false;
22022202
}
22032203

2204-
bool GPS::hasFlow()
2205-
{
2206-
return reader.passedChecksum() > 0;
2207-
}
2208-
22092204
bool GPS::whileActive()
22102205
{
22112206
unsigned int charsInBuf = 0;

src/gps/GPS.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ class GPS : private concurrency::OSThread
111111
/// Returns true if we have acquired GPS lock.
112112
virtual bool hasLock();
113113

114-
/// Returns true if there's valid data flow with the chip.
115-
virtual bool hasFlow();
116-
117114
/// Return true if we are connected to a GPS
118115
bool isConnected() const { return hasGPS; }
119116

0 commit comments

Comments
 (0)