mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-04 17:11:01 +00:00
more cppcheck warnings fixes
This commit is contained in:
@@ -8,14 +8,14 @@ class DSRRouter : public ReliableRouter
|
||||
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
|
||||
* update routing tables etc... based on what we overhear (even for messages not destined to our node)
|
||||
*/
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c);
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c) override;
|
||||
|
||||
/**
|
||||
* Send a packet on a suitable interface. This routine will
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error
|
||||
*/
|
||||
virtual ErrorCode send(MeshPacket *p);
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -77,4 +77,4 @@ class DSRRouter : public ReliableRouter
|
||||
* when the discovery is complete.
|
||||
*/
|
||||
void startDiscovery(NodeNum dest);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ class FloodingRouter : public Router, protected PacketHistory
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error
|
||||
*/
|
||||
virtual ErrorCode send(MeshPacket *p);
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -50,10 +50,10 @@ class FloodingRouter : public Router, protected PacketHistory
|
||||
* Called immedately on receiption, before any further processing.
|
||||
* @return true to abandon the packet
|
||||
*/
|
||||
virtual bool shouldFilterReceived(MeshPacket *p);
|
||||
virtual bool shouldFilterReceived(MeshPacket *p) override;
|
||||
|
||||
/**
|
||||
* Look for broadcasts we need to rebroadcast
|
||||
*/
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c);
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c) override;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ template <class T> class MemoryDynamic : public Allocator<T>
|
||||
{
|
||||
public:
|
||||
/// Return a buffer for use by others
|
||||
virtual void release(T *p)
|
||||
virtual void release(T *p) override
|
||||
{
|
||||
assert(p);
|
||||
free(p);
|
||||
@@ -66,7 +66,7 @@ template <class T> class MemoryDynamic : public Allocator<T>
|
||||
|
||||
protected:
|
||||
// Alloc some storage
|
||||
virtual T *alloc(TickType_t maxWait)
|
||||
virtual T *alloc(TickType_t maxWait) override
|
||||
{
|
||||
T *p = (T *)malloc(sizeof(T));
|
||||
assert(p);
|
||||
@@ -87,7 +87,7 @@ template <class T> class MemoryPool : public Allocator<T>
|
||||
size_t maxElements;
|
||||
|
||||
public:
|
||||
MemoryPool(size_t _maxElements) : dead(_maxElements), maxElements(_maxElements)
|
||||
explicit MemoryPool(size_t _maxElements) : dead(_maxElements), maxElements(_maxElements)
|
||||
{
|
||||
buf = new T[maxElements];
|
||||
|
||||
|
||||
@@ -154,4 +154,4 @@ class MeshPlugin
|
||||
/** set the destination and packet parameters of packet p intended as a reply to a particular "to" packet
|
||||
* This ensures that if the request packet was sent reliably, the reply is sent that way as well.
|
||||
*/
|
||||
void setReplyTo(MeshPacket *p, const MeshPacket &to);
|
||||
void setReplyTo(MeshPacket *p, const MeshPacket &to);
|
||||
|
||||
@@ -407,8 +407,8 @@ void NodeDB::saveToDisk()
|
||||
#ifdef FS
|
||||
FS.mkdir("/prefs");
|
||||
#endif
|
||||
bool okay = saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
||||
okay &= saveProto(radiofile, RadioConfig_size, sizeof(RadioConfig), RadioConfig_fields, &radioConfig);
|
||||
saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
||||
saveProto(radiofile, RadioConfig_size, sizeof(RadioConfig), RadioConfig_fields, &radioConfig);
|
||||
saveChannelsToDisk();
|
||||
|
||||
// remove any pre 1.2 pref files, turn on after 1.2 is in beta
|
||||
|
||||
@@ -123,5 +123,5 @@ class PhoneAPI
|
||||
bool handleToRadioPacket(MeshPacket &p);
|
||||
|
||||
/// If the mesh service tells us fromNum has changed, tell the phone
|
||||
virtual int onNotify(uint32_t newValue);
|
||||
virtual int onNotify(uint32_t newValue) override;
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
template <class T> class PointerQueue : public TypedQueue<T *>
|
||||
{
|
||||
public:
|
||||
PointerQueue(int maxElements) : TypedQueue<T *>(maxElements) {}
|
||||
explicit PointerQueue(int maxElements) : TypedQueue<T *>(maxElements) {}
|
||||
|
||||
// returns a ptr or null if the queue was empty
|
||||
T *dequeuePtr(TickType_t maxWait = portMAX_DELAY)
|
||||
|
||||
@@ -51,7 +51,7 @@ template <class T> class ProtobufPlugin : protected SinglePortPlugin
|
||||
|
||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||
*/
|
||||
virtual ProcessMessage handleReceived(const MeshPacket &mp)
|
||||
virtual ProcessMessage handleReceived(const MeshPacket &mp) override
|
||||
{
|
||||
// FIXME - we currently update position data in the DB only if the message was a broadcast or destined to us
|
||||
// it would be better to update even if the message was destined to others.
|
||||
|
||||
@@ -14,26 +14,26 @@ class RF95Interface : public RadioLibInterface
|
||||
public:
|
||||
RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi);
|
||||
|
||||
bool isIRQPending() { return lora->getPendingIRQ(); }
|
||||
bool isIRQPending() override { return lora->getPendingIRQ(); }
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
/// Make sure the Driver is properly configured before calling init().
|
||||
/// \return true if initialisation succeeded.
|
||||
virtual bool init();
|
||||
virtual bool init() override;
|
||||
|
||||
/// Apply any radio provisioning changes
|
||||
/// Make sure the Driver is properly configured before calling init().
|
||||
/// \return true if initialisation succeeded.
|
||||
virtual bool reconfigure();
|
||||
virtual bool reconfigure() override;
|
||||
|
||||
/// Prepare hardware for sleep. Call this _only_ for deep sleep, not needed for light sleep.
|
||||
virtual bool sleep();
|
||||
virtual bool sleep() override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Glue functions called from ISR land
|
||||
*/
|
||||
virtual void disableInterrupt();
|
||||
virtual void disableInterrupt() override;
|
||||
|
||||
/**
|
||||
* Enable a particular ISR callback glue function
|
||||
@@ -41,24 +41,24 @@ class RF95Interface : public RadioLibInterface
|
||||
virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback); }
|
||||
|
||||
/** are we actively receiving a packet (only called during receiving state) */
|
||||
virtual bool isActivelyReceiving();
|
||||
virtual bool isActivelyReceiving() override;
|
||||
|
||||
/**
|
||||
* Start waiting to receive a message
|
||||
*/
|
||||
virtual void startReceive();
|
||||
virtual void startReceive() override;
|
||||
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
virtual void addReceiveMetadata(MeshPacket *mp);
|
||||
virtual void addReceiveMetadata(MeshPacket *mp) override;
|
||||
|
||||
virtual void setStandby();
|
||||
virtual void setStandby() override;
|
||||
|
||||
/**
|
||||
* We override to turn on transmitter power as needed.
|
||||
*/
|
||||
virtual void configHardwareForSend();
|
||||
virtual void configHardwareForSend() override;
|
||||
|
||||
private:
|
||||
/** Some boards require GPIO control of tx vs rx paths */
|
||||
|
||||
@@ -205,8 +205,8 @@ class RadioInterface
|
||||
class SimRadio : public RadioInterface
|
||||
{
|
||||
public:
|
||||
virtual ErrorCode send(MeshPacket *p);
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
};
|
||||
|
||||
/// Debug printing for packets
|
||||
void printPacket(const char *prefix, const MeshPacket *p);
|
||||
void printPacket(const char *prefix, const MeshPacket *p);
|
||||
|
||||
@@ -54,7 +54,7 @@ class LockingModule : public Module
|
||||
|
||||
\param numBytes Number of bytes to transfer.
|
||||
*/
|
||||
virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes);
|
||||
virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) override;
|
||||
};
|
||||
|
||||
class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread
|
||||
@@ -116,14 +116,14 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi,
|
||||
PhysicalLayer *iface = NULL);
|
||||
|
||||
virtual ErrorCode send(MeshPacket *p);
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
|
||||
/**
|
||||
* Return true if we think the board can go to sleep (i.e. our tx queue is empty, we are not sending or receiving)
|
||||
*
|
||||
* This method must be used before putting the CPU into deep or light sleep.
|
||||
*/
|
||||
virtual bool canSleep();
|
||||
virtual bool canSleep() override;
|
||||
|
||||
/**
|
||||
* Start waiting to receive a message
|
||||
@@ -138,7 +138,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
virtual bool isActivelyReceiving() = 0;
|
||||
|
||||
/** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */
|
||||
virtual bool cancelSending(NodeNum from, PacketId id);
|
||||
virtual bool cancelSending(NodeNum from, PacketId id) override;
|
||||
|
||||
private:
|
||||
/** if we have something waiting to send, start a short random timer so we can come check for collision before actually doing
|
||||
@@ -153,7 +153,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
|
||||
static void timerCallback(void *p1, uint32_t p2);
|
||||
|
||||
virtual void onNotify(uint32_t notification);
|
||||
virtual void onNotify(uint32_t notification) override;
|
||||
|
||||
/** start an immediate transmit
|
||||
* This method is virtual so subclasses can hook as needed, subclasses should not call directly
|
||||
|
||||
@@ -33,10 +33,10 @@ struct PendingPacket {
|
||||
MeshPacket *packet;
|
||||
|
||||
/** The next time we should try to retransmit this packet */
|
||||
uint32_t nextTxMsec;
|
||||
uint32_t nextTxMsec = 0;
|
||||
|
||||
/** Starts at NUM_RETRANSMISSIONS -1(normally 3) and counts down. Once zero it will be removed from the list */
|
||||
uint8_t numRetransmissions;
|
||||
uint8_t numRetransmissions = 0;
|
||||
|
||||
/** True if we have started trying to find a route - for DSR usage
|
||||
* While trying to find a route we don't actually send the data packet. We just leave it here pending until
|
||||
@@ -74,10 +74,10 @@ class ReliableRouter : public FloodingRouter
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
* If the txmit queue is full it might return an error
|
||||
*/
|
||||
virtual ErrorCode send(MeshPacket *p);
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
|
||||
/** Do our retransmission handling */
|
||||
virtual int32_t runOnce()
|
||||
virtual int32_t runOnce() override
|
||||
{
|
||||
// Note: We must doRetransmissions FIRST, because it might queue up work for the base class runOnce implementation
|
||||
auto d = doRetransmissions();
|
||||
@@ -91,7 +91,7 @@ class ReliableRouter : public FloodingRouter
|
||||
/**
|
||||
* Look for acks/naks or someone retransmitting us
|
||||
*/
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c);
|
||||
virtual void sniffReceived(const MeshPacket *p, const Routing *c) override;
|
||||
|
||||
/**
|
||||
* Try to find the pending packet record for this ID (or NULL if not found)
|
||||
@@ -102,7 +102,7 @@ class ReliableRouter : public FloodingRouter
|
||||
/**
|
||||
* We hook this method so we can see packets before FloodingRouter says they should be discarded
|
||||
*/
|
||||
virtual bool shouldFilterReceived(MeshPacket *p);
|
||||
virtual bool shouldFilterReceived(MeshPacket *p) override;
|
||||
|
||||
/**
|
||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||
|
||||
@@ -37,7 +37,7 @@ class Router : protected concurrency::OSThread
|
||||
* do idle processing
|
||||
* Mostly looking in our incoming rxPacket queue and calling handleReceived.
|
||||
*/
|
||||
virtual int32_t runOnce();
|
||||
virtual int32_t runOnce() override;
|
||||
|
||||
/**
|
||||
* Works like send, but if we are sending to the local node, we directly put the message in the receive queue.
|
||||
@@ -143,4 +143,4 @@ extern Router *router;
|
||||
|
||||
/// Generate a unique packet id
|
||||
// FIXME, move this someplace better
|
||||
PacketId generatePacketId();
|
||||
PacketId generatePacketId();
|
||||
|
||||
@@ -9,7 +9,7 @@ class SX1268Interface : public SX126xInterface<SX1268>
|
||||
{
|
||||
public:
|
||||
/// override frequency of the SX1268 module regardless of the region (use EU433 value)
|
||||
virtual float getFreq() { return 433.175f; }
|
||||
virtual float getFreq() override { return 433.175f; }
|
||||
|
||||
SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -15,17 +15,17 @@ class SX126xInterface : public RadioLibInterface
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
/// Make sure the Driver is properly configured before calling init().
|
||||
/// \return true if initialisation succeeded.
|
||||
virtual bool init();
|
||||
virtual bool init() override;
|
||||
|
||||
/// Apply any radio provisioning changes
|
||||
/// Make sure the Driver is properly configured before calling init().
|
||||
/// \return true if initialisation succeeded.
|
||||
virtual bool reconfigure();
|
||||
virtual bool reconfigure() override;
|
||||
|
||||
/// Prepare hardware for sleep. Call this _only_ for deep sleep, not needed for light sleep.
|
||||
virtual bool sleep();
|
||||
virtual bool sleep() override;
|
||||
|
||||
bool isIRQPending() { return lora.getIrqStatus() != 0; }
|
||||
bool isIRQPending() override { return lora.getIrqStatus() != 0; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -39,7 +39,7 @@ class SX126xInterface : public RadioLibInterface
|
||||
/**
|
||||
* Glue functions called from ISR land
|
||||
*/
|
||||
virtual void disableInterrupt();
|
||||
virtual void disableInterrupt() override;
|
||||
|
||||
/**
|
||||
* Enable a particular ISR callback glue function
|
||||
@@ -47,24 +47,24 @@ class SX126xInterface : public RadioLibInterface
|
||||
virtual void enableInterrupt(void (*callback)()) { lora.setDio1Action(callback); }
|
||||
|
||||
/** are we actively receiving a packet (only called during receiving state) */
|
||||
virtual bool isActivelyReceiving();
|
||||
virtual bool isActivelyReceiving() override;
|
||||
|
||||
/**
|
||||
* Start waiting to receive a message
|
||||
*/
|
||||
virtual void startReceive();
|
||||
virtual void startReceive() override;
|
||||
|
||||
/**
|
||||
* We override to turn on transmitter power as needed.
|
||||
*/
|
||||
virtual void configHardwareForSend();
|
||||
virtual void configHardwareForSend() override;
|
||||
|
||||
/**
|
||||
* Add SNR data to received messages
|
||||
*/
|
||||
virtual void addReceiveMetadata(MeshPacket *mp);
|
||||
virtual void addReceiveMetadata(MeshPacket *mp) override;
|
||||
|
||||
virtual void setStandby();
|
||||
virtual void setStandby() override;
|
||||
|
||||
private:
|
||||
};
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ class SinglePortPlugin : public MeshPlugin
|
||||
/**
|
||||
* @return true if you want to receive the specified portnum
|
||||
*/
|
||||
virtual bool wantPacket(const MeshPacket *p) { return p->decoded.portnum == ourPortNum; }
|
||||
virtual bool wantPacket(const MeshPacket *p) override { return p->decoded.portnum == ourPortNum; }
|
||||
|
||||
/**
|
||||
* Return a mesh packet which has been preinited as a data packet with a particular port number.
|
||||
|
||||
@@ -48,7 +48,7 @@ class StreamAPI : public PhoneAPI, protected concurrency::OSThread
|
||||
* Currently we require frequent invocation from loop() to check for arrived serial packets and to send new packets to the
|
||||
* phone.
|
||||
*/
|
||||
virtual int32_t runOnce();
|
||||
virtual int32_t runOnce() override;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -67,10 +67,10 @@ class StreamAPI : public PhoneAPI, protected concurrency::OSThread
|
||||
*/
|
||||
void emitRebooted();
|
||||
|
||||
virtual void onConnectionChanged(bool connected);
|
||||
virtual void onConnectionChanged(bool connected) override;
|
||||
|
||||
/// Check the current underlying physical link to see if the client is currently connected
|
||||
virtual bool checkIsConnected() = 0;
|
||||
virtual bool checkIsConnected() override = 0;
|
||||
|
||||
/**
|
||||
* Send the current txBuffer over our stream
|
||||
|
||||
@@ -19,7 +19,7 @@ template <class T> class TypedQueue
|
||||
concurrency::OSThread *reader = NULL;
|
||||
|
||||
public:
|
||||
TypedQueue(int maxElements)
|
||||
explicit TypedQueue(int maxElements)
|
||||
{
|
||||
h = xQueueCreate(maxElements, sizeof(T));
|
||||
assert(h);
|
||||
|
||||
@@ -16,7 +16,7 @@ class WebServerThread : private concurrency::OSThread
|
||||
uint32_t requestRestart = 0;
|
||||
|
||||
protected:
|
||||
virtual int32_t runOnce();
|
||||
virtual int32_t runOnce() override;
|
||||
};
|
||||
|
||||
extern WebServerThread *webServerThread;
|
||||
|
||||
@@ -18,17 +18,17 @@ class WiFiServerAPI : public StreamAPI
|
||||
virtual ~WiFiServerAPI();
|
||||
|
||||
/// override close to also shutdown the TCP link
|
||||
virtual void close();
|
||||
virtual void close() override;
|
||||
|
||||
protected:
|
||||
/// We override this method to prevent publishing EVENT_SERIAL_CONNECTED/DISCONNECTED for wifi links (we want the board to
|
||||
/// stay in the POWERED state to prevent disabling wifi)
|
||||
virtual void onConnectionChanged(bool connected) {}
|
||||
virtual void onConnectionChanged(bool connected) override {}
|
||||
|
||||
virtual int32_t runOnce(); // Check for dropped client connections
|
||||
virtual int32_t runOnce() override; // Check for dropped client connections
|
||||
|
||||
/// Check the current underlying physical link to see if the client is currently connected
|
||||
virtual bool checkIsConnected();
|
||||
virtual bool checkIsConnected() override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ class WiFiServerPort : public WiFiServer, private concurrency::OSThread
|
||||
static void debugOut(char c);
|
||||
|
||||
protected:
|
||||
int32_t runOnce();
|
||||
int32_t runOnce() override;
|
||||
};
|
||||
|
||||
void initApiServer();
|
||||
|
||||
Reference in New Issue
Block a user