more warning fixes

This commit is contained in:
Mike Kinney 2022-01-24 18:39:17 +00:00
parent caaa235c5d
commit 7c362af3de
27 changed files with 74 additions and 69 deletions

View File

@ -42,7 +42,7 @@ class GPSStatus : public Status
} }
// preferred method // preferred method
GPSStatus(bool hasLock, bool isConnected, Position pos) GPSStatus(bool hasLock, bool isConnected, const Position& pos)
: Status() : Status()
{ {
this->hasLock = hasLock; this->hasLock = hasLock;
@ -149,4 +149,4 @@ class GPSStatus : public Status
} // namespace meshtastic } // namespace meshtastic
extern meshtastic::GPSStatus *gpsStatus; extern meshtastic::GPSStatus *gpsStatus;

View File

@ -235,18 +235,18 @@ void Power::readPowerStatus()
} }
// Notify any status instances that are observing us // Notify any status instances that are observing us
const PowerStatus powerStatus = const PowerStatus powerStatus2 =
PowerStatus(hasBattery ? OptTrue : OptFalse, batteryLevel->isVBUSPlug() ? OptTrue : OptFalse, PowerStatus(hasBattery ? OptTrue : OptFalse, batteryLevel->isVBUSPlug() ? OptTrue : OptFalse,
batteryLevel->isChargeing() ? OptTrue : OptFalse, batteryVoltageMv, batteryChargePercent); batteryLevel->isChargeing() ? OptTrue : OptFalse, batteryVoltageMv, batteryChargePercent);
DEBUG_MSG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus.getHasUSB(), DEBUG_MSG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus2.getHasUSB(),
powerStatus.getIsCharging(), powerStatus.getBatteryVoltageMv(), powerStatus.getBatteryChargePercent()); powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
newStatus.notifyObservers(&powerStatus); 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 // 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 // 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 #ifdef NRF52_SERIES
if (powerStatus.getHasBattery() && !powerStatus.getHasUSB()){ if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()){
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS){ if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS){
low_voltage_counter++; low_voltage_counter++;
if (low_voltage_counter>3) if (low_voltage_counter>3)
@ -257,13 +257,13 @@ void Power::readPowerStatus()
} }
#else #else
// If we have a battery at all and it is less than 10% full, force deep sleep // 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); powerFSM.trigger(EVENT_LOW_BATTERY);
#endif #endif
} else { } else {
// No power sensing on this board - tell everyone else we have no idea what is happening // 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); const PowerStatus powerStatus3 = PowerStatus(OptUnknown, OptUnknown, OptUnknown, -1, -1);
newStatus.notifyObservers(&powerStatus); newStatus.notifyObservers(&powerStatus3);
} }
} }

View File

@ -63,7 +63,7 @@ static void lsIdle()
// DEBUG_MSG("lsIdle begin ls_secs=%u\n", getPref_ls_secs()); // DEBUG_MSG("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
#ifndef NO_ESP32 #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? // Do we have more sleeping to do?
if (secsSlept < getPref_ls_secs()) { 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 some other service would stall sleep, don't let sleep happen yet
if (doPreflightSleep()) { if (doPreflightSleep()) {
setLed(false); // Never leave led on while in light sleep 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: case ESP_SLEEP_WAKEUP_TIMER:
// Normal case: timer expired, we should just go back to sleep ASAP // Normal case: timer expired, we should just go back to sleep ASAP
setLed(true); // briefly turn on led setLed(true); // briefly turn on led
wakeCause = doLightSleep(1); // leave led on for 1ms wakeCause2 = doLightSleep(1); // leave led on for 1ms
secsSlept += sleepTime; secsSlept += sleepTime;
// DEBUG_MSG("sleeping, flash led!\n"); // DEBUG_MSG("sleeping, flash led!\n");
@ -94,7 +94,7 @@ static void lsIdle()
default: default:
// We woke for some other reason (button press, device interrupt) // We woke for some other reason (button press, device interrupt)
// uint64_t status = esp_sleep_get_ext1_wakeup_status(); // uint64_t status = esp_sleep_get_ext1_wakeup_status();
DEBUG_MSG("wakeCause %d\n", wakeCause); DEBUG_MSG("wakeCause2 %d\n", wakeCause2);
#ifdef BUTTON_PIN #ifdef BUTTON_PIN
bool pressed = !digitalRead(BUTTON_PIN); bool pressed = !digitalRead(BUTTON_PIN);

View File

@ -117,8 +117,7 @@ float AirTime::utilizationTXPercent()
return (float(sum) / float(MS_IN_HOUR)) * 100; return (float(sum) / float(MS_IN_HOUR)) * 100;
} }
AirTime::AirTime() : concurrency::OSThread("AirTime") { AirTime::AirTime() : concurrency::OSThread("AirTime"),airtimes({}) {
airtimes = {};
} }
int32_t AirTime::runOnce() int32_t AirTime::runOnce()

View File

@ -7,9 +7,8 @@
namespace concurrency namespace concurrency
{ {
BinarySemaphoreFreeRTOS::BinarySemaphoreFreeRTOS() BinarySemaphoreFreeRTOS::BinarySemaphoreFreeRTOS() : semaphore(xSemaphoreCreateBinary())
{ {
semaphore = xSemaphoreCreateBinary();
assert(semaphore); assert(semaphore);
} }
@ -38,4 +37,4 @@ IRAM_ATTR void BinarySemaphoreFreeRTOS::giveFromISR(BaseType_t *pxHigherPriority
} // namespace concurrency } // namespace concurrency
#endif #endif

View File

@ -6,9 +6,8 @@ namespace concurrency
{ {
#ifdef HAS_FREE_RTOS #ifdef HAS_FREE_RTOS
Lock::Lock() Lock::Lock() : handle(xSemaphoreCreateBinary())
{ {
handle = xSemaphoreCreateBinary();
assert(handle); assert(handle);
assert(xSemaphoreGive(handle)); assert(xSemaphoreGive(handle));
} }

View File

@ -11,10 +11,10 @@ class Air530GPS : public NMEAGPS
{ {
protected: protected:
/// 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;
/// wake the GPS into normal operation mode /// wake the GPS into normal operation mode
virtual void wake(); virtual void wake() override;
private: private:
/// Send a NMEA cmd with checksum /// Send a NMEA cmd with checksum

View File

@ -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 * Based on: https://www.movable-type.co.uk/scripts/latlong-os-gridref.html
*/ */
void GeoCoord::latLongToOSGR(const double lat, const double lon, OSGR &osgr) { 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 a = 6377563.396; // Airy 1830 semi-major axis
double b = 6356256.909; // Airy 1830 semi-minor axis double b = 6356256.909; // Airy 1830 semi-minor axis
double f0 = 0.9996012717; // National Grid point scale factor on the central meridian 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 // 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); 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 // 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); return bearing(this->getLatitude() * 1e-7, this->getLongitude() * 1e-7, pointB.getLatitude() * 1e-7, pointB.getLongitude() * 1e-7);
} }

View File

@ -119,8 +119,8 @@ class GeoCoord {
static float rangeMetersToRadians(double range_meters); static float rangeMetersToRadians(double range_meters);
// Point to point conversions // Point to point conversions
int32_t distanceTo(GeoCoord pointB); int32_t distanceTo(const GeoCoord& pointB);
int32_t bearingTo(GeoCoord pointB); int32_t bearingTo(const GeoCoord& pointB);
std::shared_ptr<GeoCoord> pointAtDistance(double bearing, double range); std::shared_ptr<GeoCoord> pointAtDistance(double bearing, double range);
// Lat lon alt getters // Lat lon alt getters

View File

@ -54,7 +54,7 @@ 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() override; virtual bool lookForLocation() override;
virtual bool hasLock(); virtual bool hasLock() override;
/// If possible force the GPS into sleep/low power mode /// If possible force the GPS into sleep/low power mode
virtual void sleep() override; virtual void sleep() override;

View File

@ -651,7 +651,6 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
static char distStr[20]; static char distStr[20];
strcpy(distStr, "? km"); // might not have location data strcpy(distStr, "? km"); // might not have location data
float headingRadian;
NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum()); NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum());
const char *fields[] = {username, distStr, signalStr, lastStr, NULL}; 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. // it. currently we don't do this and instead draw north up only.
float bearingToOther = float bearingToOther =
GeoCoord::bearing(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i)); 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); 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) void Screen::drawDebugInfoTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{ {
Screen *screen = reinterpret_cast<Screen *>(state->userData); Screen *screen2 = reinterpret_cast<Screen *>(state->userData);
screen->debugInfo.drawFrame(display, state, x, y); screen2->debugInfo.drawFrame(display, state, x, y);
} }
void Screen::drawDebugInfoSettingsTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) void Screen::drawDebugInfoSettingsTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{ {
Screen *screen = reinterpret_cast<Screen *>(state->userData); Screen *screen2 = reinterpret_cast<Screen *>(state->userData);
screen->debugInfo.drawFrameSettings(display, state, x, y); screen2->debugInfo.drawFrameSettings(display, state, x, y);
} }
void Screen::drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) void Screen::drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{ {
Screen *screen = reinterpret_cast<Screen *>(state->userData); Screen *screen2 = reinterpret_cast<Screen *>(state->userData);
screen->debugInfo.drawFrameWiFi(display, state, x, y); screen2->debugInfo.drawFrameWiFi(display, state, x, y);
} }
/* show a message that the SSL cert is being built /* show a message that the SSL cert is being built

View File

@ -22,7 +22,7 @@ class RotaryEncoderInterruptBase :
private concurrency::OSThread private concurrency::OSThread
{ {
public: public:
RotaryEncoderInterruptBase( explicit RotaryEncoderInterruptBase(
const char *name); const char *name);
void init( void init(
uint8_t pinA, uint8_t pinB, uint8_t pinPress, uint8_t pinA, uint8_t pinB, uint8_t pinPress,

View File

@ -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 *addr;
volatile uint32_t *start = (volatile uint32_t *)_start; 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 pattern = 0;
uint32_t val; uint32_t val;
uint32_t readback; uint32_t readback;
@ -315,4 +315,4 @@ void doMemTest()
assert(0); // FIXME report error better assert(0); // FIXME report error better
iter++; iter++;
} }

View File

@ -102,7 +102,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
CryptoKey Channels::getKey(ChannelIndex chIndex) CryptoKey Channels::getKey(ChannelIndex chIndex)
{ {
Channel &ch = getByIndex(chIndex); Channel &ch = getByIndex(chIndex);
ChannelSettings &channelSettings = ch.settings; const ChannelSettings &channelSettings = ch.settings;
assert(ch.has_settings); assert(ch.has_settings);
CryptoKey k; CryptoKey k;
@ -206,7 +206,7 @@ void Channels::setChannel(const Channel &c)
const char *Channels::getName(size_t chIndex) const char *Channels::getName(size_t chIndex)
{ {
// Convert the short "" representation for Default into a usable string // 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; const char *channelName = channelSettings.name;
if (!*channelName) { // emptystring if (!*channelName) { // emptystring
// Per mesh.proto spec, if bandwidth is specified we must ignore modemConfig enum, we assume that in that case // Per mesh.proto spec, if bandwidth is specified we must ignore modemConfig enum, we assume that in that case

View File

@ -26,9 +26,12 @@ class Channels
ChannelIndex activeChannelIndex = 0; ChannelIndex activeChannelIndex = 0;
/// the precomputed hashes for each of our channels, or -1 for invalid /// 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: public:
Channels() {}
/// Well known channel names /// Well known channel names
static const char *adminChannel, *gpioChannel, *serialChannel; static const char *adminChannel, *gpioChannel, *serialChannel;
@ -134,4 +137,4 @@ class Channels
}; };
/// Singleton channel table /// Singleton channel table
extern Channels channels; extern Channels channels;

View File

@ -18,7 +18,7 @@ class MeshPacketQueue
bool replaceLowerPriorityPacket(MeshPacket *mp); bool replaceLowerPriorityPacket(MeshPacket *mp);
public: public:
MeshPacketQueue(size_t _maxLen); explicit MeshPacketQueue(size_t _maxLen);
/** enqueue a packet, return false if full */ /** enqueue a packet, return false if full */
bool enqueue(MeshPacket *p); 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 */ /** 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); MeshPacket *remove(NodeNum from, PacketId id);
}; };

View File

@ -16,7 +16,7 @@ class RadioLibRF95: public SX1278 {
\param mod Instance of Module that will be used to communicate with the %LoRa chip. \param mod Instance of Module that will be used to communicate with the %LoRa chip.
*/ */
RadioLibRF95(Module* mod); explicit RadioLibRF95(Module* mod);
// basic methods // basic methods

View File

@ -13,7 +13,7 @@ struct GlobalPacketId {
bool operator==(const GlobalPacketId &p) const { return node == p.node && id == p.id; } 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); node = getFrom(p);
id = p->id; id = p->id;
@ -45,7 +45,7 @@ struct PendingPacket {
bool wantRoute = false; bool wantRoute = false;
PendingPacket() {} PendingPacket() {}
PendingPacket(MeshPacket *p); explicit PendingPacket(MeshPacket *p);
}; };
class GlobalPacketIdHashFunction class GlobalPacketIdHashFunction

View File

@ -19,9 +19,8 @@ template <class T> class TypedQueue
concurrency::OSThread *reader = NULL; concurrency::OSThread *reader = NULL;
public: public:
explicit TypedQueue(int maxElements) explicit TypedQueue(int maxElements) : h(xQueueCreate(maxElements, sizeof(T)))
{ {
h = xQueueCreate(maxElements, sizeof(T));
assert(h); assert(h);
} }

View File

@ -130,8 +130,8 @@ static void taskCreateCert(void *parameter)
void createSSLCert() void createSSLCert()
{ {
bool runLoop = false;
if (isWifiAvailable() && !isCertReady) { if (isWifiAvailable() && !isCertReady) {
bool runLoop = false;
// Create a new process just to handle creating the cert. // 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 // This is a workaround for Bug: https://github.com/fhessel/esp32_https_server/issues/48

View File

@ -13,7 +13,7 @@ class WiFiServerAPI : public StreamAPI
WiFiClient client; WiFiClient client;
public: public:
WiFiServerAPI(WiFiClient &_client); explicit WiFiServerAPI(WiFiClient &_client);
virtual ~WiFiServerAPI(); virtual ~WiFiServerAPI();

View File

@ -156,13 +156,12 @@ ProcessMessage ExternalNotificationPlugin::handleReceived(const MeshPacket &mp)
if (radioConfig.preferences.ext_notification_plugin_enabled) { if (radioConfig.preferences.ext_notification_plugin_enabled) {
auto &p = mp.decoded;
if (getFrom(&mp) != nodeDB.getNodeNum()) { 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. // 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. // Need to know if and how this could be a problem.
if (radioConfig.preferences.ext_notification_plugin_alert_bell) { if (radioConfig.preferences.ext_notification_plugin_alert_bell) {
auto &p = mp.decoded;
DEBUG_MSG("externalNotificationPlugin - Notification Bell\n"); DEBUG_MSG("externalNotificationPlugin - Notification Bell\n");
for (int i = 0; i < p.payload.size; i++) { for (int i = 0; i < p.payload.size; i++) {
if (p.payload.bytes[i] == ASCII_BELL) { if (p.payload.bytes[i] == ASCII_BELL) {

View File

@ -145,9 +145,9 @@ int32_t PositionPlugin::runOnce()
DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies); DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies);
sendOurPosition(NODENUM_BROADCAST, requestReplies); sendOurPosition(NODENUM_BROADCAST, requestReplies);
} else if (radioConfig.preferences.position_broadcast_smart == true) { } 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. // The minimum distance to travel before we are able to send a new position packet.
const uint32_t distanceTravelMinimum = 30; const uint32_t distanceTravelMinimum = 30;
@ -173,7 +173,7 @@ int32_t PositionPlugin::runOnce()
bool requestReplies = currentGeneration != radioGeneration; bool requestReplies = currentGeneration != radioGeneration;
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); sendOurPosition(NODENUM_BROADCAST, requestReplies);
/* Update lastGpsSend to now. This means if the device is stationary, then /* 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 return 5000; // to save power only wake for our callback occasionally
} }

View File

@ -79,9 +79,9 @@ bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, Hardwar
HardwareMessage r = HardwareMessage_init_default; HardwareMessage r = HardwareMessage_init_default;
r.typ = HardwareMessage_Type_READ_GPIOS_REPLY; r.typ = HardwareMessage_Type_READ_GPIOS_REPLY;
r.gpio_value = res; r.gpio_value = res;
MeshPacket *p = allocDataProtobuf(r); MeshPacket *p2 = allocDataProtobuf(r);
setReplyTo(p, req); setReplyTo(p2, req);
myReply = p; myReply = p2;
break; break;
} }
@ -132,4 +132,4 @@ int32_t RemoteHardwarePlugin::runOnce()
} }
return 200; // Poll our GPIOs every 200ms (FIXME, make adjustable via protobuf arg) return 200; // Poll our GPIOs every 200ms (FIXME, make adjustable via protobuf arg)
} }

View File

@ -179,7 +179,7 @@ uint32_t StoreForwardPlugin::historyQueueCreate(uint32_t msAgo, uint32_t to)
void StoreForwardPlugin::historyAdd(const MeshPacket &mp) 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].time = millis();
this->packetHistory[this->packetHistoryCurrent].to = mp.to; this->packetHistory[this->packetHistoryCurrent].to = mp.to;
@ -247,14 +247,14 @@ ProcessMessage StoreForwardPlugin::handleReceived(const MeshPacket &mp)
DEBUG_MSG("--- S&F Received something\n"); DEBUG_MSG("--- S&F Received something\n");
auto &p = mp.decoded;
// The router node should not be sending messages as a client. // The router node should not be sending messages as a client.
if (getFrom(&mp) != nodeDB.getNodeNum()) { if (getFrom(&mp) != nodeDB.getNodeNum()) {
if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) { if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) {
DEBUG_MSG("Packet came from - PortNum_TEXT_MESSAGE_APP\n"); 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)) { if ((p.payload.bytes[0] == 'S') && (p.payload.bytes[1] == 'F') && (p.payload.bytes[2] == 0x00)) {
DEBUG_MSG("--- --- --- Request to send\n"); DEBUG_MSG("--- --- --- Request to send\n");

View File

@ -50,9 +50,9 @@ class CrossPlatformCryptoEngine : public CryptoEngine
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override 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];
static uint8_t scratch[MAX_BLOCKSIZE]; static uint8_t scratch[MAX_BLOCKSIZE];
size_t nc_off = 0; //size_t nc_off = 0;
// DEBUG_MSG("ESP32 encrypt!\n"); // DEBUG_MSG("ESP32 encrypt!\n");
initNonce(fromNode, packetNum); initNonce(fromNode, packetNum);

View File

@ -4,6 +4,14 @@ assertWithSideEffect
// TODO: need to come back to these // TODO: need to come back to these
duplInheritedMember duplInheritedMember
// TODO:
// "Using memset() on struct which contains a floating point number."
// tried:
// if (std::is_floating_point<T>::value) {
// p = 0;
// in src/mesh/MemoryPool.h
memsetClassFloat
// no real downside/harm in these // no real downside/harm in these
unusedFunction unusedFunction
unusedPrivateFunction unusedPrivateFunction