From 7c362af3de9ac5e4f822dbd6a580d7080864ea5f Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Mon, 24 Jan 2022 18:39:17 +0000 Subject: [PATCH] more warning fixes --- src/GPSStatus.h | 4 ++-- src/Power.cpp | 16 ++++++++-------- src/PowerFSM.cpp | 10 +++++----- src/airtime.cpp | 3 +-- src/concurrency/BinarySemaphoreFreeRTOS.cpp | 5 ++--- src/concurrency/Lock.cpp | 3 +-- src/gps/Air530GPS.h | 4 ++-- src/gps/GeoCoord.cpp | 6 +++--- src/gps/GeoCoord.h | 4 ++-- src/gps/UBloxGPS.h | 2 +- src/graphics/Screen.cpp | 15 +++++++-------- src/input/RotaryEncoderInterruptBase.h | 2 +- src/memtest.cpp | 4 ++-- src/mesh/Channels.cpp | 4 ++-- src/mesh/Channels.h | 7 +++++-- src/mesh/MeshPacketQueue.h | 4 ++-- src/mesh/RadioLibRF95.h | 2 +- src/mesh/ReliableRouter.h | 4 ++-- src/mesh/TypedQueue.h | 3 +-- src/mesh/http/WebServer.cpp | 2 +- src/mesh/wifi/WiFiServerAPI.h | 2 +- src/plugins/ExternalNotificationPlugin.cpp | 3 +-- src/plugins/PositionPlugin.cpp | 8 ++++---- src/plugins/RemoteHardwarePlugin.cpp | 8 ++++---- src/plugins/esp32/StoreForwardPlugin.cpp | 6 +++--- src/portduino/CrossPlatformCryptoEngine.cpp | 4 ++-- suppressions.txt | 8 ++++++++ 27 files changed, 74 insertions(+), 69 deletions(-) diff --git a/src/GPSStatus.h b/src/GPSStatus.h index 7399d7e2..9586c952 100644 --- a/src/GPSStatus.h +++ b/src/GPSStatus.h @@ -42,7 +42,7 @@ class GPSStatus : public Status } // preferred method - GPSStatus(bool hasLock, bool isConnected, Position pos) + GPSStatus(bool hasLock, bool isConnected, const Position& pos) : Status() { this->hasLock = hasLock; @@ -149,4 +149,4 @@ class GPSStatus : public Status } // namespace meshtastic -extern meshtastic::GPSStatus *gpsStatus; \ No newline at end of file +extern meshtastic::GPSStatus *gpsStatus; diff --git a/src/Power.cpp b/src/Power.cpp index 72e2d07f..ed2eeae6 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -235,18 +235,18 @@ void Power::readPowerStatus() } // Notify any status instances that are observing us - const PowerStatus powerStatus = + const PowerStatus powerStatus2 = PowerStatus(hasBattery ? OptTrue : OptFalse, batteryLevel->isVBUSPlug() ? OptTrue : OptFalse, batteryLevel->isChargeing() ? OptTrue : OptFalse, batteryVoltageMv, batteryChargePercent); - DEBUG_MSG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus.getHasUSB(), - powerStatus.getIsCharging(), powerStatus.getBatteryVoltageMv(), powerStatus.getBatteryChargePercent()); - newStatus.notifyObservers(&powerStatus); + DEBUG_MSG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus2.getHasUSB(), + powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent()); + newStatus.notifyObservers(&powerStatus2); // If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 3 low readings in a row // Supect fluctuating voltage on the RAK4631 to force it to deep sleep even if battery is at 85% after only a few days #ifdef NRF52_SERIES - if (powerStatus.getHasBattery() && !powerStatus.getHasUSB()){ + if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()){ if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS){ low_voltage_counter++; if (low_voltage_counter>3) @@ -257,13 +257,13 @@ void Power::readPowerStatus() } #else // If we have a battery at all and it is less than 10% full, force deep sleep - if (powerStatus.getHasBattery() && !powerStatus.getHasUSB() && batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) + if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB() && batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) powerFSM.trigger(EVENT_LOW_BATTERY); #endif } else { // No power sensing on this board - tell everyone else we have no idea what is happening - const PowerStatus powerStatus = PowerStatus(OptUnknown, OptUnknown, OptUnknown, -1, -1); - newStatus.notifyObservers(&powerStatus); + const PowerStatus powerStatus3 = PowerStatus(OptUnknown, OptUnknown, OptUnknown, -1, -1); + newStatus.notifyObservers(&powerStatus3); } } diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index a3c55c52..3316b208 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -63,7 +63,7 @@ static void lsIdle() // DEBUG_MSG("lsIdle begin ls_secs=%u\n", getPref_ls_secs()); #ifndef NO_ESP32 - esp_sleep_source_t wakeCause = ESP_SLEEP_WAKEUP_UNDEFINED; + esp_sleep_source_t wakeCause2 = ESP_SLEEP_WAKEUP_UNDEFINED; // Do we have more sleeping to do? if (secsSlept < getPref_ls_secs()) { @@ -73,14 +73,14 @@ static void lsIdle() // If some other service would stall sleep, don't let sleep happen yet if (doPreflightSleep()) { setLed(false); // Never leave led on while in light sleep - wakeCause = doLightSleep(sleepTime * 1000LL); + wakeCause2 = doLightSleep(sleepTime * 1000LL); - switch (wakeCause) { + switch (wakeCause2) { case ESP_SLEEP_WAKEUP_TIMER: // Normal case: timer expired, we should just go back to sleep ASAP setLed(true); // briefly turn on led - wakeCause = doLightSleep(1); // leave led on for 1ms + wakeCause2 = doLightSleep(1); // leave led on for 1ms secsSlept += sleepTime; // DEBUG_MSG("sleeping, flash led!\n"); @@ -94,7 +94,7 @@ static void lsIdle() default: // We woke for some other reason (button press, device interrupt) // uint64_t status = esp_sleep_get_ext1_wakeup_status(); - DEBUG_MSG("wakeCause %d\n", wakeCause); + DEBUG_MSG("wakeCause2 %d\n", wakeCause2); #ifdef BUTTON_PIN bool pressed = !digitalRead(BUTTON_PIN); diff --git a/src/airtime.cpp b/src/airtime.cpp index d497e4dc..5c0378cf 100644 --- a/src/airtime.cpp +++ b/src/airtime.cpp @@ -117,8 +117,7 @@ float AirTime::utilizationTXPercent() return (float(sum) / float(MS_IN_HOUR)) * 100; } -AirTime::AirTime() : concurrency::OSThread("AirTime") { - airtimes = {}; +AirTime::AirTime() : concurrency::OSThread("AirTime"),airtimes({}) { } int32_t AirTime::runOnce() diff --git a/src/concurrency/BinarySemaphoreFreeRTOS.cpp b/src/concurrency/BinarySemaphoreFreeRTOS.cpp index 96c64775..4d6d40d7 100644 --- a/src/concurrency/BinarySemaphoreFreeRTOS.cpp +++ b/src/concurrency/BinarySemaphoreFreeRTOS.cpp @@ -7,9 +7,8 @@ namespace concurrency { -BinarySemaphoreFreeRTOS::BinarySemaphoreFreeRTOS() +BinarySemaphoreFreeRTOS::BinarySemaphoreFreeRTOS() : semaphore(xSemaphoreCreateBinary()) { - semaphore = xSemaphoreCreateBinary(); assert(semaphore); } @@ -38,4 +37,4 @@ IRAM_ATTR void BinarySemaphoreFreeRTOS::giveFromISR(BaseType_t *pxHigherPriority } // namespace concurrency -#endif \ No newline at end of file +#endif diff --git a/src/concurrency/Lock.cpp b/src/concurrency/Lock.cpp index bcf92496..50ce6a00 100644 --- a/src/concurrency/Lock.cpp +++ b/src/concurrency/Lock.cpp @@ -6,9 +6,8 @@ namespace concurrency { #ifdef HAS_FREE_RTOS -Lock::Lock() +Lock::Lock() : handle(xSemaphoreCreateBinary()) { - handle = xSemaphoreCreateBinary(); assert(handle); assert(xSemaphoreGive(handle)); } diff --git a/src/gps/Air530GPS.h b/src/gps/Air530GPS.h index bbb9f800..535b0802 100644 --- a/src/gps/Air530GPS.h +++ b/src/gps/Air530GPS.h @@ -11,10 +11,10 @@ class Air530GPS : public NMEAGPS { protected: /// If possible force the GPS into sleep/low power mode - virtual void sleep(); + virtual void sleep() override; /// wake the GPS into normal operation mode - virtual void wake(); + virtual void wake() override; private: /// Send a NMEA cmd with checksum diff --git a/src/gps/GeoCoord.cpp b/src/gps/GeoCoord.cpp index 98f9c842..69c36ccb 100644 --- a/src/gps/GeoCoord.cpp +++ b/src/gps/GeoCoord.cpp @@ -171,7 +171,7 @@ void GeoCoord::latLongToMGRS(const double lat, const double lon, MGRS &mgrs) { * Based on: https://www.movable-type.co.uk/scripts/latlong-os-gridref.html */ void GeoCoord::latLongToOSGR(const double lat, const double lon, OSGR &osgr) { - char letter[] = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; // No 'I' in OSGR + const char letter[] = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; // No 'I' in OSGR double a = 6377563.396; // Airy 1830 semi-major axis double b = 6356256.909; // Airy 1830 semi-minor axis double f0 = 0.9996012717; // National Grid point scale factor on the central meridian @@ -419,12 +419,12 @@ float GeoCoord::rangeRadiansToMeters(double range_radians) { } // Find distance from point to passed in point -int32_t GeoCoord::distanceTo(GeoCoord pointB) { +int32_t GeoCoord::distanceTo(const GeoCoord& pointB) { return latLongToMeter(this->getLatitude() * 1e-7, this->getLongitude() * 1e-7, pointB.getLatitude() * 1e-7, pointB.getLongitude() * 1e-7); } // Find bearing from point to passed in point -int32_t GeoCoord::bearingTo(GeoCoord pointB) { +int32_t GeoCoord::bearingTo(const GeoCoord& pointB) { return bearing(this->getLatitude() * 1e-7, this->getLongitude() * 1e-7, pointB.getLatitude() * 1e-7, pointB.getLongitude() * 1e-7); } diff --git a/src/gps/GeoCoord.h b/src/gps/GeoCoord.h index a2ac56d7..02980ea0 100644 --- a/src/gps/GeoCoord.h +++ b/src/gps/GeoCoord.h @@ -119,8 +119,8 @@ class GeoCoord { static float rangeMetersToRadians(double range_meters); // Point to point conversions - int32_t distanceTo(GeoCoord pointB); - int32_t bearingTo(GeoCoord pointB); + int32_t distanceTo(const GeoCoord& pointB); + int32_t bearingTo(const GeoCoord& pointB); std::shared_ptr pointAtDistance(double bearing, double range); // Lat lon alt getters diff --git a/src/gps/UBloxGPS.h b/src/gps/UBloxGPS.h index c2521df2..3d940832 100644 --- a/src/gps/UBloxGPS.h +++ b/src/gps/UBloxGPS.h @@ -54,7 +54,7 @@ class UBloxGPS : public GPS * @return true if we've acquired a new location */ virtual bool lookForLocation() override; - virtual bool hasLock(); + virtual bool hasLock() override; /// If possible force the GPS into sleep/low power mode virtual void sleep() override; diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 768c3875..e679227f 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -651,7 +651,6 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ static char distStr[20]; strcpy(distStr, "? km"); // might not have location data - float headingRadian; NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum()); const char *fields[] = {username, distStr, signalStr, lastStr, NULL}; @@ -679,7 +678,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ // it. currently we don't do this and instead draw north up only. float bearingToOther = GeoCoord::bearing(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i)); - headingRadian = bearingToOther - myHeading; + float headingRadian = bearingToOther - myHeading; drawNodeHeading(display, compassX, compassY, headingRadian); } } @@ -943,20 +942,20 @@ int32_t Screen::runOnce() void Screen::drawDebugInfoTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { - Screen *screen = reinterpret_cast(state->userData); - screen->debugInfo.drawFrame(display, state, x, y); + Screen *screen2 = reinterpret_cast(state->userData); + screen2->debugInfo.drawFrame(display, state, x, y); } void Screen::drawDebugInfoSettingsTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { - Screen *screen = reinterpret_cast(state->userData); - screen->debugInfo.drawFrameSettings(display, state, x, y); + Screen *screen2 = reinterpret_cast(state->userData); + screen2->debugInfo.drawFrameSettings(display, state, x, y); } void Screen::drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { - Screen *screen = reinterpret_cast(state->userData); - screen->debugInfo.drawFrameWiFi(display, state, x, y); + Screen *screen2 = reinterpret_cast(state->userData); + screen2->debugInfo.drawFrameWiFi(display, state, x, y); } /* show a message that the SSL cert is being built diff --git a/src/input/RotaryEncoderInterruptBase.h b/src/input/RotaryEncoderInterruptBase.h index 2f263387..72732261 100644 --- a/src/input/RotaryEncoderInterruptBase.h +++ b/src/input/RotaryEncoderInterruptBase.h @@ -22,7 +22,7 @@ class RotaryEncoderInterruptBase : private concurrency::OSThread { public: - RotaryEncoderInterruptBase( + explicit RotaryEncoderInterruptBase( const char *name); void init( uint8_t pinA, uint8_t pinB, uint8_t pinPress, diff --git a/src/memtest.cpp b/src/memtest.cpp index f7e3eb3e..d5d07399 100644 --- a/src/memtest.cpp +++ b/src/memtest.cpp @@ -247,7 +247,7 @@ static int mem_test(uint32_t *_start, size_t len, bool doRead = true, bool doWri { volatile uint32_t *addr; volatile uint32_t *start = (volatile uint32_t *)_start; - volatile uint32_t *end = start + len / sizeof(uint32_t); + const volatile uint32_t *end = start + len / sizeof(uint32_t); uint32_t pattern = 0; uint32_t val; uint32_t readback; @@ -315,4 +315,4 @@ void doMemTest() assert(0); // FIXME report error better iter++; -} \ No newline at end of file +} diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index 37fa0d54..d757fdb3 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -102,7 +102,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex) CryptoKey Channels::getKey(ChannelIndex chIndex) { Channel &ch = getByIndex(chIndex); - ChannelSettings &channelSettings = ch.settings; + const ChannelSettings &channelSettings = ch.settings; assert(ch.has_settings); CryptoKey k; @@ -206,7 +206,7 @@ void Channels::setChannel(const Channel &c) const char *Channels::getName(size_t chIndex) { // Convert the short "" representation for Default into a usable string - ChannelSettings &channelSettings = getByIndex(chIndex).settings; + const ChannelSettings &channelSettings = getByIndex(chIndex).settings; const char *channelName = channelSettings.name; if (!*channelName) { // emptystring // Per mesh.proto spec, if bandwidth is specified we must ignore modemConfig enum, we assume that in that case diff --git a/src/mesh/Channels.h b/src/mesh/Channels.h index eb8422cb..5c5af0ec 100644 --- a/src/mesh/Channels.h +++ b/src/mesh/Channels.h @@ -26,9 +26,12 @@ class Channels ChannelIndex activeChannelIndex = 0; /// the precomputed hashes for each of our channels, or -1 for invalid - int16_t hashes[MAX_NUM_CHANNELS]; + int16_t hashes[MAX_NUM_CHANNELS] = {}; public: + + Channels() {} + /// Well known channel names static const char *adminChannel, *gpioChannel, *serialChannel; @@ -134,4 +137,4 @@ class Channels }; /// Singleton channel table -extern Channels channels; \ No newline at end of file +extern Channels channels; diff --git a/src/mesh/MeshPacketQueue.h b/src/mesh/MeshPacketQueue.h index 2c869db4..c74addf4 100644 --- a/src/mesh/MeshPacketQueue.h +++ b/src/mesh/MeshPacketQueue.h @@ -18,7 +18,7 @@ class MeshPacketQueue bool replaceLowerPriorityPacket(MeshPacket *mp); public: - MeshPacketQueue(size_t _maxLen); + explicit MeshPacketQueue(size_t _maxLen); /** enqueue a packet, return false if full */ bool enqueue(MeshPacket *p); @@ -30,4 +30,4 @@ class MeshPacketQueue /** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */ MeshPacket *remove(NodeNum from, PacketId id); -}; \ No newline at end of file +}; diff --git a/src/mesh/RadioLibRF95.h b/src/mesh/RadioLibRF95.h index d6aeb541..51955430 100644 --- a/src/mesh/RadioLibRF95.h +++ b/src/mesh/RadioLibRF95.h @@ -16,7 +16,7 @@ class RadioLibRF95: public SX1278 { \param mod Instance of Module that will be used to communicate with the %LoRa chip. */ - RadioLibRF95(Module* mod); + explicit RadioLibRF95(Module* mod); // basic methods diff --git a/src/mesh/ReliableRouter.h b/src/mesh/ReliableRouter.h index 52e9b5af..3f89dcbd 100644 --- a/src/mesh/ReliableRouter.h +++ b/src/mesh/ReliableRouter.h @@ -13,7 +13,7 @@ struct GlobalPacketId { bool operator==(const GlobalPacketId &p) const { return node == p.node && id == p.id; } - GlobalPacketId(const MeshPacket *p) + explicit GlobalPacketId(const MeshPacket *p) { node = getFrom(p); id = p->id; @@ -45,7 +45,7 @@ struct PendingPacket { bool wantRoute = false; PendingPacket() {} - PendingPacket(MeshPacket *p); + explicit PendingPacket(MeshPacket *p); }; class GlobalPacketIdHashFunction diff --git a/src/mesh/TypedQueue.h b/src/mesh/TypedQueue.h index ad8bbed5..d923a40b 100644 --- a/src/mesh/TypedQueue.h +++ b/src/mesh/TypedQueue.h @@ -19,9 +19,8 @@ template class TypedQueue concurrency::OSThread *reader = NULL; public: - explicit TypedQueue(int maxElements) + explicit TypedQueue(int maxElements) : h(xQueueCreate(maxElements, sizeof(T))) { - h = xQueueCreate(maxElements, sizeof(T)); assert(h); } diff --git a/src/mesh/http/WebServer.cpp b/src/mesh/http/WebServer.cpp index d9d2ca6b..1f376390 100644 --- a/src/mesh/http/WebServer.cpp +++ b/src/mesh/http/WebServer.cpp @@ -130,8 +130,8 @@ static void taskCreateCert(void *parameter) void createSSLCert() { - bool runLoop = false; if (isWifiAvailable() && !isCertReady) { + bool runLoop = false; // Create a new process just to handle creating the cert. // This is a workaround for Bug: https://github.com/fhessel/esp32_https_server/issues/48 diff --git a/src/mesh/wifi/WiFiServerAPI.h b/src/mesh/wifi/WiFiServerAPI.h index 416c9437..272dd29a 100644 --- a/src/mesh/wifi/WiFiServerAPI.h +++ b/src/mesh/wifi/WiFiServerAPI.h @@ -13,7 +13,7 @@ class WiFiServerAPI : public StreamAPI WiFiClient client; public: - WiFiServerAPI(WiFiClient &_client); + explicit WiFiServerAPI(WiFiClient &_client); virtual ~WiFiServerAPI(); diff --git a/src/plugins/ExternalNotificationPlugin.cpp b/src/plugins/ExternalNotificationPlugin.cpp index 8b25d77e..122c77be 100644 --- a/src/plugins/ExternalNotificationPlugin.cpp +++ b/src/plugins/ExternalNotificationPlugin.cpp @@ -156,13 +156,12 @@ ProcessMessage ExternalNotificationPlugin::handleReceived(const MeshPacket &mp) if (radioConfig.preferences.ext_notification_plugin_enabled) { - auto &p = mp.decoded; - if (getFrom(&mp) != nodeDB.getNodeNum()) { // TODO: This may be a problem if messages are sent in unicide, but I'm not sure if it will. // Need to know if and how this could be a problem. if (radioConfig.preferences.ext_notification_plugin_alert_bell) { + auto &p = mp.decoded; DEBUG_MSG("externalNotificationPlugin - Notification Bell\n"); for (int i = 0; i < p.payload.size; i++) { if (p.payload.bytes[i] == ASCII_BELL) { diff --git a/src/plugins/PositionPlugin.cpp b/src/plugins/PositionPlugin.cpp index 0a3a412d..4292b26f 100644 --- a/src/plugins/PositionPlugin.cpp +++ b/src/plugins/PositionPlugin.cpp @@ -145,9 +145,9 @@ int32_t PositionPlugin::runOnce() DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies); sendOurPosition(NODENUM_BROADCAST, requestReplies); } else if (radioConfig.preferences.position_broadcast_smart == true) { - NodeInfo *node = service.refreshMyNodeInfo(); // should guarantee there is now a position + NodeInfo *node2 = service.refreshMyNodeInfo(); // should guarantee there is now a position - if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) { + if (node2->has_position && (node2->position.latitude_i != 0 || node2->position.longitude_i != 0)) { // The minimum distance to travel before we are able to send a new position packet. const uint32_t distanceTravelMinimum = 30; @@ -173,7 +173,7 @@ int32_t PositionPlugin::runOnce() bool requestReplies = currentGeneration != radioGeneration; currentGeneration = radioGeneration; - DEBUG_MSG("Sending smart pos@%x:6 to mesh (wantReplies=%d, dt=%d, tt=%d)\n", node->position.pos_timestamp, requestReplies, distanceTravel, timeTravel); + DEBUG_MSG("Sending smart pos@%x:6 to mesh (wantReplies=%d, dt=%d, tt=%d)\n", node2->position.pos_timestamp, requestReplies, distanceTravel, timeTravel); sendOurPosition(NODENUM_BROADCAST, requestReplies); /* Update lastGpsSend to now. This means if the device is stationary, then @@ -185,4 +185,4 @@ int32_t PositionPlugin::runOnce() } return 5000; // to save power only wake for our callback occasionally -} \ No newline at end of file +} diff --git a/src/plugins/RemoteHardwarePlugin.cpp b/src/plugins/RemoteHardwarePlugin.cpp index 60ef816d..55f22ccb 100644 --- a/src/plugins/RemoteHardwarePlugin.cpp +++ b/src/plugins/RemoteHardwarePlugin.cpp @@ -79,9 +79,9 @@ bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, Hardwar HardwareMessage r = HardwareMessage_init_default; r.typ = HardwareMessage_Type_READ_GPIOS_REPLY; r.gpio_value = res; - MeshPacket *p = allocDataProtobuf(r); - setReplyTo(p, req); - myReply = p; + MeshPacket *p2 = allocDataProtobuf(r); + setReplyTo(p2, req); + myReply = p2; break; } @@ -132,4 +132,4 @@ int32_t RemoteHardwarePlugin::runOnce() } return 200; // Poll our GPIOs every 200ms (FIXME, make adjustable via protobuf arg) -} \ No newline at end of file +} diff --git a/src/plugins/esp32/StoreForwardPlugin.cpp b/src/plugins/esp32/StoreForwardPlugin.cpp index f970f86d..24535793 100644 --- a/src/plugins/esp32/StoreForwardPlugin.cpp +++ b/src/plugins/esp32/StoreForwardPlugin.cpp @@ -179,7 +179,7 @@ uint32_t StoreForwardPlugin::historyQueueCreate(uint32_t msAgo, uint32_t to) void StoreForwardPlugin::historyAdd(const MeshPacket &mp) { - auto &p = mp.decoded; + const auto &p = mp.decoded; this->packetHistory[this->packetHistoryCurrent].time = millis(); this->packetHistory[this->packetHistoryCurrent].to = mp.to; @@ -247,14 +247,14 @@ ProcessMessage StoreForwardPlugin::handleReceived(const MeshPacket &mp) DEBUG_MSG("--- S&F Received something\n"); - auto &p = mp.decoded; - // The router node should not be sending messages as a client. if (getFrom(&mp) != nodeDB.getNodeNum()) { if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) { DEBUG_MSG("Packet came from - PortNum_TEXT_MESSAGE_APP\n"); + auto &p = mp.decoded; + if ((p.payload.bytes[0] == 'S') && (p.payload.bytes[1] == 'F') && (p.payload.bytes[2] == 0x00)) { DEBUG_MSG("--- --- --- Request to send\n"); diff --git a/src/portduino/CrossPlatformCryptoEngine.cpp b/src/portduino/CrossPlatformCryptoEngine.cpp index b728c8c5..b0f6fecd 100644 --- a/src/portduino/CrossPlatformCryptoEngine.cpp +++ b/src/portduino/CrossPlatformCryptoEngine.cpp @@ -50,9 +50,9 @@ class CrossPlatformCryptoEngine : public CryptoEngine virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override { if (key.length > 0) { - uint8_t stream_block[16]; + //uint8_t stream_block[16]; static uint8_t scratch[MAX_BLOCKSIZE]; - size_t nc_off = 0; + //size_t nc_off = 0; // DEBUG_MSG("ESP32 encrypt!\n"); initNonce(fromNode, packetNum); diff --git a/suppressions.txt b/suppressions.txt index d0deeb37..d05ed57c 100644 --- a/suppressions.txt +++ b/suppressions.txt @@ -4,6 +4,14 @@ assertWithSideEffect // TODO: need to come back to these duplInheritedMember +// TODO: +// "Using memset() on struct which contains a floating point number." +// tried: +// if (std::is_floating_point::value) { +// p = 0; +// in src/mesh/MemoryPool.h +memsetClassFloat + // no real downside/harm in these unusedFunction unusedPrivateFunction