hopefully fix remaining cppcheck issues (#9745)

This commit is contained in:
Thomas Göttgens
2026-02-25 10:27:21 +01:00
committed by GitHub
parent ad7d19c317
commit 54781cf51a
8 changed files with 17 additions and 14 deletions
+1 -3
View File
@@ -51,9 +51,7 @@ class AudioThread : public concurrency::OSThread
i2sRtttl = nullptr; i2sRtttl = nullptr;
} }
if (rtttlFile != nullptr) { rtttlFile = nullptr;
rtttlFile = nullptr;
}
setCPUFast(false); setCPUFast(false);
#ifdef T_LORA_PAGER #ifdef T_LORA_PAGER
+2
View File
@@ -35,6 +35,8 @@ void consoleInit()
#if defined(SERIAL_HAS_ON_RECEIVE) #if defined(SERIAL_HAS_ON_RECEIVE)
// onReceive does only exist for HardwareSerial not for USB CDC serial // onReceive does only exist for HardwareSerial not for USB CDC serial
Port.onReceive([sc]() { sc->rxInt(); }); Port.onReceive([sc]() { sc->rxInt(); });
#else
(void)sc;
#endif #endif
DEBUG_PORT.rpInit(); // Simply sets up semaphore DEBUG_PORT.rpInit(); // Simply sets up semaphore
} }
+2 -2
View File
@@ -1209,8 +1209,8 @@ void TFTDisplay::display(bool fromBlank)
bool somethingChanged = false; bool somethingChanged = false;
// Store colors byte-reversed so that TFT_eSPI doesn't have to swap bytes in a separate step // Store colors byte-reversed so that TFT_eSPI doesn't have to swap bytes in a separate step
colorTftMesh = (TFT_MESH >> 8) | ((TFT_MESH & 0xFF) << 8); colorTftMesh = __builtin_bswap16(TFT_MESH);
colorTftBlack = (TFT_BLACK >> 8) | ((TFT_BLACK & 0xFF) << 8); colorTftBlack = __builtin_bswap16(TFT_BLACK);
y = 0; y = 0;
while (y < displayHeight) { while (y < displayHeight) {
@@ -73,7 +73,7 @@ ProcessMessage InkHUD::FavoritesMapApplet::handleReceived(const meshtastic_MeshP
} }
} else { } else {
// For non-local packets, this applet only reacts to favorited nodes. // For non-local packets, this applet only reacts to favorited nodes.
meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(mp.from); const meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(mp.from);
if (!sender || !sender->is_favorite) if (!sender || !sender->is_favorite)
return ProcessMessage::CONTINUE; return ProcessMessage::CONTINUE;
+2 -3
View File
@@ -143,9 +143,8 @@ uint32_t get_st7789_id(uint8_t cs, uint8_t sck, uint8_t mosi, uint8_t dc, uint8_
digitalWrite(rst, HIGH); digitalWrite(rst, HIGH);
delay(10); delay(10);
uint32_t ID = 0; readwrite8(0x04, 24, 1, cs, sck, mosi, dc, rst);
ID = readwrite8(0x04, 24, 1, cs, sck, mosi, dc, rst); uint32_t ID = readwrite8(0x04, 24, 1, cs, sck, mosi, dc, rst); // ST7789 needs twice
ID = readwrite8(0x04, 24, 1, cs, sck, mosi, dc, rst); // ST7789 needs twice
return ID; return ID;
} }
+1 -1
View File
@@ -56,7 +56,7 @@ class UdpMulticastHandler final
isRunning = false; isRunning = false;
} }
void onReceive(AsyncUDPPacket packet) void onReceive(AsyncUDPPacket &packet)
{ {
if (!isRunning) { if (!isRunning) {
return; return;
@@ -297,7 +297,8 @@ int32_t EnvironmentTelemetryModule::runOnce()
// this only works on the wismesh hub with the solar option. This is not an I2C sensor, so we don't need the // this only works on the wismesh hub with the solar option. This is not an I2C sensor, so we don't need the
// sensormap here. // sensormap here.
#ifdef HAS_RAKPROT #ifdef HAS_RAKPROT
result = rak9154Sensor.runOnce(); if (rak9154Sensor.hasSensor())
result = rak9154Sensor.runOnce();
#endif #endif
#endif #endif
} }
@@ -567,9 +568,11 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m
} }
#endif #endif
#ifdef HAS_RAKPROT #ifdef HAS_RAKPROT
get_metrics = rak9154Sensor.getMetrics(m); if (rak9154Sensor.hasSensor()) {
valid = valid || get_metrics; get_metrics = rak9154Sensor.getMetrics(m);
hasSensor = true; valid = valid || get_metrics;
hasSensor = true;
}
#endif #endif
return valid && hasSensor; return valid && hasSensor;
} }
@@ -18,6 +18,7 @@ class RAK9154Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
public: public:
RAK9154Sensor(); RAK9154Sensor();
bool hasSensor() { return true; } // Not an I2C sensor; always available when HAS_RAKPROT is defined
virtual int32_t runOnce() override; virtual int32_t runOnce() override;
virtual bool getMetrics(meshtastic_Telemetry *measurement) override; virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
virtual uint16_t getBusVoltageMv() override; virtual uint16_t getBusVoltageMv() override;