More reduction (#5256)

* Now with even fewer ings

* Ye

* Mo

* QMA6100PSensor
This commit is contained in:
Ben Meadors
2024-11-04 19:15:59 -06:00
committed by GitHub
co-authored by GitHub
parent 7ba6d97e99
commit f769c50fa5
83 changed files with 362 additions and 364 deletions
+2 -2
View File
@@ -11,12 +11,12 @@ lint:
- trufflehog@3.83.2 - trufflehog@3.83.2
- yamllint@1.35.1 - yamllint@1.35.1
- bandit@1.7.10 - bandit@1.7.10
- checkov@3.2.276 - checkov@3.2.277
- terrascan@1.19.9 - terrascan@1.19.9
- trivy@0.56.2 - trivy@0.56.2
#- trufflehog@3.63.2-rc0 #- trufflehog@3.63.2-rc0
- taplo@0.9.3 - taplo@0.9.3
- ruff@0.7.1 - ruff@0.7.2
- isort@5.13.2 - isort@5.13.2
- markdownlint@0.42.0 - markdownlint@0.42.0
- oxipng@9.1.2 - oxipng@9.1.2
+12 -12
View File
@@ -42,14 +42,14 @@ class AmbientLightingThread : public concurrency::OSThread
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
_type = type; _type = type;
if (_type == ScanI2C::DeviceType::NONE) { if (_type == ScanI2C::DeviceType::NONE) {
LOG_DEBUG("AmbientLighting disabling due to no RGB leds found on I2C bus"); LOG_DEBUG("AmbientLighting Disable due to no RGB leds found on I2C bus");
disable(); disable();
return; return;
} }
#endif #endif
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) #if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
if (!moduleConfig.ambient_lighting.led_state) { if (!moduleConfig.ambient_lighting.led_state) {
LOG_DEBUG("AmbientLighting disabling due to moduleConfig.ambient_lighting.led_state OFF"); LOG_DEBUG("AmbientLighting Disable due to moduleConfig.ambient_lighting.led_state OFF");
disable(); disable();
return; return;
} }
@@ -106,27 +106,27 @@ class AmbientLightingThread : public concurrency::OSThread
rgb.setRed(0); rgb.setRed(0);
rgb.setGreen(0); rgb.setGreen(0);
rgb.setBlue(0); rgb.setBlue(0);
LOG_INFO("Turn Off NCP5623 Ambient lighting"); LOG_INFO("OFF: NCP5623 Ambient lighting");
#endif #endif
#ifdef HAS_NEOPIXEL #ifdef HAS_NEOPIXEL
pixels.clear(); pixels.clear();
pixels.show(); pixels.show();
LOG_INFO("Turn Off NeoPixel Ambient lighting"); LOG_INFO("OFF: NeoPixel Ambient lighting");
#endif #endif
#ifdef RGBLED_CA #ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - 0); analogWrite(RGBLED_RED, 255 - 0);
analogWrite(RGBLED_GREEN, 255 - 0); analogWrite(RGBLED_GREEN, 255 - 0);
analogWrite(RGBLED_BLUE, 255 - 0); analogWrite(RGBLED_BLUE, 255 - 0);
LOG_INFO("Turn Off Ambient lighting RGB Common Anode"); LOG_INFO("OFF: Ambient light RGB Common Anode");
#elif defined(RGBLED_RED) #elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, 0); analogWrite(RGBLED_RED, 0);
analogWrite(RGBLED_GREEN, 0); analogWrite(RGBLED_GREEN, 0);
analogWrite(RGBLED_BLUE, 0); analogWrite(RGBLED_BLUE, 0);
LOG_INFO("Turn Off Ambient lighting RGB Common Cathode"); LOG_INFO("OFF: Ambient light RGB Common Cathode");
#endif #endif
#ifdef UNPHONE #ifdef UNPHONE
unphone.rgb(0, 0, 0); unphone.rgb(0, 0, 0);
LOG_INFO("Turn Off unPhone Ambient lighting"); LOG_INFO("OFF: unPhone Ambient lighting");
#endif #endif
return 0; return 0;
} }
@@ -138,7 +138,7 @@ class AmbientLightingThread : public concurrency::OSThread
rgb.setRed(moduleConfig.ambient_lighting.red); rgb.setRed(moduleConfig.ambient_lighting.red);
rgb.setGreen(moduleConfig.ambient_lighting.green); rgb.setGreen(moduleConfig.ambient_lighting.green);
rgb.setBlue(moduleConfig.ambient_lighting.blue); rgb.setBlue(moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Init NCP5623 Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current, LOG_DEBUG("Init NCP5623 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current,
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue); moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#endif #endif
#ifdef HAS_NEOPIXEL #ifdef HAS_NEOPIXEL
@@ -157,7 +157,7 @@ class AmbientLightingThread : public concurrency::OSThread
#endif #endif
#endif #endif
pixels.show(); pixels.show();
LOG_DEBUG("Init NeoPixel Ambient lighting w/ brightness(current)=%d, red=%d, green=%d, blue=%d", LOG_DEBUG("Init NeoPixel Ambient light w/ brightness(current)=%d, red=%d, green=%d, blue=%d",
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue); moduleConfig.ambient_lighting.blue);
#endif #endif
@@ -165,18 +165,18 @@ class AmbientLightingThread : public concurrency::OSThread
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red); analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green); analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue); analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Init Ambient lighting RGB Common Anode w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red, LOG_DEBUG("Init Ambient light RGB Common Anode w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue); moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#elif defined(RGBLED_RED) #elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red); analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green); analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
analogWrite(RGBLED_BLUE, moduleConfig.ambient_lighting.blue); analogWrite(RGBLED_BLUE, moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Init Ambient lighting RGB Common Cathode w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red, LOG_DEBUG("Init Ambient light RGB Common Cathode w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue); moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#endif #endif
#ifdef UNPHONE #ifdef UNPHONE
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue); unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Init unPhone Ambient lighting w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red, LOG_DEBUG("Init unPhone Ambient light w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue); moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#endif #endif
} }
+6 -6
View File
@@ -231,7 +231,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
listDir(file.path(), levels - 1, del); listDir(file.path(), levels - 1, del);
if (del) { if (del) {
LOG_DEBUG("Removing %s", file.path()); LOG_DEBUG("Remove %s", file.path());
strncpy(buffer, file.path(), sizeof(buffer)); strncpy(buffer, file.path(), sizeof(buffer));
file.close(); file.close();
FSCom.rmdir(buffer); FSCom.rmdir(buffer);
@@ -241,7 +241,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO)) #elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
listDir(file.name(), levels - 1, del); listDir(file.name(), levels - 1, del);
if (del) { if (del) {
LOG_DEBUG("Removing %s", file.name()); LOG_DEBUG("Remove %s", file.name());
strncpy(buffer, file.name(), sizeof(buffer)); strncpy(buffer, file.name(), sizeof(buffer));
file.close(); file.close();
FSCom.rmdir(buffer); FSCom.rmdir(buffer);
@@ -257,7 +257,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
} else { } else {
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
if (del) { if (del) {
LOG_DEBUG("Deleting %s", file.path()); LOG_DEBUG("Delete %s", file.path());
strncpy(buffer, file.path(), sizeof(buffer)); strncpy(buffer, file.path(), sizeof(buffer));
file.close(); file.close();
FSCom.remove(buffer); FSCom.remove(buffer);
@@ -267,7 +267,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
} }
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO)) #elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
if (del) { if (del) {
LOG_DEBUG("Deleting %s", file.name()); LOG_DEBUG("Delete %s", file.name());
strncpy(buffer, file.name(), sizeof(buffer)); strncpy(buffer, file.name(), sizeof(buffer));
file.close(); file.close();
FSCom.remove(buffer); FSCom.remove(buffer);
@@ -284,7 +284,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
} }
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
if (del) { if (del) {
LOG_DEBUG("Removing %s", root.path()); LOG_DEBUG("Remove %s", root.path());
strncpy(buffer, root.path(), sizeof(buffer)); strncpy(buffer, root.path(), sizeof(buffer));
root.close(); root.close();
FSCom.rmdir(buffer); FSCom.rmdir(buffer);
@@ -293,7 +293,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
} }
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO)) #elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
if (del) { if (del) {
LOG_DEBUG("Removing %s", root.name()); LOG_DEBUG("Remove %s", root.name());
strncpy(buffer, root.name(), sizeof(buffer)); strncpy(buffer, root.name(), sizeof(buffer));
root.close(); root.close();
FSCom.rmdir(buffer); FSCom.rmdir(buffer);
+4 -4
View File
@@ -722,9 +722,9 @@ void Power::readPowerStatus()
if (low_voltage_counter > 10) { if (low_voltage_counter > 10) {
#ifdef ARCH_NRF52 #ifdef ARCH_NRF52
// We can't trigger deep sleep on NRF52, it's freezing the board // We can't trigger deep sleep on NRF52, it's freezing the board
LOG_DEBUG("Low voltage detected, but not triggering deep sleep"); LOG_DEBUG("Low voltage detected, but not trigger deep sleep");
#else #else
LOG_INFO("Low voltage detected, triggering deep sleep"); LOG_INFO("Low voltage detected, trigger deep sleep");
powerFSM.trigger(EVENT_LOW_BATTERY); powerFSM.trigger(EVENT_LOW_BATTERY);
#endif #endif
} }
@@ -820,7 +820,7 @@ bool Power::axpChipInit()
delete PMU; delete PMU;
PMU = NULL; PMU = NULL;
} else { } else {
LOG_INFO("AXP2101 PMU init succeeded, using AXP2101 PMU"); LOG_INFO("AXP2101 PMU init succeeded");
} }
} }
@@ -831,7 +831,7 @@ bool Power::axpChipInit()
delete PMU; delete PMU;
PMU = NULL; PMU = NULL;
} else { } else {
LOG_INFO("AXP192 PMU init succeeded, using AXP192 PMU"); LOG_INFO("AXP192 PMU init succeeded");
} }
} }
+2 -2
View File
@@ -105,7 +105,7 @@ static void lsIdle()
wakeCause2 = doLightSleep(100); // leave led on for 1ms wakeCause2 = doLightSleep(100); // leave led on for 1ms
secsSlept += sleepTime; secsSlept += sleepTime;
// LOG_INFO("sleeping, flash led!"); // LOG_INFO("Sleep, flash led!");
break; break;
case ESP_SLEEP_WAKEUP_UART: case ESP_SLEEP_WAKEUP_UART:
@@ -137,7 +137,7 @@ static void lsIdle()
} else { } else {
// Time to stop sleeping! // Time to stop sleeping!
ledBlink.set(false); ledBlink.set(false);
LOG_INFO("Reached ls_secs, servicing loop()"); LOG_INFO("Reached ls_secs, service loop()");
powerFSM.trigger(EVENT_WAKE_TIMER); powerFSM.trigger(EVENT_WAKE_TIMER);
} }
#endif #endif
+3 -3
View File
@@ -50,7 +50,7 @@ void AirTime::airtimeRotatePeriod()
{ {
if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) { if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) {
LOG_DEBUG("Rotating airtimes to a new period = %u", this->currentPeriodIndex()); LOG_DEBUG("Rotate airtimes to a new period = %u", this->currentPeriodIndex());
for (int i = PERIODS_TO_LOG - 2; i >= 0; --i) { for (int i = PERIODS_TO_LOG - 2; i >= 0; --i) {
this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i]; this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i];
@@ -126,7 +126,7 @@ bool AirTime::isTxAllowedChannelUtil(bool polite)
if (channelUtilizationPercent() < percentage) { if (channelUtilizationPercent() < percentage) {
return true; return true;
} else { } else {
LOG_WARN("Channel utilization is >%d percent. Skipping this opportunity to send.", percentage); LOG_WARN("Channel utilization is >%d percent. Skip opportunity to send.", percentage);
return false; return false;
} }
} }
@@ -137,7 +137,7 @@ bool AirTime::isTxAllowedAirUtil()
if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) { if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) {
return true; return true;
} else { } else {
LOG_WARN("Tx air utilization is >%f percent. Skipping this opportunity to send.", LOG_WARN("Tx air utilization is >%f percent. Skip opportunity to send.",
myRegion->dutyCycle * polite_duty_cycle_percent / 100); myRegion->dutyCycle * polite_duty_cycle_percent / 100);
return false; return false;
} }
+2 -2
View File
@@ -37,7 +37,7 @@ IRAM_ATTR bool NotifiedWorkerThread::notifyCommon(uint32_t v, bool overwrite)
return true; return true;
} else { } else {
if (debugNotification) { if (debugNotification) {
LOG_DEBUG("dropping notification %d", v); LOG_DEBUG("Drop notification %d", v);
} }
return false; return false;
} }
@@ -67,7 +67,7 @@ bool NotifiedWorkerThread::notifyLater(uint32_t delay, uint32_t v, bool overwrit
if (didIt) { // If we didn't already have something queued, override the delay to be larger if (didIt) { // If we didn't already have something queued, override the delay to be larger
setIntervalFromNow(delay); // a new version of setInterval relative to the current time setIntervalFromNow(delay); // a new version of setInterval relative to the current time
if (debugNotification) { if (debugNotification) {
LOG_DEBUG("delaying notification %u", delay); LOG_DEBUG("Delay notification %u", delay);
} }
} }
+18 -19
View File
@@ -424,7 +424,7 @@ bool GPS::setup()
int msglen = 0; int msglen = 0;
if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) { if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) {
if (probeTries < 2) { if (probeTries < 2) {
LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]); LOG_DEBUG("Probe for GPS at %d", serialSpeeds[speedSelect]);
gnssModel = probe(serialSpeeds[speedSelect]); gnssModel = probe(serialSpeeds[speedSelect]);
if (gnssModel == GNSS_MODEL_UNKNOWN) { if (gnssModel == GNSS_MODEL_UNKNOWN) {
if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) { if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) {
@@ -435,11 +435,11 @@ bool GPS::setup()
} }
// Rare Serial Speeds // Rare Serial Speeds
if (probeTries == 2) { if (probeTries == 2) {
LOG_DEBUG("Probing for GPS at %d", rareSerialSpeeds[speedSelect]); LOG_DEBUG("Probe for GPS at %d", rareSerialSpeeds[speedSelect]);
gnssModel = probe(rareSerialSpeeds[speedSelect]); gnssModel = probe(rareSerialSpeeds[speedSelect]);
if (gnssModel == GNSS_MODEL_UNKNOWN) { if (gnssModel == GNSS_MODEL_UNKNOWN) {
if (++speedSelect == sizeof(rareSerialSpeeds) / sizeof(int)) { if (++speedSelect == sizeof(rareSerialSpeeds) / sizeof(int)) {
LOG_WARN("Giving up on GPS probe and setting to %d", GPS_BAUDRATE); LOG_WARN("Give up on GPS probe and set to %d", GPS_BAUDRATE);
return true; return true;
} }
} }
@@ -576,8 +576,8 @@ bool GPS::setup()
SEND_UBX_PACKET(0x06, 0x01, _message_GGA, "enable NMEA GGA", 500); SEND_UBX_PACKET(0x06, 0x01, _message_GGA, "enable NMEA GGA", 500);
clearBuffer(); clearBuffer();
SEND_UBX_PACKET(0x06, 0x11, _message_CFG_RXM_ECO, "enable powersaving ECO mode for Neo-6", 500); SEND_UBX_PACKET(0x06, 0x11, _message_CFG_RXM_ECO, "enable powersave ECO mode for Neo-6", 500);
SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "enable powersaving details for GPS", 500); SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "enable powersave details for GPS", 500);
SEND_UBX_PACKET(0x06, 0x01, _message_AID, "disable UBX-AID", 500); SEND_UBX_PACKET(0x06, 0x01, _message_AID, "disable UBX-AID", 500);
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE); msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE);
@@ -636,8 +636,8 @@ bool GPS::setup()
if (uBloxProtocolVersion >= 18) { if (uBloxProtocolVersion >= 18) {
clearBuffer(); clearBuffer();
SEND_UBX_PACKET(0x06, 0x86, _message_PMS, "enable powersaving for GPS", 500); SEND_UBX_PACKET(0x06, 0x86, _message_PMS, "enable powersave for GPS", 500);
SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "enable powersaving details for GPS", 500); SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "enable powersave details for GPS", 500);
// For M8 we want to enable NMEA vserion 4.10 so we can see the additional sats. // For M8 we want to enable NMEA vserion 4.10 so we can see the additional sats.
if (gnssModel == GNSS_MODEL_UBLOX8) { if (gnssModel == GNSS_MODEL_UBLOX8) {
@@ -645,8 +645,8 @@ bool GPS::setup()
SEND_UBX_PACKET(0x06, 0x17, _message_NMEA, "enable NMEA 4.10", 500); SEND_UBX_PACKET(0x06, 0x17, _message_NMEA, "enable NMEA 4.10", 500);
} }
} else { } else {
SEND_UBX_PACKET(0x06, 0x11, _message_CFG_RXM_PSM, "enable powersaving mode for GPS", 500); SEND_UBX_PACKET(0x06, 0x11, _message_CFG_RXM_PSM, "enable powersave mode for GPS", 500);
SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "enable powersaving details for GPS", 500); SEND_UBX_PACKET(0x06, 0x3B, _message_CFG_PM2, "enable powersave details for GPS", 500);
} }
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE); msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE);
@@ -672,13 +672,13 @@ bool GPS::setup()
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_TXT_INFO_BBR, "disable Info messages for M10 GPS BBR", 300); SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_TXT_INFO_BBR, "disable Info messages for M10 GPS BBR", 300);
delay(750); delay(750);
// Do M10 configuration for Power Management. // Do M10 configuration for Power Management.
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_PM_RAM, "enable powersaving for M10 GPS RAM", 300); SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_PM_RAM, "enable powersave for M10 GPS RAM", 300);
delay(750); delay(750);
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_PM_BBR, "enable powersaving for M10 GPS BBR", 300); SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_PM_BBR, "enable powersave for M10 GPS BBR", 300);
delay(750); delay(750);
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ITFM_RAM, "enable Jamming detection M10 GPS RAM", 300); SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ITFM_RAM, "enable jam detection M10 GPS RAM", 300);
delay(750); delay(750);
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ITFM_BBR, "enable Jamming detection M10 GPS BBR", 300); SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ITFM_BBR, "enable jam detection M10 GPS BBR", 300);
delay(750); delay(750);
// Here is where the init commands should go to do further M10 initialization. // Here is where the init commands should go to do further M10 initialization.
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_SBAS_RAM, "disable SBAS M10 GPS RAM", 300); SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_SBAS_RAM, "disable SBAS M10 GPS RAM", 300);
@@ -724,7 +724,7 @@ void GPS::setPowerState(GPSPowerState newState, uint32_t sleepTime)
// Update the stored GPSPowerstate, and create local copies // Update the stored GPSPowerstate, and create local copies
GPSPowerState oldState = powerState; GPSPowerState oldState = powerState;
powerState = newState; powerState = newState;
LOG_INFO("GPS power state moving from %s to %s", getGPSPowerStateString(oldState), getGPSPowerStateString(newState)); LOG_INFO("GPS power state move from %s to %s", getGPSPowerStateString(oldState), getGPSPowerStateString(newState));
#ifdef HELTEC_MESH_NODE_T114 #ifdef HELTEC_MESH_NODE_T114
if ((oldState == GPS_OFF || oldState == GPS_HARDSLEEP) && (newState != GPS_OFF && newState != GPS_HARDSLEEP)) { if ((oldState == GPS_OFF || oldState == GPS_HARDSLEEP) && (newState != GPS_OFF && newState != GPS_HARDSLEEP)) {
@@ -968,8 +968,7 @@ void GPS::publishUpdate()
shouldPublish = false; shouldPublish = false;
// In debug logs, identify position by @timestamp:stage (stage 2 = publish) // In debug logs, identify position by @timestamp:stage (stage 2 = publish)
LOG_DEBUG("publishing pos@%x:2, hasVal=%d, Sats=%d, GPSlock=%d", p.timestamp, hasValidLocation, p.sats_in_view, LOG_DEBUG("Publish pos@%x:2, hasVal=%d, Sats=%d, GPSlock=%d", p.timestamp, hasValidLocation, p.sats_in_view, hasLock());
hasLock());
// Notify any status instances that are observing us // Notify any status instances that are observing us
const meshtastic::GPSStatus status = meshtastic::GPSStatus(hasValidLocation, isConnected(), isPowerSaving(), p); const meshtastic::GPSStatus status = meshtastic::GPSStatus(hasValidLocation, isConnected(), isPowerSaving(), p);
@@ -984,7 +983,7 @@ int32_t GPS::runOnce()
{ {
if (!GPSInitFinished) { if (!GPSInitFinished) {
if (!_serial_gps || config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT) { if (!_serial_gps || config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT) {
LOG_INFO("GPS set to not-present. Skipping probe"); LOG_INFO("GPS set to not-present. Skip probe");
return disable(); return disable();
} }
if (!setup()) if (!setup())
@@ -1020,7 +1019,7 @@ int32_t GPS::runOnce()
GNSS_MODEL_UBLOX10)) { GNSS_MODEL_UBLOX10)) {
// reset the GPS on next bootup // reset the GPS on next bootup
if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) { if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) {
LOG_DEBUG("GPS is not communicating, trying factory reset on next boot"); LOG_DEBUG("GPS is not found, try factory reset on next boot");
devicestate.did_gps_reset = false; devicestate.did_gps_reset = false;
nodeDB->saveToDisk(SEGMENT_DEVICESTATE); nodeDB->saveToDisk(SEGMENT_DEVICESTATE);
return disable(); // Stop the GPS thread as it can do nothing useful until next reboot. return disable(); // Stop the GPS thread as it can do nothing useful until next reboot.
@@ -1656,7 +1655,7 @@ bool GPS::whileActive()
} }
#ifdef SERIAL_BUFFER_SIZE #ifdef SERIAL_BUFFER_SIZE
if (_serial_gps->available() >= SERIAL_BUFFER_SIZE - 1) { if (_serial_gps->available() >= SERIAL_BUFFER_SIZE - 1) {
LOG_WARN("GPS Buffer full with %u bytes waiting. Flushing to avoid corruption", _serial_gps->available()); LOG_WARN("GPS Buffer full with %u bytes waiting. Flush to avoid corruption", _serial_gps->available());
clearBuffer(); clearBuffer();
} }
#endif #endif
+1 -1
View File
@@ -108,7 +108,7 @@ void GPSUpdateScheduling::updateLockTimePrediction()
searchCount++; // Only tracked so we can disregard initial lock-times searchCount++; // Only tracked so we can disregard initial lock-times
LOG_DEBUG("Predicting %us to get next lock", predictedMsToGetLock / 1000); LOG_DEBUG("Predict %us to get next lock", predictedMsToGetLock / 1000);
} }
// How long do we expect to spend searching for a lock? // How long do we expect to spend searching for a lock?
+1 -1
View File
@@ -134,7 +134,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
LOG_DEBUG("Reapply external time to correct clock drift %ld secs", printableEpoch); LOG_DEBUG("Reapply external time to correct clock drift %ld secs", printableEpoch);
} else { } else {
shouldSet = false; shouldSet = false;
LOG_DEBUG("Current RTC quality: %s. Ignoring time of RTC quality of %s", RtcName(currentQuality), RtcName(q)); LOG_DEBUG("Current RTC quality: %s. Ignore time of RTC quality of %s", RtcName(currentQuality), RtcName(q));
} }
if (shouldSet) { if (shouldSet) {
+2 -2
View File
@@ -79,7 +79,7 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
} }
// Trigger the refresh in GxEPD2 // Trigger the refresh in GxEPD2
LOG_DEBUG("Updating E-Paper"); LOG_DEBUG("Update E-Paper");
adafruitDisplay->nextPage(); adafruitDisplay->nextPage();
// End the update process // End the update process
@@ -123,7 +123,7 @@ void EInkDisplay::setDetected(uint8_t detected)
// Connect to the display - variant specific // Connect to the display - variant specific
bool EInkDisplay::connect() bool EInkDisplay::connect()
{ {
LOG_INFO("Doing EInk init"); LOG_INFO("Do EInk init");
#ifdef PIN_EINK_EN #ifdef PIN_EINK_EN
// backlight power, HIGH is backlight on, LOW is off // backlight power, HIGH is backlight on, LOW is off
+2 -2
View File
@@ -119,7 +119,7 @@ void EInkDynamicDisplay::endOrDetach()
awaitRefresh(); awaitRefresh();
else { else {
// Async begins // Async begins
LOG_DEBUG("Async full-refresh begins (dropping frames)"); LOG_DEBUG("Async full-refresh begins (drop frames)");
notifyLater(intervalPollAsyncRefresh, DUE_POLL_ASYNCREFRESH, true); // Hand-off to NotifiedWorkerThread notifyLater(intervalPollAsyncRefresh, DUE_POLL_ASYNCREFRESH, true); // Hand-off to NotifiedWorkerThread
} }
} }
@@ -469,7 +469,7 @@ void EInkDynamicDisplay::joinAsyncRefresh()
if (!asyncRefreshRunning) if (!asyncRefreshRunning)
return; return;
LOG_DEBUG("Joining an async refresh in progress"); LOG_DEBUG("Join an async refresh in progress");
// Continually poll the BUSY pin // Continually poll the BUSY pin
while (adafruitDisplay->epd2.isBusy()) while (adafruitDisplay->epd2.isBusy())
+15 -15
View File
@@ -242,7 +242,7 @@ static void drawWelcomeScreen(OLEDDisplay *display, OLEDDisplayUiState *state, i
// draw overlay in bottom right corner of screen to show when notifications are muted or modifier key is active // draw overlay in bottom right corner of screen to show when notifications are muted or modifier key is active
static void drawFunctionOverlay(OLEDDisplay *display, OLEDDisplayUiState *state) static void drawFunctionOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
{ {
// LOG_DEBUG("Drawing function overlay"); // LOG_DEBUG("Draw function overlay");
if (functionSymbals.begin() != functionSymbals.end()) { if (functionSymbals.begin() != functionSymbals.end()) {
char buf[64]; char buf[64];
display->setFont(FONT_SMALL); display->setFont(FONT_SMALL);
@@ -260,7 +260,7 @@ static void drawDeepSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
EINK_ADD_FRAMEFLAG(display, COSMETIC); EINK_ADD_FRAMEFLAG(display, COSMETIC);
EINK_ADD_FRAMEFLAG(display, BLOCKING); EINK_ADD_FRAMEFLAG(display, BLOCKING);
LOG_DEBUG("Drawing deep sleep screen"); LOG_DEBUG("Draw deep sleep screen");
// Display displayStr on the screen // Display displayStr on the screen
drawIconScreen("Sleeping", display, state, x, y); drawIconScreen("Sleeping", display, state, x, y);
@@ -269,7 +269,7 @@ static void drawDeepSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
/// Used on eink displays when screen updates are paused /// Used on eink displays when screen updates are paused
static void drawScreensaverOverlay(OLEDDisplay *display, OLEDDisplayUiState *state) static void drawScreensaverOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
{ {
LOG_DEBUG("Drawing screensaver overlay"); LOG_DEBUG("Draw screensaver overlay");
EINK_ADD_FRAMEFLAG(display, COSMETIC); // Take the opportunity for a full-refresh EINK_ADD_FRAMEFLAG(display, COSMETIC); // Take the opportunity for a full-refresh
@@ -337,7 +337,7 @@ static void drawModuleFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int
module_frame = state->currentFrame; module_frame = state->currentFrame;
// LOG_DEBUG("Screen is not in transition. Frame: %d", module_frame); // LOG_DEBUG("Screen is not in transition. Frame: %d", module_frame);
} }
// LOG_DEBUG("Drawing Module Frame %d", module_frame); // LOG_DEBUG("Draw Module Frame %d", module_frame);
MeshModule &pi = *moduleFrames.at(module_frame); MeshModule &pi = *moduleFrames.at(module_frame);
pi.drawFrame(display, state, x, y); pi.drawFrame(display, state, x, y);
} }
@@ -912,7 +912,7 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
const meshtastic_MeshPacket &mp = devicestate.rx_text_message; const meshtastic_MeshPacket &mp = devicestate.rx_text_message;
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(getFrom(&mp)); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(getFrom(&mp));
// LOG_DEBUG("drawing text message from 0x%x: %s", mp.from, // LOG_DEBUG("Draw text message from 0x%x: %s", mp.from,
// mp.decoded.variant.data.decoded.bytes); // mp.decoded.variant.data.decoded.bytes);
// Demo for drawStringMaxWidth: // Demo for drawStringMaxWidth:
@@ -1499,7 +1499,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
#elif ARCH_PORTDUINO #elif ARCH_PORTDUINO
if (settingsMap[displayPanel] != no_screen) { if (settingsMap[displayPanel] != no_screen) {
LOG_DEBUG("Making TFTDisplay!"); LOG_DEBUG("Make TFTDisplay!");
dispdev = new TFTDisplay(address.address, -1, -1, geometry, dispdev = new TFTDisplay(address.address, -1, -1, geometry,
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
} else { } else {
@@ -1546,7 +1546,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
if (on != screenOn) { if (on != screenOn) {
if (on) { if (on) {
LOG_INFO("Turning on screen"); LOG_INFO("Turn on screen");
powerMon->setState(meshtastic_PowerMon_State_Screen_On); powerMon->setState(meshtastic_PowerMon_State_Screen_On);
#ifdef T_WATCH_S3 #ifdef T_WATCH_S3
PMU->enablePowerOutput(XPOWERS_ALDO2); PMU->enablePowerOutput(XPOWERS_ALDO2);
@@ -1581,7 +1581,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
// eInkScreensaver parameter is usually NULL (default argument), default frame used instead // eInkScreensaver parameter is usually NULL (default argument), default frame used instead
setScreensaverFrames(einkScreensaver); setScreensaverFrames(einkScreensaver);
#endif #endif
LOG_INFO("Turning off screen"); LOG_INFO("Turn off screen");
dispdev->displayOff(); dispdev->displayOff();
#ifdef USE_ST7789 #ifdef USE_ST7789
SPI1.end(); SPI1.end();
@@ -1885,7 +1885,7 @@ int32_t Screen::runOnce()
EINK_ADD_FRAMEFLAG(dispdev, COSMETIC); EINK_ADD_FRAMEFLAG(dispdev, COSMETIC);
#endif #endif
LOG_DEBUG("LastScreenTransition exceeded %ums transitioning to next frame", (millis() - lastScreenTransition)); LOG_DEBUG("LastScreenTransition exceeded %ums transition to next frame", (millis() - lastScreenTransition));
handleOnPress(); handleOnPress();
} }
} }
@@ -1921,7 +1921,7 @@ void Screen::drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiStat
void Screen::setSSLFrames() void Screen::setSSLFrames()
{ {
if (address_found.address) { if (address_found.address) {
// LOG_DEBUG("showing SSL frames"); // LOG_DEBUG("Show SSL frames");
static FrameCallback sslFrames[] = {drawSSLScreen}; static FrameCallback sslFrames[] = {drawSSLScreen};
ui->setFrames(sslFrames, 1); ui->setFrames(sslFrames, 1);
ui->update(); ui->update();
@@ -1933,7 +1933,7 @@ void Screen::setSSLFrames()
void Screen::setWelcomeFrames() void Screen::setWelcomeFrames()
{ {
if (address_found.address) { if (address_found.address) {
// LOG_DEBUG("showing Welcome frames"); // LOG_DEBUG("Show Welcome frames");
static FrameCallback frames[] = {drawWelcomeScreen}; static FrameCallback frames[] = {drawWelcomeScreen};
setFrameImmediateDraw(frames); setFrameImmediateDraw(frames);
} }
@@ -1999,7 +1999,7 @@ void Screen::setFrames(FrameFocus focus)
uint8_t originalPosition = ui->getUiState()->currentFrame; uint8_t originalPosition = ui->getUiState()->currentFrame;
FramesetInfo fsi; // Location of specific frames, for applying focus parameter FramesetInfo fsi; // Location of specific frames, for applying focus parameter
LOG_DEBUG("showing standard frames"); LOG_DEBUG("Show standard frames");
showingNormalScreen = true; showingNormalScreen = true;
#ifdef USE_EINK #ifdef USE_EINK
@@ -2012,7 +2012,7 @@ void Screen::setFrames(FrameFocus focus)
#endif #endif
moduleFrames = MeshModule::GetMeshModulesWithUIFrames(); moduleFrames = MeshModule::GetMeshModulesWithUIFrames();
LOG_DEBUG("Showing %d module frames", moduleFrames.size()); LOG_DEBUG("Show %d module frames", moduleFrames.size());
#ifdef DEBUG_PORT #ifdef DEBUG_PORT
int totalFrameCount = MAX_NUM_NODES + NUM_EXTRA_FRAMES + moduleFrames.size(); int totalFrameCount = MAX_NUM_NODES + NUM_EXTRA_FRAMES + moduleFrames.size();
LOG_DEBUG("Total frame count: %d", totalFrameCount); LOG_DEBUG("Total frame count: %d", totalFrameCount);
@@ -2094,7 +2094,7 @@ void Screen::setFrames(FrameFocus focus)
#endif #endif
fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE
LOG_DEBUG("Finished building frames. numframes: %d", numframes); LOG_DEBUG("Finished build frames. numframes: %d", numframes);
ui->setFrames(normalFrames, numframes); ui->setFrames(normalFrames, numframes);
ui->enableAllIndicators(); ui->enableAllIndicators();
@@ -2193,7 +2193,7 @@ void Screen::dismissCurrentFrame()
void Screen::handleStartFirmwareUpdateScreen() void Screen::handleStartFirmwareUpdateScreen()
{ {
LOG_DEBUG("showing firmware screen"); LOG_DEBUG("Show firmware screen");
showingNormalScreen = false; showingNormalScreen = false;
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // E-Ink: Explicitly use fast-refresh for next frame EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // E-Ink: Explicitly use fast-refresh for next frame
+1 -1
View File
@@ -823,7 +823,7 @@ void TFTDisplay::setDetected(uint8_t detected)
bool TFTDisplay::connect() bool TFTDisplay::connect()
{ {
concurrency::LockGuard g(spiLock); concurrency::LockGuard g(spiLock);
LOG_INFO("Doing TFT init"); LOG_INFO("Do TFT init");
#ifdef RAK14014 #ifdef RAK14014
tft = new TFT_eSPI; tft = new TFT_eSPI;
#else #else
+3 -3
View File
@@ -116,7 +116,7 @@ void MPR121Keyboard::begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr)
void MPR121Keyboard::reset() void MPR121Keyboard::reset()
{ {
LOG_DEBUG("MPR121 Resetting..."); LOG_DEBUG("MPR121 Reset...");
// Trigger a MPR121 Soft Reset // Trigger a MPR121 Soft Reset
if (m_wire) { if (m_wire) {
m_wire->beginTransmission(m_addr); m_wire->beginTransmission(m_addr);
@@ -132,7 +132,7 @@ void MPR121Keyboard::reset()
writeRegister(_MPR121_REG_ELECTRODE_CONFIG, 0x00); writeRegister(_MPR121_REG_ELECTRODE_CONFIG, 0x00);
delay(100); delay(100);
LOG_DEBUG("MPR121 Configuring"); LOG_DEBUG("MPR121 Configure");
// Set touch release thresholds // Set touch release thresholds
for (uint8_t i = 0; i < 12; i++) { for (uint8_t i = 0; i < 12; i++) {
// Set touch threshold // Set touch threshold
@@ -178,7 +178,7 @@ void MPR121Keyboard::reset()
writeRegister(_MPR121_REG_ELECTRODE_CONFIG, writeRegister(_MPR121_REG_ELECTRODE_CONFIG,
ECR_CALIBRATION_TRACK_FROM_PARTIAL_FILTER | ECR_PROXIMITY_DETECTION_OFF | ECR_TOUCH_DETECTION_12CH); ECR_CALIBRATION_TRACK_FROM_PARTIAL_FILTER | ECR_PROXIMITY_DETECTION_OFF | ECR_TOUCH_DETECTION_12CH);
delay(100); delay(100);
LOG_DEBUG("MPR121 Running"); LOG_DEBUG("MPR121 Run");
state = Idle; state = Idle;
} }
+1 -1
View File
@@ -11,7 +11,7 @@ void CardKbI2cImpl::init()
{ {
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(I2C_NO_RESCAN) #if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(I2C_NO_RESCAN)
if (cardkb_found.address == 0x00) { if (cardkb_found.address == 0x00) {
LOG_DEBUG("Rescanning for I2C keyboard"); LOG_DEBUG("Rescan for I2C keyboard");
uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR}; uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR};
uint8_t i2caddr_asize = 4; uint8_t i2caddr_asize = 4;
auto i2cScanner = std::unique_ptr<ScanI2CTwoWire>(new ScanI2CTwoWire()); auto i2cScanner = std::unique_ptr<ScanI2CTwoWire>(new ScanI2CTwoWire());
+16 -16
View File
@@ -392,7 +392,7 @@ void setup()
LOG_INFO("Use %s as I2C device", settingsStrings[i2cdev].c_str()); LOG_INFO("Use %s as I2C device", settingsStrings[i2cdev].c_str());
Wire.begin(settingsStrings[i2cdev].c_str()); Wire.begin(settingsStrings[i2cdev].c_str());
} else { } else {
LOG_INFO("No I2C device configured, skipping"); LOG_INFO("No I2C device configured, Skip");
} }
#elif HAS_WIRE #elif HAS_WIRE
Wire.begin(); Wire.begin();
@@ -671,7 +671,7 @@ void setup()
if (config.power.is_power_saving == true && if (config.power.is_power_saving == true &&
IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER, IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER, meshtastic_Config_DeviceConfig_Role_SENSOR)) meshtastic_Config_DeviceConfig_Role_TAK_TRACKER, meshtastic_Config_DeviceConfig_Role_SENSOR))
LOG_DEBUG("Tracker/Sensor: Skipping start melody"); LOG_DEBUG("Tracker/Sensor: Skip start melody");
else else
playStartMelody(); playStartMelody();
@@ -770,7 +770,7 @@ void setup()
if (gps) { if (gps) {
gpsStatus->observe(&gps->newStatus); gpsStatus->observe(&gps->newStatus);
} else { } else {
LOG_DEBUG("Running without GPS"); LOG_DEBUG("Run without GPS");
} }
} }
} }
@@ -840,7 +840,7 @@ void setup()
delete rIf; delete rIf;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else { } else {
LOG_INFO("SX1262 init success, using SX1262 radio"); LOG_INFO("SX1262 init success");
} }
} }
} else if (settingsMap[use_rf95]) { } else if (settingsMap[use_rf95]) {
@@ -856,7 +856,7 @@ void setup()
rIf = NULL; rIf = NULL;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else { } else {
LOG_INFO("RF95 init success, using RF95 radio"); LOG_INFO("RF95 init success");
} }
} }
} else if (settingsMap[use_sx1280]) { } else if (settingsMap[use_sx1280]) {
@@ -871,7 +871,7 @@ void setup()
rIf = NULL; rIf = NULL;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else { } else {
LOG_INFO("SX1280 init success, using SX1280 radio"); LOG_INFO("SX1280 init success");
} }
} }
} else if (settingsMap[use_sx1268]) { } else if (settingsMap[use_sx1268]) {
@@ -886,7 +886,7 @@ void setup()
rIf = NULL; rIf = NULL;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else { } else {
LOG_INFO("SX1268 init success, using SX1268 radio"); LOG_INFO("SX1268 init success");
} }
} }
} }
@@ -906,7 +906,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("STM32WL init success, using STM32WL radio"); LOG_INFO("STM32WL init success");
radioType = STM32WLx_RADIO; radioType = STM32WLx_RADIO;
} }
} }
@@ -934,7 +934,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("RF95 init success, using RF95 radio"); LOG_INFO("RF95 init success");
radioType = RF95_RADIO; radioType = RF95_RADIO;
} }
} }
@@ -948,7 +948,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("SX1262 init success, using SX1262 radio"); LOG_INFO("SX1262 init success");
radioType = SX1262_RADIO; radioType = SX1262_RADIO;
} }
} }
@@ -992,7 +992,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("SX1268 init success, using SX1268 radio"); LOG_INFO("SX1268 init success");
radioType = SX1268_RADIO; radioType = SX1268_RADIO;
} }
} }
@@ -1006,7 +1006,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("LLCC68 init success, using LLCC68 radio"); LOG_INFO("LLCC68 init success");
radioType = LLCC68_RADIO; radioType = LLCC68_RADIO;
} }
} }
@@ -1020,7 +1020,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("LR1110 init success, using LR1110 radio"); LOG_INFO("LR1110 init success");
radioType = LR1110_RADIO; radioType = LR1110_RADIO;
} }
} }
@@ -1034,7 +1034,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("LR1120 init success, using LR1120 radio"); LOG_INFO("LR1120 init success");
radioType = LR1120_RADIO; radioType = LR1120_RADIO;
} }
} }
@@ -1048,7 +1048,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("LR1121 init success, using LR1121 radio"); LOG_INFO("LR1121 init success");
radioType = LR1121_RADIO; radioType = LR1121_RADIO;
} }
} }
@@ -1062,7 +1062,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_INFO("SX1280 init success, using SX1280 radio"); LOG_INFO("SX1280 init success");
radioType = SX1280_RADIO; radioType = SX1280_RADIO;
} }
} }
+3 -3
View File
@@ -190,7 +190,7 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
k.length = channelSettings.psk.size; k.length = channelSettings.psk.size;
if (k.length == 0) { if (k.length == 0) {
if (ch.role == meshtastic_Channel_Role_SECONDARY) { if (ch.role == meshtastic_Channel_Role_SECONDARY) {
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key", ch.settings.name); LOG_DEBUG("Unset PSK for secondary channel %s. use primary key", ch.settings.name);
k = getKey(primaryIndex); k = getKey(primaryIndex);
} else { } else {
LOG_WARN("User disabled encryption"); LOG_WARN("User disabled encryption");
@@ -199,7 +199,7 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
// Convert the short single byte variants of psk into variant that can be used more generally // Convert the short single byte variants of psk into variant that can be used more generally
uint8_t pskIndex = k.bytes[0]; uint8_t pskIndex = k.bytes[0];
LOG_DEBUG("Expanding short PSK #%d", pskIndex); LOG_DEBUG("Expand short PSK #%d", pskIndex);
if (pskIndex == 0) if (pskIndex == 0)
k.length = 0; // Turn off encryption k.length = 0; // Turn off encryption
else { else {
@@ -384,7 +384,7 @@ bool Channels::hasDefaultChannel()
bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash) bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash)
{ {
if (chIndex > getNumChannels() || getHash(chIndex) != channelHash) { if (chIndex > getNumChannels() || getHash(chIndex) != channelHash) {
// LOG_DEBUG("Skipping channel %d (hash %x) due to invalid hash/index, want=%x", chIndex, getHash(chIndex), // LOG_DEBUG("Skip channel %d (hash %x) due to invalid hash/index, want=%x", chIndex, getHash(chIndex),
// channelHash); // channelHash);
return false; return false;
} else { } else {
+5 -5
View File
@@ -18,7 +18,7 @@
*/ */
void CryptoEngine::generateKeyPair(uint8_t *pubKey, uint8_t *privKey) void CryptoEngine::generateKeyPair(uint8_t *pubKey, uint8_t *privKey)
{ {
LOG_DEBUG("Generating Curve25519 keypair"); LOG_DEBUG("Generate Curve25519 keypair");
Curve25519::dh1(public_key, private_key); Curve25519::dh1(public_key, private_key);
memcpy(pubKey, public_key, sizeof(public_key)); memcpy(pubKey, public_key, sizeof(public_key));
memcpy(privKey, private_key, sizeof(private_key)); memcpy(privKey, private_key, sizeof(private_key));
@@ -80,8 +80,8 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, meshtas
initNonce(fromNode, packetNum, extraNonceTmp); initNonce(fromNode, packetNum, extraNonceTmp);
// Calculate the shared secret with the destination node and encrypt // Calculate the shared secret with the destination node and encrypt
printBytes("Attempt encrypt using nonce: ", nonce, 13); printBytes("Attempt encrypt with nonce: ", nonce, 13);
printBytes("Attempt encrypt using shared_key starting with: ", shared_key, 8); printBytes("Attempt encrypt with shared_key starting with: ", shared_key, 8);
aes_ccm_ae(shared_key, 32, nonce, 8, bytes, numBytes, nullptr, 0, bytesOut, aes_ccm_ae(shared_key, 32, nonce, 8, bytes, numBytes, nullptr, 0, bytesOut,
auth); // this can write up to 15 bytes longer than numbytes past bytesOut auth); // this can write up to 15 bytes longer than numbytes past bytesOut
memcpy((uint8_t *)(auth + 8), &extraNonceTmp, memcpy((uint8_t *)(auth + 8), &extraNonceTmp,
@@ -117,8 +117,8 @@ bool CryptoEngine::decryptCurve25519(uint32_t fromNode, meshtastic_UserLite_publ
crypto->hash(shared_key, 32); crypto->hash(shared_key, 32);
initNonce(fromNode, packetNum, extraNonce); initNonce(fromNode, packetNum, extraNonce);
printBytes("Attempt decrypt using nonce: ", nonce, 13); printBytes("Attempt decrypt with nonce: ", nonce, 13);
printBytes("Attempt decrypt using shared_key starting with: ", shared_key, 8); printBytes("Attempt decrypt with shared_key starting with: ", shared_key, 8);
return aes_ccm_ad(shared_key, 32, nonce, 8, bytes, numBytes - 12, nullptr, 0, auth, bytesOut); return aes_ccm_ad(shared_key, 32, nonce, 8, bytes, numBytes - 12, nullptr, 0, auth, bytesOut);
} }
+2 -2
View File
@@ -63,12 +63,12 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
} }
#endif #endif
LOG_INFO("Rebroadcasting received floodmsg"); LOG_INFO("Rebroadcast received floodmsg");
// Note: we are careful to resend using the original senders node id // Note: we are careful to resend using the original senders node id
// We are careful not to call our hooked version of send() - because we don't want to check this again // We are careful not to call our hooked version of send() - because we don't want to check this again
Router::send(tosend); Router::send(tosend);
} else { } else {
LOG_DEBUG("Not rebroadcasting: Role = CLIENT_MUTE or Rebroadcast Mode = NONE"); LOG_DEBUG("No rebroadcast: Role = CLIENT_MUTE or Rebroadcast Mode = NONE");
} }
} else { } else {
LOG_DEBUG("Ignore 0 id broadcast"); LOG_DEBUG("Ignore 0 id broadcast");
+1 -1
View File
@@ -151,7 +151,7 @@ void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src)
// If the requester didn't ask for a response we might need to discard unused replies to prevent memory leaks // If the requester didn't ask for a response we might need to discard unused replies to prevent memory leaks
if (pi.myReply) { if (pi.myReply) {
LOG_DEBUG("Discarding an unneeded response"); LOG_DEBUG("Discard an unneeded response");
packetPool.release(pi.myReply); packetPool.release(pi.myReply);
pi.myReply = NULL; pi.myReply = NULL;
} }
+7 -7
View File
@@ -167,7 +167,7 @@ NodeNum MeshService::getNodenumFromRequestId(uint32_t request_id)
void MeshService::handleToRadio(meshtastic_MeshPacket &p) void MeshService::handleToRadio(meshtastic_MeshPacket &p)
{ {
#if defined(ARCH_PORTDUINO) && !HAS_RADIO #if defined(ARCH_PORTDUINO) && !HAS_RADIO
// Simulates device is receiving a packet via the LoRa chip // Simulates device received a packet via the LoRa chip
if (p.decoded.portnum == meshtastic_PortNum_SIMULATOR_APP) { if (p.decoded.portnum == meshtastic_PortNum_SIMULATOR_APP) {
// Simulator packet (=Compressed packet) is encapsulated in a MeshPacket, so need to unwrap first // Simulator packet (=Compressed packet) is encapsulated in a MeshPacket, so need to unwrap first
meshtastic_Compressed scratch; meshtastic_Compressed scratch;
@@ -183,7 +183,7 @@ void MeshService::handleToRadio(meshtastic_MeshPacket &p)
// Switch the port from PortNum_SIMULATOR_APP back to the original PortNum // Switch the port from PortNum_SIMULATOR_APP back to the original PortNum
p.decoded.portnum = decoded->portnum; p.decoded.portnum = decoded->portnum;
} else } else
LOG_ERROR("Error decoding protobuf for simulator message!"); LOG_ERROR("Error decoding proto for simulator message!");
} }
// Let SimRadio receive as if it did via its LoRa chip // Let SimRadio receive as if it did via its LoRa chip
SimRadio::instance->startReceive(&p); SimRadio::instance->startReceive(&p);
@@ -225,7 +225,7 @@ ErrorCode MeshService::sendQueueStatusToPhone(const meshtastic_QueueStatus &qs,
copied->mesh_packet_id = mesh_packet_id; copied->mesh_packet_id = mesh_packet_id;
if (toPhoneQueueStatusQueue.numFree() == 0) { if (toPhoneQueueStatusQueue.numFree() == 0) {
LOG_INFO("tophone queue status queue is full, discarding oldest"); LOG_INFO("tophone queue status queue is full, discard oldest");
meshtastic_QueueStatus *d = toPhoneQueueStatusQueue.dequeuePtr(0); meshtastic_QueueStatus *d = toPhoneQueueStatusQueue.dequeuePtr(0);
if (d) if (d)
releaseQueueStatusToPool(d); releaseQueueStatusToPool(d);
@@ -306,12 +306,12 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p)
if (toPhoneQueue.numFree() == 0) { if (toPhoneQueue.numFree() == 0) {
if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP || if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP ||
p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP) { p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP) {
LOG_WARN("ToPhone queue is full, discarding oldest"); LOG_WARN("ToPhone queue is full, discard oldest");
meshtastic_MeshPacket *d = toPhoneQueue.dequeuePtr(0); meshtastic_MeshPacket *d = toPhoneQueue.dequeuePtr(0);
if (d) if (d)
releaseToPool(d); releaseToPool(d);
} else { } else {
LOG_WARN("ToPhone queue is full, dropping packet"); LOG_WARN("ToPhone queue is full, drop packet");
releaseToPool(p); releaseToPool(p);
fromNum++; // Make sure to notify observers in case they are reconnected so they can get the packets fromNum++; // Make sure to notify observers in case they are reconnected so they can get the packets
return; return;
@@ -326,7 +326,7 @@ void MeshService::sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage
{ {
LOG_DEBUG("Send mqtt message on topic '%s' to client for proxy", m->topic); LOG_DEBUG("Send mqtt message on topic '%s' to client for proxy", m->topic);
if (toPhoneMqttProxyQueue.numFree() == 0) { if (toPhoneMqttProxyQueue.numFree() == 0) {
LOG_WARN("MqttClientProxyMessagePool queue is full, discarding oldest"); LOG_WARN("MqttClientProxyMessagePool queue is full, discard oldest");
meshtastic_MqttClientProxyMessage *d = toPhoneMqttProxyQueue.dequeuePtr(0); meshtastic_MqttClientProxyMessage *d = toPhoneMqttProxyQueue.dequeuePtr(0);
if (d) if (d)
releaseMqttClientProxyMessageToPool(d); releaseMqttClientProxyMessageToPool(d);
@@ -340,7 +340,7 @@ void MeshService::sendClientNotification(meshtastic_ClientNotification *n)
{ {
LOG_DEBUG("Send client notification to phone"); LOG_DEBUG("Send client notification to phone");
if (toPhoneClientNotificationQueue.numFree() == 0) { if (toPhoneClientNotificationQueue.numFree() == 0) {
LOG_WARN("ClientNotification queue is full, discarding oldest"); LOG_WARN("ClientNotification queue is full, discard oldest");
meshtastic_ClientNotification *d = toPhoneClientNotificationQueue.dequeuePtr(0); meshtastic_ClientNotification *d = toPhoneClientNotificationQueue.dequeuePtr(0);
if (d) if (d)
releaseClientNotificationToPool(d); releaseClientNotificationToPool(d);
+14 -14
View File
@@ -219,7 +219,7 @@ NodeDB::NodeDB()
// If we are setup to broadcast on the default channel, ensure that the telemetry intervals are coerced to the minimum value // If we are setup to broadcast on the default channel, ensure that the telemetry intervals are coerced to the minimum value
// of 30 minutes or more // of 30 minutes or more
if (channels.isDefaultChannel(channels.getPrimaryIndex())) { if (channels.isDefaultChannel(channels.getPrimaryIndex())) {
LOG_DEBUG("Coercing telemetry to min of 30 minutes on defaults"); LOG_DEBUG("Coerce telemetry to min of 30 minutes on defaults");
moduleConfig.telemetry.device_update_interval = Default::getConfiguredOrMinimumValue( moduleConfig.telemetry.device_update_interval = Default::getConfiguredOrMinimumValue(
moduleConfig.telemetry.device_update_interval, min_default_telemetry_interval_secs); moduleConfig.telemetry.device_update_interval, min_default_telemetry_interval_secs);
moduleConfig.telemetry.environment_update_interval = Default::getConfiguredOrMinimumValue( moduleConfig.telemetry.environment_update_interval = Default::getConfiguredOrMinimumValue(
@@ -304,7 +304,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
bool NodeDB::factoryReset(bool eraseBleBonds) bool NodeDB::factoryReset(bool eraseBleBonds)
{ {
LOG_INFO("Performing factory reset!"); LOG_INFO("Perform factory reset!");
// first, remove the "/prefs" (this removes most prefs) // first, remove the "/prefs" (this removes most prefs)
rmDir("/prefs"); rmDir("/prefs");
#ifdef FSCom #ifdef FSCom
@@ -320,14 +320,14 @@ bool NodeDB::factoryReset(bool eraseBleBonds)
// third, write everything to disk // third, write everything to disk
saveToDisk(); saveToDisk();
if (eraseBleBonds) { if (eraseBleBonds) {
LOG_INFO("Erasing BLE bonds"); LOG_INFO("Erase BLE bonds");
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
// This will erase what's in NVS including ssl keys, persistent variables and ble pairing // This will erase what's in NVS including ssl keys, persistent variables and ble pairing
nvs_flash_erase(); nvs_flash_erase();
#endif #endif
#ifdef ARCH_NRF52 #ifdef ARCH_NRF52
Bluefruit.begin(); Bluefruit.begin();
LOG_INFO("Clearing bluetooth bonds!"); LOG_INFO("Clear bluetooth bonds!");
bond_print_list(BLE_GAP_ROLE_PERIPH); bond_print_list(BLE_GAP_ROLE_PERIPH);
bond_print_list(BLE_GAP_ROLE_CENTRAL); bond_print_list(BLE_GAP_ROLE_CENTRAL);
Bluefruit.Periph.clearBonds(); Bluefruit.Periph.clearBonds();
@@ -647,7 +647,7 @@ void NodeDB::removeNodeByNum(NodeNum nodeNum)
numMeshNodes -= removed; numMeshNodes -= removed;
std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + 1, std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + 1,
meshtastic_NodeInfoLite()); meshtastic_NodeInfoLite());
LOG_DEBUG("NodeDB::removeNodeByNum purged %d entries. Saving changes...", removed); LOG_DEBUG("NodeDB::removeNodeByNum purged %d entries. Save changes...", removed);
saveDeviceStateToDisk(); saveDeviceStateToDisk();
} }
@@ -803,7 +803,7 @@ void NodeDB::loadFromDisk()
// installDefaultDeviceState(); // Our in RAM copy might now be corrupt // installDefaultDeviceState(); // Our in RAM copy might now be corrupt
//} else { //} else {
if (devicestate.version < DEVICESTATE_MIN_VER) { if (devicestate.version < DEVICESTATE_MIN_VER) {
LOG_WARN("Devicestate %d is old, discarding", devicestate.version); LOG_WARN("Devicestate %d is old, discard", devicestate.version);
installDefaultDeviceState(); installDefaultDeviceState();
} else { } else {
LOG_INFO("Loaded saved devicestate version %d, with nodecount: %d", devicestate.version, devicestate.node_db_lite.size()); LOG_INFO("Loaded saved devicestate version %d, with nodecount: %d", devicestate.version, devicestate.node_db_lite.size());
@@ -818,7 +818,7 @@ void NodeDB::loadFromDisk()
installDefaultConfig(); // Our in RAM copy might now be corrupt installDefaultConfig(); // Our in RAM copy might now be corrupt
} else { } else {
if (config.version < DEVICESTATE_MIN_VER) { if (config.version < DEVICESTATE_MIN_VER) {
LOG_WARN("config %d is old, discarding", config.version); LOG_WARN("config %d is old, discard", config.version);
installDefaultConfig(true); installDefaultConfig(true);
} else { } else {
LOG_INFO("Loaded saved config version %d", config.version); LOG_INFO("Loaded saved config version %d", config.version);
@@ -831,7 +831,7 @@ void NodeDB::loadFromDisk()
installDefaultModuleConfig(); // Our in RAM copy might now be corrupt installDefaultModuleConfig(); // Our in RAM copy might now be corrupt
} else { } else {
if (moduleConfig.version < DEVICESTATE_MIN_VER) { if (moduleConfig.version < DEVICESTATE_MIN_VER) {
LOG_WARN("moduleConfig %d is old, discarding", moduleConfig.version); LOG_WARN("moduleConfig %d is old, discard", moduleConfig.version);
installDefaultModuleConfig(); installDefaultModuleConfig();
} else { } else {
LOG_INFO("Loaded saved moduleConfig version %d", moduleConfig.version); LOG_INFO("Loaded saved moduleConfig version %d", moduleConfig.version);
@@ -844,7 +844,7 @@ void NodeDB::loadFromDisk()
installDefaultChannels(); // Our in RAM copy might now be corrupt installDefaultChannels(); // Our in RAM copy might now be corrupt
} else { } else {
if (channelFile.version < DEVICESTATE_MIN_VER) { if (channelFile.version < DEVICESTATE_MIN_VER) {
LOG_WARN("channelFile %d is old, discarding", channelFile.version); LOG_WARN("channelFile %d is old, discard", channelFile.version);
installDefaultChannels(); installDefaultChannels();
} else { } else {
LOG_INFO("Loaded saved channelFile version %d", channelFile.version); LOG_INFO("Loaded saved channelFile version %d", channelFile.version);
@@ -883,7 +883,7 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
#ifdef FSCom #ifdef FSCom
auto f = SafeFile(filename, fullAtomic); auto f = SafeFile(filename, fullAtomic);
LOG_INFO("Saving %s", filename); LOG_INFO("Save %s", filename);
pb_ostream_t stream = {&writecb, static_cast<Print *>(&f), protoSize}; pb_ostream_t stream = {&writecb, static_cast<Print *>(&f), protoSize};
if (!pb_encode(&stream, fields, dest_struct)) { if (!pb_encode(&stream, fields, dest_struct)) {
@@ -1126,7 +1126,7 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
// we copy the key into the incoming packet, to prevent overwrite // we copy the key into the incoming packet, to prevent overwrite
memcpy(p.public_key.bytes, info->user.public_key.bytes, 32); memcpy(p.public_key.bytes, info->user.public_key.bytes, 32);
} else { } else {
LOG_INFO("Updating Node Pubkey!"); LOG_INFO("Update Node Pubkey!");
} }
} }
#endif #endif
@@ -1141,7 +1141,7 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
} }
if (nodeId != getNodeNum()) if (nodeId != getNodeNum())
info->channel = channelIndex; // Set channel we need to use to reach this node (but don't set our own channel) info->channel = channelIndex; // Set channel we need to use to reach this node (but don't set our own channel)
LOG_DEBUG("updating changed=%d user %s/%s, channel=%d", changed, info->user.long_name, info->user.short_name, info->channel); LOG_DEBUG("Update changed=%d user %s/%s, channel=%d", changed, info->user.long_name, info->user.short_name, info->channel);
info->has_user = true; info->has_user = true;
if (changed) { if (changed) {
@@ -1271,9 +1271,9 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
if (screen) if (screen)
screen->print(lcd.c_str()); screen->print(lcd.c_str());
if (filename) { if (filename) {
LOG_ERROR("NOTE! Recording critical error %d at %s:%lu", code, filename, address); LOG_ERROR("NOTE! Record critical error %d at %s:%lu", code, filename, address);
} else { } else {
LOG_ERROR("NOTE! Recording critical error %d, address=0x%lx", code, address); LOG_ERROR("NOTE! Record critical error %d, address=0x%lx", code, address);
} }
// Record error to DB // Record error to DB
+3 -3
View File
@@ -151,7 +151,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
break; break;
} }
} else { } else {
LOG_ERROR("Error: ignoring malformed toradio"); LOG_ERROR("Error: ignore malformed toradio");
} }
return false; return false;
@@ -603,14 +603,14 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] && if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] &&
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) { Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) {
LOG_WARN("Rate limiting portnum %d", p.decoded.portnum); LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "TraceRoute can only be sent once every 30 seconds"); sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "TraceRoute can only be sent once every 30 seconds");
meshtastic_QueueStatus qs = router->getQueueStatus(); meshtastic_QueueStatus qs = router->getQueueStatus();
service->sendQueueStatusToPhone(qs, 0, p.id); service->sendQueueStatusToPhone(qs, 0, p.id);
return false; return false;
} else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] && } else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) { Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
LOG_WARN("Rate limiting portnum %d", p.decoded.portnum); LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
meshtastic_QueueStatus qs = router->getQueueStatus(); meshtastic_QueueStatus qs = router->getQueueStatus();
service->sendQueueStatusToPhone(qs, 0, p.id); service->sendQueueStatusToPhone(qs, 0, p.id);
// FIXME: Figure out why this continues to happen // FIXME: Figure out why this continues to happen
+2 -2
View File
@@ -91,7 +91,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) { if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) {
decoded = &scratch; decoded = &scratch;
} else { } else {
LOG_ERROR("Error decoding protobuf module!"); LOG_ERROR("Error decoding proto module!");
// if we can't decode it, nobody can process it! // if we can't decode it, nobody can process it!
return ProcessMessage::STOP; return ProcessMessage::STOP;
} }
@@ -112,7 +112,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) { if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) {
decoded = &scratch; decoded = &scratch;
} else { } else {
LOG_ERROR("Error decoding protobuf module!"); LOG_ERROR("Error decoding proto module!");
// if we can't decode it, nobody can process it! // if we can't decode it, nobody can process it!
return; return;
} }
+1 -1
View File
@@ -494,7 +494,7 @@ void RadioInterface::applyModemConfig()
} }
if ((myRegion->freqEnd - myRegion->freqStart) < bw / 1000) { if ((myRegion->freqEnd - myRegion->freqStart) < bw / 1000) {
static const char *err_string = "Regional frequency range is smaller than bandwidth. Falling back to default preset"; static const char *err_string = "Regional frequency range is smaller than bandwidth. Fall back to default preset";
LOG_ERROR(err_string); LOG_ERROR(err_string);
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
+1 -1
View File
@@ -193,7 +193,7 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
// Sometimes when testing it is useful to be able to never turn on the xmitter // Sometimes when testing it is useful to be able to never turn on the xmitter
#ifndef LORA_DISABLE_SENDING #ifndef LORA_DISABLE_SENDING
printPacket("enqueuing for send", p); printPacket("enqueue for send", p);
LOG_DEBUG("txGood=%d,txRelay=%d,rxGood=%d,rxBad=%d", txGood, txRelay, rxGood, rxBad); LOG_DEBUG("txGood=%d,txRelay=%d,rxGood=%d,rxBad=%d", txGood, txRelay, rxGood, rxBad);
ErrorCode res = txQueue.enqueue(p) ? ERRNO_OK : ERRNO_UNKNOWN; ErrorCode res = txQueue.enqueue(p) ? ERRNO_OK : ERRNO_UNKNOWN;
+2 -2
View File
@@ -53,7 +53,7 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
auto key = GlobalPacketId(getFrom(p), p->id); auto key = GlobalPacketId(getFrom(p), p->id);
auto old = findPendingPacket(key); auto old = findPendingPacket(key);
if (old) { if (old) {
LOG_DEBUG("Generating implicit ack"); LOG_DEBUG("Generate implicit ack");
// NOTE: we do NOT check p->wantAck here because p is the INCOMING rebroadcast and that packet is not expected to be // NOTE: we do NOT check p->wantAck here because p is the INCOMING rebroadcast and that packet is not expected to be
// marked as wantAck // marked as wantAck
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, old->packet->channel); sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, old->packet->channel);
@@ -221,7 +221,7 @@ int32_t ReliableRouter::doRetransmissions()
// FIXME, handle 51 day rollover here!!! // FIXME, handle 51 day rollover here!!!
if (p.nextTxMsec <= now) { if (p.nextTxMsec <= now) {
if (p.numRetransmissions == 0) { if (p.numRetransmissions == 0) {
LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to, LOG_DEBUG("Reliable send failed, return a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to,
p.packet->id); p.packet->id);
sendAckNak(meshtastic_Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel); sendAckNak(meshtastic_Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel);
// Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived // Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived
+3 -3
View File
@@ -71,7 +71,7 @@ int32_t Router::runOnce()
perhapsHandleReceived(mp); perhapsHandleReceived(mp);
} }
// LOG_DEBUG("sleeping forever!"); // LOG_DEBUG("Sleep forever!");
return INT32_MAX; // Wait a long time - until we get woken for the message queue return INT32_MAX; // Wait a long time - until we get woken for the message queue
} }
@@ -143,7 +143,7 @@ void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFro
void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p) void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p)
{ {
LOG_ERROR("Error=%d, returning NAK and dropping packet", err); LOG_ERROR("Error=%d, return NAK and drop packet", err);
sendAckNak(err, getFrom(p), p->id, p->channel); sendAckNak(err, getFrom(p), p->id, p->channel);
packetPool.release(p); packetPool.release(p);
} }
@@ -588,7 +588,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
p->decoded.portnum == meshtastic_PortNum_NEIGHBORINFO_APP && p->decoded.portnum == meshtastic_PortNum_NEIGHBORINFO_APP &&
(!moduleConfig.has_neighbor_info || !moduleConfig.neighbor_info.enabled)) { (!moduleConfig.has_neighbor_info || !moduleConfig.neighbor_info.enabled)) {
LOG_DEBUG("Neighbor info module is disabled, ignoring neighbor packet"); LOG_DEBUG("Neighbor info module is disabled, ignore neighbor packet");
cancelSending(p->from, p->id); cancelSending(p->from, p->id);
skipHandle = true; skipHandle = true;
} }
+1 -1
View File
@@ -80,7 +80,7 @@ template <typename T> bool SX128xInterface<T>::init()
#elif defined(ARCH_NRF52) #elif defined(ARCH_NRF52)
NVIC_SystemReset(); NVIC_SystemReset();
#else #else
LOG_ERROR("FIXME implement reboot for this platform. Skipping for now."); LOG_ERROR("FIXME implement reboot for this platform. Skip for now.");
#endif #endif
} }
+3 -3
View File
@@ -30,7 +30,7 @@ template <class T> int32_t ServerAPI<T>::runOnce()
if (client.connected()) { if (client.connected()) {
return StreamAPI::runOncePart(); return StreamAPI::runOncePart();
} else { } else {
LOG_INFO("Client dropped connection, suspending API service"); LOG_INFO("Client dropped connection, suspend API service");
enabled = false; // we no longer need to run enabled = false; // we no longer need to run
return 0; return 0;
} }
@@ -63,11 +63,11 @@ template <class T, class U> int32_t APIServerPort<T, U>::runOnce()
// Reconnections are delayed by full wait time // Reconnections are delayed by full wait time
if (waitTime < 400) { if (waitTime < 400) {
waitTime *= 2; waitTime *= 2;
LOG_INFO("Previous TCP connection still open, trying again in %dms", waitTime); LOG_INFO("Previous TCP connection still open, try again in %dms", waitTime);
return waitTime; return waitTime;
} }
#endif #endif
LOG_INFO("Force closing previous TCP connection"); LOG_INFO("Force close previous TCP connection");
delete openAPI; delete openAPI;
} }
+1 -1
View File
@@ -11,7 +11,7 @@ void initApiServer(int port)
// Start API server on port 4403 // Start API server on port 4403
if (!apiPort) { if (!apiPort) {
apiPort = new WiFiServerPort(port); apiPort = new WiFiServerPort(port);
LOG_INFO("API server listening on TCP port %d", port); LOG_INFO("API server listen on TCP port %d", port);
apiPort->init(); apiPort->init();
} }
} }
+2 -2
View File
@@ -82,9 +82,9 @@ static int32_t reconnectETH()
#ifndef DISABLE_NTP #ifndef DISABLE_NTP
if (isEthernetAvailable() && (ntp_renew < millis())) { if (isEthernetAvailable() && (ntp_renew < millis())) {
LOG_INFO("Updating NTP time from %s", config.network.ntp_server); LOG_INFO("Update NTP time from %s", config.network.ntp_server);
if (timeClient.update()) { if (timeClient.update()) {
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed"); LOG_DEBUG("NTP Request Success - Set RTCQualityNTP if needed");
struct timeval tv; struct timeval tv;
tv.tv_sec = timeClient.getEpochTime(); tv.tv_sec = timeClient.getEpochTime();
+5 -5
View File
@@ -449,7 +449,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
void handleFormUpload(HTTPRequest *req, HTTPResponse *res) void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
{ {
LOG_DEBUG("Form Upload - Disabling keep-alive"); LOG_DEBUG("Form Upload - Disable keep-alive");
res->setHeader("Connection", "close"); res->setHeader("Connection", "close");
// First, we need to check the encoding of the form that we have received. // First, we need to check the encoding of the form that we have received.
@@ -508,14 +508,14 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
// Double check that it is what we expect // Double check that it is what we expect
if (name != "file") { if (name != "file") {
LOG_DEBUG("Skipping unexpected field"); LOG_DEBUG("Skip unexpected field");
res->println("<p>No file found.</p>"); res->println("<p>No file found.</p>");
return; return;
} }
// Double check that it is what we expect // Double check that it is what we expect
if (filename == "") { if (filename == "") {
LOG_DEBUG("Skipping unexpected field"); LOG_DEBUG("Skip unexpected field");
res->println("<p>No file found.</p>"); res->println("<p>No file found.</p>");
return; return;
} }
@@ -700,9 +700,9 @@ void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res)
res->setHeader("Access-Control-Allow-Methods", "GET"); res->setHeader("Access-Control-Allow-Methods", "GET");
res->println("<h1>Meshtastic</h1>"); res->println("<h1>Meshtastic</h1>");
res->println("Deleting Content in /static/*"); res->println("Delete Content in /static/*");
LOG_INFO("Deleting files from /static/* : "); LOG_INFO("Delete files from /static/* : ");
htmlDeleteDir("/static"); htmlDeleteDir("/static");
+1 -1
View File
@@ -69,7 +69,7 @@ static void taskCreateCert(void *parameter)
#if 0 #if 0
// Delete the saved certs (used in debugging) // Delete the saved certs (used in debugging)
LOG_DEBUG("Deleting any saved SSL keys"); LOG_DEBUG("Delete any saved SSL keys");
// prefs.clear(); // prefs.clear();
prefs.remove("PK"); prefs.remove("PK");
prefs.remove("cert"); prefs.remove("cert");
+8 -8
View File
@@ -144,7 +144,7 @@ static int32_t reconnectWiFi()
#ifndef DISABLE_NTP #ifndef DISABLE_NTP
if (WiFi.isConnected() && (!Throttle::isWithinTimespanMs(lastrun_ntp, 43200000) || (lastrun_ntp == 0))) { // every 12 hours if (WiFi.isConnected() && (!Throttle::isWithinTimespanMs(lastrun_ntp, 43200000) || (lastrun_ntp == 0))) { // every 12 hours
LOG_DEBUG("Updating NTP time from %s", config.network.ntp_server); LOG_DEBUG("Update NTP time from %s", config.network.ntp_server);
if (timeClient.update()) { if (timeClient.update()) {
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed"); LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed");
@@ -396,25 +396,25 @@ static void WiFiEvent(WiFiEvent_t event)
LOG_INFO("SmartConfig: Send ACK done"); LOG_INFO("SmartConfig: Send ACK done");
break; break;
case ARDUINO_EVENT_PROV_INIT: case ARDUINO_EVENT_PROV_INIT:
LOG_INFO("Provisioning: Init"); LOG_INFO("Provision Init");
break; break;
case ARDUINO_EVENT_PROV_DEINIT: case ARDUINO_EVENT_PROV_DEINIT:
LOG_INFO("Provisioning: Stopped"); LOG_INFO("Provision Stopped");
break; break;
case ARDUINO_EVENT_PROV_START: case ARDUINO_EVENT_PROV_START:
LOG_INFO("Provisioning: Started"); LOG_INFO("Provision Started");
break; break;
case ARDUINO_EVENT_PROV_END: case ARDUINO_EVENT_PROV_END:
LOG_INFO("Provisioning: End"); LOG_INFO("Provision End");
break; break;
case ARDUINO_EVENT_PROV_CRED_RECV: case ARDUINO_EVENT_PROV_CRED_RECV:
LOG_INFO("Provisioning: Credentials received"); LOG_INFO("Provision Credentials received");
break; break;
case ARDUINO_EVENT_PROV_CRED_FAIL: case ARDUINO_EVENT_PROV_CRED_FAIL:
LOG_INFO("Provisioning: Credentials failed"); LOG_INFO("Provision Credentials failed");
break; break;
case ARDUINO_EVENT_PROV_CRED_SUCCESS: case ARDUINO_EVENT_PROV_CRED_SUCCESS:
LOG_INFO("Provisioning: Credentials success"); LOG_INFO("Provision Credentials success");
break; break;
default: default:
break; break;
+55 -55
View File
@@ -74,7 +74,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
// Could tighten this up further by tracking the last public_key we went an AdminMessage request to // Could tighten this up further by tracking the last public_key we went an AdminMessage request to
// and only allowing responses from that remote. // and only allowing responses from that remote.
if (messageIsResponse(r)) { if (messageIsResponse(r)) {
LOG_DEBUG("Allowing admin response message"); LOG_DEBUG("Allow admin response message");
} else if (mp.from == 0) { } else if (mp.from == 0) {
if (config.security.is_managed) { if (config.security.is_managed) {
LOG_INFO("Ignore local admin payload because is_managed"); LOG_INFO("Ignore local admin payload because is_managed");
@@ -82,7 +82,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
} }
} else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) { } else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) {
if (!config.security.admin_channel_enabled) { if (!config.security.admin_channel_enabled) {
LOG_INFO("Ignore admin channel, as legacy admin is disabled"); LOG_INFO("Ignore admin channel, legacy admin is disabled");
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp); myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
return handled; return handled;
} }
@@ -105,7 +105,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
return handled; return handled;
} }
LOG_INFO("Handling admin payload %i", r->which_payload_variant); LOG_INFO("Handle admin payload %i", r->which_payload_variant);
// all of the get and set messages, including those for other modules, flow through here first. // all of the get and set messages, including those for other modules, flow through here first.
// any message that changes state, we want to check the passkey for // any message that changes state, we want to check the passkey for
@@ -122,23 +122,23 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
* Getters * Getters
*/ */
case meshtastic_AdminMessage_get_owner_request_tag: case meshtastic_AdminMessage_get_owner_request_tag:
LOG_INFO("Client is getting owner"); LOG_INFO("Client got owner");
handleGetOwner(mp); handleGetOwner(mp);
break; break;
case meshtastic_AdminMessage_get_config_request_tag: case meshtastic_AdminMessage_get_config_request_tag:
LOG_INFO("Client is getting config"); LOG_INFO("Client got config");
handleGetConfig(mp, r->get_config_request); handleGetConfig(mp, r->get_config_request);
break; break;
case meshtastic_AdminMessage_get_module_config_request_tag: case meshtastic_AdminMessage_get_module_config_request_tag:
LOG_INFO("Client is getting module config"); LOG_INFO("Client got module config");
handleGetModuleConfig(mp, r->get_module_config_request); handleGetModuleConfig(mp, r->get_module_config_request);
break; break;
case meshtastic_AdminMessage_get_channel_request_tag: { case meshtastic_AdminMessage_get_channel_request_tag: {
uint32_t i = r->get_channel_request - 1; uint32_t i = r->get_channel_request - 1;
LOG_INFO("Client is getting channel %u", i); LOG_INFO("Client got channel %u", i);
if (i >= MAX_NUM_CHANNELS) if (i >= MAX_NUM_CHANNELS)
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
else else
@@ -150,29 +150,29 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
* Setters * Setters
*/ */
case meshtastic_AdminMessage_set_owner_tag: case meshtastic_AdminMessage_set_owner_tag:
LOG_INFO("Client is setting owner"); LOG_INFO("Client set owner");
handleSetOwner(r->set_owner); handleSetOwner(r->set_owner);
break; break;
case meshtastic_AdminMessage_set_config_tag: case meshtastic_AdminMessage_set_config_tag:
LOG_INFO("Client is setting the config"); LOG_INFO("Client set config");
handleSetConfig(r->set_config); handleSetConfig(r->set_config);
break; break;
case meshtastic_AdminMessage_set_module_config_tag: case meshtastic_AdminMessage_set_module_config_tag:
LOG_INFO("Client is setting the module config"); LOG_INFO("Client set module config");
handleSetModuleConfig(r->set_module_config); handleSetModuleConfig(r->set_module_config);
break; break;
case meshtastic_AdminMessage_set_channel_tag: case meshtastic_AdminMessage_set_channel_tag:
LOG_INFO("Client is setting channel %d", r->set_channel.index); LOG_INFO("Client set channel %d", r->set_channel.index);
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS) if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
else else
handleSetChannel(r->set_channel); handleSetChannel(r->set_channel);
break; break;
case meshtastic_AdminMessage_set_ham_mode_tag: case meshtastic_AdminMessage_set_ham_mode_tag:
LOG_INFO("Client is setting ham mode"); LOG_INFO("Client set ham mode");
handleSetHamMode(r->set_ham_mode); handleSetHamMode(r->set_ham_mode);
break; break;
@@ -208,13 +208,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_get_device_metadata_request_tag: { case meshtastic_AdminMessage_get_device_metadata_request_tag: {
LOG_INFO("Client is getting device metadata"); LOG_INFO("Client got device metadata");
handleGetDeviceMetadata(mp); handleGetDeviceMetadata(mp);
break; break;
} }
case meshtastic_AdminMessage_factory_reset_config_tag: { case meshtastic_AdminMessage_factory_reset_config_tag: {
disableBluetooth(); disableBluetooth();
LOG_INFO("Initiating factory config reset"); LOG_INFO("Initiate factory config reset");
nodeDB->factoryReset(); nodeDB->factoryReset();
LOG_INFO("Factory config reset finished, rebooting soon"); LOG_INFO("Factory config reset finished, rebooting soon");
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
@@ -222,37 +222,37 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
} }
case meshtastic_AdminMessage_factory_reset_device_tag: { case meshtastic_AdminMessage_factory_reset_device_tag: {
disableBluetooth(); disableBluetooth();
LOG_INFO("Initiating full factory reset"); LOG_INFO("Initiate full factory reset");
nodeDB->factoryReset(true); nodeDB->factoryReset(true);
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
break; break;
} }
case meshtastic_AdminMessage_nodedb_reset_tag: { case meshtastic_AdminMessage_nodedb_reset_tag: {
disableBluetooth(); disableBluetooth();
LOG_INFO("Initiating node-db reset"); LOG_INFO("Initiate node-db reset");
nodeDB->resetNodes(); nodeDB->resetNodes();
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
break; break;
} }
case meshtastic_AdminMessage_begin_edit_settings_tag: { case meshtastic_AdminMessage_begin_edit_settings_tag: {
LOG_INFO("Beginning transaction for editing settings"); LOG_INFO("Begin transaction for editing settings");
hasOpenEditTransaction = true; hasOpenEditTransaction = true;
break; break;
} }
case meshtastic_AdminMessage_commit_edit_settings_tag: { case meshtastic_AdminMessage_commit_edit_settings_tag: {
disableBluetooth(); disableBluetooth();
LOG_INFO("Committing transaction for edited settings"); LOG_INFO("Commit transaction for edited settings");
hasOpenEditTransaction = false; hasOpenEditTransaction = false;
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
break; break;
} }
case meshtastic_AdminMessage_get_device_connection_status_request_tag: { case meshtastic_AdminMessage_get_device_connection_status_request_tag: {
LOG_INFO("Client is getting device connection status"); LOG_INFO("Client got device connection status");
handleGetDeviceConnectionStatus(mp); handleGetDeviceConnectionStatus(mp);
break; break;
} }
case meshtastic_AdminMessage_get_module_config_response_tag: { case meshtastic_AdminMessage_get_module_config_response_tag: {
LOG_INFO("Client is receiving a get_module_config response"); LOG_INFO("Client received a get_module_config response");
if (fromOthers && r->get_module_config_response.which_payload_variant == if (fromOthers && r->get_module_config_response.which_payload_variant ==
meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) { meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) {
handleGetModuleConfigResponse(mp, r); handleGetModuleConfigResponse(mp, r);
@@ -260,13 +260,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_remove_by_nodenum_tag: { case meshtastic_AdminMessage_remove_by_nodenum_tag: {
LOG_INFO("Client is receiving a remove_nodenum command"); LOG_INFO("Client received remove_nodenum command");
nodeDB->removeNodeByNum(r->remove_by_nodenum); nodeDB->removeNodeByNum(r->remove_by_nodenum);
this->notifyObservers(r); // Observed by screen this->notifyObservers(r); // Observed by screen
break; break;
} }
case meshtastic_AdminMessage_set_favorite_node_tag: { case meshtastic_AdminMessage_set_favorite_node_tag: {
LOG_INFO("Client is receiving a set_favorite_node command"); LOG_INFO("Client received set_favorite_node command");
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
if (node != NULL) { if (node != NULL) {
node->is_favorite = true; node->is_favorite = true;
@@ -275,7 +275,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_remove_favorite_node_tag: { case meshtastic_AdminMessage_remove_favorite_node_tag: {
LOG_INFO("Client is receiving a remove_favorite_node command"); LOG_INFO("Client received remove_favorite_node command");
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
if (node != NULL) { if (node != NULL) {
node->is_favorite = false; node->is_favorite = false;
@@ -284,7 +284,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_set_fixed_position_tag: { case meshtastic_AdminMessage_set_fixed_position_tag: {
LOG_INFO("Client is receiving a set_fixed_position command"); LOG_INFO("Client received set_fixed_position command");
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
node->has_position = true; node->has_position = true;
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position); node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
@@ -300,14 +300,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_remove_fixed_position_tag: { case meshtastic_AdminMessage_remove_fixed_position_tag: {
LOG_INFO("Client is receiving a remove_fixed_position command"); LOG_INFO("Client received remove_fixed_position command");
nodeDB->clearLocalPosition(); nodeDB->clearLocalPosition();
config.position.fixed_position = false; config.position.fixed_position = false;
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false); saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
break; break;
} }
case meshtastic_AdminMessage_set_time_only_tag: { case meshtastic_AdminMessage_set_time_only_tag: {
LOG_INFO("Client is receiving a set_time_only command"); LOG_INFO("Client received set_time_only command");
struct timeval tv; struct timeval tv;
tv.tv_sec = r->set_time_only; tv.tv_sec = r->set_time_only;
tv.tv_usec = 0; tv.tv_usec = 0;
@@ -316,14 +316,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_enter_dfu_mode_request_tag: { case meshtastic_AdminMessage_enter_dfu_mode_request_tag: {
LOG_INFO("Client is requesting to enter DFU mode"); LOG_INFO("Client requesting to enter DFU mode");
#if defined(ARCH_NRF52) || defined(ARCH_RP2040) #if defined(ARCH_NRF52) || defined(ARCH_RP2040)
enterDfuMode(); enterDfuMode();
#endif #endif
break; break;
} }
case meshtastic_AdminMessage_delete_file_request_tag: { case meshtastic_AdminMessage_delete_file_request_tag: {
LOG_DEBUG("Client is requesting to delete file: %s", r->delete_file_request); LOG_DEBUG("Client requesting to delete file: %s", r->delete_file_request);
#ifdef FSCom #ifdef FSCom
if (FSCom.remove(r->delete_file_request)) { if (FSCom.remove(r->delete_file_request)) {
LOG_DEBUG("Successfully deleted file"); LOG_DEBUG("Successfully deleted file");
@@ -348,10 +348,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
setPassKey(&res); setPassKey(&res);
myReply = allocDataProtobuf(res); myReply = allocDataProtobuf(res);
} else if (mp.decoded.want_response) { } else if (mp.decoded.want_response) {
LOG_DEBUG("We did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant); LOG_DEBUG("Did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant);
} else if (handleResult != AdminMessageHandleResult::HANDLED) { } else if (handleResult != AdminMessageHandleResult::HANDLED) {
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages // Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
LOG_INFO("Ignore nonrelevant admin %d", r->which_payload_variant); LOG_INFO("Ignore irrelevant admin %d", r->which_payload_variant);
} }
break; break;
} }
@@ -369,7 +369,7 @@ void AdminModule::handleGetModuleConfigResponse(const meshtastic_MeshPacket &mp,
// Skip if it's disabled or no pins are exposed // Skip if it's disabled or no pins are exposed
if (!r->get_module_config_response.payload_variant.remote_hardware.enabled || if (!r->get_module_config_response.payload_variant.remote_hardware.enabled ||
r->get_module_config_response.payload_variant.remote_hardware.available_pins_count == 0) { r->get_module_config_response.payload_variant.remote_hardware.available_pins_count == 0) {
LOG_DEBUG("Remote hardware module disabled or no available_pins. Skipping..."); LOG_DEBUG("Remote hardware module disabled or no available_pins. Skip...");
return; return;
} }
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) { for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {
@@ -711,49 +711,49 @@ void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32
if (req.decoded.want_response) { if (req.decoded.want_response) {
switch (configType) { switch (configType) {
case meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG: case meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG:
LOG_INFO("Getting config: Device"); LOG_INFO("Get config: Device");
res.get_config_response.which_payload_variant = meshtastic_Config_device_tag; res.get_config_response.which_payload_variant = meshtastic_Config_device_tag;
res.get_config_response.payload_variant.device = config.device; res.get_config_response.payload_variant.device = config.device;
break; break;
case meshtastic_AdminMessage_ConfigType_POSITION_CONFIG: case meshtastic_AdminMessage_ConfigType_POSITION_CONFIG:
LOG_INFO("Getting config: Position"); LOG_INFO("Get config: Position");
res.get_config_response.which_payload_variant = meshtastic_Config_position_tag; res.get_config_response.which_payload_variant = meshtastic_Config_position_tag;
res.get_config_response.payload_variant.position = config.position; res.get_config_response.payload_variant.position = config.position;
break; break;
case meshtastic_AdminMessage_ConfigType_POWER_CONFIG: case meshtastic_AdminMessage_ConfigType_POWER_CONFIG:
LOG_INFO("Getting config: Power"); LOG_INFO("Get config: Power");
res.get_config_response.which_payload_variant = meshtastic_Config_power_tag; res.get_config_response.which_payload_variant = meshtastic_Config_power_tag;
res.get_config_response.payload_variant.power = config.power; res.get_config_response.payload_variant.power = config.power;
break; break;
case meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG: case meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG:
LOG_INFO("Getting config: Network"); LOG_INFO("Get config: Network");
res.get_config_response.which_payload_variant = meshtastic_Config_network_tag; res.get_config_response.which_payload_variant = meshtastic_Config_network_tag;
res.get_config_response.payload_variant.network = config.network; res.get_config_response.payload_variant.network = config.network;
writeSecret(res.get_config_response.payload_variant.network.wifi_psk, writeSecret(res.get_config_response.payload_variant.network.wifi_psk,
sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk); sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
break; break;
case meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG: case meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG:
LOG_INFO("Getting config: Display"); LOG_INFO("Get config: Display");
res.get_config_response.which_payload_variant = meshtastic_Config_display_tag; res.get_config_response.which_payload_variant = meshtastic_Config_display_tag;
res.get_config_response.payload_variant.display = config.display; res.get_config_response.payload_variant.display = config.display;
break; break;
case meshtastic_AdminMessage_ConfigType_LORA_CONFIG: case meshtastic_AdminMessage_ConfigType_LORA_CONFIG:
LOG_INFO("Getting config: LoRa"); LOG_INFO("Get config: LoRa");
res.get_config_response.which_payload_variant = meshtastic_Config_lora_tag; res.get_config_response.which_payload_variant = meshtastic_Config_lora_tag;
res.get_config_response.payload_variant.lora = config.lora; res.get_config_response.payload_variant.lora = config.lora;
break; break;
case meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG: case meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG:
LOG_INFO("Getting config: Bluetooth"); LOG_INFO("Get config: Bluetooth");
res.get_config_response.which_payload_variant = meshtastic_Config_bluetooth_tag; res.get_config_response.which_payload_variant = meshtastic_Config_bluetooth_tag;
res.get_config_response.payload_variant.bluetooth = config.bluetooth; res.get_config_response.payload_variant.bluetooth = config.bluetooth;
break; break;
case meshtastic_AdminMessage_ConfigType_SECURITY_CONFIG: case meshtastic_AdminMessage_ConfigType_SECURITY_CONFIG:
LOG_INFO("Getting config: Security"); LOG_INFO("Get config: Security");
res.get_config_response.which_payload_variant = meshtastic_Config_security_tag; res.get_config_response.which_payload_variant = meshtastic_Config_security_tag;
res.get_config_response.payload_variant.security = config.security; res.get_config_response.payload_variant.security = config.security;
break; break;
case meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG: case meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG:
LOG_INFO("Getting config: Sessionkey"); LOG_INFO("Get config: Sessionkey");
res.get_config_response.which_payload_variant = meshtastic_Config_sessionkey_tag; res.get_config_response.which_payload_variant = meshtastic_Config_sessionkey_tag;
break; break;
} }
@@ -777,67 +777,67 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
if (req.decoded.want_response) { if (req.decoded.want_response) {
switch (configType) { switch (configType) {
case meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG:
LOG_INFO("Getting module config: MQTT"); LOG_INFO("Get module config: MQTT");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag;
res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt; res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG:
LOG_INFO("Getting module config: Serial"); LOG_INFO("Get module config: Serial");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_serial_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_serial_tag;
res.get_module_config_response.payload_variant.serial = moduleConfig.serial; res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
LOG_INFO("Getting module config: External Notification"); LOG_INFO("Get module config: External Notification");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification; res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
LOG_INFO("Getting module config: Store & Forward"); LOG_INFO("Get module config: Store & Forward");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward; res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
LOG_INFO("Getting module config: Range Test"); LOG_INFO("Get module config: Range Test");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test; res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
LOG_INFO("Getting module config: Telemetry"); LOG_INFO("Get module config: Telemetry");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry; res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
LOG_INFO("Getting module config: Canned Message"); LOG_INFO("Get module config: Canned Message");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag;
res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message; res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG:
LOG_INFO("Getting module config: Audio"); LOG_INFO("Get module config: Audio");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
res.get_module_config_response.payload_variant.audio = moduleConfig.audio; res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
LOG_INFO("Getting module config: Remote Hardware"); LOG_INFO("Get module config: Remote Hardware");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag;
res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware; res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_NEIGHBORINFO_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_NEIGHBORINFO_CONFIG:
LOG_INFO("Getting module config: Neighbor Info"); LOG_INFO("Get module config: Neighbor Info");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_neighbor_info_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_neighbor_info_tag;
res.get_module_config_response.payload_variant.neighbor_info = moduleConfig.neighbor_info; res.get_module_config_response.payload_variant.neighbor_info = moduleConfig.neighbor_info;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG:
LOG_INFO("Getting module config: Detection Sensor"); LOG_INFO("Get module config: Detection Sensor");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_detection_sensor_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_detection_sensor_tag;
res.get_module_config_response.payload_variant.detection_sensor = moduleConfig.detection_sensor; res.get_module_config_response.payload_variant.detection_sensor = moduleConfig.detection_sensor;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_AMBIENTLIGHTING_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_AMBIENTLIGHTING_CONFIG:
LOG_INFO("Getting module config: Ambient Lighting"); LOG_INFO("Get module config: Ambient Lighting");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag;
res.get_module_config_response.payload_variant.ambient_lighting = moduleConfig.ambient_lighting; res.get_module_config_response.payload_variant.ambient_lighting = moduleConfig.ambient_lighting;
break; break;
case meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG: case meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG:
LOG_INFO("Getting module config: Paxcounter"); LOG_INFO("Get module config: Paxcounter");
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag; res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
res.get_module_config_response.payload_variant.paxcounter = moduleConfig.paxcounter; res.get_module_config_response.payload_variant.paxcounter = moduleConfig.paxcounter;
break; break;
@@ -978,10 +978,10 @@ void AdminModule::reboot(int32_t seconds)
void AdminModule::saveChanges(int saveWhat, bool shouldReboot) void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
{ {
if (!hasOpenEditTransaction) { if (!hasOpenEditTransaction) {
LOG_INFO("Saving changes to disk"); LOG_INFO("Save changes to disk");
service->reloadConfig(saveWhat); // Calls saveToDisk among other things service->reloadConfig(saveWhat); // Calls saveToDisk among other things
} else { } else {
LOG_INFO("Delaying save of changes to disk until the open transaction is committed"); LOG_INFO("Delay save of changes to disk until the open transaction is committed");
} }
if (shouldReboot && !hasOpenEditTransaction) { if (shouldReboot && !hasOpenEditTransaction) {
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
+1 -1
View File
@@ -126,7 +126,7 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
} else { } else {
if (!t->is_compressed) { if (!t->is_compressed) {
// Not compressed. Something is wrong // Not compressed. Something is wrong
LOG_WARN("Received uncompressed TAKPacket over radio! Skipping"); LOG_WARN("Received uncompressed TAKPacket over radio! Skip");
return; return;
} }
+5 -5
View File
@@ -227,12 +227,12 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
case INPUT_BROKER_MSG_BRIGHTNESS_UP: // make screen brighter case INPUT_BROKER_MSG_BRIGHTNESS_UP: // make screen brighter
if (screen) if (screen)
screen->increaseBrightness(); screen->increaseBrightness();
LOG_DEBUG("increasing Screen Brightness"); LOG_DEBUG("Increase Screen Brightness");
break; break;
case INPUT_BROKER_MSG_BRIGHTNESS_DOWN: // make screen dimmer case INPUT_BROKER_MSG_BRIGHTNESS_DOWN: // make screen dimmer
if (screen) if (screen)
screen->decreaseBrightness(); screen->decreaseBrightness();
LOG_DEBUG("Decreasing Screen Brightness"); LOG_DEBUG("Decrease Screen Brightness");
break; break;
case INPUT_BROKER_MSG_FN_SYMBOL_ON: // draw modifier (function) symbal case INPUT_BROKER_MSG_FN_SYMBOL_ON: // draw modifier (function) symbal
if (screen) if (screen)
@@ -977,7 +977,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st
if (temporaryMessage.length() != 0) { if (temporaryMessage.length() != 0) {
requestFocus(); // Tell Screen::setFrames to move to our module's frame requestFocus(); // Tell Screen::setFrames to move to our module's frame
LOG_DEBUG("Drawing temporary message: %s", temporaryMessage.c_str()); LOG_DEBUG("Draw temporary message: %s", temporaryMessage.c_str());
display->setTextAlignment(TEXT_ALIGN_CENTER); display->setTextAlignment(TEXT_ALIGN_CENTER);
display->setFont(FONT_MEDIUM); display->setFont(FONT_MEDIUM);
display->drawString(display->getWidth() / 2 + x, 0 + y + 12, temporaryMessage); display->drawString(display->getWidth() / 2 + x, 0 + y + 12, temporaryMessage);
@@ -1206,13 +1206,13 @@ AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const
switch (request->which_payload_variant) { switch (request->which_payload_variant) {
case meshtastic_AdminMessage_get_canned_message_module_messages_request_tag: case meshtastic_AdminMessage_get_canned_message_module_messages_request_tag:
LOG_DEBUG("Client is getting radio canned messages"); LOG_DEBUG("Client getting radio canned messages");
this->handleGetCannedMessageModuleMessages(mp, response); this->handleGetCannedMessageModuleMessages(mp, response);
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE; result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
break; break;
case meshtastic_AdminMessage_set_canned_message_module_messages_tag: case meshtastic_AdminMessage_set_canned_message_module_messages_tag:
LOG_DEBUG("Client is setting radio canned messages"); LOG_DEBUG("Client getting radio canned messages");
this->handleSetCannedMessageModuleMessages(request->set_canned_message_module_messages); this->handleSetCannedMessageModuleMessages(request->set_canned_message_module_messages);
result = AdminMessageHandleResult::HANDLED; result = AdminMessageHandleResult::HANDLED;
break; break;
+2 -2
View File
@@ -76,7 +76,7 @@ int32_t DetectionSensorModule::runOnce()
if (moduleConfig.detection_sensor.monitor_pin > 0) { if (moduleConfig.detection_sensor.monitor_pin > 0) {
pinMode(moduleConfig.detection_sensor.monitor_pin, moduleConfig.detection_sensor.use_pullup ? INPUT_PULLUP : INPUT); pinMode(moduleConfig.detection_sensor.monitor_pin, moduleConfig.detection_sensor.use_pullup ? INPUT_PULLUP : INPUT);
} else { } else {
LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disabling module..."); LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disable module...");
return disable(); return disable();
} }
LOG_INFO("Detection Sensor Module: init"); LOG_INFO("Detection Sensor Module: init");
@@ -118,7 +118,7 @@ int32_t DetectionSensorModule::runOnce()
void DetectionSensorModule::sendDetectionMessage() void DetectionSensorModule::sendDetectionMessage()
{ {
LOG_DEBUG("Detected event observed. Sending message"); LOG_DEBUG("Detected event observed. Send message");
char *message = new char[40]; char *message = new char[40];
sprintf(message, "%s detected", moduleConfig.detection_sensor.name); sprintf(message, "%s detected", moduleConfig.detection_sensor.name);
meshtastic_MeshPacket *p = allocDataPacket(); meshtastic_MeshPacket *p = allocDataPacket();
+2 -2
View File
@@ -518,13 +518,13 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
switch (request->which_payload_variant) { switch (request->which_payload_variant) {
case meshtastic_AdminMessage_get_ringtone_request_tag: case meshtastic_AdminMessage_get_ringtone_request_tag:
LOG_INFO("Client is getting ringtone"); LOG_INFO("Client getting ringtone");
this->handleGetRingtone(mp, response); this->handleGetRingtone(mp, response);
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE; result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
break; break;
case meshtastic_AdminMessage_set_ringtone_message_tag: case meshtastic_AdminMessage_set_ringtone_message_tag:
LOG_INFO("Client is setting ringtone"); LOG_INFO("Client setting ringtone");
this->handleSetRingtone(request->set_canned_message_module_messages); this->handleSetRingtone(request->set_canned_message_module_messages);
result = AdminMessageHandleResult::HANDLED; result = AdminMessageHandleResult::HANDLED;
break; break;
+2 -2
View File
@@ -91,7 +91,7 @@ void NeighborInfoModule::cleanUpNeighbors()
// We will remove a neighbor if we haven't heard from them in twice the broadcast interval // We will remove a neighbor if we haven't heard from them in twice the broadcast interval
// cannot use isWithinTimespanMs() as it->last_rx_time is seconds since 1970 // cannot use isWithinTimespanMs() as it->last_rx_time is seconds since 1970
if ((now - it->last_rx_time > it->node_broadcast_interval_secs * 2) && (it->node_id != my_node_id)) { if ((now - it->last_rx_time > it->node_broadcast_interval_secs * 2) && (it->node_id != my_node_id)) {
LOG_DEBUG("Removing neighbor with node ID 0x%x", it->node_id); LOG_DEBUG("Remove neighbor with node ID 0x%x", it->node_id);
it = std::vector<meshtastic_Neighbor>::reverse_iterator( it = std::vector<meshtastic_Neighbor>::reverse_iterator(
neighbors.erase(std::next(it).base())); // Erase the element and update the iterator neighbors.erase(std::next(it).base())); // Erase the element and update the iterator
} else { } else {
@@ -203,7 +203,7 @@ meshtastic_Neighbor *NeighborInfoModule::getOrCreateNeighbor(NodeNum originalSen
neighbors.push_back(new_nbr); neighbors.push_back(new_nbr);
} else { } else {
// If we have too many neighbors, replace the oldest one // If we have too many neighbors, replace the oldest one
LOG_WARN("Neighbor DB is full, replacing oldest neighbor"); LOG_WARN("Neighbor DB is full, replace oldest neighbor");
neighbors.erase(neighbors.begin()); neighbors.erase(neighbors.begin());
neighbors.push_back(new_nbr); neighbors.push_back(new_nbr);
} }
+3 -3
View File
@@ -65,16 +65,16 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply()
{ {
if (!airTime->isTxAllowedChannelUtil(false)) { if (!airTime->isTxAllowedChannelUtil(false)) {
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
LOG_DEBUG("Skip sending NodeInfo > 40%% ch. util"); LOG_DEBUG("Skip send NodeInfo > 40%% ch. util");
return NULL; return NULL;
} }
// If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway. // If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway.
if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) { if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) {
LOG_DEBUG("Skip sending NodeInfo since we sent it <5 mins ago."); LOG_DEBUG("Skip send NodeInfo since we sent it <5 mins ago.");
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
return NULL; return NULL;
} else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) { } else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) {
LOG_DEBUG("Skip sending requested NodeInfo since we sent it <60s ago."); LOG_DEBUG("Skip send requested NodeInfo since we sent it <60s ago.");
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
return NULL; return NULL;
} else { } else {
+10 -10
View File
@@ -38,7 +38,7 @@ PositionModule::PositionModule()
if ((config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER || if ((config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER ||
config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) && config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
config.power.is_power_saving) { config.power.is_power_saving) {
LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz"); LOG_DEBUG("Clear position on startup for sleepy tracker (ー。ー) zzz");
nodeDB->clearLocalPosition(); nodeDB->clearLocalPosition();
} }
} }
@@ -110,7 +110,7 @@ void PositionModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic
{ {
// Phone position packets need to be truncated to the channel precision // Phone position packets need to be truncated to the channel precision
if (isFromUs(&mp) && (precision < 32 && precision > 0)) { if (isFromUs(&mp) && (precision < 32 && precision > 0)) {
LOG_DEBUG("Truncating phone position to channel precision %i", precision); LOG_DEBUG("Truncate phone position to channel precision %i", precision);
p->latitude_i = p->latitude_i & (UINT32_MAX << (32 - precision)); p->latitude_i = p->latitude_i & (UINT32_MAX << (32 - precision));
p->longitude_i = p->longitude_i & (UINT32_MAX << (32 - precision)); p->longitude_i = p->longitude_i & (UINT32_MAX << (32 - precision));
@@ -157,7 +157,7 @@ bool PositionModule::hasQualityTimesource()
meshtastic_MeshPacket *PositionModule::allocReply() meshtastic_MeshPacket *PositionModule::allocReply()
{ {
if (precision == 0) { if (precision == 0) {
LOG_DEBUG("Skipping location send because precision is set to 0!"); LOG_DEBUG("Skip location send because precision is set to 0!");
return nullptr; return nullptr;
} }
@@ -177,7 +177,7 @@ meshtastic_MeshPacket *PositionModule::allocReply()
localPosition.seq_number++; localPosition.seq_number++;
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) { if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) {
LOG_WARN("Skipping position send because lat/lon are zero!"); LOG_WARN("Skip position send because lat/lon are zero!");
return nullptr; return nullptr;
} }
@@ -249,11 +249,11 @@ meshtastic_MeshPacket *PositionModule::allocReply()
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices // nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices
// without can get time. // without can get time.
if (getRTCQuality() < RTCQualityNTP) { if (getRTCQuality() < RTCQualityNTP) {
LOG_INFO("Stripping time %u from position send", p.time); LOG_INFO("Strip time %u from position send", p.time);
p.time = 0; p.time = 0;
} else { } else {
p.time = getValidTime(RTCQualityNTP); p.time = getValidTime(RTCQualityNTP);
LOG_INFO("Providing time to mesh %u", p.time); LOG_INFO("Provide time to mesh %u", p.time);
} }
LOG_INFO("Position reply: time=%i lat=%i lon=%i", p.time, p.latitude_i, p.longitude_i); LOG_INFO("Position reply: time=%i lat=%i lon=%i", p.time, p.latitude_i, p.longitude_i);
@@ -350,7 +350,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER, if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) && meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
config.power.is_power_saving) { config.power.is_power_saving) {
LOG_DEBUG("Start next execution in 5s, then going to sleep"); LOG_DEBUG("Start next execution in 5s, then sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }
@@ -363,7 +363,7 @@ int32_t PositionModule::runOnce()
if (sleepOnNextExecution == true) { if (sleepOnNextExecution == true) {
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs); uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs);
LOG_DEBUG("Sleeping for %ims, then awaking to send position again", nightyNightMs); LOG_DEBUG("Sleep for %ims, then awaking to send position again", nightyNightMs);
doDeepSleep(nightyNightMs, false); doDeepSleep(nightyNightMs, false);
} }
@@ -406,7 +406,7 @@ int32_t PositionModule::runOnce()
if (smartPosition.hasTraveledOverThreshold && if (smartPosition.hasTraveledOverThreshold &&
Throttle::execute( Throttle::execute(
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); }, &lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling"); })) { []() { LOG_DEBUG("Skip send smart broadcast due to time throttling"); })) {
LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, " LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, "
"minTimeInterval=%ims)", "minTimeInterval=%ims)",
@@ -464,7 +464,7 @@ void PositionModule::handleNewPosition()
if (smartPosition.hasTraveledOverThreshold && if (smartPosition.hasTraveledOverThreshold &&
Throttle::execute( Throttle::execute(
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); }, &lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling"); })) { []() { LOG_DEBUG("Skip send smart broadcast due to time throttling"); })) {
LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, " LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, "
"minTimeInterval=%ims)", "minTimeInterval=%ims)",
localPosition.timestamp, smartPosition.distanceTraveled, smartPosition.distanceThreshold, msSinceLastSend, localPosition.timestamp, smartPosition.distanceTraveled, smartPosition.distanceThreshold, msSinceLastSend,
+1 -1
View File
@@ -81,7 +81,7 @@ int32_t RangeTestModule::runOnce()
// If we have been running for more than 8 hours, turn module back off // If we have been running for more than 8 hours, turn module back off
if (!Throttle::isWithinTimespanMs(started, 28800000)) { if (!Throttle::isWithinTimespanMs(started, 28800000)) {
LOG_INFO("Range Test Module - Disabling after 8 hours"); LOG_INFO("Range Test Module - Disable after 8 hours");
return disable(); return disable();
} else { } else {
return (senderHeartbeat); return (senderHeartbeat);
+1 -1
View File
@@ -149,7 +149,7 @@ int32_t RemoteHardwareModule::runOnce()
if (curVal != previousWatch) { if (curVal != previousWatch) {
previousWatch = curVal; previousWatch = curVal;
LOG_INFO("Broadcasting GPIOS 0x%llx changed!", curVal); LOG_INFO("Broadcast GPIOS 0x%llx changed!", curVal);
// Something changed! Tell the world with a broadcast message // Something changed! Tell the world with a broadcast message
meshtastic_HardwareMessage r = meshtastic_HardwareMessage_init_default; meshtastic_HardwareMessage r = meshtastic_HardwareMessage_init_default;
+4 -4
View File
@@ -105,7 +105,7 @@ void StoreForwardModule::historySend(uint32_t secAgo, uint32_t to)
queueSize = this->historyReturnMax; queueSize = this->historyReturnMax;
if (queueSize) { if (queueSize) {
LOG_INFO("S&F - Sending %u message(s)", queueSize); LOG_INFO("S&F - Send %u message(s)", queueSize);
this->busy = true; // runOnce() will pickup the next steps once busy = true. this->busy = true; // runOnce() will pickup the next steps once busy = true.
this->busyTo = to; this->busyTo = to;
} else { } else {
@@ -403,7 +403,7 @@ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &m
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_StoreAndForward_msg, &scratch)) { if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_StoreAndForward_msg, &scratch)) {
decoded = &scratch; decoded = &scratch;
} else { } else {
LOG_ERROR("Error decoding protobuf module!"); LOG_ERROR("Error decoding proto module!");
// if we can't decode it, nobody can process it! // if we can't decode it, nobody can process it!
return ProcessMessage::STOP; return ProcessMessage::STOP;
} }
@@ -602,10 +602,10 @@ StoreForwardModule::StoreForwardModule()
is_server = true; is_server = true;
} else { } else {
LOG_INFO("."); LOG_INFO(".");
LOG_INFO("S&F: not enough PSRAM free, disabling"); LOG_INFO("S&F: not enough PSRAM free, Disable");
} }
} else { } else {
LOG_INFO("S&F: device doesn't have PSRAM, disabling"); LOG_INFO("S&F: device doesn't have PSRAM, Disable");
} }
// Client // Client
@@ -36,7 +36,7 @@ int32_t AirQualityTelemetryModule::runOnce()
LOG_INFO("Air quality Telemetry: init"); LOG_INFO("Air quality Telemetry: init");
if (!aqi.begin_I2C()) { if (!aqi.begin_I2C()) {
#ifndef I2C_NO_RESCAN #ifndef I2C_NO_RESCAN
LOG_WARN("Could not establish i2c connection to AQI sensor. Rescanning..."); LOG_WARN("Could not establish i2c connection to AQI sensor. Rescan");
// rescan for late arriving sensors. AQI Module starts about 10 seconds into the boot so this is plenty. // rescan for late arriving sensors. AQI Module starts about 10 seconds into the boot so this is plenty.
uint8_t i2caddr_scan[] = {PMSA0031_ADDR}; uint8_t i2caddr_scan[] = {PMSA0031_ADDR};
uint8_t i2caddr_asize = 1; uint8_t i2caddr_asize = 1;
@@ -107,7 +107,7 @@ bool AirQualityTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPack
bool AirQualityTelemetryModule::getAirQualityTelemetry(meshtastic_Telemetry *m) bool AirQualityTelemetryModule::getAirQualityTelemetry(meshtastic_Telemetry *m)
{ {
if (!aqi.read(&data)) { if (!aqi.read(&data)) {
LOG_WARN("Skipping send measurements. Could not read AQIn"); LOG_WARN("Skip send measurements. Could not read AQIn");
return false; return false;
} }
@@ -121,9 +121,8 @@ bool AirQualityTelemetryModule::getAirQualityTelemetry(meshtastic_Telemetry *m)
m->variant.air_quality_metrics.pm25_environmental = data.pm25_env; m->variant.air_quality_metrics.pm25_environmental = data.pm25_env;
m->variant.air_quality_metrics.pm100_environmental = data.pm100_env; m->variant.air_quality_metrics.pm100_environmental = data.pm100_env;
LOG_INFO("(Sending): PM1.0(Standard)=%i, PM2.5(Standard)=%i, PM10.0(Standard)=%i", LOG_INFO("Send: PM1.0(Standard)=%i, PM2.5(Standard)=%i, PM10.0(Standard)=%i", m->variant.air_quality_metrics.pm10_standard,
m->variant.air_quality_metrics.pm10_standard, m->variant.air_quality_metrics.pm25_standard, m->variant.air_quality_metrics.pm25_standard, m->variant.air_quality_metrics.pm100_standard);
m->variant.air_quality_metrics.pm100_standard);
LOG_INFO(" | PM1.0(Environmental)=%i, PM2.5(Environmental)=%i, PM10.0(Environmental)=%i", LOG_INFO(" | PM1.0(Environmental)=%i, PM2.5(Environmental)=%i, PM10.0(Environmental)=%i",
m->variant.air_quality_metrics.pm10_environmental, m->variant.air_quality_metrics.pm25_environmental, m->variant.air_quality_metrics.pm10_environmental, m->variant.air_quality_metrics.pm25_environmental,
@@ -150,7 +149,7 @@ meshtastic_MeshPacket *AirQualityTelemetryModule::allocReply()
if (decoded->which_variant == meshtastic_Telemetry_air_quality_metrics_tag) { if (decoded->which_variant == meshtastic_Telemetry_air_quality_metrics_tag) {
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero; meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
if (getAirQualityTelemetry(&m)) { if (getAirQualityTelemetry(&m)) {
LOG_INFO("Air quality telemetry replying to request"); LOG_INFO("Air quality telemetry reply to request");
return allocDataProtobuf(m); return allocDataProtobuf(m);
} else { } else {
return NULL; return NULL;
+3 -3
View File
@@ -76,7 +76,7 @@ meshtastic_MeshPacket *DeviceTelemetryModule::allocReply()
} }
// Check for a request for device metrics // Check for a request for device metrics
if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) { if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) {
LOG_INFO("Device telemetry replying to request"); LOG_INFO("Device telemetry reply to request");
meshtastic_Telemetry telemetry = getDeviceTelemetry(); meshtastic_Telemetry telemetry = getDeviceTelemetry();
return allocDataProtobuf(telemetry); return allocDataProtobuf(telemetry);
@@ -134,7 +134,7 @@ void DeviceTelemetryModule::sendLocalStatsToPhone()
telemetry.variant.local_stats.num_tx_relay_canceled = router->txRelayCanceled; telemetry.variant.local_stats.num_tx_relay_canceled = router->txRelayCanceled;
} }
LOG_INFO("(Sending local stats): uptime=%i, channel_utilization=%f, air_util_tx=%f, num_online_nodes=%i, num_total_nodes=%i", LOG_INFO("Sending local stats: uptime=%i, channel_utilization=%f, air_util_tx=%f, num_online_nodes=%i, num_total_nodes=%i",
telemetry.variant.local_stats.uptime_seconds, telemetry.variant.local_stats.channel_utilization, telemetry.variant.local_stats.uptime_seconds, telemetry.variant.local_stats.channel_utilization,
telemetry.variant.local_stats.air_util_tx, telemetry.variant.local_stats.num_online_nodes, telemetry.variant.local_stats.air_util_tx, telemetry.variant.local_stats.num_online_nodes,
telemetry.variant.local_stats.num_total_nodes); telemetry.variant.local_stats.num_total_nodes);
@@ -153,7 +153,7 @@ void DeviceTelemetryModule::sendLocalStatsToPhone()
bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
{ {
meshtastic_Telemetry telemetry = getDeviceTelemetry(); meshtastic_Telemetry telemetry = getDeviceTelemetry();
LOG_INFO("(Sending): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f, uptime=%i", LOG_INFO("Send: air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f, uptime=%i",
telemetry.variant.device_metrics.air_util_tx, telemetry.variant.device_metrics.channel_utilization, telemetry.variant.device_metrics.air_util_tx, telemetry.variant.device_metrics.channel_utilization,
telemetry.variant.device_metrics.battery_level, telemetry.variant.device_metrics.voltage, telemetry.variant.device_metrics.battery_level, telemetry.variant.device_metrics.voltage,
telemetry.variant.device_metrics.uptime_seconds); telemetry.variant.device_metrics.uptime_seconds);
@@ -73,7 +73,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval, uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval,
default_telemetry_broadcast_interval_secs); default_telemetry_broadcast_interval_secs);
LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs); LOG_DEBUG("Sleep for %ims, then awake to send metrics again", nightyNightMs);
doDeepSleep(nightyNightMs, true); doDeepSleep(nightyNightMs, true);
} }
@@ -411,7 +411,7 @@ meshtastic_MeshPacket *EnvironmentTelemetryModule::allocReply()
if (decoded->which_variant == meshtastic_Telemetry_environment_metrics_tag) { if (decoded->which_variant == meshtastic_Telemetry_environment_metrics_tag) {
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero; meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
if (getEnvironmentTelemetry(&m)) { if (getEnvironmentTelemetry(&m)) {
LOG_INFO("Environment telemetry replying to request"); LOG_INFO("Environment telemetry reply to request");
return allocDataProtobuf(m); return allocDataProtobuf(m);
} else { } else {
return NULL; return NULL;
@@ -431,14 +431,14 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
#else #else
if (getEnvironmentTelemetry(&m)) { if (getEnvironmentTelemetry(&m)) {
#endif #endif
LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f", LOG_INFO("Send: barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f",
m.variant.environment_metrics.barometric_pressure, m.variant.environment_metrics.current, m.variant.environment_metrics.barometric_pressure, m.variant.environment_metrics.current,
m.variant.environment_metrics.gas_resistance, m.variant.environment_metrics.relative_humidity, m.variant.environment_metrics.gas_resistance, m.variant.environment_metrics.relative_humidity,
m.variant.environment_metrics.temperature); m.variant.environment_metrics.temperature);
LOG_INFO("(Sending): voltage=%f, IAQ=%d, distance=%f, lux=%f", m.variant.environment_metrics.voltage, LOG_INFO("Send: voltage=%f, IAQ=%d, distance=%f, lux=%f", m.variant.environment_metrics.voltage,
m.variant.environment_metrics.iaq, m.variant.environment_metrics.distance, m.variant.environment_metrics.lux); m.variant.environment_metrics.iaq, m.variant.environment_metrics.distance, m.variant.environment_metrics.lux);
LOG_INFO("(Sending): wind speed=%fm/s, direction=%d degrees, weight=%fkg", m.variant.environment_metrics.wind_speed, LOG_INFO("Send: wind speed=%fm/s, direction=%d degrees, weight=%fkg", m.variant.environment_metrics.wind_speed,
m.variant.environment_metrics.wind_direction, m.variant.environment_metrics.weight); m.variant.environment_metrics.wind_direction, m.variant.environment_metrics.weight);
sensor_read_error_count = 0; sensor_read_error_count = 0;
@@ -463,7 +463,7 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
service->sendToMesh(p, RX_SRC_LOCAL, true); service->sendToMesh(p, RX_SRC_LOCAL, true);
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
LOG_DEBUG("Start next execution in 5s, then going to sleep"); LOG_DEBUG("Start next execution in 5s, then sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }
+4 -4
View File
@@ -39,7 +39,7 @@ int32_t HealthTelemetryModule::runOnce()
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.health_update_interval, uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.health_update_interval,
default_telemetry_broadcast_interval_secs); default_telemetry_broadcast_interval_secs);
LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs); LOG_DEBUG("Sleep for %ims, then awake to send metrics again", nightyNightMs);
doDeepSleep(nightyNightMs, true); doDeepSleep(nightyNightMs, true);
} }
@@ -195,7 +195,7 @@ meshtastic_MeshPacket *HealthTelemetryModule::allocReply()
if (decoded->which_variant == meshtastic_Telemetry_health_metrics_tag) { if (decoded->which_variant == meshtastic_Telemetry_health_metrics_tag) {
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero; meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
if (getHealthTelemetry(&m)) { if (getHealthTelemetry(&m)) {
LOG_INFO("Health telemetry replying to request"); LOG_INFO("Health telemetry reply to request");
return allocDataProtobuf(m); return allocDataProtobuf(m);
} else { } else {
return NULL; return NULL;
@@ -211,7 +211,7 @@ bool HealthTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
m.which_variant = meshtastic_Telemetry_health_metrics_tag; m.which_variant = meshtastic_Telemetry_health_metrics_tag;
m.time = getTime(); m.time = getTime();
if (getHealthTelemetry(&m)) { if (getHealthTelemetry(&m)) {
LOG_INFO("(Sending): temperature=%f, heart_bpm=%d, spO2=%d", m.variant.health_metrics.temperature, LOG_INFO("Send: temperature=%f, heart_bpm=%d, spO2=%d", m.variant.health_metrics.temperature,
m.variant.health_metrics.heart_bpm, m.variant.health_metrics.spO2); m.variant.health_metrics.heart_bpm, m.variant.health_metrics.spO2);
sensor_read_error_count = 0; sensor_read_error_count = 0;
@@ -236,7 +236,7 @@ bool HealthTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
service->sendToMesh(p, RX_SRC_LOCAL, true); service->sendToMesh(p, RX_SRC_LOCAL, true);
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
LOG_DEBUG("Start next execution in 5s, then going to sleep"); LOG_DEBUG("Start next execution in 5s, then sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }
+4 -4
View File
@@ -27,7 +27,7 @@ int32_t PowerTelemetryModule::runOnce()
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.power_update_interval, uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.power_update_interval,
default_telemetry_broadcast_interval_secs); default_telemetry_broadcast_interval_secs);
LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs); LOG_DEBUG("Sleep for %ims, then awake to send metrics again", nightyNightMs);
doDeepSleep(nightyNightMs, true); doDeepSleep(nightyNightMs, true);
} }
@@ -199,7 +199,7 @@ meshtastic_MeshPacket *PowerTelemetryModule::allocReply()
if (decoded->which_variant == meshtastic_Telemetry_power_metrics_tag) { if (decoded->which_variant == meshtastic_Telemetry_power_metrics_tag) {
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero; meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
if (getPowerTelemetry(&m)) { if (getPowerTelemetry(&m)) {
LOG_INFO("Power telemetry replying to request"); LOG_INFO("Power telemetry reply to request");
return allocDataProtobuf(m); return allocDataProtobuf(m);
} else { } else {
return NULL; return NULL;
@@ -216,7 +216,7 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
m.which_variant = meshtastic_Telemetry_power_metrics_tag; m.which_variant = meshtastic_Telemetry_power_metrics_tag;
m.time = getTime(); m.time = getTime();
if (getPowerTelemetry(&m)) { if (getPowerTelemetry(&m)) {
LOG_INFO("(Sending): ch1_voltage=%f, ch1_current=%f, ch2_voltage=%f, ch2_current=%f, " LOG_INFO("Send: ch1_voltage=%f, ch1_current=%f, ch2_voltage=%f, ch2_current=%f, "
"ch3_voltage=%f, ch3_current=%f", "ch3_voltage=%f, ch3_current=%f",
m.variant.power_metrics.ch1_voltage, m.variant.power_metrics.ch1_current, m.variant.power_metrics.ch2_voltage, m.variant.power_metrics.ch1_voltage, m.variant.power_metrics.ch1_current, m.variant.power_metrics.ch2_voltage,
m.variant.power_metrics.ch2_current, m.variant.power_metrics.ch3_voltage, m.variant.power_metrics.ch3_current); m.variant.power_metrics.ch2_current, m.variant.power_metrics.ch3_voltage, m.variant.power_metrics.ch3_current);
@@ -243,7 +243,7 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
service->sendToMesh(p, RX_SRC_LOCAL, true); service->sendToMesh(p, RX_SRC_LOCAL, true);
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
LOG_DEBUG("Start next execution in 5s then going to sleep"); LOG_DEBUG("Start next execution in 5s then sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }
+1 -1
View File
@@ -27,7 +27,7 @@ void AHT10Sensor::setup() {}
bool AHT10Sensor::getMetrics(meshtastic_Telemetry *measurement) bool AHT10Sensor::getMetrics(meshtastic_Telemetry *measurement)
{ {
LOG_DEBUG("AHT10Sensor::getMetrics"); LOG_DEBUG("AHT10 getMetrics");
sensors_event_t humidity, temp; sensors_event_t humidity, temp;
aht10.getEvent(&humidity, &temp); aht10.getEvent(&humidity, &temp);
@@ -35,7 +35,7 @@ bool BME280Sensor::getMetrics(meshtastic_Telemetry *measurement)
measurement->variant.environment_metrics.has_relative_humidity = true; measurement->variant.environment_metrics.has_relative_humidity = true;
measurement->variant.environment_metrics.has_barometric_pressure = true; measurement->variant.environment_metrics.has_barometric_pressure = true;
LOG_DEBUG("BME280Sensor::getMetrics"); LOG_DEBUG("BME280 getMetrics");
bme280.takeForcedMeasurement(); bme280.takeForcedMeasurement();
measurement->variant.environment_metrics.temperature = bme280.readTemperature(); measurement->variant.environment_metrics.temperature = bme280.readTemperature();
measurement->variant.environment_metrics.relative_humidity = bme280.readHumidity(); measurement->variant.environment_metrics.relative_humidity = bme280.readHumidity();
@@ -29,7 +29,7 @@ bool BMP085Sensor::getMetrics(meshtastic_Telemetry *measurement)
measurement->variant.environment_metrics.has_temperature = true; measurement->variant.environment_metrics.has_temperature = true;
measurement->variant.environment_metrics.has_barometric_pressure = true; measurement->variant.environment_metrics.has_barometric_pressure = true;
LOG_DEBUG("BMP085Sensor::getMetrics"); LOG_DEBUG("BMP085 getMetrics");
measurement->variant.environment_metrics.temperature = bmp085.readTemperature(); measurement->variant.environment_metrics.temperature = bmp085.readTemperature();
measurement->variant.environment_metrics.barometric_pressure = bmp085.readPressure() / 100.0F; measurement->variant.environment_metrics.barometric_pressure = bmp085.readPressure() / 100.0F;
@@ -34,7 +34,7 @@ bool BMP280Sensor::getMetrics(meshtastic_Telemetry *measurement)
measurement->variant.environment_metrics.has_temperature = true; measurement->variant.environment_metrics.has_temperature = true;
measurement->variant.environment_metrics.has_barometric_pressure = true; measurement->variant.environment_metrics.has_barometric_pressure = true;
LOG_DEBUG("BMP280Sensor::getMetrics"); LOG_DEBUG("BMP280 getMetrics");
bmp280.takeForcedMeasurement(); bmp280.takeForcedMeasurement();
measurement->variant.environment_metrics.temperature = bmp280.readTemperature(); measurement->variant.environment_metrics.temperature = bmp280.readTemperature();
measurement->variant.environment_metrics.barometric_pressure = bmp280.readPressure() / 100.0F; measurement->variant.environment_metrics.barometric_pressure = bmp280.readPressure() / 100.0F;
@@ -50,11 +50,11 @@ bool BMP3XXSensor::getMetrics(meshtastic_Telemetry *measurement)
measurement->variant.environment_metrics.barometric_pressure = static_cast<float>(bmp3xx->pressure) / 100.0F; measurement->variant.environment_metrics.barometric_pressure = static_cast<float>(bmp3xx->pressure) / 100.0F;
measurement->variant.environment_metrics.relative_humidity = 0.0f; measurement->variant.environment_metrics.relative_humidity = 0.0f;
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i temp: %.1f press %.1f", measurement->which_variant, LOG_DEBUG("BMP3XX getMetrics id: %i temp: %.1f press %.1f", measurement->which_variant,
measurement->variant.environment_metrics.temperature, measurement->variant.environment_metrics.temperature,
measurement->variant.environment_metrics.barometric_pressure); measurement->variant.environment_metrics.barometric_pressure);
} else { } else {
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i", measurement->which_variant); LOG_DEBUG("BMP3XX getMetrics id: %i", measurement->which_variant);
} }
return true; return true;
} }
@@ -27,7 +27,7 @@ bool MAX17048Singleton::isBatteryCharging()
{ {
float volts = cellVoltage(); float volts = cellVoltage();
if (isnan(volts)) { if (isnan(volts)) {
LOG_DEBUG("%s::isBatteryCharging is not connected", sensorStr); LOG_DEBUG("%s::isBatteryCharging not connected", sensorStr);
return 0; return 0;
} }
@@ -140,11 +140,11 @@ void MAX17048Sensor::setup() {}
bool MAX17048Sensor::getMetrics(meshtastic_Telemetry *measurement) bool MAX17048Sensor::getMetrics(meshtastic_Telemetry *measurement)
{ {
LOG_DEBUG("MAX17048Sensor::getMetrics id: %i", measurement->which_variant); LOG_DEBUG("MAX17048 getMetrics id: %i", measurement->which_variant);
float volts = max17048->cellVoltage(); float volts = max17048->cellVoltage();
if (isnan(volts)) { if (isnan(volts)) {
LOG_DEBUG("MAX17048Sensor::getMetrics battery is not connected"); LOG_DEBUG("MAX17048 getMetrics battery is not connected");
return false; return false;
} }
@@ -153,7 +153,7 @@ bool MAX17048Sensor::getMetrics(meshtastic_Telemetry *measurement)
soc = clamp(soc, 0.0f, 100.0f); // clamp soc between 0 and 100% soc = clamp(soc, 0.0f, 100.0f); // clamp soc between 0 and 100%
float ttg = (100.0f - soc) / rate; // calculate hours to charge/discharge float ttg = (100.0f - soc) / rate; // calculate hours to charge/discharge
LOG_DEBUG("MAX17048Sensor::getMetrics volts: %.3fV soc: %.1f%% ttg: %.1f hours", volts, soc, ttg); LOG_DEBUG("MAX17048 getMetrics volts: %.3fV soc: %.1f%% ttg: %.1f hours", volts, soc, ttg);
if ((int)measurement->which_variant == meshtastic_Telemetry_power_metrics_tag) { if ((int)measurement->which_variant == meshtastic_Telemetry_power_metrics_tag) {
measurement->variant.power_metrics.has_ch1_voltage = true; measurement->variant.power_metrics.has_ch1_voltage = true;
measurement->variant.power_metrics.ch1_voltage = volts; measurement->variant.power_metrics.ch1_voltage = volts;
@@ -28,7 +28,7 @@ bool MCP9808Sensor::getMetrics(meshtastic_Telemetry *measurement)
{ {
measurement->variant.environment_metrics.has_temperature = true; measurement->variant.environment_metrics.has_temperature = true;
LOG_DEBUG("MCP9808Sensor::getMetrics"); LOG_DEBUG("MCP9808 getMetrics");
measurement->variant.environment_metrics.temperature = mcp9808.readTempC(); measurement->variant.environment_metrics.temperature = mcp9808.readTempC();
return true; return true;
} }
@@ -35,7 +35,7 @@ void NAU7802Sensor::setup() {}
bool NAU7802Sensor::getMetrics(meshtastic_Telemetry *measurement) bool NAU7802Sensor::getMetrics(meshtastic_Telemetry *measurement)
{ {
LOG_DEBUG("NAU7802Sensor::getMetrics"); LOG_DEBUG("NAU7802 getMetrics");
nau7802.powerUp(); nau7802.powerUp();
// Wait for the sensor to become ready for one second max // Wait for the sensor to become ready for one second max
uint32_t start = millis(); uint32_t start = millis();
@@ -24,7 +24,7 @@ void RCWL9620Sensor::setup() {}
bool RCWL9620Sensor::getMetrics(meshtastic_Telemetry *measurement) bool RCWL9620Sensor::getMetrics(meshtastic_Telemetry *measurement)
{ {
measurement->variant.environment_metrics.has_distance = true; measurement->variant.environment_metrics.has_distance = true;
LOG_DEBUG("RCWL9620Sensor::getMetrics"); LOG_DEBUG("RCWL9620 getMetrics");
measurement->variant.environment_metrics.distance = getDistance(); measurement->variant.environment_metrics.distance = getDistance();
return true; return true;
} }
@@ -31,7 +31,7 @@ class TelemetrySensor
int32_t initI2CSensor() int32_t initI2CSensor()
{ {
if (!status) { if (!status) {
LOG_WARN("Could not connect to detected %s sensor. Removing from nodeTelemetrySensorsMap.", sensorName); LOG_WARN("Could not connect to detected %s sensor. Remove from nodeTelemetrySensorsMap.", sensorName);
nodeTelemetrySensorsMap[sensorType].first = 0; nodeTelemetrySensorsMap[sensorType].first = 0;
} else { } else {
LOG_INFO("Opened %s sensor on i2c bus", sensorName); LOG_INFO("Opened %s sensor on i2c bus", sensorName);
+1 -1
View File
@@ -39,7 +39,7 @@ bool PaxcounterModule::sendInfo(NodeNum dest)
if (paxcounterModule->reportedDataSent) if (paxcounterModule->reportedDataSent)
return false; return false;
LOG_INFO("PaxcounterModule: sending pax info wifi=%d; ble=%d; uptime=%lu", count_from_libpax.wifi_count, LOG_INFO("PaxcounterModule: send pax info wifi=%d; ble=%d; uptime=%lu", count_from_libpax.wifi_count,
count_from_libpax.ble_count, millis() / 1000); count_from_libpax.ble_count, millis() / 1000);
meshtastic_Paxcount pl = meshtastic_Paxcount_init_default; meshtastic_Paxcount pl = meshtastic_Paxcount_init_default;
+2 -2
View File
@@ -65,14 +65,14 @@ class AccelerometerThread : public concurrency::OSThread
return; return;
if (device.address.port == ScanI2C::I2CPort::NO_I2C || device.address.address == 0 || device.type == ScanI2C::NONE) { if (device.address.port == ScanI2C::I2CPort::NO_I2C || device.address.address == 0 || device.type == ScanI2C::NONE) {
LOG_DEBUG("AccelerometerThread disabling due to no sensors found"); LOG_DEBUG("AccelerometerThread Disable due to no sensors found");
disable(); disable();
return; return;
} }
#ifndef RAK_4631 #ifndef RAK_4631
if (!config.display.wake_on_tap_or_motion && !config.device.double_tap_as_button_press) { if (!config.display.wake_on_tap_or_motion && !config.device.double_tap_as_button_press) {
LOG_DEBUG("AccelerometerThread disabling due to no interested configurations"); LOG_DEBUG("AccelerometerThread Disable due to no interested configurations");
disable(); disable();
return; return;
} }
+2 -2
View File
@@ -41,10 +41,10 @@ bool BMA423Sensor::init()
// It corresponds to isDoubleClick interrupt // It corresponds to isDoubleClick interrupt
sensor.enableWakeupIRQ(); sensor.enableWakeupIRQ();
LOG_DEBUG("BMA423Sensor::init ok"); LOG_DEBUG("BMA423 init ok");
return true; return true;
} }
LOG_DEBUG("BMA423Sensor::init failed"); LOG_DEBUG("BMA423 init failed");
return false; return false;
} }
+2 -2
View File
@@ -16,10 +16,10 @@ bool BMX160Sensor::init()
if (sensor.begin()) { if (sensor.begin()) {
// set output data rate // set output data rate
sensor.ODR_Config(BMX160_ACCEL_ODR_100HZ, BMX160_GYRO_ODR_100HZ); sensor.ODR_Config(BMX160_ACCEL_ODR_100HZ, BMX160_GYRO_ODR_100HZ);
LOG_DEBUG("BMX160Sensor::init ok"); LOG_DEBUG("BMX160 init ok");
return true; return true;
} }
LOG_DEBUG("BMX160Sensor::init failed"); LOG_DEBUG("BMX160 init failed");
return false; return false;
} }
+12 -12
View File
@@ -44,14 +44,14 @@ int32_t ICM20948Sensor::runOnce()
// Wake on motion using polling - this is not as efficient as using hardware interrupt pin (see above) // Wake on motion using polling - this is not as efficient as using hardware interrupt pin (see above)
auto status = sensor->setBank(0); auto status = sensor->setBank(0);
if (sensor->status != ICM_20948_Stat_Ok) { if (sensor->status != ICM_20948_Stat_Ok) {
LOG_DEBUG("ICM20948Sensor::isWakeOnMotion failed to set bank - %s", sensor->statusString()); LOG_DEBUG("ICM20948 isWakeOnMotion failed to set bank - %s", sensor->statusString());
return MOTION_SENSOR_CHECK_INTERVAL_MS; return MOTION_SENSOR_CHECK_INTERVAL_MS;
} }
ICM_20948_INT_STATUS_t int_stat; ICM_20948_INT_STATUS_t int_stat;
status = sensor->read(AGB0_REG_INT_STATUS, (uint8_t *)&int_stat, sizeof(ICM_20948_INT_STATUS_t)); status = sensor->read(AGB0_REG_INT_STATUS, (uint8_t *)&int_stat, sizeof(ICM_20948_INT_STATUS_t));
if (status != ICM_20948_Stat_Ok) { if (status != ICM_20948_Stat_Ok) {
LOG_DEBUG("ICM20948Sensor::isWakeOnMotion failed to read interrupts - %s", sensor->statusString()); LOG_DEBUG("ICM20948 isWakeOnMotion failed to read interrupts - %s", sensor->statusString());
return MOTION_SENSOR_CHECK_INTERVAL_MS; return MOTION_SENSOR_CHECK_INTERVAL_MS;
} }
@@ -99,25 +99,25 @@ bool ICM20948Singleton::init(ScanI2C::FoundDevice device)
ICM_20948_Status_e status = begin(Wire, device.address.address == ICM20948_ADDR ? 1 : 0); ICM_20948_Status_e status = begin(Wire, device.address.address == ICM20948_ADDR ? 1 : 0);
#endif #endif
if (status != ICM_20948_Stat_Ok) { if (status != ICM_20948_Stat_Ok) {
LOG_DEBUG("ICM20948Sensor::init begin - %s", statusString()); LOG_DEBUG("ICM20948 init begin - %s", statusString());
return false; return false;
} }
// SW reset to make sure the device starts in a known state // SW reset to make sure the device starts in a known state
if (swReset() != ICM_20948_Stat_Ok) { if (swReset() != ICM_20948_Stat_Ok) {
LOG_DEBUG("ICM20948Sensor::init reset - %s", statusString()); LOG_DEBUG("ICM20948 init reset - %s", statusString());
return false; return false;
} }
delay(200); delay(200);
// Now wake the sensor up // Now wake the sensor up
if (sleep(false) != ICM_20948_Stat_Ok) { if (sleep(false) != ICM_20948_Stat_Ok) {
LOG_DEBUG("ICM20948Sensor::init wake - %s", statusString()); LOG_DEBUG("ICM20948 init wake - %s", statusString());
return false; return false;
} }
if (lowPower(false) != ICM_20948_Stat_Ok) { if (lowPower(false) != ICM_20948_Stat_Ok) {
LOG_DEBUG("ICM20948Sensor::init high power - %s", statusString()); LOG_DEBUG("ICM20948 init high power - %s", statusString());
return false; return false;
} }
@@ -125,19 +125,19 @@ bool ICM20948Singleton::init(ScanI2C::FoundDevice device)
// Active low // Active low
cfgIntActiveLow(true); cfgIntActiveLow(true);
LOG_DEBUG("ICM20948Sensor::init set cfgIntActiveLow - %s", statusString()); LOG_DEBUG("ICM20948 init set cfgIntActiveLow - %s", statusString());
// Push-pull // Push-pull
cfgIntOpenDrain(false); cfgIntOpenDrain(false);
LOG_DEBUG("ICM20948Sensor::init set cfgIntOpenDrain - %s", statusString()); LOG_DEBUG("ICM20948 init set cfgIntOpenDrain - %s", statusString());
// If enabled, *ANY* read will clear the INT_STATUS register. // If enabled, *ANY* read will clear the INT_STATUS register.
cfgIntAnyReadToClear(true); cfgIntAnyReadToClear(true);
LOG_DEBUG("ICM20948Sensor::init set cfgIntAnyReadToClear - %s", statusString()); LOG_DEBUG("ICM20948 init set cfgIntAnyReadToClear - %s", statusString());
// Latch the interrupt until cleared // Latch the interrupt until cleared
cfgIntLatch(true); cfgIntLatch(true);
LOG_DEBUG("ICM20948Sensor::init set cfgIntLatch - %s", statusString()); LOG_DEBUG("ICM20948 init set cfgIntLatch - %s", statusString());
// Set up an interrupt pin with an internal pullup for active low // Set up an interrupt pin with an internal pullup for active low
pinMode(ICM_20948_INT_PIN, INPUT_PULLUP); pinMode(ICM_20948_INT_PIN, INPUT_PULLUP);
@@ -168,13 +168,13 @@ bool ICM20948Singleton::setWakeOnMotion()
// Enable WoM Logic mode 1 = Compare the current sample with the previous sample // Enable WoM Logic mode 1 = Compare the current sample with the previous sample
status = WOMLogic(true, 1); status = WOMLogic(true, 1);
LOG_DEBUG("ICM20948Sensor::init set WOMLogic - %s", statusString()); LOG_DEBUG("ICM20948 init set WOMLogic - %s", statusString());
if (status != ICM_20948_Stat_Ok) if (status != ICM_20948_Stat_Ok)
return false; return false;
// Enable interrupts on WakeOnMotion // Enable interrupts on WakeOnMotion
status = intEnableWOM(true); status = intEnableWOM(true);
LOG_DEBUG("ICM20948Sensor::init set intEnableWOM - %s", statusString()); LOG_DEBUG("ICM20948 init set intEnableWOM - %s", statusString());
return status == ICM_20948_Stat_Ok; return status == ICM_20948_Stat_Ok;
// Clear any current interrupts // Clear any current interrupts
+2 -2
View File
@@ -11,10 +11,10 @@ bool LIS3DHSensor::init()
sensor.setRange(LIS3DH_RANGE_2_G); sensor.setRange(LIS3DH_RANGE_2_G);
// Adjust threshold, higher numbers are less sensitive // Adjust threshold, higher numbers are less sensitive
sensor.setClick(config.device.double_tap_as_button_press ? 2 : 1, MOTION_SENSOR_CHECK_INTERVAL_MS); sensor.setClick(config.device.double_tap_as_button_press ? 2 : 1, MOTION_SENSOR_CHECK_INTERVAL_MS);
LOG_DEBUG("LIS3DHSensor::init ok"); LOG_DEBUG("LIS3DH init ok");
return true; return true;
} }
LOG_DEBUG("LIS3DHSensor::init failed"); LOG_DEBUG("LIS3DH init failed");
return false; return false;
} }
+2 -2
View File
@@ -15,10 +15,10 @@ bool LSM6DS3Sensor::init()
// Duration is number of occurrences needed to trigger, higher threshold is less sensitive // Duration is number of occurrences needed to trigger, higher threshold is less sensitive
sensor.enableWakeup(config.display.wake_on_tap_or_motion, 1, LSM6DS3_WAKE_THRESH); sensor.enableWakeup(config.display.wake_on_tap_or_motion, 1, LSM6DS3_WAKE_THRESH);
LOG_DEBUG("LSM6DS3Sensor::init ok"); LOG_DEBUG("LSM6DS3 init ok");
return true; return true;
} }
LOG_DEBUG("LSM6DS3Sensor::init failed"); LOG_DEBUG("LSM6DS3 init failed");
return false; return false;
} }
+2 -2
View File
@@ -13,10 +13,10 @@ bool MPU6050Sensor::init()
sensor.setMotionDetectionDuration(20); sensor.setMotionDetectionDuration(20);
sensor.setInterruptPinLatch(true); // Keep it latched. Will turn off when reinitialized. sensor.setInterruptPinLatch(true); // Keep it latched. Will turn off when reinitialized.
sensor.setInterruptPinPolarity(true); sensor.setInterruptPinPolarity(true);
LOG_DEBUG("MPU6050Sensor::init ok"); LOG_DEBUG("MPU6050 init ok");
return true; return true;
} }
LOG_DEBUG("MPU6050Sensor::init failed"); LOG_DEBUG("MPU6050 init failed");
return false; return false;
} }
+4 -4
View File
@@ -10,8 +10,8 @@ MotionSensor::MotionSensor(ScanI2C::FoundDevice foundDevice)
device.address.address = foundDevice.address.address; device.address.address = foundDevice.address.address;
device.address.port = foundDevice.address.port; device.address.port = foundDevice.address.port;
device.type = foundDevice.type; device.type = foundDevice.type;
LOG_DEBUG("MotionSensor::MotionSensor port: %s address: 0x%x type: %d", LOG_DEBUG("Motion MotionSensor port: %s address: 0x%x type: %d", devicePort() == ScanI2C::I2CPort::WIRE1 ? "Wire1" : "Wire",
devicePort() == ScanI2C::I2CPort::WIRE1 ? "Wire1" : "Wire", (uint8_t)deviceAddress(), deviceType()); (uint8_t)deviceAddress(), deviceType());
} }
ScanI2C::DeviceType MotionSensor::deviceType() ScanI2C::DeviceType MotionSensor::deviceType()
@@ -57,14 +57,14 @@ void MotionSensor::drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState
void MotionSensor::wakeScreen() void MotionSensor::wakeScreen()
{ {
if (powerFSM.getState() == &stateDARK) { if (powerFSM.getState() == &stateDARK) {
LOG_DEBUG("MotionSensor::wakeScreen detected"); LOG_DEBUG("Motion wakeScreen detected");
powerFSM.trigger(EVENT_INPUT); powerFSM.trigger(EVENT_INPUT);
} }
} }
void MotionSensor::buttonPress() void MotionSensor::buttonPress()
{ {
LOG_DEBUG("MotionSensor::buttonPress detected"); LOG_DEBUG("Motion buttonPress detected");
powerFSM.trigger(EVENT_PRESS); powerFSM.trigger(EVENT_PRESS);
} }
+13 -13
View File
@@ -44,7 +44,7 @@ int32_t QMA6100PSensor::runOnce()
uint8_t tempVal; uint8_t tempVal;
if (!sensor->readRegisterRegion(SFE_QMA6100P_INT_ST0, &tempVal, 1)) { if (!sensor->readRegisterRegion(SFE_QMA6100P_INT_ST0, &tempVal, 1)) {
LOG_DEBUG("QMA6100PSensor::isWakeOnMotion failed to read interrupts"); LOG_DEBUG("QMA6100PS isWakeOnMotion failed to read interrupts");
return MOTION_SENSOR_CHECK_INTERVAL_MS; return MOTION_SENSOR_CHECK_INTERVAL_MS;
} }
@@ -88,55 +88,55 @@ bool QMA6100PSingleton::init(ScanI2C::FoundDevice device)
bool status = begin(device.address.address, &Wire); bool status = begin(device.address.address, &Wire);
#endif #endif
if (status != true) { if (status != true) {
LOG_WARN("QMA6100PSensor::init begin failed\n"); LOG_WARN("QMA6100P init begin failed\n");
return false; return false;
} }
delay(20); delay(20);
// SW reset to make sure the device starts in a known state // SW reset to make sure the device starts in a known state
if (softwareReset() != true) { if (softwareReset() != true) {
LOG_WARN("QMA6100PSensor::init reset failed\n"); LOG_WARN("QMA6100P init reset failed\n");
return false; return false;
} }
delay(20); delay(20);
// Set range // Set range
if (!setRange(QMA_6100P_MPU_ACCEL_SCALE)) { if (!setRange(QMA_6100P_MPU_ACCEL_SCALE)) {
LOG_WARN("QMA6100PSensor::init range failed"); LOG_WARN("QMA6100P init range failed");
return false; return false;
} }
// set active mode // set active mode
if (!enableAccel()) { if (!enableAccel()) {
LOG_WARN("ERROR :QMA6100PSensor::active mode set failed"); LOG_WARN("ERROR QMA6100P active mode set failed");
} }
// set calibrateoffsets // set calibrateoffsets
if (!calibrateOffsets()) { if (!calibrateOffsets()) {
LOG_WARN("ERROR :QMA6100PSensor:: calibration failed"); LOG_WARN("ERROR QMA6100P calibration failed");
} }
#ifdef QMA_6100P_INT_PIN #ifdef QMA_6100P_INT_PIN
// Active low & Open Drain // Active low & Open Drain
uint8_t tempVal; uint8_t tempVal;
if (!readRegisterRegion(SFE_QMA6100P_INTPINT_CONF, &tempVal, 1)) { if (!readRegisterRegion(SFE_QMA6100P_INTPINT_CONF, &tempVal, 1)) {
LOG_WARN("QMA6100PSensor::init failed to read interrupt pin config"); LOG_WARN("QMA6100P init failed to read interrupt pin config");
return false; return false;
} }
tempVal |= 0b00000010; // Active low & Open Drain tempVal |= 0b00000010; // Active low & Open Drain
if (!writeRegisterByte(SFE_QMA6100P_INTPINT_CONF, tempVal)) { if (!writeRegisterByte(SFE_QMA6100P_INTPINT_CONF, tempVal)) {
LOG_WARN("QMA6100PSensor::init failed to write interrupt pin config"); LOG_WARN("QMA6100P init failed to write interrupt pin config");
return false; return false;
} }
// Latch until cleared, all reads clear the latch // Latch until cleared, all reads clear the latch
if (!readRegisterRegion(SFE_QMA6100P_INT_CFG, &tempVal, 1)) { if (!readRegisterRegion(SFE_QMA6100P_INT_CFG, &tempVal, 1)) {
LOG_WARN("QMA6100PSensor::init failed to read interrupt config"); LOG_WARN("QMA6100P init failed to read interrupt config");
return false; return false;
} }
tempVal |= 0b10000001; // Latch until cleared, INT_RD_CLR1 tempVal |= 0b10000001; // Latch until cleared, INT_RD_CLR1
if (!writeRegisterByte(SFE_QMA6100P_INT_CFG, tempVal)) { if (!writeRegisterByte(SFE_QMA6100P_INT_CFG, tempVal)) {
LOG_WARN("QMA6100PSensor::init failed to write interrupt config"); LOG_WARN("QMA6100P init failed to write interrupt config");
return false; return false;
} }
// Set up an interrupt pin with an internal pullup for active low // Set up an interrupt pin with an internal pullup for active low
@@ -153,7 +153,7 @@ bool QMA6100PSingleton::setWakeOnMotion()
{ {
// Enable 'Any Motion' interrupt // Enable 'Any Motion' interrupt
if (!writeRegisterByte(SFE_QMA6100P_INT_EN2, 0b00000111)) { if (!writeRegisterByte(SFE_QMA6100P_INT_EN2, 0b00000111)) {
LOG_WARN("QMA6100PSingleton::setWakeOnMotion failed to write interrupt enable"); LOG_WARN("QMA6100P :setWakeOnMotion failed to write interrupt enable");
return false; return false;
} }
@@ -161,7 +161,7 @@ bool QMA6100PSingleton::setWakeOnMotion()
uint8_t tempVal; uint8_t tempVal;
if (!readRegisterRegion(SFE_QMA6100P_INT_MAP1, &tempVal, 1)) { if (!readRegisterRegion(SFE_QMA6100P_INT_MAP1, &tempVal, 1)) {
LOG_WARN("QMA6100PSingleton::setWakeOnMotion failed to read interrupt map"); LOG_WARN("QMA6100P setWakeOnMotion failed to read interrupt map");
return false; return false;
} }
@@ -171,7 +171,7 @@ bool QMA6100PSingleton::setWakeOnMotion()
tempVal = int_map1.all; tempVal = int_map1.all;
if (!writeRegisterByte(SFE_QMA6100P_INT_MAP1, tempVal)) { if (!writeRegisterByte(SFE_QMA6100P_INT_MAP1, tempVal)) {
LOG_WARN("QMA6100PSingleton::setWakeOnMotion failed to write interrupt map"); LOG_WARN("QMA6100P setWakeOnMotion failed to write interrupt map");
return false; return false;
} }
+2 -2
View File
@@ -17,10 +17,10 @@ bool STK8XXXSensor::init()
attachInterrupt( attachInterrupt(
digitalPinToInterrupt(STK8XXX_INT), [] { STK_IRQ = true; }, RISING); digitalPinToInterrupt(STK8XXX_INT), [] { STK_IRQ = true; }, RISING);
LOG_DEBUG("STK8XXXSensor::init ok"); LOG_DEBUG("STK8XXX init ok");
return true; return true;
} }
LOG_DEBUG("STK8XXXSensor::init failed"); LOG_DEBUG("STK8XXX init failed");
return false; return false;
} }
+11 -11
View File
@@ -91,7 +91,7 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
p->decoded.payload.size = jsonPayloadStr.length(); p->decoded.payload.size = jsonPayloadStr.length();
service->sendToMesh(p, RX_SRC_LOCAL); service->sendToMesh(p, RX_SRC_LOCAL);
} else { } else {
LOG_WARN("Received MQTT json payload too long, dropping"); LOG_WARN("Received MQTT json payload too long, drop");
} }
} else if (json["type"]->AsString().compare("sendposition") == 0 && json["payload"]->IsObject()) { } else if (json["type"]->AsString().compare("sendposition") == 0 && json["payload"]->IsObject()) {
// invent the "sendposition" type for a valid envelope // invent the "sendposition" type for a valid envelope
@@ -122,17 +122,17 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
&meshtastic_Position_msg, &pos); // make the Data protobuf from position &meshtastic_Position_msg, &pos); // make the Data protobuf from position
service->sendToMesh(p, RX_SRC_LOCAL); service->sendToMesh(p, RX_SRC_LOCAL);
} else { } else {
LOG_DEBUG("JSON Ignoring downlink message with unsupported type"); LOG_DEBUG("JSON ignore downlink message with unsupported type");
} }
} else { } else {
LOG_ERROR("JSON Received payload on MQTT but not a valid envelope"); LOG_ERROR("JSON received payload on MQTT but not a valid envelope");
} }
} else { } else {
LOG_WARN("JSON downlink received on channel not called 'mqtt' or without downlink enabled"); LOG_WARN("JSON downlink received on channel not called 'mqtt' or without downlink enabled");
} }
} else { } else {
// no json, this is an invalid payload // no json, this is an invalid payload
LOG_ERROR("JSON Received payload on MQTT but not a valid JSON"); LOG_ERROR("JSON received payload on MQTT but not a valid JSON");
} }
delete json_value; delete json_value;
} else { } else {
@@ -315,7 +315,7 @@ void MQTT::reconnect()
{ {
if (wantsLink()) { if (wantsLink()) {
if (moduleConfig.mqtt.proxy_to_client_enabled) { if (moduleConfig.mqtt.proxy_to_client_enabled) {
LOG_INFO("MQTT connecting via client proxy instead"); LOG_INFO("MQTT connect via client proxy instead");
enabled = true; enabled = true;
runASAP = true; runASAP = true;
reconnectCount = 0; reconnectCount = 0;
@@ -478,7 +478,7 @@ int32_t MQTT::runOnce()
} else { } else {
// we are connected to server, check often for new requests on the TCP port // we are connected to server, check often for new requests on the TCP port
if (!wantConnection) { if (!wantConnection) {
LOG_INFO("MQTT link not needed, dropping"); LOG_INFO("MQTT link not needed, drop");
pubSub.disconnect(); pubSub.disconnect();
} }
@@ -571,7 +571,7 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me
env->channel_id = (char *)channelId; env->channel_id = (char *)channelId;
env->gateway_id = owner.id; env->gateway_id = owner.id;
LOG_DEBUG("MQTT onSend - Publishing "); LOG_DEBUG("MQTT onSend - Publish ");
if (moduleConfig.mqtt.encryption_enabled) { if (moduleConfig.mqtt.encryption_enabled) {
env->packet = (meshtastic_MeshPacket *)&mp_encrypted; env->packet = (meshtastic_MeshPacket *)&mp_encrypted;
LOG_DEBUG("encrypted message"); LOG_DEBUG("encrypted message");
@@ -604,9 +604,9 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me
} }
#endif // ARCH_NRF52 NRF52_USE_JSON #endif // ARCH_NRF52 NRF52_USE_JSON
} else { } else {
LOG_INFO("MQTT not connected, queueing packet"); LOG_INFO("MQTT not connected, queue packet");
if (mqttQueue.numFree() == 0) { if (mqttQueue.numFree() == 0) {
LOG_WARN("MQTT queue is full, discarding oldest"); LOG_WARN("MQTT queue is full, discard oldest");
meshtastic_ServiceEnvelope *d = mqttQueue.dequeuePtr(0); meshtastic_ServiceEnvelope *d = mqttQueue.dequeuePtr(0);
if (d) if (d)
mqttPool.release(d); mqttPool.release(d);
@@ -630,9 +630,9 @@ void MQTT::perhapsReportToMap()
if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) {
last_report_to_map = millis(); last_report_to_map = millis();
if (map_position_precision == 0) if (map_position_precision == 0)
LOG_WARN("MQTT Map reporting enabled, but precision is 0"); LOG_WARN("MQTT Map report enabled, but precision is 0");
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)
LOG_WARN("MQTT Map reporting enabled, but no position available"); LOG_WARN("MQTT Map report enabled, but no position available");
return; return;
} }
+1 -1
View File
@@ -59,7 +59,7 @@ class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks
memcpy(lastToRadio, val.data(), val.length()); memcpy(lastToRadio, val.data(), val.length());
bluetoothPhoneAPI->handleToRadio(val.data(), val.length()); bluetoothPhoneAPI->handleToRadio(val.data(), val.length());
} else { } else {
LOG_DEBUG("Dropping duplicate ToRadio packet we just saw"); LOG_DEBUG("Drop dup ToRadio packet we just saw");
} }
} }
}; };
+1 -1
View File
@@ -83,7 +83,7 @@ void enableSlowCLK()
LOG_DEBUG("32K XTAL OSC has not started up"); LOG_DEBUG("32K XTAL OSC has not started up");
} else { } else {
rtc_clk_slow_freq_set(RTC_SLOW_FREQ_32K_XTAL); rtc_clk_slow_freq_set(RTC_SLOW_FREQ_32K_XTAL);
LOG_DEBUG("Switching RTC Source to 32.768Khz succeeded, using 32K XTAL"); LOG_DEBUG("Switch RTC Source to 32.768Khz succeeded, using 32K XTAL");
CALIBRATE_ONE(RTC_CAL_RTC_MUX); CALIBRATE_ONE(RTC_CAL_RTC_MUX);
CALIBRATE_ONE(RTC_CAL_32K_XTAL); CALIBRATE_ONE(RTC_CAL_32K_XTAL);
} }
+9 -9
View File
@@ -152,7 +152,7 @@ void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, ui
memcpy(lastToRadio, data, len); memcpy(lastToRadio, data, len);
bluetoothPhoneAPI->handleToRadio(data, len); bluetoothPhoneAPI->handleToRadio(data, len);
} else { } else {
LOG_DEBUG("Dropping duplicate ToRadio packet we just saw"); LOG_DEBUG("Drop dup ToRadio packet we just saw");
} }
} }
@@ -225,7 +225,7 @@ void NRF52Bluetooth::startDisabled()
// Shutdown bluetooth for minimum power draw // Shutdown bluetooth for minimum power draw
Bluefruit.Advertising.stop(); Bluefruit.Advertising.stop();
Bluefruit.setTxPower(-40); // Minimum power Bluefruit.setTxPower(-40); // Minimum power
LOG_INFO("Disabling NRF52 Bluetooth. (Workaround: tx power min, advertising stopped)"); LOG_INFO("Disable NRF52 Bluetooth. (Workaround: tx power min, advertise stopped)");
} }
bool NRF52Bluetooth::isConnected() bool NRF52Bluetooth::isConnected()
{ {
@@ -238,7 +238,7 @@ int NRF52Bluetooth::getRssi()
void NRF52Bluetooth::setup() void NRF52Bluetooth::setup()
{ {
// Initialise the Bluefruit module // Initialise the Bluefruit module
LOG_INFO("Initialize the Bluefruit nRF52 module"); LOG_INFO("Init the Bluefruit nRF52 module");
Bluefruit.autoConnLed(false); Bluefruit.autoConnLed(false);
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX); Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.begin(); Bluefruit.begin();
@@ -290,7 +290,7 @@ void NRF52Bluetooth::setup()
// Setup the advertising packet(s) // Setup the advertising packet(s)
LOG_INFO("Set up the advertising payload(s)"); LOG_INFO("Set up the advertising payload(s)");
startAdv(); startAdv();
LOG_INFO("Advertising"); LOG_INFO("Advertise");
} }
void NRF52Bluetooth::resumeAdvertising() void NRF52Bluetooth::resumeAdvertising()
{ {
@@ -306,7 +306,7 @@ void updateBatteryLevel(uint8_t level)
} }
void NRF52Bluetooth::clearBonds() void NRF52Bluetooth::clearBonds()
{ {
LOG_INFO("Clearing bluetooth bonds!"); LOG_INFO("Clear bluetooth bonds!");
bond_print_list(BLE_GAP_ROLE_PERIPH); bond_print_list(BLE_GAP_ROLE_PERIPH);
bond_print_list(BLE_GAP_ROLE_CENTRAL); bond_print_list(BLE_GAP_ROLE_CENTRAL);
Bluefruit.Periph.clearBonds(); Bluefruit.Periph.clearBonds();
@@ -318,7 +318,7 @@ void NRF52Bluetooth::onConnectionSecured(uint16_t conn_handle)
} }
bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request) bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request)
{ {
LOG_INFO("BLE pairing process started with passkey %.3s %.3s", passkey, passkey + 3); LOG_INFO("BLE pair process started with passkey %.3s %.3s", passkey, passkey + 3);
powerFSM.trigger(EVENT_BLUETOOTH_PAIR); powerFSM.trigger(EVENT_BLUETOOTH_PAIR);
#if !defined(MESHTASTIC_EXCLUDE_SCREEN) #if !defined(MESHTASTIC_EXCLUDE_SCREEN)
screen->startAlert([](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void { screen->startAlert([](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
@@ -354,15 +354,15 @@ bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passke
break; break;
} }
} }
LOG_INFO("BLE passkey pairing: match_request=%i", match_request); LOG_INFO("BLE passkey pair: match_request=%i", match_request);
return true; return true;
} }
void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_status) void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_status)
{ {
if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS) if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS)
LOG_INFO("BLE pairing success"); LOG_INFO("BLE pair success");
else else
LOG_INFO("BLE pairing failed"); LOG_INFO("BLE pair failed");
screen->endAlert(); screen->endAlert();
} }
+1 -1
View File
@@ -74,7 +74,7 @@ void setBluetoothEnable(bool enable)
// For debugging use: don't use bluetooth // For debugging use: don't use bluetooth
if (!useSoftDevice) { if (!useSoftDevice) {
if (enable) if (enable)
LOG_INFO("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING"); LOG_INFO("Disable NRF52 BLUETOOTH WHILE DEBUGGING");
return; return;
} }
+1 -1
View File
@@ -193,7 +193,7 @@ void SimRadio::startSend(meshtastic_MeshPacket *txp)
memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size); memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size);
c.data.size = p->decoded.payload.size; c.data.size = p->decoded.payload.size;
} else { } else {
LOG_WARN("Payload size larger than compressed message allows! Sending empty payload"); LOG_WARN("Payload size larger than compressed message allows! Send empty payload");
} }
p->decoded.payload.size = p->decoded.payload.size =
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Compressed_msg, &c); pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Compressed_msg, &c);
+1 -1
View File
@@ -2,7 +2,7 @@
#include <string> #include <string>
static const char hexChars[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; static const char hexChars[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
static const char *errStr = "Error decoding protobuf for %s message!"; static const char *errStr = "Error decoding proto for %s message!";
class MeshPacketSerializer class MeshPacketSerializer
{ {
@@ -93,7 +93,7 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp,
jsonObj["payload"]["current_ch3"] = decoded->variant.power_metrics.ch3_current; jsonObj["payload"]["current_ch3"] = decoded->variant.power_metrics.ch3_current;
} }
} else if (shouldLog) { } else if (shouldLog) {
LOG_ERROR("Error decoding protobuf for telemetry message!"); LOG_ERROR("Error decoding proto for telemetry message!");
return ""; return "";
} }
break; break;
@@ -111,7 +111,7 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp,
jsonObj["payload"]["hardware"] = decoded->hw_model; jsonObj["payload"]["hardware"] = decoded->hw_model;
jsonObj["payload"]["role"] = (int)decoded->role; jsonObj["payload"]["role"] = (int)decoded->role;
} else if (shouldLog) { } else if (shouldLog) {
LOG_ERROR("Error decoding protobuf for nodeinfo message!"); LOG_ERROR("Error decoding proto for nodeinfo message!");
return ""; return "";
} }
break; break;
@@ -156,7 +156,7 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp,
jsonObj["payload"]["precision_bits"] = (int)decoded->precision_bits; jsonObj["payload"]["precision_bits"] = (int)decoded->precision_bits;
} }
} else if (shouldLog) { } else if (shouldLog) {
LOG_ERROR("Error decoding protobuf for position message!"); LOG_ERROR("Error decoding proto for position message!");
return ""; return "";
} }
break; break;
@@ -176,7 +176,7 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp,
jsonObj["payload"]["latitude_i"] = (int)decoded->latitude_i; jsonObj["payload"]["latitude_i"] = (int)decoded->latitude_i;
jsonObj["payload"]["longitude_i"] = (int)decoded->longitude_i; jsonObj["payload"]["longitude_i"] = (int)decoded->longitude_i;
} else if (shouldLog) { } else if (shouldLog) {
LOG_ERROR("Error decoding protobuf for position message!"); LOG_ERROR("Error decoding proto for position message!");
return ""; return "";
} }
break; break;
@@ -207,7 +207,7 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp,
neighbors.remove(0); neighbors.remove(0);
jsonObj["payload"]["neighbors"] = neighbors; jsonObj["payload"]["neighbors"] = neighbors;
} else if (shouldLog) { } else if (shouldLog) {
LOG_ERROR("Error decoding protobuf for neighborinfo message!"); LOG_ERROR("Error decoding proto for neighborinfo message!");
return ""; return "";
} }
break; break;
@@ -241,7 +241,7 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp,
jsonObj["payload"]["route"] = route; jsonObj["payload"]["route"] = route;
} else if (shouldLog) { } else if (shouldLog) {
LOG_ERROR("Error decoding protobuf for traceroute message!"); LOG_ERROR("Error decoding proto for traceroute message!");
return ""; return "";
} }
} else { } else {
@@ -274,7 +274,7 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp,
jsonObj["payload"]["gpio_mask"] = (unsigned int)decoded->gpio_mask; jsonObj["payload"]["gpio_mask"] = (unsigned int)decoded->gpio_mask;
} }
} else if (shouldLog) { } else if (shouldLog) {
LOG_ERROR("Error decoding protobuf for RemoteHardware message!"); LOG_ERROR("Error decoding proto for RemoteHardware message!");
return ""; return "";
} }
break; break;
+1 -1
View File
@@ -140,7 +140,7 @@ void initDeepSleep()
#if SOC_RTCIO_HOLD_SUPPORTED #if SOC_RTCIO_HOLD_SUPPORTED
// If waking from sleep, release any and all RTC GPIOs // If waking from sleep, release any and all RTC GPIOs
if (wakeCause != ESP_SLEEP_WAKEUP_UNDEFINED) { if (wakeCause != ESP_SLEEP_WAKEUP_UNDEFINED) {
LOG_DEBUG("Disabling any holds on RTC IO pads"); LOG_DEBUG("Disable any holds on RTC IO pads");
for (uint8_t i = 0; i <= GPIO_NUM_MAX; i++) { for (uint8_t i = 0; i <= GPIO_NUM_MAX; i++) {
if (rtc_gpio_is_valid_gpio((gpio_num_t)i)) if (rtc_gpio_is_valid_gpio((gpio_num_t)i))
rtc_gpio_hold_dis((gpio_num_t)i); rtc_gpio_hold_dis((gpio_num_t)i);
+7 -7
View File
@@ -97,7 +97,7 @@ void XModemAdapter::sendControl(meshtastic_XModem_Control c)
{ {
xmodemStore = meshtastic_XModem_init_zero; xmodemStore = meshtastic_XModem_init_zero;
xmodemStore.control = c; xmodemStore.control = c;
LOG_DEBUG("XModem: Notify Sending control %d", c); LOG_DEBUG("XModem: Notify Send control %d", c);
packetReady.notifyObservers(packetno); packetReady.notifyObservers(packetno);
} }
@@ -131,7 +131,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
isReceiving = false; isReceiving = false;
break; break;
} else { // Transmit this file from Flash } else { // Transmit this file from Flash
LOG_INFO("XModem: Transmitting file %s", filename); LOG_INFO("XModem: Transmit file %s", filename);
file = FSCom.open(filename, FILE_O_READ); file = FSCom.open(filename, FILE_O_READ);
if (file) { if (file) {
packetno = 1; packetno = 1;
@@ -141,7 +141,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
xmodemStore.seq = packetno; xmodemStore.seq = packetno;
xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size);
LOG_DEBUG("XModem: STX Notify Sending packet %d, %d Bytes", packetno, xmodemStore.buffer.size); LOG_DEBUG("XModem: STX Notify Send packet %d, %d Bytes", packetno, xmodemStore.buffer.size);
if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) {
isEOT = true; isEOT = true;
// send EOT on next Ack // send EOT on next Ack
@@ -196,7 +196,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
if (isEOT) { if (isEOT) {
sendControl(meshtastic_XModem_Control_EOT); sendControl(meshtastic_XModem_Control_EOT);
file.close(); file.close();
LOG_INFO("XModem: Finished sending file %s", filename); LOG_INFO("XModem: Finished send file %s", filename);
isTransmitting = false; isTransmitting = false;
isEOT = false; isEOT = false;
break; break;
@@ -208,7 +208,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
xmodemStore.seq = packetno; xmodemStore.seq = packetno;
xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size);
LOG_DEBUG("XModem: ACK Notify Sending packet %d, %d Bytes", packetno, xmodemStore.buffer.size); LOG_DEBUG("XModem: ACK Notify Send packet %d, %d Bytes", packetno, xmodemStore.buffer.size);
if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) {
isEOT = true; isEOT = true;
// send EOT on next Ack // send EOT on next Ack
@@ -225,7 +225,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
if (--retrans <= 0) { if (--retrans <= 0) {
sendControl(meshtastic_XModem_Control_CAN); sendControl(meshtastic_XModem_Control_CAN);
file.close(); file.close();
LOG_INFO("XModem: Retransmit timeout, cancelling file %s", filename); LOG_INFO("XModem: Retransmit timeout, cancel file %s", filename);
isTransmitting = false; isTransmitting = false;
break; break;
} }
@@ -235,7 +235,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
file.seek((packetno - 1) * sizeof(meshtastic_XModem_buffer_t::bytes)); file.seek((packetno - 1) * sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size);
LOG_DEBUG("XModem: NAK Notify Sending packet %d, %d Bytes", packetno, xmodemStore.buffer.size); LOG_DEBUG("XModem: NAK Notify Send packet %d, %d Bytes", packetno, xmodemStore.buffer.size);
if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) {
isEOT = true; isEOT = true;
// send EOT on next Ack // send EOT on next Ack