mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 22:22:05 +00:00
more cppcheck warnings fixes
This commit is contained in:
parent
be0b9979bc
commit
caaa235c5d
1
.gitignore
vendored
1
.gitignore
vendored
@ -28,3 +28,4 @@ __pycache__
|
|||||||
*~
|
*~
|
||||||
|
|
||||||
venv/
|
venv/
|
||||||
|
release/
|
||||||
|
@ -11,7 +11,8 @@ export APP_VERSION=$VERSION
|
|||||||
|
|
||||||
# only check high and medium in our source
|
# only check high and medium in our source
|
||||||
# TODO: only doing tbeam (to start; add all/more later)
|
# TODO: only doing tbeam (to start; add all/more later)
|
||||||
pio check --flags "-DAPP_VERSION=${APP_VERSION} --suppressions-list=suppressions.txt" -e tbeam --skip-packages --severity=medium --severity=high --pattern="src/"
|
#pio check --flags "-DAPP_VERSION=${APP_VERSION} --suppressions-list=suppressions.txt" -e tbeam --skip-packages --severity=medium --severity=high --pattern="src/"
|
||||||
|
pio check --flags "-DAPP_VERSION=${APP_VERSION} --suppressions-list=suppressions.txt" -e tbeam --skip-packages --pattern="src/"
|
||||||
return_code=$?
|
return_code=$?
|
||||||
|
|
||||||
# TODO: not sure why return_code is 0
|
# TODO: not sure why return_code is 0
|
||||||
|
@ -47,7 +47,7 @@ template <class Callback, class T> class CallbackObserver : public Observer<T>
|
|||||||
CallbackObserver(Callback *_objPtr, ObserverCallback _method) : objPtr(_objPtr), method(_method) {}
|
CallbackObserver(Callback *_objPtr, ObserverCallback _method) : objPtr(_objPtr), method(_method) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int onNotify(T arg) { return (objPtr->*method)(arg); }
|
virtual int onNotify(T arg) override { return (objPtr->*method)(arg); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +75,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
*
|
*
|
||||||
* FIXME - use a lipo lookup table, the current % full is super wrong
|
* FIXME - use a lipo lookup table, the current % full is super wrong
|
||||||
*/
|
*/
|
||||||
virtual int getBattPercentage()
|
virtual int getBattPercentage() override
|
||||||
{
|
{
|
||||||
float v = getBattVoltage();
|
float v = getBattVoltage();
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
/**
|
/**
|
||||||
* The raw voltage of the batteryin millivolts or NAN if unknown
|
* The raw voltage of the batteryin millivolts or NAN if unknown
|
||||||
*/
|
*/
|
||||||
virtual float getBattVoltage()
|
virtual float getBattVoltage() override
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef ADC_MULTIPLIER
|
#ifndef ADC_MULTIPLIER
|
||||||
@ -127,15 +127,15 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
/**
|
/**
|
||||||
* return true if there is a battery installed in this unit
|
* return true if there is a battery installed in this unit
|
||||||
*/
|
*/
|
||||||
virtual bool isBatteryConnect() { return getBattPercentage() != -1; }
|
virtual bool isBatteryConnect() override { return getBattPercentage() != -1; }
|
||||||
|
|
||||||
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
||||||
/// in power
|
/// in power
|
||||||
virtual bool isVBUSPlug() { return getBattVoltage() > chargingVolt; }
|
virtual bool isVBUSPlug() override { return getBattVoltage() > chargingVolt; }
|
||||||
|
|
||||||
/// Assume charging if we have a battery and external power is connected.
|
/// Assume charging if we have a battery and external power is connected.
|
||||||
/// we can't be smart enough to say 'full'?
|
/// we can't be smart enough to say 'full'?
|
||||||
virtual bool isChargeing() { return isBatteryConnect() && isVBUSPlug(); }
|
virtual bool isChargeing() override { return isBatteryConnect() && isVBUSPlug(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
||||||
|
@ -22,7 +22,7 @@ class RedirectablePrint : public Print
|
|||||||
volatile bool inDebugPrint = false;
|
volatile bool inDebugPrint = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RedirectablePrint(Print *_dest) : dest(_dest) {}
|
explicit RedirectablePrint(Print *_dest) : dest(_dest) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a new destination
|
* Set a new destination
|
||||||
|
@ -15,9 +15,9 @@ class SerialConsole : public StreamAPI, public RedirectablePrint
|
|||||||
* we override this to notice when we've received a protobuf over the serial stream. Then we shunt off
|
* we override this to notice when we've received a protobuf over the serial stream. Then we shunt off
|
||||||
* debug serial output.
|
* debug serial output.
|
||||||
*/
|
*/
|
||||||
virtual bool handleToRadio(const uint8_t *buf, size_t len);
|
virtual bool handleToRadio(const uint8_t *buf, size_t len) override;
|
||||||
|
|
||||||
virtual size_t write(uint8_t c)
|
virtual size_t write(uint8_t c) override
|
||||||
{
|
{
|
||||||
if (c == '\n') // prefix any newlines with carriage return
|
if (c == '\n') // prefix any newlines with carriage return
|
||||||
RedirectablePrint::write('\r');
|
RedirectablePrint::write('\r');
|
||||||
@ -27,7 +27,7 @@ class SerialConsole : public StreamAPI, public RedirectablePrint
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// Check the current underlying physical link to see if the client is currently connected
|
/// Check the current underlying physical link to see if the client is currently connected
|
||||||
virtual bool checkIsConnected();
|
virtual bool checkIsConnected() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A simple wrapper to allow non class aware code write to the console
|
// A simple wrapper to allow non class aware code write to the console
|
||||||
|
@ -10,7 +10,7 @@ namespace concurrency {
|
|||||||
class LockGuard
|
class LockGuard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LockGuard(Lock *lock);
|
explicit LockGuard(Lock *lock);
|
||||||
~LockGuard();
|
~LockGuard();
|
||||||
|
|
||||||
LockGuard(const LockGuard &) = delete;
|
LockGuard(const LockGuard &) = delete;
|
||||||
|
@ -39,7 +39,7 @@ class NotifiedWorkerThread : public OSThread
|
|||||||
virtual void onNotify(uint32_t notification) = 0;
|
virtual void onNotify(uint32_t notification) = 0;
|
||||||
|
|
||||||
/// just calls checkNotification()
|
/// just calls checkNotification()
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
|
|
||||||
/// Sometimes we might want to check notifications independently of when our thread was getting woken up (i.e. if we are about to change
|
/// Sometimes we might want to check notifications independently of when our thread was getting woken up (i.e. if we are about to change
|
||||||
/// radio transmit/receive modes we want to handle any pending interrupts first). You can call this method and if any notifications are currently
|
/// radio transmit/receive modes we want to handle any pending interrupts first). You can call this method and if any notifications are currently
|
||||||
|
@ -18,7 +18,7 @@ class Periodic : public OSThread
|
|||||||
Periodic(const char *name, int32_t (*_callback)()) : OSThread(name), callback(_callback) {}
|
Periodic(const char *name, int32_t (*_callback)()) : OSThread(name), callback(_callback) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t runOnce() { return callback(); }
|
int32_t runOnce() override { return callback(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace concurrency
|
} // namespace concurrency
|
||||||
|
@ -32,7 +32,7 @@ class ESP32CryptoEngine : public CryptoEngine
|
|||||||
* @param bytes a _static_ buffer that will remain valid for the life of this crypto instance (i.e. this class will cache the
|
* @param bytes a _static_ buffer that will remain valid for the life of this crypto instance (i.e. this class will cache the
|
||||||
* provided pointer)
|
* provided pointer)
|
||||||
*/
|
*/
|
||||||
virtual void setKey(const CryptoKey &k)
|
virtual void setKey(const CryptoKey &k) override
|
||||||
{
|
{
|
||||||
CryptoEngine::setKey(k);
|
CryptoEngine::setKey(k);
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class ESP32CryptoEngine : public CryptoEngine
|
|||||||
*
|
*
|
||||||
* @param bytes is updated in place
|
* @param bytes is updated in place
|
||||||
*/
|
*/
|
||||||
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes)
|
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
{
|
{
|
||||||
if (key.length > 0) {
|
if (key.length > 0) {
|
||||||
uint8_t stream_block[16];
|
uint8_t stream_block[16];
|
||||||
@ -66,7 +66,7 @@ class ESP32CryptoEngine : public CryptoEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes)
|
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
{
|
{
|
||||||
// DEBUG_MSG("ESP32 decrypt!\n");
|
// DEBUG_MSG("ESP32 decrypt!\n");
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class GPS : private concurrency::OSThread
|
|||||||
*/
|
*/
|
||||||
void publishUpdate();
|
void publishUpdate();
|
||||||
|
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates an instance of the GPS class.
|
// Creates an instance of the GPS class.
|
||||||
|
@ -23,14 +23,14 @@ class NMEAGPS : public GPS
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool setupGPS();
|
virtual bool setupGPS() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Subclasses should look for serial rx characters here and feed it to their GPS parser
|
/** Subclasses should look for serial rx characters here and feed it to their GPS parser
|
||||||
*
|
*
|
||||||
* Return true if we received a valid message from the GPS
|
* Return true if we received a valid message from the GPS
|
||||||
*/
|
*/
|
||||||
virtual bool whileIdle();
|
virtual bool whileIdle() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
||||||
@ -38,7 +38,7 @@ class NMEAGPS : public GPS
|
|||||||
*
|
*
|
||||||
* @return true if we've acquired a time
|
* @return true if we've acquired a time
|
||||||
*/
|
*/
|
||||||
virtual bool lookForTime();
|
virtual bool lookForTime() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
||||||
@ -46,7 +46,7 @@ class NMEAGPS : public GPS
|
|||||||
*
|
*
|
||||||
* @return true if we've acquired a new location
|
* @return true if we've acquired a new location
|
||||||
*/
|
*/
|
||||||
virtual bool lookForLocation();
|
virtual bool lookForLocation() override;
|
||||||
|
|
||||||
virtual bool hasLock();
|
virtual bool hasLock() override;
|
||||||
};
|
};
|
||||||
|
@ -22,22 +22,22 @@ class UBloxGPS : public GPS
|
|||||||
*
|
*
|
||||||
* @return true for success
|
* @return true for success
|
||||||
*/
|
*/
|
||||||
bool factoryReset();
|
bool factoryReset() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Returns true if we succeeded
|
* Returns true if we succeeded
|
||||||
*/
|
*/
|
||||||
virtual bool setupGPS();
|
virtual bool setupGPS() override;
|
||||||
|
|
||||||
/** Subclasses should look for serial rx characters here and feed it to their GPS parser
|
/** Subclasses should look for serial rx characters here and feed it to their GPS parser
|
||||||
*
|
*
|
||||||
* Return true if we received a valid message from the GPS
|
* Return true if we received a valid message from the GPS
|
||||||
*/
|
*/
|
||||||
virtual bool whileIdle();
|
virtual bool whileIdle() override;
|
||||||
|
|
||||||
/** Idle processing while GPS is looking for lock */
|
/** Idle processing while GPS is looking for lock */
|
||||||
virtual void whileActive();
|
virtual void whileActive() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
||||||
@ -45,7 +45,7 @@ class UBloxGPS : public GPS
|
|||||||
*
|
*
|
||||||
* @return true if we've acquired a time
|
* @return true if we've acquired a time
|
||||||
*/
|
*/
|
||||||
virtual bool lookForTime();
|
virtual bool lookForTime() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
||||||
@ -53,12 +53,12 @@ class UBloxGPS : public GPS
|
|||||||
*
|
*
|
||||||
* @return true if we've acquired a new location
|
* @return true if we've acquired a new location
|
||||||
*/
|
*/
|
||||||
virtual bool lookForLocation();
|
virtual bool lookForLocation() override;
|
||||||
virtual bool hasLock();
|
virtual bool hasLock();
|
||||||
|
|
||||||
/// If possible force the GPS into sleep/low power mode
|
/// If possible force the GPS into sleep/low power mode
|
||||||
virtual void sleep();
|
virtual void sleep() override;
|
||||||
virtual void wake();
|
virtual void wake() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Attempt to connect to our GPS, returns false if no gps is present
|
/// Attempt to connect to our GPS, returns false if no gps is present
|
||||||
|
@ -25,7 +25,7 @@ class EInkDisplay : public OLEDDisplay
|
|||||||
EInkDisplay(uint8_t address, int sda, int scl);
|
EInkDisplay(uint8_t address, int sda, int scl);
|
||||||
|
|
||||||
// Write the buffer to the display memory (for eink we only do this occasionally)
|
// Write the buffer to the display memory (for eink we only do this occasionally)
|
||||||
virtual void display(void);
|
virtual void display(void) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force a display update if we haven't drawn within the specified msecLimit
|
* Force a display update if we haven't drawn within the specified msecLimit
|
||||||
@ -36,13 +36,13 @@ class EInkDisplay : public OLEDDisplay
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the header size of the buffer used, e.g. for the SPI command header
|
// the header size of the buffer used, e.g. for the SPI command header
|
||||||
virtual int getBufferOffset(void) { return 0; }
|
virtual int getBufferOffset(void) override { return 0; }
|
||||||
|
|
||||||
// Send a command to the display (low level function)
|
// Send a command to the display (low level function)
|
||||||
virtual void sendCommand(uint8_t com);
|
virtual void sendCommand(uint8_t com) override;
|
||||||
|
|
||||||
// Connect to the display
|
// Connect to the display
|
||||||
virtual bool connect();
|
virtual bool connect() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ class Screen : public concurrency::OSThread
|
|||||||
CallbackObserver<Screen, const UIFrameEvent *>(this, &Screen::handleUIFrameEvent);
|
CallbackObserver<Screen, const UIFrameEvent *>(this, &Screen::handleUIFrameEvent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Screen(uint8_t address, int sda = -1, int scl = -1);
|
explicit Screen(uint8_t address, int sda = -1, int scl = -1);
|
||||||
|
|
||||||
Screen(const Screen &) = delete;
|
Screen(const Screen &) = delete;
|
||||||
Screen &operator=(const Screen &) = delete;
|
Screen &operator=(const Screen &) = delete;
|
||||||
|
@ -21,15 +21,15 @@ class TFTDisplay : public OLEDDisplay
|
|||||||
TFTDisplay(uint8_t address, int sda, int scl);
|
TFTDisplay(uint8_t address, int sda, int scl);
|
||||||
|
|
||||||
// Write the buffer to the display memory
|
// Write the buffer to the display memory
|
||||||
virtual void display(void);
|
virtual void display(void) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the header size of the buffer used, e.g. for the SPI command header
|
// the header size of the buffer used, e.g. for the SPI command header
|
||||||
virtual int getBufferOffset(void) { return 0; }
|
virtual int getBufferOffset(void) override { return 0; }
|
||||||
|
|
||||||
// Send a command to the display (low level function)
|
// Send a command to the display (low level function)
|
||||||
virtual void sendCommand(uint8_t com);
|
virtual void sendCommand(uint8_t com) override;
|
||||||
|
|
||||||
// Connect to the display
|
// Connect to the display
|
||||||
virtual bool connect();
|
virtual bool connect() override;
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ class RotaryEncoderInterruptBase :
|
|||||||
void intBHandler();
|
void intBHandler();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
RotaryEncoderInterruptBaseStateType intHandler(
|
RotaryEncoderInterruptBaseStateType intHandler(
|
||||||
bool actualPinRaising,
|
bool actualPinRaising,
|
||||||
int otherPinLevel,
|
int otherPinLevel,
|
||||||
|
@ -141,7 +141,7 @@ class PowerFSMThread : public OSThread
|
|||||||
PowerFSMThread() : OSThread("PowerFSM") {}
|
PowerFSMThread() : OSThread("PowerFSM") {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t runOnce()
|
int32_t runOnce() override
|
||||||
{
|
{
|
||||||
powerFSM.run_machine();
|
powerFSM.run_machine();
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ class ButtonThread : public OSThread
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// If the button is pressed we suppress CPU sleep until release
|
/// If the button is pressed we suppress CPU sleep until release
|
||||||
int32_t runOnce()
|
int32_t runOnce() override
|
||||||
{
|
{
|
||||||
canSleep = true; // Assume we should not keep the board awake
|
canSleep = true; // Assume we should not keep the board awake
|
||||||
|
|
||||||
|
@ -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
|
* 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)
|
* 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
|
* Send a packet on a suitable interface. This routine will
|
||||||
* later free() the packet to pool. This routine is not allowed to stall.
|
* later free() the packet to pool. This routine is not allowed to stall.
|
||||||
* If the txmit queue is full it might return an error
|
* If the txmit queue is full it might return an error
|
||||||
*/
|
*/
|
||||||
virtual ErrorCode send(MeshPacket *p);
|
virtual ErrorCode send(MeshPacket *p) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +41,7 @@ class FloodingRouter : public Router, protected PacketHistory
|
|||||||
* later free() the packet to pool. This routine is not allowed to stall.
|
* later free() the packet to pool. This routine is not allowed to stall.
|
||||||
* If the txmit queue is full it might return an error
|
* If the txmit queue is full it might return an error
|
||||||
*/
|
*/
|
||||||
virtual ErrorCode send(MeshPacket *p);
|
virtual ErrorCode send(MeshPacket *p) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -50,10 +50,10 @@ class FloodingRouter : public Router, protected PacketHistory
|
|||||||
* Called immedately on receiption, before any further processing.
|
* Called immedately on receiption, before any further processing.
|
||||||
* @return true to abandon the packet
|
* @return true to abandon the packet
|
||||||
*/
|
*/
|
||||||
virtual bool shouldFilterReceived(MeshPacket *p);
|
virtual bool shouldFilterReceived(MeshPacket *p) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look for broadcasts we need to rebroadcast
|
* 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:
|
public:
|
||||||
/// Return a buffer for use by others
|
/// Return a buffer for use by others
|
||||||
virtual void release(T *p)
|
virtual void release(T *p) override
|
||||||
{
|
{
|
||||||
assert(p);
|
assert(p);
|
||||||
free(p);
|
free(p);
|
||||||
@ -66,7 +66,7 @@ template <class T> class MemoryDynamic : public Allocator<T>
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Alloc some storage
|
// Alloc some storage
|
||||||
virtual T *alloc(TickType_t maxWait)
|
virtual T *alloc(TickType_t maxWait) override
|
||||||
{
|
{
|
||||||
T *p = (T *)malloc(sizeof(T));
|
T *p = (T *)malloc(sizeof(T));
|
||||||
assert(p);
|
assert(p);
|
||||||
@ -87,7 +87,7 @@ template <class T> class MemoryPool : public Allocator<T>
|
|||||||
size_t maxElements;
|
size_t maxElements;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MemoryPool(size_t _maxElements) : dead(_maxElements), maxElements(_maxElements)
|
explicit MemoryPool(size_t _maxElements) : dead(_maxElements), maxElements(_maxElements)
|
||||||
{
|
{
|
||||||
buf = new T[maxElements];
|
buf = new T[maxElements];
|
||||||
|
|
||||||
|
@ -407,8 +407,8 @@ void NodeDB::saveToDisk()
|
|||||||
#ifdef FS
|
#ifdef FS
|
||||||
FS.mkdir("/prefs");
|
FS.mkdir("/prefs");
|
||||||
#endif
|
#endif
|
||||||
bool okay = saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
||||||
okay &= saveProto(radiofile, RadioConfig_size, sizeof(RadioConfig), RadioConfig_fields, &radioConfig);
|
saveProto(radiofile, RadioConfig_size, sizeof(RadioConfig), RadioConfig_fields, &radioConfig);
|
||||||
saveChannelsToDisk();
|
saveChannelsToDisk();
|
||||||
|
|
||||||
// remove any pre 1.2 pref files, turn on after 1.2 is in beta
|
// 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);
|
bool handleToRadioPacket(MeshPacket &p);
|
||||||
|
|
||||||
/// If the mesh service tells us fromNum has changed, tell the phone
|
/// 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 *>
|
template <class T> class PointerQueue : public TypedQueue<T *>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PointerQueue(int maxElements) : TypedQueue<T *>(maxElements) {}
|
explicit PointerQueue(int maxElements) : TypedQueue<T *>(maxElements) {}
|
||||||
|
|
||||||
// returns a ptr or null if the queue was empty
|
// returns a ptr or null if the queue was empty
|
||||||
T *dequeuePtr(TickType_t maxWait = portMAX_DELAY)
|
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
|
@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
|
// 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.
|
// it would be better to update even if the message was destined to others.
|
||||||
|
@ -14,26 +14,26 @@ class RF95Interface : public RadioLibInterface
|
|||||||
public:
|
public:
|
||||||
RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi);
|
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.
|
/// Initialise the Driver transport hardware and software.
|
||||||
/// Make sure the Driver is properly configured before calling init().
|
/// Make sure the Driver is properly configured before calling init().
|
||||||
/// \return true if initialisation succeeded.
|
/// \return true if initialisation succeeded.
|
||||||
virtual bool init();
|
virtual bool init() override;
|
||||||
|
|
||||||
/// Apply any radio provisioning changes
|
/// Apply any radio provisioning changes
|
||||||
/// Make sure the Driver is properly configured before calling init().
|
/// Make sure the Driver is properly configured before calling init().
|
||||||
/// \return true if initialisation succeeded.
|
/// \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.
|
/// Prepare hardware for sleep. Call this _only_ for deep sleep, not needed for light sleep.
|
||||||
virtual bool sleep();
|
virtual bool sleep() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Glue functions called from ISR land
|
* Glue functions called from ISR land
|
||||||
*/
|
*/
|
||||||
virtual void disableInterrupt();
|
virtual void disableInterrupt() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable a particular ISR callback glue function
|
* Enable a particular ISR callback glue function
|
||||||
@ -41,24 +41,24 @@ class RF95Interface : public RadioLibInterface
|
|||||||
virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback); }
|
virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback); }
|
||||||
|
|
||||||
/** are we actively receiving a packet (only called during receiving state) */
|
/** are we actively receiving a packet (only called during receiving state) */
|
||||||
virtual bool isActivelyReceiving();
|
virtual bool isActivelyReceiving() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start waiting to receive a message
|
* Start waiting to receive a message
|
||||||
*/
|
*/
|
||||||
virtual void startReceive();
|
virtual void startReceive() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add SNR data to received messages
|
* 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.
|
* We override to turn on transmitter power as needed.
|
||||||
*/
|
*/
|
||||||
virtual void configHardwareForSend();
|
virtual void configHardwareForSend() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Some boards require GPIO control of tx vs rx paths */
|
/** Some boards require GPIO control of tx vs rx paths */
|
||||||
|
@ -205,7 +205,7 @@ class RadioInterface
|
|||||||
class SimRadio : public RadioInterface
|
class SimRadio : public RadioInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ErrorCode send(MeshPacket *p);
|
virtual ErrorCode send(MeshPacket *p) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Debug printing for packets
|
/// Debug printing for packets
|
||||||
|
@ -54,7 +54,7 @@ class LockingModule : public Module
|
|||||||
|
|
||||||
\param numBytes Number of bytes to transfer.
|
\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
|
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,
|
RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi,
|
||||||
PhysicalLayer *iface = NULL);
|
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)
|
* 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.
|
* 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
|
* Start waiting to receive a message
|
||||||
@ -138,7 +138,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
|||||||
virtual bool isActivelyReceiving() = 0;
|
virtual bool isActivelyReceiving() = 0;
|
||||||
|
|
||||||
/** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */
|
/** 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:
|
private:
|
||||||
/** if we have something waiting to send, start a short random timer so we can come check for collision before actually doing
|
/** 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);
|
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
|
/** start an immediate transmit
|
||||||
* This method is virtual so subclasses can hook as needed, subclasses should not call directly
|
* This method is virtual so subclasses can hook as needed, subclasses should not call directly
|
||||||
|
@ -33,10 +33,10 @@ struct PendingPacket {
|
|||||||
MeshPacket *packet;
|
MeshPacket *packet;
|
||||||
|
|
||||||
/** The next time we should try to retransmit this 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 */
|
/** 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
|
/** 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
|
* 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.
|
* later free() the packet to pool. This routine is not allowed to stall.
|
||||||
* If the txmit queue is full it might return an error
|
* 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 */
|
/** 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
|
// Note: We must doRetransmissions FIRST, because it might queue up work for the base class runOnce implementation
|
||||||
auto d = doRetransmissions();
|
auto d = doRetransmissions();
|
||||||
@ -91,7 +91,7 @@ class ReliableRouter : public FloodingRouter
|
|||||||
/**
|
/**
|
||||||
* Look for acks/naks or someone retransmitting us
|
* 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)
|
* 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
|
* 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.
|
* 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
|
* do idle processing
|
||||||
* Mostly looking in our incoming rxPacket queue and calling handleReceived.
|
* 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.
|
* Works like send, but if we are sending to the local node, we directly put the message in the receive queue.
|
||||||
|
@ -9,7 +9,7 @@ class SX1268Interface : public SX126xInterface<SX1268>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// override frequency of the SX1268 module regardless of the region (use EU433 value)
|
/// 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);
|
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.
|
/// Initialise the Driver transport hardware and software.
|
||||||
/// Make sure the Driver is properly configured before calling init().
|
/// Make sure the Driver is properly configured before calling init().
|
||||||
/// \return true if initialisation succeeded.
|
/// \return true if initialisation succeeded.
|
||||||
virtual bool init();
|
virtual bool init() override;
|
||||||
|
|
||||||
/// Apply any radio provisioning changes
|
/// Apply any radio provisioning changes
|
||||||
/// Make sure the Driver is properly configured before calling init().
|
/// Make sure the Driver is properly configured before calling init().
|
||||||
/// \return true if initialisation succeeded.
|
/// \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.
|
/// 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:
|
protected:
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class SX126xInterface : public RadioLibInterface
|
|||||||
/**
|
/**
|
||||||
* Glue functions called from ISR land
|
* Glue functions called from ISR land
|
||||||
*/
|
*/
|
||||||
virtual void disableInterrupt();
|
virtual void disableInterrupt() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable a particular ISR callback glue function
|
* Enable a particular ISR callback glue function
|
||||||
@ -47,24 +47,24 @@ class SX126xInterface : public RadioLibInterface
|
|||||||
virtual void enableInterrupt(void (*callback)()) { lora.setDio1Action(callback); }
|
virtual void enableInterrupt(void (*callback)()) { lora.setDio1Action(callback); }
|
||||||
|
|
||||||
/** are we actively receiving a packet (only called during receiving state) */
|
/** are we actively receiving a packet (only called during receiving state) */
|
||||||
virtual bool isActivelyReceiving();
|
virtual bool isActivelyReceiving() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start waiting to receive a message
|
* Start waiting to receive a message
|
||||||
*/
|
*/
|
||||||
virtual void startReceive();
|
virtual void startReceive() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We override to turn on transmitter power as needed.
|
* We override to turn on transmitter power as needed.
|
||||||
*/
|
*/
|
||||||
virtual void configHardwareForSend();
|
virtual void configHardwareForSend() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add SNR data to received messages
|
* 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:
|
private:
|
||||||
};
|
};
|
@ -21,7 +21,7 @@ class SinglePortPlugin : public MeshPlugin
|
|||||||
/**
|
/**
|
||||||
* @return true if you want to receive the specified portnum
|
* @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.
|
* 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
|
* Currently we require frequent invocation from loop() to check for arrived serial packets and to send new packets to the
|
||||||
* phone.
|
* phone.
|
||||||
*/
|
*/
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -67,10 +67,10 @@ class StreamAPI : public PhoneAPI, protected concurrency::OSThread
|
|||||||
*/
|
*/
|
||||||
void emitRebooted();
|
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
|
/// 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
|
* Send the current txBuffer over our stream
|
||||||
|
@ -19,7 +19,7 @@ template <class T> class TypedQueue
|
|||||||
concurrency::OSThread *reader = NULL;
|
concurrency::OSThread *reader = NULL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TypedQueue(int maxElements)
|
explicit TypedQueue(int maxElements)
|
||||||
{
|
{
|
||||||
h = xQueueCreate(maxElements, sizeof(T));
|
h = xQueueCreate(maxElements, sizeof(T));
|
||||||
assert(h);
|
assert(h);
|
||||||
|
@ -16,7 +16,7 @@ class WebServerThread : private concurrency::OSThread
|
|||||||
uint32_t requestRestart = 0;
|
uint32_t requestRestart = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WebServerThread *webServerThread;
|
extern WebServerThread *webServerThread;
|
||||||
|
@ -18,17 +18,17 @@ class WiFiServerAPI : public StreamAPI
|
|||||||
virtual ~WiFiServerAPI();
|
virtual ~WiFiServerAPI();
|
||||||
|
|
||||||
/// override close to also shutdown the TCP link
|
/// override close to also shutdown the TCP link
|
||||||
virtual void close();
|
virtual void close() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// We override this method to prevent publishing EVENT_SERIAL_CONNECTED/DISCONNECTED for wifi links (we want the board to
|
/// 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)
|
/// 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
|
/// 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);
|
static void debugOut(char c);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t runOnce();
|
int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void initApiServer();
|
void initApiServer();
|
||||||
|
@ -40,7 +40,7 @@ class MQTT : private concurrency::OSThread
|
|||||||
void reconnect();
|
void reconnect();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** return true if we have a channel that wants uplink/downlink
|
/** return true if we have a channel that wants uplink/downlink
|
||||||
|
@ -28,7 +28,7 @@ class BluetoothPhoneAPI : public PhoneAPI
|
|||||||
/**
|
/**
|
||||||
* Subclasses can use this as a hook to provide custom notifications for their transport (i.e. bluetooth notifies)
|
* Subclasses can use this as a hook to provide custom notifications for their transport (i.e. bluetooth notifies)
|
||||||
*/
|
*/
|
||||||
virtual void onNowHasData(uint32_t fromRadioNum)
|
virtual void onNowHasData(uint32_t fromRadioNum) override
|
||||||
{
|
{
|
||||||
PhoneAPI::onNowHasData(fromRadioNum);
|
PhoneAPI::onNowHasData(fromRadioNum);
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ class BluetoothPhoneAPI : public PhoneAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check the current underlying physical link to see if the client is currently connected
|
/// Check the current underlying physical link to see if the client is currently connected
|
||||||
virtual bool checkIsConnected() {
|
virtual bool checkIsConnected() override {
|
||||||
return bleConnected;
|
return bleConnected;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ class NRF52CryptoEngine : public CryptoEngine
|
|||||||
*
|
*
|
||||||
* @param bytes is updated in place
|
* @param bytes is updated in place
|
||||||
*/
|
*/
|
||||||
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes)
|
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
{
|
{
|
||||||
// DEBUG_MSG("NRF52 encrypt!\n");
|
// DEBUG_MSG("NRF52 encrypt!\n");
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ class NRF52CryptoEngine : public CryptoEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes)
|
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
{
|
{
|
||||||
// DEBUG_MSG("NRF52 decrypt!\n");
|
// DEBUG_MSG("NRF52 decrypt!\n");
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class AdminPlugin : public ProtobufPlugin<AdminMessage>
|
|||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *p) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleSetOwner(const User &o);
|
void handleSetOwner(const User &o);
|
||||||
|
@ -40,7 +40,7 @@ class CannedMessagePlugin :
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
|
|
||||||
void sendText(
|
void sendText(
|
||||||
NodeNum dest,
|
NodeNum dest,
|
||||||
@ -52,10 +52,10 @@ class CannedMessagePlugin :
|
|||||||
int getPrevIndex();
|
int getPrevIndex();
|
||||||
|
|
||||||
int handleInputEvent(const InputEvent *event);
|
int handleInputEvent(const InputEvent *event);
|
||||||
virtual bool wantUIFrame() { return this->shouldDraw(); }
|
virtual bool wantUIFrame() override { return this->shouldDraw(); }
|
||||||
virtual Observable<const UIFrameEvent *>* getUIFrameObservable() { return this; }
|
virtual Observable<const UIFrameEvent *>* getUIFrameObservable() override { return this; }
|
||||||
virtual void drawFrame(
|
virtual void drawFrame(
|
||||||
OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
|
||||||
|
|
||||||
int currentMessageIndex = -1;
|
int currentMessageIndex = -1;
|
||||||
cannedMessagePluginRunState runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
cannedMessagePluginRunState runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||||
|
@ -18,15 +18,15 @@ class EnvironmentalMeasurementPlugin : private concurrency::OSThread, public Pro
|
|||||||
{
|
{
|
||||||
lastMeasurementPacket = nullptr;
|
lastMeasurementPacket = nullptr;
|
||||||
}
|
}
|
||||||
virtual bool wantUIFrame();
|
virtual bool wantUIFrame() override;
|
||||||
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Called to handle a particular incoming message
|
/** Called to handle a particular incoming message
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, EnvironmentalMeasurement *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, EnvironmentalMeasurement *p) override;
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
/**
|
/**
|
||||||
* Send our EnvironmentalMeasurement into the mesh
|
* Send our EnvironmentalMeasurement into the mesh
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@ class ExternalNotificationPlugin : public SinglePortPlugin, private concurrency:
|
|||||||
|
|
||||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@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;
|
||||||
|
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
@ -26,14 +26,14 @@ class NodeInfoPlugin : public ProtobufPlugin<User>, private concurrency::OSThrea
|
|||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, User *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, User *p) override;
|
||||||
|
|
||||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply() override;
|
||||||
|
|
||||||
/** Does our periodic broadcast */
|
/** Does our periodic broadcast */
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NodeInfoPlugin *nodeInfoPlugin;
|
extern NodeInfoPlugin *nodeInfoPlugin;
|
@ -37,14 +37,14 @@ class PositionPlugin : public ProtobufPlugin<Position>, private concurrency::OST
|
|||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Position *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Position *p) override;
|
||||||
|
|
||||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply() override;
|
||||||
|
|
||||||
/** Does our periodic broadcast */
|
/** Does our periodic broadcast */
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PositionPlugin *positionPlugin;
|
extern PositionPlugin *positionPlugin;
|
@ -27,7 +27,7 @@ class RemoteHardwarePlugin : public ProtobufPlugin<HardwareMessage>, private con
|
|||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, HardwareMessage *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, HardwareMessage *p) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Periodically read the gpios we have been asked to WATCH, if they have changed,
|
* Periodically read the gpios we have been asked to WATCH, if they have changed,
|
||||||
@ -37,7 +37,7 @@ class RemoteHardwarePlugin : public ProtobufPlugin<HardwareMessage>, private con
|
|||||||
*
|
*
|
||||||
* Returns desired period for next invocation (or RUN_SAME for no change)
|
* Returns desired period for next invocation (or RUN_SAME for no change)
|
||||||
*/
|
*/
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RemoteHardwarePlugin remoteHardwarePlugin;
|
extern RemoteHardwarePlugin remoteHardwarePlugin;
|
@ -18,5 +18,5 @@ class ReplyPlugin : public SinglePortPlugin
|
|||||||
/** For reply plugin we do all of our processing in the (normally optional)
|
/** For reply plugin we do all of our processing in the (normally optional)
|
||||||
* want_replies handling
|
* want_replies handling
|
||||||
*/
|
*/
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply() override;
|
||||||
};
|
};
|
||||||
|
@ -22,14 +22,14 @@ class RoutingPlugin : public ProtobufPlugin<Routing>
|
|||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Routing *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Routing *p) override;
|
||||||
|
|
||||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply() override;
|
||||||
|
|
||||||
/// Override wantPacket to say we want to see all packets, not just those for our port number
|
/// Override wantPacket to say we want to see all packets, not just those for our port number
|
||||||
virtual bool wantPacket(const MeshPacket *p) { return true; }
|
virtual bool wantPacket(const MeshPacket *p) override { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RoutingPlugin *routingPlugin;
|
extern RoutingPlugin *routingPlugin;
|
@ -19,7 +19,7 @@ class TextMessagePlugin : public SinglePortPlugin, public Observable<const MeshP
|
|||||||
|
|
||||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@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;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TextMessagePlugin *textMessagePlugin;
|
extern TextMessagePlugin *textMessagePlugin;
|
@ -14,7 +14,7 @@ class RangeTestPlugin : private concurrency::OSThread
|
|||||||
RangeTestPlugin();
|
RangeTestPlugin();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RangeTestPlugin *rangeTestPlugin;
|
extern RangeTestPlugin *rangeTestPlugin;
|
||||||
@ -46,13 +46,13 @@ class RangeTestPluginRadio : public SinglePortPlugin
|
|||||||
float latLongToMeter(double lat_a, double lng_a, double lat_b, double lng_b);
|
float latLongToMeter(double lat_a, double lng_a, double lat_b, double lng_b);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply() override;
|
||||||
|
|
||||||
/** Called to handle a particular incoming message
|
/** Called to handle a particular incoming message
|
||||||
|
|
||||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@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;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RangeTestPluginRadio *rangeTestPluginRadio;
|
extern RangeTestPluginRadio *rangeTestPluginRadio;
|
||||||
|
@ -14,7 +14,7 @@ class SerialPlugin : private concurrency::OSThread
|
|||||||
SerialPlugin();
|
SerialPlugin();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SerialPlugin *serialPlugin;
|
extern SerialPlugin *serialPlugin;
|
||||||
@ -41,13 +41,13 @@ class SerialPluginRadio : public SinglePortPlugin
|
|||||||
void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply() override;
|
||||||
|
|
||||||
/** Called to handle a particular incoming message
|
/** Called to handle a particular incoming message
|
||||||
|
|
||||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@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;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SerialPluginRadio *serialPluginRadio;
|
extern SerialPluginRadio *serialPluginRadio;
|
||||||
|
@ -54,7 +54,7 @@ class StoreForwardPlugin : public SinglePortPlugin, private concurrency::OSThrea
|
|||||||
*/
|
*/
|
||||||
void sendPayload(NodeNum dest = NODENUM_BROADCAST, uint32_t packetHistory_index = 0);
|
void sendPayload(NodeNum dest = NODENUM_BROADCAST, uint32_t packetHistory_index = 0);
|
||||||
void sendMessage(NodeNum dest, char *str);
|
void sendMessage(NodeNum dest, char *str);
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply() override;
|
||||||
/*
|
/*
|
||||||
Override the wantPortnum method.
|
Override the wantPortnum method.
|
||||||
*/
|
*/
|
||||||
@ -70,14 +70,14 @@ class StoreForwardPlugin : public SinglePortPlugin, private concurrency::OSThrea
|
|||||||
bool heartbeat = false; // No heartbeat.
|
bool heartbeat = false; // No heartbeat.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
|
|
||||||
/** Called to handle a particular incoming message
|
/** Called to handle a particular incoming message
|
||||||
|
|
||||||
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for
|
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for
|
||||||
it
|
it
|
||||||
*/
|
*/
|
||||||
virtual ProcessMessage handleReceived(const MeshPacket &mp);
|
virtual ProcessMessage handleReceived(const MeshPacket &mp) override;
|
||||||
virtual ProcessMessage handleReceivedProtobuf(const MeshPacket &mp, StoreAndForward *p);
|
virtual ProcessMessage handleReceivedProtobuf(const MeshPacket &mp, StoreAndForward *p);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,7 @@ class CrossPlatformCryptoEngine : public CryptoEngine
|
|||||||
* @param bytes a _static_ buffer that will remain valid for the life of this crypto instance (i.e. this class will cache the
|
* @param bytes a _static_ buffer that will remain valid for the life of this crypto instance (i.e. this class will cache the
|
||||||
* provided pointer)
|
* provided pointer)
|
||||||
*/
|
*/
|
||||||
virtual void setKey(const CryptoKey &k)
|
virtual void setKey(const CryptoKey &k) override
|
||||||
{
|
{
|
||||||
CryptoEngine::setKey(k);
|
CryptoEngine::setKey(k);
|
||||||
DEBUG_MSG("Installing AES%d key!\n", key.length * 8);
|
DEBUG_MSG("Installing AES%d key!\n", key.length * 8);
|
||||||
@ -47,7 +47,7 @@ class CrossPlatformCryptoEngine : public CryptoEngine
|
|||||||
*
|
*
|
||||||
* @param bytes is updated in place
|
* @param bytes is updated in place
|
||||||
*/
|
*/
|
||||||
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes)
|
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
{
|
{
|
||||||
if (key.length > 0) {
|
if (key.length > 0) {
|
||||||
uint8_t stream_block[16];
|
uint8_t stream_block[16];
|
||||||
@ -67,7 +67,7 @@ class CrossPlatformCryptoEngine : public CryptoEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes)
|
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
{
|
{
|
||||||
// For CTR, the implementation is the same
|
// For CTR, the implementation is the same
|
||||||
encrypt(fromNode, packetNum, numBytes, bytes);
|
encrypt(fromNode, packetNum, numBytes, bytes);
|
||||||
|
@ -26,7 +26,7 @@ class Power : private concurrency::OSThread
|
|||||||
void shutdown();
|
void shutdown();
|
||||||
void readPowerStatus();
|
void readPowerStatus();
|
||||||
virtual bool setup();
|
virtual bool setup();
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce() override;
|
||||||
void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; }
|
void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -4,6 +4,10 @@ assertWithSideEffect
|
|||||||
// TODO: need to come back to these
|
// TODO: need to come back to these
|
||||||
duplInheritedMember
|
duplInheritedMember
|
||||||
|
|
||||||
|
// no real downside/harm in these
|
||||||
|
unusedFunction
|
||||||
|
unusedPrivateFunction
|
||||||
|
|
||||||
// most likely due to a cppcheck configuration issue (like missing an include)
|
// most likely due to a cppcheck configuration issue (like missing an include)
|
||||||
syntaxError
|
syntaxError
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user