fix a lot of low level cppcheck warnings (#9623)

* simplify the observer pattern, since all the called functions are const getters.
* use arduino macro over std: for numerical values and refactor local variables in drawScrollbar()
* oh, so Cppcheck actually complained about const pointers not being const.
* slowly getting out of ifdef hell
* fix inkHUD warnings as well
* last 2 check warnings
* git checks should fail on low defects from now on
This commit is contained in:
Thomas Göttgens
2026-02-16 12:28:07 +01:00
committed by GitHub
parent 32db70037d
commit 56fd9c7813
56 changed files with 217 additions and 226 deletions

View File

@@ -1209,14 +1209,13 @@ int32_t CannedMessageModule::runOnce()
this->cursor = 0;
// Tell Screen to jump straight to the TextMessage frame
UIFrameEvent e;
e.action = UIFrameEvent::Action::SWITCH_TO_TEXTMESSAGE;
this->notifyObservers(&e);
// Now deactivate this module
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
return INT32_MAX; // dont fall back into canned list
return INT32_MAX; // don't fall back into canned list
} else {
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
}
@@ -1237,14 +1236,13 @@ int32_t CannedMessageModule::runOnce()
this->cursor = 0;
// Tell Screen to jump straight to the TextMessage frame
UIFrameEvent e;
e.action = UIFrameEvent::Action::SWITCH_TO_TEXTMESSAGE;
this->notifyObservers(&e);
// Now deactivate this module
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
return INT32_MAX; // dont fall back into canned list
return INT32_MAX; // don't fall back into canned list
}
} else {
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
@@ -1255,11 +1253,10 @@ int32_t CannedMessageModule::runOnce()
this->freetext = "";
this->cursor = 0;
UIFrameEvent e;
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
this->notifyObservers(&e);
// Immediately stop, dont linger on canned screen
// Immediately stop, don't linger on canned screen
return INT32_MAX;
}
// Highlight [Select Destination] initially when entering the message list
@@ -2070,7 +2067,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st
// Draw lines with emotes
int rowHeight = FONT_HEIGHT_SMALL;
int yLine = inputY;
for (auto &line : lines) {
for (const auto &line : lines) {
int nextX = x;
for (const auto &token : line) {
if (token.first) {