kopia lustrzana https://github.com/meshtastic/firmware
remove newline from logging statements. (#5022)
remove newline from logging statements in code. The LOG_* functions will now magically add it at the end. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>pull/5046/head^2
rodzic
fb9f361052
commit
05e4a639a1
|
@ -96,7 +96,7 @@ lib_deps =
|
|||
https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0
|
||||
nanopb/Nanopb@^0.4.9
|
||||
erriez/ErriezCRC32@^1.0.1
|
||||
|
||||
|
||||
; Used for the code analysis in PIO Home / Inspect
|
||||
check_tool = cppcheck
|
||||
check_skip_packages = yes
|
||||
|
|
|
@ -42,18 +42,18 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||
#ifdef HAS_NCP5623
|
||||
_type = type;
|
||||
if (_type == ScanI2C::DeviceType::NONE) {
|
||||
LOG_DEBUG("AmbientLightingThread disabling due to no RGB leds found on I2C bus\n");
|
||||
LOG_DEBUG("AmbientLightingThread disabling due to no RGB leds found on I2C bus");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||
if (!moduleConfig.ambient_lighting.led_state) {
|
||||
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
|
||||
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("AmbientLightingThread initializing\n");
|
||||
LOG_DEBUG("AmbientLightingThread initializing");
|
||||
#ifdef HAS_NCP5623
|
||||
if (_type == ScanI2C::NCP5623) {
|
||||
rgb.begin();
|
||||
|
@ -106,27 +106,27 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||
rgb.setRed(0);
|
||||
rgb.setGreen(0);
|
||||
rgb.setBlue(0);
|
||||
LOG_INFO("Turn Off NCP5623 Ambient lighting.\n");
|
||||
LOG_INFO("Turn Off NCP5623 Ambient lighting.");
|
||||
#endif
|
||||
#ifdef HAS_NEOPIXEL
|
||||
pixels.clear();
|
||||
pixels.show();
|
||||
LOG_INFO("Turn Off NeoPixel Ambient lighting.\n");
|
||||
LOG_INFO("Turn Off NeoPixel Ambient lighting.");
|
||||
#endif
|
||||
#ifdef RGBLED_CA
|
||||
analogWrite(RGBLED_RED, 255 - 0);
|
||||
analogWrite(RGBLED_GREEN, 255 - 0);
|
||||
analogWrite(RGBLED_BLUE, 255 - 0);
|
||||
LOG_INFO("Turn Off Ambient lighting RGB Common Anode.\n");
|
||||
LOG_INFO("Turn Off Ambient lighting RGB Common Anode.");
|
||||
#elif defined(RGBLED_RED)
|
||||
analogWrite(RGBLED_RED, 0);
|
||||
analogWrite(RGBLED_GREEN, 0);
|
||||
analogWrite(RGBLED_BLUE, 0);
|
||||
LOG_INFO("Turn Off Ambient lighting RGB Common Cathode.\n");
|
||||
LOG_INFO("Turn Off Ambient lighting RGB Common Cathode.");
|
||||
#endif
|
||||
#ifdef UNPHONE
|
||||
unphone.rgb(0, 0, 0);
|
||||
LOG_INFO("Turn Off unPhone Ambient lighting.\n");
|
||||
LOG_INFO("Turn Off unPhone Ambient lighting.");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||
rgb.setRed(moduleConfig.ambient_lighting.red);
|
||||
rgb.setGreen(moduleConfig.ambient_lighting.green);
|
||||
rgb.setBlue(moduleConfig.ambient_lighting.blue);
|
||||
LOG_DEBUG("Initializing NCP5623 Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d\n",
|
||||
LOG_DEBUG("Initializing NCP5623 Ambient lighting 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);
|
||||
#endif
|
||||
|
@ -158,7 +158,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||
#endif
|
||||
#endif
|
||||
pixels.show();
|
||||
LOG_DEBUG("Initializing NeoPixel Ambient lighting w/ brightness(current)=%d, red=%d, green=%d, blue=%d\n",
|
||||
LOG_DEBUG("Initializing NeoPixel Ambient lighting 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.blue);
|
||||
#endif
|
||||
|
@ -166,18 +166,18 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
|
||||
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
|
||||
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
|
||||
LOG_DEBUG("Initializing Ambient lighting RGB Common Anode w/ red=%d, green=%d, blue=%d\n",
|
||||
LOG_DEBUG("Initializing Ambient lighting RGB Common Anode w/ red=%d, green=%d, blue=%d",
|
||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||
#elif defined(RGBLED_RED)
|
||||
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
|
||||
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
|
||||
analogWrite(RGBLED_BLUE, moduleConfig.ambient_lighting.blue);
|
||||
LOG_DEBUG("Initializing Ambient lighting RGB Common Cathode w/ red=%d, green=%d, blue=%d\n",
|
||||
LOG_DEBUG("Initializing Ambient lighting RGB Common Cathode w/ red=%d, green=%d, blue=%d",
|
||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||
#endif
|
||||
#ifdef UNPHONE
|
||||
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||
LOG_DEBUG("Initializing unPhone Ambient lighting w/ red=%d, green=%d, blue=%d\n", moduleConfig.ambient_lighting.red,
|
||||
LOG_DEBUG("Initializing unPhone Ambient lighting w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
|
||||
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ ButtonThread::ButtonThread() : OSThread("Button")
|
|||
#if defined(ARCH_PORTDUINO)
|
||||
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) {
|
||||
this->userButton = OneButton(settingsMap[user], true, true);
|
||||
LOG_DEBUG("Using GPIO%02d for button\n", settingsMap[user]);
|
||||
LOG_DEBUG("Using GPIO%02d for button", settingsMap[user]);
|
||||
}
|
||||
#elif defined(BUTTON_PIN)
|
||||
int pin = config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN; // Resolved button pin
|
||||
|
@ -47,7 +47,7 @@ ButtonThread::ButtonThread() : OSThread("Button")
|
|||
#else
|
||||
this->userButton = OneButton(pin, true, true);
|
||||
#endif
|
||||
LOG_DEBUG("Using GPIO%02d for button\n", pin);
|
||||
LOG_DEBUG("Using GPIO%02d for button", pin);
|
||||
#endif
|
||||
|
||||
#ifdef INPUT_PULLUP_SENSE
|
||||
|
@ -123,7 +123,7 @@ int32_t ButtonThread::runOnce()
|
|||
if (btnEvent != BUTTON_EVENT_NONE) {
|
||||
switch (btnEvent) {
|
||||
case BUTTON_EVENT_PRESSED: {
|
||||
LOG_BUTTON("press!\n");
|
||||
LOG_BUTTON("press!");
|
||||
// If a nag notification is running, stop it and prevent other actions
|
||||
if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) {
|
||||
externalNotificationModule->stopNow();
|
||||
|
@ -148,7 +148,7 @@ int32_t ButtonThread::runOnce()
|
|||
}
|
||||
|
||||
case BUTTON_EVENT_DOUBLE_PRESSED: {
|
||||
LOG_BUTTON("Double press!\n");
|
||||
LOG_BUTTON("Double press!");
|
||||
service->refreshLocalMeshNode();
|
||||
auto sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
|
||||
if (screen) {
|
||||
|
@ -162,7 +162,7 @@ int32_t ButtonThread::runOnce()
|
|||
}
|
||||
|
||||
case BUTTON_EVENT_MULTI_PRESSED: {
|
||||
LOG_BUTTON("Mulitipress! %hux\n", multipressClickCount);
|
||||
LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
|
||||
switch (multipressClickCount) {
|
||||
#if HAS_GPS
|
||||
// 3 clicks: toggle GPS
|
||||
|
@ -189,7 +189,7 @@ int32_t ButtonThread::runOnce()
|
|||
} // end multipress event
|
||||
|
||||
case BUTTON_EVENT_LONG_PRESSED: {
|
||||
LOG_BUTTON("Long press!\n");
|
||||
LOG_BUTTON("Long press!");
|
||||
powerFSM.trigger(EVENT_PRESS);
|
||||
if (screen) {
|
||||
screen->startAlert("Shutting down...");
|
||||
|
@ -201,7 +201,7 @@ int32_t ButtonThread::runOnce()
|
|||
// Do actual shutdown when button released, otherwise the button release
|
||||
// may wake the board immediatedly.
|
||||
case BUTTON_EVENT_LONG_RELEASED: {
|
||||
LOG_INFO("Shutdown from long press\n");
|
||||
LOG_INFO("Shutdown from long press");
|
||||
playShutdownMelody();
|
||||
delay(3000);
|
||||
power->shutdown();
|
||||
|
@ -210,7 +210,7 @@ int32_t ButtonThread::runOnce()
|
|||
|
||||
#ifdef BUTTON_PIN_TOUCH
|
||||
case BUTTON_EVENT_TOUCH_LONG_PRESSED: {
|
||||
LOG_BUTTON("Touch press!\n");
|
||||
LOG_BUTTON("Touch press!");
|
||||
if (screen) {
|
||||
// Wake if asleep
|
||||
if (powerFSM.getState() == &stateDARK)
|
||||
|
|
|
@ -53,7 +53,7 @@ bool lfs_assert_failed =
|
|||
|
||||
extern "C" void lfs_assert(const char *reason)
|
||||
{
|
||||
LOG_ERROR("LFS assert: %s\n", reason);
|
||||
LOG_ERROR("LFS assert: %s", reason);
|
||||
lfs_assert_failed = true;
|
||||
}
|
||||
|
||||
|
@ -75,19 +75,19 @@ bool copyFile(const char *from, const char *to)
|
|||
r = OSFS::getFile(from, cbuffer);
|
||||
|
||||
if (r == notfound) {
|
||||
LOG_ERROR("Failed to open source file %s\n", from);
|
||||
LOG_ERROR("Failed to open source file %s", from);
|
||||
return false;
|
||||
} else if (r == noerr) {
|
||||
r = OSFS::newFile(to, cbuffer, true);
|
||||
if (r == noerr) {
|
||||
return true;
|
||||
} else {
|
||||
LOG_ERROR("OSFS Error %d\n", r);
|
||||
LOG_ERROR("OSFS Error %d", r);
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_ERROR("OSFS Error %d\n", r);
|
||||
LOG_ERROR("OSFS Error %d", r);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -97,13 +97,13 @@ bool copyFile(const char *from, const char *to)
|
|||
|
||||
File f1 = FSCom.open(from, FILE_O_READ);
|
||||
if (!f1) {
|
||||
LOG_ERROR("Failed to open source file %s\n", from);
|
||||
LOG_ERROR("Failed to open source file %s", from);
|
||||
return false;
|
||||
}
|
||||
|
||||
File f2 = FSCom.open(to, FILE_O_WRITE);
|
||||
if (!f2) {
|
||||
LOG_ERROR("Failed to open destination file %s\n", to);
|
||||
LOG_ERROR("Failed to open destination file %s", to);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||
#ifdef ARCH_ESP32
|
||||
listDir(file.path(), levels - 1, del);
|
||||
if (del) {
|
||||
LOG_DEBUG("Removing %s\n", file.path());
|
||||
LOG_DEBUG("Removing %s", file.path());
|
||||
strncpy(buffer, file.path(), sizeof(buffer));
|
||||
file.close();
|
||||
FSCom.rmdir(buffer);
|
||||
|
@ -241,7 +241,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||
listDir(file.name(), levels - 1, del);
|
||||
if (del) {
|
||||
LOG_DEBUG("Removing %s\n", file.name());
|
||||
LOG_DEBUG("Removing %s", file.name());
|
||||
strncpy(buffer, file.name(), sizeof(buffer));
|
||||
file.close();
|
||||
FSCom.rmdir(buffer);
|
||||
|
@ -249,7 +249,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||
file.close();
|
||||
}
|
||||
#else
|
||||
LOG_DEBUG(" %s (directory)\n", file.name());
|
||||
LOG_DEBUG(" %s (directory)", file.name());
|
||||
listDir(file.name(), levels - 1, del);
|
||||
file.close();
|
||||
#endif
|
||||
|
@ -257,26 +257,26 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||
} else {
|
||||
#ifdef ARCH_ESP32
|
||||
if (del) {
|
||||
LOG_DEBUG("Deleting %s\n", file.path());
|
||||
LOG_DEBUG("Deleting %s", file.path());
|
||||
strncpy(buffer, file.path(), sizeof(buffer));
|
||||
file.close();
|
||||
FSCom.remove(buffer);
|
||||
} else {
|
||||
LOG_DEBUG(" %s (%i Bytes)\n", file.path(), file.size());
|
||||
LOG_DEBUG(" %s (%i Bytes)", file.path(), file.size());
|
||||
file.close();
|
||||
}
|
||||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||
if (del) {
|
||||
LOG_DEBUG("Deleting %s\n", file.name());
|
||||
LOG_DEBUG("Deleting %s", file.name());
|
||||
strncpy(buffer, file.name(), sizeof(buffer));
|
||||
file.close();
|
||||
FSCom.remove(buffer);
|
||||
} else {
|
||||
LOG_DEBUG(" %s (%i Bytes)\n", file.name(), file.size());
|
||||
LOG_DEBUG(" %s (%i Bytes)", file.name(), file.size());
|
||||
file.close();
|
||||
}
|
||||
#else
|
||||
LOG_DEBUG(" %s (%i Bytes)\n", file.name(), file.size());
|
||||
LOG_DEBUG(" %s (%i Bytes)", file.name(), file.size());
|
||||
file.close();
|
||||
#endif
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||
}
|
||||
#ifdef ARCH_ESP32
|
||||
if (del) {
|
||||
LOG_DEBUG("Removing %s\n", root.path());
|
||||
LOG_DEBUG("Removing %s", root.path());
|
||||
strncpy(buffer, root.path(), sizeof(buffer));
|
||||
root.close();
|
||||
FSCom.rmdir(buffer);
|
||||
|
@ -293,7 +293,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||
}
|
||||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||
if (del) {
|
||||
LOG_DEBUG("Removing %s\n", root.name());
|
||||
LOG_DEBUG("Removing %s", root.name());
|
||||
strncpy(buffer, root.name(), sizeof(buffer));
|
||||
root.close();
|
||||
FSCom.rmdir(buffer);
|
||||
|
@ -329,13 +329,13 @@ void fsInit()
|
|||
{
|
||||
#ifdef FSCom
|
||||
if (!FSBegin()) {
|
||||
LOG_ERROR("Filesystem mount Failed.\n");
|
||||
LOG_ERROR("Filesystem mount Failed.");
|
||||
// assert(0); This auto-formats the partition, so no need to fail here.
|
||||
}
|
||||
#if defined(ARCH_ESP32)
|
||||
LOG_DEBUG("Filesystem files (%d/%d Bytes):\n", FSCom.usedBytes(), FSCom.totalBytes());
|
||||
LOG_DEBUG("Filesystem files (%d/%d Bytes):", FSCom.usedBytes(), FSCom.totalBytes());
|
||||
#else
|
||||
LOG_DEBUG("Filesystem files:\n");
|
||||
LOG_DEBUG("Filesystem files:");
|
||||
#endif
|
||||
listDir("/", 10);
|
||||
#endif
|
||||
|
@ -350,28 +350,28 @@ void setupSDCard()
|
|||
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
||||
|
||||
if (!SD.begin(SDCARD_CS, SDHandler)) {
|
||||
LOG_DEBUG("No SD_MMC card detected\n");
|
||||
LOG_DEBUG("No SD_MMC card detected");
|
||||
return;
|
||||
}
|
||||
uint8_t cardType = SD.cardType();
|
||||
if (cardType == CARD_NONE) {
|
||||
LOG_DEBUG("No SD_MMC card attached\n");
|
||||
LOG_DEBUG("No SD_MMC card attached");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("SD_MMC Card Type: ");
|
||||
if (cardType == CARD_MMC) {
|
||||
LOG_DEBUG("MMC\n");
|
||||
LOG_DEBUG("MMC");
|
||||
} else if (cardType == CARD_SD) {
|
||||
LOG_DEBUG("SDSC\n");
|
||||
LOG_DEBUG("SDSC");
|
||||
} else if (cardType == CARD_SDHC) {
|
||||
LOG_DEBUG("SDHC\n");
|
||||
LOG_DEBUG("SDHC");
|
||||
} else {
|
||||
LOG_DEBUG("UNKNOWN\n");
|
||||
LOG_DEBUG("UNKNOWN");
|
||||
}
|
||||
|
||||
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
|
||||
LOG_DEBUG("SD Card Size: %lu MB\n", (uint32_t)cardSize);
|
||||
LOG_DEBUG("Total space: %lu MB\n", (uint32_t)(SD.totalBytes() / (1024 * 1024)));
|
||||
LOG_DEBUG("Used space: %lu MB\n", (uint32_t)(SD.usedBytes() / (1024 * 1024)));
|
||||
LOG_DEBUG("SD Card Size: %lu MB", (uint32_t)cardSize);
|
||||
LOG_DEBUG("Total space: %lu MB", (uint32_t)(SD.totalBytes() / (1024 * 1024)));
|
||||
LOG_DEBUG("Used space: %lu MB", (uint32_t)(SD.usedBytes() / (1024 * 1024)));
|
||||
#endif
|
||||
}
|
|
@ -51,7 +51,7 @@ class GPSStatus : public Status
|
|||
{
|
||||
if (config.position.fixed_position) {
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_WARN("Using fixed latitude\n");
|
||||
LOG_WARN("Using fixed latitude");
|
||||
#endif
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
return node->position.latitude_i;
|
||||
|
@ -64,7 +64,7 @@ class GPSStatus : public Status
|
|||
{
|
||||
if (config.position.fixed_position) {
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_WARN("Using fixed longitude\n");
|
||||
LOG_WARN("Using fixed longitude");
|
||||
#endif
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
return node->position.longitude_i;
|
||||
|
@ -77,7 +77,7 @@ class GPSStatus : public Status
|
|||
{
|
||||
if (config.position.fixed_position) {
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_WARN("Using fixed altitude\n");
|
||||
LOG_WARN("Using fixed altitude");
|
||||
#endif
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
return node->position.altitude;
|
||||
|
@ -95,7 +95,7 @@ class GPSStatus : public Status
|
|||
bool matches(const GPSStatus *newStatus) const
|
||||
{
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("GPSStatus.match() new pos@%x to old pos@%x\n", newStatus->p.timestamp, p.timestamp);
|
||||
LOG_DEBUG("GPSStatus.match() new pos@%x to old pos@%x", newStatus->p.timestamp, p.timestamp);
|
||||
#endif
|
||||
return (newStatus->hasLock != hasLock || newStatus->isConnected != isConnected ||
|
||||
newStatus->isPowerSaving != isPowerSaving || newStatus->p.latitude_i != p.latitude_i ||
|
||||
|
@ -112,7 +112,7 @@ class GPSStatus : public Status
|
|||
|
||||
if (isDirty && p.timestamp && (newStatus->p.timestamp == p.timestamp)) {
|
||||
// We can NEVER be in two locations at the same time! (also PR #886)
|
||||
LOG_ERROR("BUG: Positional timestamp unchanged from prev solution\n");
|
||||
LOG_ERROR("BUG: Positional timestamp unchanged from prev solution");
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
|
@ -124,11 +124,11 @@ class GPSStatus : public Status
|
|||
if (isDirty) {
|
||||
if (hasLock) {
|
||||
// In debug logs, identify position by @timestamp:stage (stage 3 = notify)
|
||||
LOG_DEBUG("New GPS pos@%x:3 lat=%f lon=%f alt=%d pdop=%.2f track=%.2f speed=%.2f sats=%d\n", p.timestamp,
|
||||
LOG_DEBUG("New GPS pos@%x:3 lat=%f lon=%f alt=%d pdop=%.2f track=%.2f speed=%.2f sats=%d", p.timestamp,
|
||||
p.latitude_i * 1e-7, p.longitude_i * 1e-7, p.altitude, p.PDOP * 1e-2, p.ground_track * 1e-5,
|
||||
p.ground_speed * 1e-2, p.sats_in_view);
|
||||
} else {
|
||||
LOG_DEBUG("No GPS lock\n");
|
||||
LOG_DEBUG("No GPS lock");
|
||||
}
|
||||
onNewStatus.notifyObservers(this);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ void GpioVirtPin::set(bool value)
|
|||
|
||||
void GpioHwPin::set(bool value)
|
||||
{
|
||||
// if (num == 3) LOG_DEBUG("Setting pin %d to %d\n", num, value);
|
||||
// if (num == 3) LOG_DEBUG("Setting pin %d to %d", num, value);
|
||||
pinMode(num, OUTPUT);
|
||||
digitalWrite(num, value);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void GpioBinaryTransformer::update()
|
|||
newValue = (GpioVirtPin::PinState)(p1 && p2);
|
||||
break;
|
||||
case Or:
|
||||
// LOG_DEBUG("Doing GPIO OR\n");
|
||||
// LOG_DEBUG("Doing GPIO OR");
|
||||
newValue = (GpioVirtPin::PinState)(p1 || p2);
|
||||
break;
|
||||
case Xor:
|
||||
|
|
|
@ -56,7 +56,7 @@ class NodeStatus : public Status
|
|||
numTotal = newStatus->getNumTotal();
|
||||
}
|
||||
if (isDirty || newStatus->forceUpdate) {
|
||||
LOG_DEBUG("Node status update: %d online, %d total\n", numOnline, numTotal);
|
||||
LOG_DEBUG("Node status update: %d online, %d total", numOnline, numTotal);
|
||||
onNewStatus.notifyObservers(this);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -240,7 +240,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(HAS_PMU) && \
|
||||
!MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
if (hasINA()) {
|
||||
LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage\n", config.power.device_battery_ina_address);
|
||||
LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage", config.power.device_battery_ina_address);
|
||||
return getINAVoltage();
|
||||
}
|
||||
#endif
|
||||
|
@ -290,7 +290,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||
last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF
|
||||
}
|
||||
|
||||
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t)
|
||||
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t)
|
||||
// (last_read_value));
|
||||
}
|
||||
return last_read_value;
|
||||
|
@ -335,7 +335,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||
raw += adc_buf;
|
||||
raw_c++; // Count valid samples
|
||||
} else {
|
||||
LOG_DEBUG("An attempt to sample ADC2 failed\n");
|
||||
LOG_DEBUG("An attempt to sample ADC2 failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,7 @@ bool Power::analogInit()
|
|||
#endif
|
||||
|
||||
#ifdef BATTERY_PIN
|
||||
LOG_DEBUG("Using analog input %d for battery level\n", BATTERY_PIN);
|
||||
LOG_DEBUG("Using analog input %d for battery level", BATTERY_PIN);
|
||||
|
||||
// disable any internal pullups
|
||||
pinMode(BATTERY_PIN, INPUT);
|
||||
|
@ -526,18 +526,18 @@ bool Power::analogInit()
|
|||
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, width, DEFAULT_VREF, adc_characs);
|
||||
// show ADC characterization base
|
||||
if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
|
||||
LOG_INFO("ADCmod: ADC characterization based on Two Point values stored in eFuse\n");
|
||||
LOG_INFO("ADCmod: ADC characterization based on Two Point values stored in eFuse");
|
||||
} else if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
|
||||
LOG_INFO("ADCmod: ADC characterization based on reference voltage stored in eFuse\n");
|
||||
LOG_INFO("ADCmod: ADC characterization based on reference voltage stored in eFuse");
|
||||
}
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S3
|
||||
// ESP32S3
|
||||
else if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP_FIT) {
|
||||
LOG_INFO("ADCmod: ADC Characterization based on Two Point values and fitting curve coefficients stored in eFuse\n");
|
||||
LOG_INFO("ADCmod: ADC Characterization based on Two Point values and fitting curve coefficients stored in eFuse");
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
LOG_INFO("ADCmod: ADC characterization based on default reference voltage\n");
|
||||
LOG_INFO("ADCmod: ADC characterization based on default reference voltage");
|
||||
}
|
||||
#endif // ARCH_ESP32
|
||||
|
||||
|
@ -586,7 +586,7 @@ bool Power::setup()
|
|||
|
||||
void Power::shutdown()
|
||||
{
|
||||
LOG_INFO("Shutting down\n");
|
||||
LOG_INFO("Shutting down");
|
||||
|
||||
#if defined(ARCH_NRF52) || defined(ARCH_ESP32) || defined(ARCH_RP2040)
|
||||
#ifdef PIN_LED1
|
||||
|
@ -641,7 +641,7 @@ void Power::readPowerStatus()
|
|||
// changes.
|
||||
|
||||
nrfx_power_usb_state_t nrf_usb_state = nrfx_power_usbstatus_get();
|
||||
// LOG_DEBUG("NRF Power %d\n", nrf_usb_state);
|
||||
// LOG_DEBUG("NRF Power %d", nrf_usb_state);
|
||||
|
||||
// If changed to DISCONNECTED
|
||||
if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED)
|
||||
|
@ -654,22 +654,22 @@ void Power::readPowerStatus()
|
|||
|
||||
// Notify any status instances that are observing us
|
||||
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent);
|
||||
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus2.getHasUSB(),
|
||||
powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
||||
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(),
|
||||
powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
||||
newStatus.notifyObservers(&powerStatus2);
|
||||
#ifdef DEBUG_HEAP
|
||||
if (lastheap != memGet.getFreeHeap()) {
|
||||
LOG_DEBUG("Threads running:");
|
||||
std::string threadlist = "Threads running:";
|
||||
int running = 0;
|
||||
for (int i = 0; i < MAX_THREADS; i++) {
|
||||
auto thread = concurrency::mainController.get(i);
|
||||
if ((thread != nullptr) && (thread->enabled)) {
|
||||
LOG_DEBUG(" %s", thread->ThreadName.c_str());
|
||||
threadlist += vformat(" %s", thread->ThreadName.c_str());
|
||||
running++;
|
||||
}
|
||||
}
|
||||
LOG_DEBUG("\n");
|
||||
LOG_DEBUG("Heap status: %d/%d bytes free (%d), running %d/%d threads\n", memGet.getFreeHeap(), memGet.getHeapSize(),
|
||||
LOG_DEBUG(threadlist.c_str());
|
||||
LOG_DEBUG("Heap status: %d/%d bytes free (%d), running %d/%d threads", memGet.getFreeHeap(), memGet.getHeapSize(),
|
||||
memGet.getFreeHeap() - lastheap, running, concurrency::mainController.size(false));
|
||||
lastheap = memGet.getFreeHeap();
|
||||
}
|
||||
|
@ -702,13 +702,13 @@ void Power::readPowerStatus()
|
|||
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
||||
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
|
||||
low_voltage_counter++;
|
||||
LOG_DEBUG("Low voltage counter: %d/10\n", low_voltage_counter);
|
||||
LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter);
|
||||
if (low_voltage_counter > 10) {
|
||||
#ifdef ARCH_NRF52
|
||||
// We can't trigger deep sleep on NRF52, it's freezing the board
|
||||
LOG_DEBUG("Low voltage detected, but not triggering deep sleep\n");
|
||||
LOG_DEBUG("Low voltage detected, but not triggering deep sleep");
|
||||
#else
|
||||
LOG_INFO("Low voltage detected, triggering deep sleep\n");
|
||||
LOG_INFO("Low voltage detected, triggering deep sleep");
|
||||
powerFSM.trigger(EVENT_LOW_BATTERY);
|
||||
#endif
|
||||
}
|
||||
|
@ -730,12 +730,12 @@ int32_t Power::runOnce()
|
|||
PMU->getIrqStatus();
|
||||
|
||||
if (PMU->isVbusRemoveIrq()) {
|
||||
LOG_INFO("USB unplugged\n");
|
||||
LOG_INFO("USB unplugged");
|
||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||
}
|
||||
|
||||
if (PMU->isVbusInsertIrq()) {
|
||||
LOG_INFO("USB plugged In\n");
|
||||
LOG_INFO("USB plugged In");
|
||||
powerFSM.trigger(EVENT_POWER_CONNECTED);
|
||||
}
|
||||
|
||||
|
@ -743,21 +743,21 @@ int32_t Power::runOnce()
|
|||
Other things we could check if we cared...
|
||||
|
||||
if (PMU->isBatChagerStartIrq()) {
|
||||
LOG_DEBUG("Battery start charging\n");
|
||||
LOG_DEBUG("Battery start charging");
|
||||
}
|
||||
if (PMU->isBatChagerDoneIrq()) {
|
||||
LOG_DEBUG("Battery fully charged\n");
|
||||
LOG_DEBUG("Battery fully charged");
|
||||
}
|
||||
if (PMU->isBatInsertIrq()) {
|
||||
LOG_DEBUG("Battery inserted\n");
|
||||
LOG_DEBUG("Battery inserted");
|
||||
}
|
||||
if (PMU->isBatRemoveIrq()) {
|
||||
LOG_DEBUG("Battery removed\n");
|
||||
LOG_DEBUG("Battery removed");
|
||||
}
|
||||
*/
|
||||
#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3?
|
||||
if (PMU->isPekeyLongPressIrq()) {
|
||||
LOG_DEBUG("PEK long button press\n");
|
||||
LOG_DEBUG("PEK long button press");
|
||||
screen->setOn(false);
|
||||
}
|
||||
#endif
|
||||
|
@ -800,22 +800,22 @@ bool Power::axpChipInit()
|
|||
if (!PMU) {
|
||||
PMU = new XPowersAXP2101(*w);
|
||||
if (!PMU->init()) {
|
||||
LOG_WARN("Failed to find AXP2101 power management\n");
|
||||
LOG_WARN("Failed to find AXP2101 power management");
|
||||
delete PMU;
|
||||
PMU = NULL;
|
||||
} else {
|
||||
LOG_INFO("AXP2101 PMU init succeeded, using AXP2101 PMU\n");
|
||||
LOG_INFO("AXP2101 PMU init succeeded, using AXP2101 PMU");
|
||||
}
|
||||
}
|
||||
|
||||
if (!PMU) {
|
||||
PMU = new XPowersAXP192(*w);
|
||||
if (!PMU->init()) {
|
||||
LOG_WARN("Failed to find AXP192 power management\n");
|
||||
LOG_WARN("Failed to find AXP192 power management");
|
||||
delete PMU;
|
||||
PMU = NULL;
|
||||
} else {
|
||||
LOG_INFO("AXP192 PMU init succeeded, using AXP192 PMU\n");
|
||||
LOG_INFO("AXP192 PMU init succeeded, using AXP192 PMU");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -972,51 +972,51 @@ bool Power::axpChipInit()
|
|||
PMU->enableBattVoltageMeasure();
|
||||
|
||||
if (PMU->isChannelAvailable(XPOWERS_DCDC1)) {
|
||||
LOG_DEBUG("DC1 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC1) ? "+" : "-",
|
||||
LOG_DEBUG("DC1 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC1) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC1));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_DCDC2)) {
|
||||
LOG_DEBUG("DC2 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC2) ? "+" : "-",
|
||||
LOG_DEBUG("DC2 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC2) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC2));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_DCDC3)) {
|
||||
LOG_DEBUG("DC3 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC3) ? "+" : "-",
|
||||
LOG_DEBUG("DC3 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC3) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC3));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_DCDC4)) {
|
||||
LOG_DEBUG("DC4 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC4) ? "+" : "-",
|
||||
LOG_DEBUG("DC4 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC4) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC4));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_LDO2)) {
|
||||
LOG_DEBUG("LDO2 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_LDO2) ? "+" : "-",
|
||||
LOG_DEBUG("LDO2 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_LDO2) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_LDO2));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_LDO3)) {
|
||||
LOG_DEBUG("LDO3 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_LDO3) ? "+" : "-",
|
||||
LOG_DEBUG("LDO3 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_LDO3) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_LDO3));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_ALDO1)) {
|
||||
LOG_DEBUG("ALDO1: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO1) ? "+" : "-",
|
||||
LOG_DEBUG("ALDO1: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO1) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO1));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_ALDO2)) {
|
||||
LOG_DEBUG("ALDO2: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO2) ? "+" : "-",
|
||||
LOG_DEBUG("ALDO2: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO2) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO2));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_ALDO3)) {
|
||||
LOG_DEBUG("ALDO3: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO3) ? "+" : "-",
|
||||
LOG_DEBUG("ALDO3: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO3) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO3));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_ALDO4)) {
|
||||
LOG_DEBUG("ALDO4: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO4) ? "+" : "-",
|
||||
LOG_DEBUG("ALDO4: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO4) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO4));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_BLDO1)) {
|
||||
LOG_DEBUG("BLDO1: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_BLDO1) ? "+" : "-",
|
||||
LOG_DEBUG("BLDO1: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_BLDO1) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_BLDO1));
|
||||
}
|
||||
if (PMU->isChannelAvailable(XPOWERS_BLDO2)) {
|
||||
LOG_DEBUG("BLDO2: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_BLDO2) ? "+" : "-",
|
||||
LOG_DEBUG("BLDO2: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_BLDO2) ? "+" : "-",
|
||||
PMU->getPowerChannelVoltage(XPOWERS_BLDO2));
|
||||
}
|
||||
|
||||
|
@ -1124,7 +1124,7 @@ LipoBatteryLevel lipoLevel;
|
|||
bool Power::lipoInit()
|
||||
{
|
||||
bool result = lipoLevel.runOnce();
|
||||
LOG_DEBUG("Power::lipoInit lipo sensor is %s\n", result ? "ready" : "not ready yet");
|
||||
LOG_DEBUG("Power::lipoInit lipo sensor is %s", result ? "ready" : "not ready yet");
|
||||
if (!result)
|
||||
return false;
|
||||
batteryLevel = &lipoLevel;
|
||||
|
|
|
@ -53,7 +53,7 @@ static bool isPowered()
|
|||
|
||||
static void sdsEnter()
|
||||
{
|
||||
LOG_DEBUG("Enter state: SDS\n");
|
||||
LOG_DEBUG("Enter state: SDS");
|
||||
// FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw
|
||||
doDeepSleep(Default::getConfiguredOrDefaultMs(config.power.sds_secs), false);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ extern Power *power;
|
|||
|
||||
static void shutdownEnter()
|
||||
{
|
||||
LOG_DEBUG("Enter state: SHUTDOWN\n");
|
||||
LOG_DEBUG("Enter state: SHUTDOWN");
|
||||
power->shutdown();
|
||||
}
|
||||
|
||||
|
@ -72,16 +72,16 @@ static uint32_t secsSlept;
|
|||
|
||||
static void lsEnter()
|
||||
{
|
||||
LOG_INFO("lsEnter begin, ls_secs=%u\n", config.power.ls_secs);
|
||||
LOG_INFO("lsEnter begin, ls_secs=%u", config.power.ls_secs);
|
||||
screen->setOn(false);
|
||||
secsSlept = 0; // How long have we been sleeping this time
|
||||
|
||||
// LOG_INFO("lsEnter end\n");
|
||||
// LOG_INFO("lsEnter end");
|
||||
}
|
||||
|
||||
static void lsIdle()
|
||||
{
|
||||
// LOG_INFO("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
|
||||
// LOG_INFO("lsIdle begin ls_secs=%u", getPref_ls_secs());
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
|
||||
|
@ -105,7 +105,7 @@ static void lsIdle()
|
|||
wakeCause2 = doLightSleep(100); // leave led on for 1ms
|
||||
|
||||
secsSlept += sleepTime;
|
||||
// LOG_INFO("sleeping, flash led!\n");
|
||||
// LOG_INFO("sleeping, flash led!");
|
||||
break;
|
||||
|
||||
case ESP_SLEEP_WAKEUP_UART:
|
||||
|
@ -137,7 +137,7 @@ static void lsIdle()
|
|||
} else {
|
||||
// Time to stop sleeping!
|
||||
ledBlink.set(false);
|
||||
LOG_INFO("Reached ls_secs, servicing loop()\n");
|
||||
LOG_INFO("Reached ls_secs, servicing loop()");
|
||||
powerFSM.trigger(EVENT_WAKE_TIMER);
|
||||
}
|
||||
#endif
|
||||
|
@ -145,12 +145,12 @@ static void lsIdle()
|
|||
|
||||
static void lsExit()
|
||||
{
|
||||
LOG_INFO("Exit state: LS\n");
|
||||
LOG_INFO("Exit state: LS");
|
||||
}
|
||||
|
||||
static void nbEnter()
|
||||
{
|
||||
LOG_DEBUG("Enter state: NB\n");
|
||||
LOG_DEBUG("Enter state: NB");
|
||||
screen->setOn(false);
|
||||
#ifdef ARCH_ESP32
|
||||
// Only ESP32 should turn off bluetooth
|
||||
|
@ -168,7 +168,7 @@ static void darkEnter()
|
|||
|
||||
static void serialEnter()
|
||||
{
|
||||
LOG_DEBUG("Enter state: SERIAL\n");
|
||||
LOG_DEBUG("Enter state: SERIAL");
|
||||
setBluetoothEnable(false);
|
||||
screen->setOn(true);
|
||||
screen->print("Serial connected\n");
|
||||
|
@ -183,10 +183,10 @@ static void serialExit()
|
|||
|
||||
static void powerEnter()
|
||||
{
|
||||
// LOG_DEBUG("Enter state: POWER\n");
|
||||
// LOG_DEBUG("Enter state: POWER");
|
||||
if (!isPowered()) {
|
||||
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
|
||||
LOG_INFO("Loss of power in Powered\n");
|
||||
LOG_INFO("Loss of power in Powered");
|
||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||
} else {
|
||||
screen->setOn(true);
|
||||
|
@ -205,7 +205,7 @@ static void powerIdle()
|
|||
{
|
||||
if (!isPowered()) {
|
||||
// If we got here, we are in the wrong state
|
||||
LOG_INFO("Loss of power in Powered\n");
|
||||
LOG_INFO("Loss of power in Powered");
|
||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ static void powerExit()
|
|||
|
||||
static void onEnter()
|
||||
{
|
||||
LOG_DEBUG("Enter state: ON\n");
|
||||
LOG_DEBUG("Enter state: ON");
|
||||
screen->setOn(true);
|
||||
setBluetoothEnable(true);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ static void screenPress()
|
|||
|
||||
static void bootEnter()
|
||||
{
|
||||
LOG_DEBUG("Enter state: BOOT\n");
|
||||
LOG_DEBUG("Enter state: BOOT");
|
||||
}
|
||||
|
||||
State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN");
|
||||
|
@ -264,7 +264,7 @@ void PowerFSM_setup()
|
|||
config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR;
|
||||
bool hasPower = isPowered();
|
||||
|
||||
LOG_INFO("PowerFSM init, USB power=%d\n", hasPower ? 1 : 0);
|
||||
LOG_INFO("PowerFSM init, USB power=%d", hasPower ? 1 : 0);
|
||||
powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout");
|
||||
|
||||
// wake timer expired or a packet arrived
|
||||
|
|
|
@ -35,7 +35,7 @@ void PowerMon::emitLog(const char *reason)
|
|||
{
|
||||
#ifdef USE_POWERMON
|
||||
// The nrf52 printf doesn't understand 64 bit ints, so if we ever reach that point this function will need to change.
|
||||
LOG_INFO("S:PM:0x%08lx,%s\n", (uint32_t)states, reason);
|
||||
LOG_INFO("S:PM:0x%08lx,%s", (uint32_t)states, reason);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class PowerStatus : public Status
|
|||
isCharging = newStatus->isCharging;
|
||||
}
|
||||
if (isDirty) {
|
||||
// LOG_DEBUG("Battery %dmV %d%%\n", batteryVoltageMv, batteryChargePercent);
|
||||
// LOG_DEBUG("Battery %dmV %d%%", batteryVoltageMv, batteryChargePercent);
|
||||
onNewStatus.notifyObservers(this);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -98,81 +98,75 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format,
|
|||
{
|
||||
size_t r = 0;
|
||||
|
||||
// Cope with 0 len format strings, but look for new line terminator
|
||||
bool hasNewline = *format && format[strlen(format) - 1] == '\n';
|
||||
#ifdef ARCH_PORTDUINO
|
||||
bool color = !settingsMap[ascii_logs];
|
||||
#else
|
||||
bool color = true;
|
||||
#endif
|
||||
|
||||
// If we are the first message on a report, include the header
|
||||
if (!isContinuationMessage) {
|
||||
// include the header
|
||||
if (color) {
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
||||
Print::write("\u001b[34m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
||||
Print::write("\u001b[32m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
||||
Print::write("\u001b[33m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0)
|
||||
Print::write("\u001b[31m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
||||
Print::write("\u001b[35m", 6);
|
||||
}
|
||||
|
||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile
|
||||
if (rtc_sec > 0) {
|
||||
long hms = rtc_sec % SEC_PER_DAY;
|
||||
// hms += tz.tz_dsttime * SEC_PER_HOUR;
|
||||
// hms -= tz.tz_minuteswest * SEC_PER_MIN;
|
||||
// mod `hms` to ensure in positive range of [0...SEC_PER_DAY)
|
||||
hms = (hms + SEC_PER_DAY) % SEC_PER_DAY;
|
||||
|
||||
// Tear apart hms into h:m:s
|
||||
int hour = hms / SEC_PER_HOUR;
|
||||
int min = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||
int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
||||
#ifdef ARCH_PORTDUINO
|
||||
::printf("%s ", logLevel);
|
||||
if (color) {
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
||||
Print::write("\u001b[34m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
||||
Print::write("\u001b[32m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
||||
Print::write("\u001b[33m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0)
|
||||
Print::write("\u001b[31m", 6);
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
||||
Print::write("\u001b[35m", 6);
|
||||
::printf("\u001b[0m");
|
||||
}
|
||||
|
||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile
|
||||
if (rtc_sec > 0) {
|
||||
long hms = rtc_sec % SEC_PER_DAY;
|
||||
// hms += tz.tz_dsttime * SEC_PER_HOUR;
|
||||
// hms -= tz.tz_minuteswest * SEC_PER_MIN;
|
||||
// mod `hms` to ensure in positive range of [0...SEC_PER_DAY)
|
||||
hms = (hms + SEC_PER_DAY) % SEC_PER_DAY;
|
||||
|
||||
// Tear apart hms into h:m:s
|
||||
int hour = hms / SEC_PER_HOUR;
|
||||
int min = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||
int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
||||
#ifdef ARCH_PORTDUINO
|
||||
::printf("%s ", logLevel);
|
||||
if (color) {
|
||||
::printf("\u001b[0m");
|
||||
}
|
||||
::printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||
::printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||
#else
|
||||
printf("%s ", logLevel);
|
||||
if (color) {
|
||||
printf("\u001b[0m");
|
||||
}
|
||||
printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||
printf("%s ", logLevel);
|
||||
if (color) {
|
||||
printf("\u001b[0m");
|
||||
}
|
||||
printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||
#endif
|
||||
} else {
|
||||
} else {
|
||||
#ifdef ARCH_PORTDUINO
|
||||
::printf("%s ", logLevel);
|
||||
if (color) {
|
||||
::printf("\u001b[0m");
|
||||
}
|
||||
::printf("| ??:??:?? %u ", millis() / 1000);
|
||||
::printf("%s ", logLevel);
|
||||
if (color) {
|
||||
::printf("\u001b[0m");
|
||||
}
|
||||
::printf("| ??:??:?? %u ", millis() / 1000);
|
||||
#else
|
||||
printf("%s ", logLevel);
|
||||
if (color) {
|
||||
printf("\u001b[0m");
|
||||
}
|
||||
printf("| ??:??:?? %u ", millis() / 1000);
|
||||
printf("%s ", logLevel);
|
||||
if (color) {
|
||||
printf("\u001b[0m");
|
||||
}
|
||||
printf("| ??:??:?? %u ", millis() / 1000);
|
||||
#endif
|
||||
}
|
||||
auto thread = concurrency::OSThread::currentThread;
|
||||
if (thread) {
|
||||
print("[");
|
||||
// printf("%p ", thread);
|
||||
// assert(thread->ThreadName.length());
|
||||
print(thread->ThreadName);
|
||||
print("] ");
|
||||
}
|
||||
}
|
||||
auto thread = concurrency::OSThread::currentThread;
|
||||
if (thread) {
|
||||
print("[");
|
||||
// printf("%p ", thread);
|
||||
// assert(thread->ThreadName.length());
|
||||
print(thread->ThreadName);
|
||||
print("] ");
|
||||
}
|
||||
r += vprintf(logLevel, format, arg);
|
||||
|
||||
isContinuationMessage = !hasNewline;
|
||||
}
|
||||
|
||||
void RedirectablePrint::log_to_syslog(const char *logLevel, const char *format, va_list arg)
|
||||
|
@ -283,29 +277,44 @@ meshtastic_LogRecord_Level RedirectablePrint::getLogLevel(const char *logLevel)
|
|||
|
||||
void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
||||
{
|
||||
|
||||
// append \n to format
|
||||
size_t len = strlen(format);
|
||||
char *newFormat = new char[len + 2];
|
||||
strcpy(newFormat, format);
|
||||
newFormat[len] = '\n';
|
||||
newFormat[len + 1] = '\0';
|
||||
|
||||
#if ARCH_PORTDUINO
|
||||
// level trace is special, two possible ways to handle it.
|
||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0) {
|
||||
if (settingsStrings[traceFilename] != "") {
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
va_start(arg, newFormat);
|
||||
try {
|
||||
traceFile << va_arg(arg, char *) << std::endl;
|
||||
} catch (const std::ios_base::failure &e) {
|
||||
}
|
||||
va_end(arg);
|
||||
}
|
||||
if (settingsMap[logoutputlevel] < level_trace && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
||||
if (settingsMap[logoutputlevel] < level_trace && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0) {
|
||||
delete[] newFormat;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (settingsMap[logoutputlevel] < level_debug && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
||||
if (settingsMap[logoutputlevel] < level_debug && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0) {
|
||||
delete[] newFormat;
|
||||
return;
|
||||
else if (settingsMap[logoutputlevel] < level_info && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
||||
} else if (settingsMap[logoutputlevel] < level_info && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0) {
|
||||
delete[] newFormat;
|
||||
return;
|
||||
else if (settingsMap[logoutputlevel] < level_warn && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
||||
} else if (settingsMap[logoutputlevel] < level_warn && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0) {
|
||||
delete[] newFormat;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (moduleConfig.serial.override_console_serial_port && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0) {
|
||||
delete[] newFormat;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -317,11 +326,11 @@ void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
|||
#endif
|
||||
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
va_start(arg, newFormat);
|
||||
|
||||
log_to_serial(logLevel, format, arg);
|
||||
log_to_syslog(logLevel, format, arg);
|
||||
log_to_ble(logLevel, format, arg);
|
||||
log_to_serial(logLevel, newFormat, arg);
|
||||
log_to_syslog(logLevel, newFormat, arg);
|
||||
log_to_ble(logLevel, newFormat, arg);
|
||||
|
||||
va_end(arg);
|
||||
#ifdef HAS_FREE_RTOS
|
||||
|
@ -331,17 +340,18 @@ void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
|||
#endif
|
||||
}
|
||||
|
||||
delete[] newFormat;
|
||||
return;
|
||||
}
|
||||
|
||||
void RedirectablePrint::hexDump(const char *logLevel, unsigned char *buf, uint16_t len)
|
||||
{
|
||||
const char alphabet[17] = "0123456789abcdef";
|
||||
log(logLevel, " +------------------------------------------------+ +----------------+\n");
|
||||
log(logLevel, " |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f | | ASCII |\n");
|
||||
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||
log(logLevel, " |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f | | ASCII |");
|
||||
for (uint16_t i = 0; i < len; i += 16) {
|
||||
if (i % 128 == 0)
|
||||
log(logLevel, " +------------------------------------------------+ +----------------+\n");
|
||||
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||
char s[] = "| | | |\n";
|
||||
uint8_t ix = 1, iy = 52;
|
||||
for (uint8_t j = 0; j < 16; j++) {
|
||||
|
@ -363,7 +373,7 @@ void RedirectablePrint::hexDump(const char *logLevel, unsigned char *buf, uint16
|
|||
log(logLevel, ".");
|
||||
log(logLevel, s);
|
||||
}
|
||||
log(logLevel, " +------------------------------------------------+ +----------------+\n");
|
||||
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||
}
|
||||
|
||||
std::string RedirectablePrint::mt_sprintf(const std::string fmt_str, ...)
|
||||
|
|
|
@ -15,9 +15,6 @@ class RedirectablePrint : public Print
|
|||
{
|
||||
Print *dest;
|
||||
|
||||
/// Used to allow multiple logDebug messages to appear on a single log line
|
||||
bool isContinuationMessage = false;
|
||||
|
||||
#ifdef HAS_FREE_RTOS
|
||||
SemaphoreHandle_t inDebugPrint = nullptr;
|
||||
StaticSemaphore_t _MutexStorageSpace;
|
||||
|
|
|
@ -59,14 +59,14 @@ bool SafeFile::close()
|
|||
|
||||
// brief window of risk here ;-)
|
||||
if (fullAtomic && FSCom.exists(filename.c_str()) && !FSCom.remove(filename.c_str())) {
|
||||
LOG_ERROR("Can't remove old pref file\n");
|
||||
LOG_ERROR("Can't remove old pref file");
|
||||
return false;
|
||||
}
|
||||
|
||||
String filenameTmp = filename;
|
||||
filenameTmp += ".tmp";
|
||||
if (!renameFile(filenameTmp.c_str(), filename.c_str())) {
|
||||
LOG_ERROR("Error: can't rename new pref file\n");
|
||||
LOG_ERROR("Error: can't rename new pref file");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ bool SafeFile::testReadback()
|
|||
filenameTmp += ".tmp";
|
||||
auto f2 = FSCom.open(filenameTmp.c_str(), FILE_O_READ);
|
||||
if (!f2) {
|
||||
LOG_ERROR("Can't open tmp file for readback\n");
|
||||
LOG_ERROR("Can't open tmp file for readback");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ bool SafeFile::testReadback()
|
|||
f2.close();
|
||||
|
||||
if (test_hash != hash) {
|
||||
LOG_ERROR("Readback failed hash mismatch\n");
|
||||
LOG_ERROR("Readback failed hash mismatch");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,17 +13,17 @@ void AirTime::logAirtime(reportTypes reportType, uint32_t airtime_ms)
|
|||
{
|
||||
|
||||
if (reportType == TX_LOG) {
|
||||
LOG_DEBUG("Packet transmitted : %ums\n", airtime_ms);
|
||||
LOG_DEBUG("Packet transmitted : %ums", airtime_ms);
|
||||
this->airtimes.periodTX[0] = this->airtimes.periodTX[0] + airtime_ms;
|
||||
air_period_tx[0] = air_period_tx[0] + airtime_ms;
|
||||
|
||||
this->utilizationTX[this->getPeriodUtilHour()] = this->utilizationTX[this->getPeriodUtilHour()] + airtime_ms;
|
||||
} else if (reportType == RX_LOG) {
|
||||
LOG_DEBUG("Packet received : %ums\n", airtime_ms);
|
||||
LOG_DEBUG("Packet received : %ums", airtime_ms);
|
||||
this->airtimes.periodRX[0] = this->airtimes.periodRX[0] + airtime_ms;
|
||||
air_period_rx[0] = air_period_rx[0] + airtime_ms;
|
||||
} else if (reportType == RX_ALL_LOG) {
|
||||
LOG_DEBUG("Packet received (noise?) : %ums\n", airtime_ms);
|
||||
LOG_DEBUG("Packet received (noise?) : %ums", airtime_ms);
|
||||
this->airtimes.periodRX_ALL[0] = this->airtimes.periodRX_ALL[0] + airtime_ms;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void AirTime::airtimeRotatePeriod()
|
|||
{
|
||||
|
||||
if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) {
|
||||
LOG_DEBUG("Rotating airtimes to a new period = %u\n", this->currentPeriodIndex());
|
||||
LOG_DEBUG("Rotating airtimes to a new period = %u", this->currentPeriodIndex());
|
||||
|
||||
for (int i = PERIODS_TO_LOG - 2; i >= 0; --i) {
|
||||
this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i];
|
||||
|
@ -105,7 +105,7 @@ float AirTime::channelUtilizationPercent()
|
|||
uint32_t sum = 0;
|
||||
for (uint32_t i = 0; i < CHANNEL_UTILIZATION_PERIODS; i++) {
|
||||
sum += this->channelUtilization[i];
|
||||
// LOG_DEBUG("ChanUtilArray %u %u\n", i, this->channelUtilization[i]);
|
||||
// LOG_DEBUG("ChanUtilArray %u %u", i, this->channelUtilization[i]);
|
||||
}
|
||||
|
||||
return (float(sum) / float(CHANNEL_UTILIZATION_PERIODS * 10 * 1000)) * 100;
|
||||
|
@ -127,7 +127,7 @@ bool AirTime::isTxAllowedChannelUtil(bool polite)
|
|||
if (channelUtilizationPercent() < percentage) {
|
||||
return true;
|
||||
} else {
|
||||
LOG_WARN("Channel utilization is >%d percent. Skipping this opportunity to send.\n", percentage);
|
||||
LOG_WARN("Channel utilization is >%d percent. Skipping this opportunity to send.", percentage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ bool AirTime::isTxAllowedAirUtil()
|
|||
if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) {
|
||||
return true;
|
||||
} else {
|
||||
LOG_WARN("Tx air utilization is >%f percent. Skipping this opportunity to send.\n",
|
||||
LOG_WARN("Tx air utilization is >%f percent. Skipping this opportunity to send.",
|
||||
myRegion->dutyCycle * polite_duty_cycle_percent / 100);
|
||||
return false;
|
||||
}
|
||||
|
@ -209,13 +209,13 @@ int32_t AirTime::runOnce()
|
|||
}
|
||||
}
|
||||
/*
|
||||
LOG_DEBUG("utilPeriodTX %d TX Airtime %3.2f%\n", utilPeriodTX, airTime->utilizationTXPercent());
|
||||
LOG_DEBUG("utilPeriodTX %d TX Airtime %3.2f%", utilPeriodTX, airTime->utilizationTXPercent());
|
||||
for (uint32_t i = 0; i < MINUTES_IN_HOUR; i++) {
|
||||
LOG_DEBUG(
|
||||
"%d,", this->utilizationTX[i]
|
||||
);
|
||||
}
|
||||
LOG_DEBUG("\n");
|
||||
LOG_DEBUG("");
|
||||
*/
|
||||
return (1000 * 1);
|
||||
}
|
|
@ -18,7 +18,7 @@ bool InterruptableDelay::delay(uint32_t msec)
|
|||
// sem take will return false if we timed out (i.e. were not interrupted)
|
||||
bool r = semaphore.take(msec);
|
||||
|
||||
// LOG_DEBUG("interrupt=%d\n", r);
|
||||
// LOG_DEBUG("interrupt=%d", r);
|
||||
return !r;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ IRAM_ATTR bool NotifiedWorkerThread::notifyCommon(uint32_t v, bool overwrite)
|
|||
|
||||
notification = v;
|
||||
if (debugNotification) {
|
||||
LOG_DEBUG("setting notification %d\n", v);
|
||||
LOG_DEBUG("setting notification %d", v);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (debugNotification) {
|
||||
LOG_DEBUG("dropping notification %d\n", v);
|
||||
LOG_DEBUG("dropping notification %d", v);
|
||||
}
|
||||
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
|
||||
setIntervalFromNow(delay); // a new version of setInterval relative to the current time
|
||||
if (debugNotification) {
|
||||
LOG_DEBUG("delaying notification %u\n", delay);
|
||||
LOG_DEBUG("delaying notification %u", delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,15 +62,15 @@ bool OSThread::shouldRun(unsigned long time)
|
|||
bool r = Thread::shouldRun(time);
|
||||
|
||||
if (showRun && r) {
|
||||
LOG_DEBUG("Thread %s: run\n", ThreadName.c_str());
|
||||
LOG_DEBUG("Thread %s: run", ThreadName.c_str());
|
||||
}
|
||||
|
||||
if (showWaiting && enabled && !r) {
|
||||
LOG_DEBUG("Thread %s: wait %lu\n", ThreadName.c_str(), interval);
|
||||
LOG_DEBUG("Thread %s: wait %lu", ThreadName.c_str(), interval);
|
||||
}
|
||||
|
||||
if (showDisabled && !enabled) {
|
||||
LOG_DEBUG("Thread %s: disabled\n", ThreadName.c_str());
|
||||
LOG_DEBUG("Thread %s: disabled", ThreadName.c_str());
|
||||
}
|
||||
|
||||
return r;
|
||||
|
@ -86,9 +86,9 @@ void OSThread::run()
|
|||
#ifdef DEBUG_HEAP
|
||||
auto newHeap = memGet.getFreeHeap();
|
||||
if (newHeap < heap)
|
||||
LOG_DEBUG("------ Thread %s leaked heap %d -> %d (%d) ------\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
LOG_DEBUG("------ Thread %s leaked heap %d -> %d (%d) ------", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
if (heap < newHeap)
|
||||
LOG_DEBUG("++++++ Thread %s freed heap %d -> %d (%d) ++++++\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
LOG_DEBUG("++++++ Thread %s freed heap %d -> %d (%d) ++++++", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
#endif
|
||||
|
||||
runned();
|
||||
|
|
|
@ -71,15 +71,15 @@ ScanI2C::DeviceType ScanI2CTwoWire::probeOLED(ScanI2C::DeviceAddress addr) const
|
|||
r &= 0x0f;
|
||||
|
||||
if (r == 0x08 || r == 0x00) {
|
||||
LOG_INFO("sh1106 display found\n");
|
||||
LOG_INFO("sh1106 display found");
|
||||
o_probe = SCREEN_SH1106; // SH1106
|
||||
} else if (r == 0x03 || r == 0x04 || r == 0x06 || r == 0x07) {
|
||||
LOG_INFO("ssd1306 display found\n");
|
||||
LOG_INFO("ssd1306 display found");
|
||||
o_probe = SCREEN_SSD1306; // SSD1306
|
||||
}
|
||||
c++;
|
||||
} while ((r != r_prev) && (c < 4));
|
||||
LOG_DEBUG("0x%x subtype probed in %i tries \n", r, c);
|
||||
LOG_DEBUG("0x%x subtype probed in %i tries ", r, c);
|
||||
|
||||
return o_probe;
|
||||
}
|
||||
|
@ -88,31 +88,31 @@ void ScanI2CTwoWire::printATECCInfo() const
|
|||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
atecc.readConfigZone(false);
|
||||
|
||||
LOG_DEBUG("ATECC608B Serial Number: ");
|
||||
std::string atecc_numbers = "ATECC608B Serial Number: ";
|
||||
for (int i = 0; i < 9; i++) {
|
||||
LOG_DEBUG("%02x", atecc.serialNumber[i]);
|
||||
atecc_numbers += vformat("%02x", atecc.serialNumber[i]);
|
||||
}
|
||||
|
||||
LOG_DEBUG(", Rev Number: ");
|
||||
atecc_numbers += ", Rev Number: ";
|
||||
for (int i = 0; i < 4; i++) {
|
||||
LOG_DEBUG("%02x", atecc.revisionNumber[i]);
|
||||
atecc_numbers += vformat("%02x", atecc.revisionNumber[i]);
|
||||
}
|
||||
LOG_DEBUG("\n");
|
||||
LOG_DEBUG(atecc_numbers.c_str());
|
||||
|
||||
LOG_DEBUG("ATECC608B Config %s", atecc.configLockStatus ? "Locked" : "Unlocked");
|
||||
LOG_DEBUG(", Data %s", atecc.dataOTPLockStatus ? "Locked" : "Unlocked");
|
||||
LOG_DEBUG(", Slot 0 %s\n", atecc.slot0LockStatus ? "Locked" : "Unlocked");
|
||||
LOG_DEBUG("ATECC608B Config %s, Data %s, Slot 0 %s", atecc.configLockStatus ? "Locked" : "Unlocked",
|
||||
atecc.dataOTPLockStatus ? "Locked" : "Unlocked", atecc.slot0LockStatus ? "Locked" : "Unlocked");
|
||||
|
||||
std::string atecc_publickey = "";
|
||||
if (atecc.configLockStatus && atecc.dataOTPLockStatus && atecc.slot0LockStatus) {
|
||||
if (atecc.generatePublicKey() == false) {
|
||||
LOG_DEBUG("ATECC608B Error generating public key\n");
|
||||
atecc_publickey += "ATECC608B Error generating public key";
|
||||
} else {
|
||||
LOG_DEBUG("ATECC608B Public Key: ");
|
||||
atecc_publickey += "ATECC608B Public Key: ";
|
||||
for (int i = 0; i < 64; i++) {
|
||||
LOG_DEBUG("%02x", atecc.publicKey64Bytes[i]);
|
||||
atecc_publickey += vformat("%02x", atecc.publicKey64Bytes[i]);
|
||||
}
|
||||
LOG_DEBUG("\n");
|
||||
}
|
||||
LOG_DEBUG(atecc_publickey.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ uint16_t ScanI2CTwoWire::getRegisterValue(const ScanI2CTwoWire::RegisterLocation
|
|||
i2cBus->endTransmission();
|
||||
delay(20);
|
||||
i2cBus->requestFrom(registerLocation.i2cAddress.address, responseWidth);
|
||||
LOG_DEBUG("Wire.available() = %d\n", i2cBus->available());
|
||||
LOG_DEBUG("Wire.available() = %d", i2cBus->available());
|
||||
if (i2cBus->available() == 2) {
|
||||
// Read MSB, then LSB
|
||||
value = (uint16_t)i2cBus->read() << 8;
|
||||
|
@ -149,7 +149,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
{
|
||||
concurrency::LockGuard guard((concurrency::Lock *)&lock);
|
||||
|
||||
LOG_DEBUG("Scanning for I2C devices on port %d\n", port);
|
||||
LOG_DEBUG("Scanning for I2C devices on port %d", port);
|
||||
|
||||
uint8_t err;
|
||||
|
||||
|
@ -176,7 +176,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
if (asize != 0) {
|
||||
if (!in_array(address, asize, addr.address))
|
||||
continue;
|
||||
LOG_DEBUG("Scanning address 0x%x\n", addr.address);
|
||||
LOG_DEBUG("Scanning address 0x%x", addr.address);
|
||||
}
|
||||
i2cBus->beginTransmission(addr.address);
|
||||
#ifdef ARCH_PORTDUINO
|
||||
|
@ -189,7 +189,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
#endif
|
||||
type = NONE;
|
||||
if (err == 0) {
|
||||
LOG_DEBUG("I2C device found at address 0x%x\n", addr.address);
|
||||
LOG_DEBUG("I2C device found at address 0x%x", addr.address);
|
||||
|
||||
switch (addr.address) {
|
||||
case SSD1306_ADDRESS:
|
||||
|
@ -205,9 +205,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
#endif
|
||||
|
||||
{
|
||||
LOG_INFO("ATECC608B initialized\n");
|
||||
LOG_INFO("ATECC608B initialized");
|
||||
} else {
|
||||
LOG_WARN("ATECC608B initialization failed\n");
|
||||
LOG_WARN("ATECC608B initialization failed");
|
||||
}
|
||||
printATECCInfo();
|
||||
break;
|
||||
|
@ -217,7 +217,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
case RV3028_RTC:
|
||||
// foundDevices[addr] = RTC_RV3028;
|
||||
type = RTC_RV3028;
|
||||
LOG_INFO("RV3028 RTC found\n");
|
||||
LOG_INFO("RV3028 RTC found");
|
||||
rtc.initI2C(*i2cBus);
|
||||
rtc.writeToRegister(0x35, 0x07); // no Clkout
|
||||
rtc.writeToRegister(0x37, 0xB4);
|
||||
|
@ -225,7 +225,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
#endif
|
||||
|
||||
#ifdef PCF8563_RTC
|
||||
SCAN_SIMPLE_CASE(PCF8563_RTC, RTC_PCF8563, "PCF8563 RTC found\n")
|
||||
SCAN_SIMPLE_CASE(PCF8563_RTC, RTC_PCF8563, "PCF8563 RTC found")
|
||||
#endif
|
||||
|
||||
case CARDKB_ADDR:
|
||||
|
@ -233,49 +233,49 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x04), 1);
|
||||
if (registerValue == 0x02) {
|
||||
// KEYPAD_VERSION
|
||||
LOG_INFO("RAK14004 found\n");
|
||||
LOG_INFO("RAK14004 found");
|
||||
type = RAK14004;
|
||||
} else {
|
||||
LOG_INFO("m5 cardKB found\n");
|
||||
LOG_INFO("m5 cardKB found");
|
||||
type = CARDKB;
|
||||
}
|
||||
break;
|
||||
|
||||
SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found\n");
|
||||
SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10 keyboard found\n");
|
||||
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n");
|
||||
SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found");
|
||||
SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10 keyboard found");
|
||||
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found");
|
||||
#ifdef HAS_NCP5623
|
||||
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found\n");
|
||||
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found");
|
||||
#endif
|
||||
#ifdef HAS_PMU
|
||||
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "axp192/axp2101 PMU found\n")
|
||||
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "axp192/axp2101 PMU found")
|
||||
#endif
|
||||
case BME_ADDR:
|
||||
case BME_ADDR_ALTERNATE:
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xD0), 1); // GET_ID
|
||||
switch (registerValue) {
|
||||
case 0x61:
|
||||
LOG_INFO("BME-680 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("BME-680 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = BME_680;
|
||||
break;
|
||||
case 0x60:
|
||||
LOG_INFO("BME-280 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("BME-280 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = BME_280;
|
||||
break;
|
||||
case 0x55:
|
||||
LOG_INFO("BMP-085 or BMP-180 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("BMP-085 or BMP-180 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = BMP_085;
|
||||
break;
|
||||
default:
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1); // GET_ID
|
||||
switch (registerValue) {
|
||||
case 0x50: // BMP-388 should be 0x50
|
||||
LOG_INFO("BMP-388 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("BMP-388 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = BMP_3XX;
|
||||
break;
|
||||
case 0x58: // BMP-280 should be 0x58
|
||||
default:
|
||||
LOG_INFO("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("BMP-280 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = BMP_280;
|
||||
break;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
break;
|
||||
#ifndef HAS_NCP5623
|
||||
case AHT10_ADDR:
|
||||
LOG_INFO("AHT10 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("AHT10 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = AHT10;
|
||||
break;
|
||||
#endif
|
||||
|
@ -292,23 +292,23 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
case INA_ADDR_ALTERNATE:
|
||||
case INA_ADDR_WAVESHARE_UPS:
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2);
|
||||
LOG_DEBUG("Register MFG_UID: 0x%x\n", registerValue);
|
||||
LOG_DEBUG("Register MFG_UID: 0x%x", registerValue);
|
||||
if (registerValue == 0x5449) {
|
||||
LOG_INFO("INA260 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("INA260 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = INA260;
|
||||
} else { // Assume INA219 if INA260 ID is not found
|
||||
LOG_INFO("INA219 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("INA219 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = INA219;
|
||||
}
|
||||
break;
|
||||
case INA3221_ADDR:
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2);
|
||||
LOG_DEBUG("Register MFG_UID: 0x%x\n", registerValue);
|
||||
LOG_DEBUG("Register MFG_UID: 0x%x", registerValue);
|
||||
if (registerValue == 0x5449) {
|
||||
LOG_INFO("INA3221 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("INA3221 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||
type = INA3221;
|
||||
} else {
|
||||
LOG_INFO("DFRobot Lark weather station found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("DFRobot Lark weather station found at address 0x%x", (uint8_t)addr.address);
|
||||
type = DFROBOT_LARK;
|
||||
}
|
||||
break;
|
||||
|
@ -320,7 +320,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 2);
|
||||
if (registerValue == 0x8700) {
|
||||
type = STK8BAXX;
|
||||
LOG_INFO("STK8BAXX accelerometer found\n");
|
||||
LOG_INFO("STK8BAXX accelerometer found");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x07), 2);
|
||||
if (registerValue == 0x0400) {
|
||||
type = MCP9808;
|
||||
LOG_INFO("MCP9808 sensor found\n");
|
||||
LOG_INFO("MCP9808 sensor found");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 2);
|
||||
if (registerValue == 0x3300 || registerValue == 0x3333) { // RAK4631 WisBlock has LIS3DH register at 0x3333
|
||||
type = LIS3DH;
|
||||
LOG_INFO("LIS3DH accelerometer found\n");
|
||||
LOG_INFO("LIS3DH accelerometer found");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -344,95 +344,95 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x89), 2);
|
||||
if (registerValue == 0x11a2 || registerValue == 0x11da || registerValue == 0xe9c) {
|
||||
type = SHT4X;
|
||||
LOG_INFO("SHT4X sensor found\n");
|
||||
LOG_INFO("SHT4X sensor found");
|
||||
} else if (getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x7E), 2) == 0x5449) {
|
||||
type = OPT3001;
|
||||
LOG_INFO("OPT3001 light sensor found\n");
|
||||
LOG_INFO("OPT3001 light sensor found");
|
||||
} else {
|
||||
type = SHT31;
|
||||
LOG_INFO("SHT31 sensor found\n");
|
||||
LOG_INFO("SHT31 sensor found");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
SCAN_SIMPLE_CASE(SHTC3_ADDR, SHTC3, "SHTC3 sensor found\n")
|
||||
SCAN_SIMPLE_CASE(SHTC3_ADDR, SHTC3, "SHTC3 sensor found")
|
||||
case RCWL9620_ADDR:
|
||||
// get MAX30102 PARTID
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFF), 1);
|
||||
if (registerValue == 0x15) {
|
||||
type = MAX30102;
|
||||
LOG_INFO("MAX30102 Health sensor found\n");
|
||||
LOG_INFO("MAX30102 Health sensor found");
|
||||
break;
|
||||
} else {
|
||||
type = RCWL9620;
|
||||
LOG_INFO("RCWL9620 sensor found\n");
|
||||
LOG_INFO("RCWL9620 sensor found");
|
||||
}
|
||||
break;
|
||||
|
||||
case LPS22HB_ADDR_ALT:
|
||||
SCAN_SIMPLE_CASE(LPS22HB_ADDR, LPS22HB, "LPS22HB sensor found\n")
|
||||
SCAN_SIMPLE_CASE(LPS22HB_ADDR, LPS22HB, "LPS22HB sensor found")
|
||||
|
||||
SCAN_SIMPLE_CASE(QMC6310_ADDR, QMC6310, "QMC6310 Highrate 3-Axis magnetic sensor found\n")
|
||||
SCAN_SIMPLE_CASE(QMC6310_ADDR, QMC6310, "QMC6310 Highrate 3-Axis magnetic sensor found")
|
||||
|
||||
case QMI8658_ADDR:
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0A), 1); // get ID
|
||||
if (registerValue == 0xC0) {
|
||||
type = BQ24295;
|
||||
LOG_INFO("BQ24295 PMU found\n");
|
||||
LOG_INFO("BQ24295 PMU found");
|
||||
break;
|
||||
}
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 1); // get ID
|
||||
if (registerValue == 0x6A) {
|
||||
type = LSM6DS3;
|
||||
LOG_INFO("LSM6DS3 accelerometer found at address 0x%x\n", (uint8_t)addr.address);
|
||||
LOG_INFO("LSM6DS3 accelerometer found at address 0x%x", (uint8_t)addr.address);
|
||||
} else {
|
||||
type = QMI8658;
|
||||
LOG_INFO("QMI8658 Highrate 6-Axis inertial measurement sensor found\n");
|
||||
LOG_INFO("QMI8658 Highrate 6-Axis inertial measurement sensor found");
|
||||
}
|
||||
break;
|
||||
|
||||
SCAN_SIMPLE_CASE(QMC5883L_ADDR, QMC5883L, "QMC5883L Highrate 3-Axis magnetic sensor found\n")
|
||||
SCAN_SIMPLE_CASE(HMC5883L_ADDR, HMC5883L, "HMC5883L 3-Axis digital compass found\n")
|
||||
SCAN_SIMPLE_CASE(PMSA0031_ADDR, PMSA0031, "PMSA0031 air quality sensor found\n")
|
||||
SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found\n");
|
||||
SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x\n", (uint8_t)addr.address);
|
||||
SCAN_SIMPLE_CASE(TCA9535_ADDR, TCA9535, "TCA9535 I2C expander found\n");
|
||||
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found\n");
|
||||
SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700 light sensor found\n");
|
||||
SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591 light sensor found\n");
|
||||
SCAN_SIMPLE_CASE(OPT3001_ADDR, OPT3001, "OPT3001 light sensor found\n");
|
||||
SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632 IR temp sensor found\n");
|
||||
SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802 based scale found\n");
|
||||
SCAN_SIMPLE_CASE(FT6336U_ADDR, FT6336U, "FT6336U touchscreen found\n");
|
||||
SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048 lipo fuel gauge found\n");
|
||||
SCAN_SIMPLE_CASE(QMC5883L_ADDR, QMC5883L, "QMC5883L Highrate 3-Axis magnetic sensor found")
|
||||
SCAN_SIMPLE_CASE(HMC5883L_ADDR, HMC5883L, "HMC5883L 3-Axis digital compass found")
|
||||
SCAN_SIMPLE_CASE(PMSA0031_ADDR, PMSA0031, "PMSA0031 air quality sensor found")
|
||||
SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found");
|
||||
SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x", (uint8_t)addr.address);
|
||||
SCAN_SIMPLE_CASE(TCA9535_ADDR, TCA9535, "TCA9535 I2C expander found");
|
||||
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found");
|
||||
SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700 light sensor found");
|
||||
SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591 light sensor found");
|
||||
SCAN_SIMPLE_CASE(OPT3001_ADDR, OPT3001, "OPT3001 light sensor found");
|
||||
SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632 IR temp sensor found");
|
||||
SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802 based scale found");
|
||||
SCAN_SIMPLE_CASE(FT6336U_ADDR, FT6336U, "FT6336U touchscreen found");
|
||||
SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048 lipo fuel gauge found");
|
||||
#ifdef HAS_TPS65233
|
||||
SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233 BIAS-T found\n");
|
||||
SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233 BIAS-T found");
|
||||
#endif
|
||||
SCAN_SIMPLE_CASE(MLX90614_ADDR_DEF, MLX90614, "MLX90614 IR temp sensor found\n");
|
||||
SCAN_SIMPLE_CASE(MLX90614_ADDR_DEF, MLX90614, "MLX90614 IR temp sensor found");
|
||||
|
||||
case ICM20948_ADDR: // same as BMX160_ADDR
|
||||
case ICM20948_ADDR_ALT: // same as MPU6050_ADDR
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1);
|
||||
if (registerValue == 0xEA) {
|
||||
type = ICM20948;
|
||||
LOG_INFO("ICM20948 9-dof motion processor found\n");
|
||||
LOG_INFO("ICM20948 9-dof motion processor found");
|
||||
break;
|
||||
} else if (addr.address == BMX160_ADDR) {
|
||||
type = BMX160;
|
||||
LOG_INFO("BMX160 accelerometer found\n");
|
||||
LOG_INFO("BMX160 accelerometer found");
|
||||
break;
|
||||
} else {
|
||||
type = MPU6050;
|
||||
LOG_INFO("MPU6050 accelerometer found\n");
|
||||
LOG_INFO("MPU6050 accelerometer found");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_INFO("Device found at address 0x%x was not able to be enumerated\n", addr.address);
|
||||
LOG_INFO("Device found at address 0x%x was not able to be enumerated", addr.address);
|
||||
}
|
||||
} else if (err == 4) {
|
||||
LOG_ERROR("Unknown error at address 0x%x\n", addr.address);
|
||||
LOG_ERROR("Unknown error at address 0x%x", addr.address);
|
||||
}
|
||||
|
||||
// Check if a type was found for the enumerated device - save, if so
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
uint32_t axpDebugRead()
|
||||
{
|
||||
axp.debugCharging();
|
||||
LOG_DEBUG("vbus current %f\n", axp.getVbusCurrent());
|
||||
LOG_DEBUG("charge current %f\n", axp.getBattChargeCurrent());
|
||||
LOG_DEBUG("bat voltage %f\n", axp.getBattVoltage());
|
||||
LOG_DEBUG("batt pct %d\n", axp.getBattPercentage());
|
||||
LOG_DEBUG("is battery connected %d\n", axp.isBatteryConnect());
|
||||
LOG_DEBUG("is USB connected %d\n", axp.isVBUSPlug());
|
||||
LOG_DEBUG("is charging %d\n", axp.isChargeing());
|
||||
LOG_DEBUG("vbus current %f", axp.getVbusCurrent());
|
||||
LOG_DEBUG("charge current %f", axp.getBattChargeCurrent());
|
||||
LOG_DEBUG("bat voltage %f", axp.getBattVoltage());
|
||||
LOG_DEBUG("batt pct %d", axp.getBattPercentage());
|
||||
LOG_DEBUG("is battery connected %d", axp.isBatteryConnect());
|
||||
LOG_DEBUG("is USB connected %d", axp.isVBUSPlug());
|
||||
LOG_DEBUG("is charging %d", axp.isChargeing());
|
||||
|
||||
return 30 * 1000;
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ void scanEInkDevice(void)
|
|||
d_writeCommand(0x20);
|
||||
eink_found = (d_waitWhileBusy(150) > 0) ? true : false;
|
||||
if (eink_found)
|
||||
LOG_DEBUG("EInk display found\n");
|
||||
LOG_DEBUG("EInk display found");
|
||||
else
|
||||
LOG_DEBUG("EInk display not found\n");
|
||||
LOG_DEBUG("EInk display not found");
|
||||
SPI1.end();
|
||||
}
|
||||
#endif
|
164
src/gps/GPS.cpp
164
src/gps/GPS.cpp
|
@ -154,7 +154,7 @@ uint8_t GPS::makeCASPacket(uint8_t class_id, uint8_t msg_id, uint8_t payload_siz
|
|||
CASChecksum(UBXscratch, (payload_size + 10));
|
||||
|
||||
#if defined(GPS_DEBUG) && defined(DEBUG_PORT)
|
||||
LOG_DEBUG("Constructed CAS packet: \n");
|
||||
LOG_DEBUG("Constructed CAS packet: ");
|
||||
DEBUG_PORT.hexDump(MESHTASTIC_LOG_LEVEL_DEBUG, UBXscratch, payload_size + 10);
|
||||
#endif
|
||||
return (payload_size + 10);
|
||||
|
@ -166,33 +166,33 @@ GPS_RESPONSE GPS::getACK(const char *message, uint32_t waitMillis)
|
|||
uint8_t b;
|
||||
int bytesRead = 0;
|
||||
uint32_t startTimeout = millis() + waitMillis;
|
||||
#ifdef GPS_DEBUG
|
||||
std::string debugmsg = "";
|
||||
#endif
|
||||
while (millis() < startTimeout) {
|
||||
if (_serial_gps->available()) {
|
||||
b = _serial_gps->read();
|
||||
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("%c", (b >= 32 && b <= 126) ? b : '.');
|
||||
debugmsg += vformat("%c", (b >= 32 && b <= 126) ? b : '.');
|
||||
#endif
|
||||
buffer[bytesRead] = b;
|
||||
bytesRead++;
|
||||
if ((bytesRead == 767) || (b == '\r')) {
|
||||
if (strnstr((char *)buffer, message, bytesRead) != nullptr) {
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("\r\nFound: %s\r\n", message); // Log the found message
|
||||
LOG_DEBUG("Found: %s", message); // Log the found message
|
||||
#endif
|
||||
return GNSS_RESPONSE_OK;
|
||||
} else {
|
||||
bytesRead = 0;
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("\r\n");
|
||||
LOG_DEBUG(debugmsg.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("\n");
|
||||
#endif
|
||||
return GNSS_RESPONSE_NONE;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ GPS_RESPONSE GPS::getACKCas(uint8_t class_id, uint8_t msg_id, uint32_t waitMilli
|
|||
// Check for an ACK-ACK for the specified class and message id
|
||||
if ((msg_cls == 0x05) && (msg_msg_id == 0x01) && payload_cls == class_id && payload_msg == msg_id) {
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_INFO("Got ACK for class %02X message %02X in %d millis.\n", class_id, msg_id, millis() - startTime);
|
||||
LOG_INFO("Got ACK for class %02X message %02X in %d millis.", class_id, msg_id, millis() - startTime);
|
||||
#endif
|
||||
return GNSS_RESPONSE_OK;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ GPS_RESPONSE GPS::getACKCas(uint8_t class_id, uint8_t msg_id, uint32_t waitMilli
|
|||
// Check for an ACK-NACK for the specified class and message id
|
||||
if ((msg_cls == 0x05) && (msg_msg_id == 0x00) && payload_cls == class_id && payload_msg == msg_id) {
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_WARN("Got NACK for class %02X message %02X in %d millis.\n", class_id, msg_id, millis() - startTime);
|
||||
LOG_WARN("Got NACK for class %02X message %02X in %d millis.", class_id, msg_id, millis() - startTime);
|
||||
#endif
|
||||
return GNSS_RESPONSE_NAK;
|
||||
}
|
||||
|
@ -281,8 +281,8 @@ GPS_RESPONSE GPS::getACK(uint8_t class_id, uint8_t msg_id, uint32_t waitMillis)
|
|||
while (Throttle::isWithinTimespanMs(startTime, waitMillis)) {
|
||||
if (ack > 9) {
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("\n");
|
||||
LOG_INFO("Got ACK for class %02X message %02X in %d millis.\n", class_id, msg_id, millis() - startTime);
|
||||
LOG_DEBUG("");
|
||||
LOG_INFO("Got ACK for class %02X message %02X in %d millis.", class_id, msg_id, millis() - startTime);
|
||||
#endif
|
||||
return GNSS_RESPONSE_OK; // ACK received
|
||||
}
|
||||
|
@ -304,9 +304,9 @@ GPS_RESPONSE GPS::getACK(uint8_t class_id, uint8_t msg_id, uint32_t waitMillis)
|
|||
} else {
|
||||
if (ack == 3 && b == 0x00) { // UBX-ACK-NAK message
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("\n");
|
||||
LOG_DEBUG("");
|
||||
#endif
|
||||
LOG_WARN("Got NAK for class %02X message %02X\n", class_id, msg_id);
|
||||
LOG_WARN("Got NAK for class %02X message %02X", class_id, msg_id);
|
||||
return GNSS_RESPONSE_NAK; // NAK received
|
||||
}
|
||||
ack = 0; // Reset the acknowledgement counter
|
||||
|
@ -314,8 +314,8 @@ GPS_RESPONSE GPS::getACK(uint8_t class_id, uint8_t msg_id, uint32_t waitMillis)
|
|||
}
|
||||
}
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("\n");
|
||||
LOG_WARN("No response for class %02X message %02X\n", class_id, msg_id);
|
||||
LOG_DEBUG("");
|
||||
LOG_WARN("No response for class %02X message %02X", class_id, msg_id);
|
||||
#endif
|
||||
return GNSS_RESPONSE_NONE; // No response received within timeout
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t
|
|||
} else {
|
||||
// return payload length
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_INFO("Got ACK for class %02X message %02X in %d millis.\n", requestedClass, requestedID,
|
||||
LOG_INFO("Got ACK for class %02X message %02X in %d millis.", requestedClass, requestedID,
|
||||
millis() - startTime);
|
||||
#endif
|
||||
return needRead;
|
||||
|
@ -400,7 +400,7 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t
|
|||
}
|
||||
}
|
||||
}
|
||||
// LOG_WARN("No response for class %02X message %02X\n", requestedClass, requestedID);
|
||||
// LOG_WARN("No response for class %02X message %02X", requestedClass, requestedID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -416,13 +416,13 @@ bool GPS::setup()
|
|||
speedSelect = std::find(serialSpeeds, std::end(serialSpeeds), GPS_BAUDRATE) - serialSpeeds;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Probing for GPS at %d \n", serialSpeeds[speedSelect]);
|
||||
LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]);
|
||||
gnssModel = probe(serialSpeeds[speedSelect]);
|
||||
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||
if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) {
|
||||
speedSelect = 0;
|
||||
if (--probeTries == 0) {
|
||||
LOG_WARN("Giving up on GPS probe and setting to 9600.\n");
|
||||
LOG_WARN("Giving up on GPS probe and setting to 9600.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ bool GPS::setup()
|
|||
msglen = makeCASPacket(0x06, 0x01, sizeof(cas_cfg_msg_packet), cas_cfg_msg_packet);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
if (getACKCas(0x06, 0x01, 250) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("ATGM336H - Could not enable NMEA MSG: %d\n", fields[i]);
|
||||
LOG_WARN("ATGM336H - Could not enable NMEA MSG: %d", fields[i]);
|
||||
}
|
||||
}
|
||||
} else if (gnssModel == GNSS_MODEL_UC6580) {
|
||||
|
@ -551,13 +551,13 @@ bool GPS::setup()
|
|||
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("Unable to save GNSS module configuration.\n");
|
||||
LOG_WARN("Unable to save GNSS module configuration.");
|
||||
} else {
|
||||
LOG_INFO("GNSS module configuration saved!\n");
|
||||
LOG_INFO("GNSS module configuration saved!");
|
||||
}
|
||||
} else if (IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9)) {
|
||||
if (gnssModel == GNSS_MODEL_UBLOX7) {
|
||||
LOG_DEBUG("Setting GPS+SBAS\n");
|
||||
LOG_DEBUG("Setting GPS+SBAS");
|
||||
msglen = makeUBXPacket(0x06, 0x3e, sizeof(_message_GNSS_7), _message_GNSS_7);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
} else { // 8,9
|
||||
|
@ -567,12 +567,12 @@ bool GPS::setup()
|
|||
|
||||
if (getACK(0x06, 0x3e, 800) == GNSS_RESPONSE_NAK) {
|
||||
// It's not critical if the module doesn't acknowledge this configuration.
|
||||
LOG_INFO("reconfigure GNSS - defaults maintained. Is this module GPS-only?\n");
|
||||
LOG_INFO("reconfigure GNSS - defaults maintained. Is this module GPS-only?");
|
||||
} else {
|
||||
if (gnssModel == GNSS_MODEL_UBLOX7) {
|
||||
LOG_INFO("GNSS configured for GPS+SBAS.\n");
|
||||
LOG_INFO("GNSS configured for GPS+SBAS.");
|
||||
} else { // 8,9
|
||||
LOG_INFO("GNSS configured for GPS+SBAS+GLONASS+Galileo.\n");
|
||||
LOG_INFO("GNSS configured for GPS+SBAS+GLONASS+Galileo.");
|
||||
}
|
||||
// Documentation say, we need wait atleast 0.5s after reconfiguration of GNSS module, before sending next
|
||||
// commands for the M8 it tends to be more... 1 sec should be enough ;>)
|
||||
|
@ -620,9 +620,9 @@ bool GPS::setup()
|
|||
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("Unable to save GNSS module configuration.\n");
|
||||
LOG_WARN("Unable to save GNSS module configuration.");
|
||||
} else {
|
||||
LOG_INFO("GNSS module configuration saved!\n");
|
||||
LOG_INFO("GNSS module configuration saved!");
|
||||
}
|
||||
} else if (gnssModel == GNSS_MODEL_UBLOX10) {
|
||||
delay(1000);
|
||||
|
@ -667,9 +667,9 @@ bool GPS::setup()
|
|||
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE_10), _message_SAVE_10);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) {
|
||||
LOG_WARN("Unable to save GNSS module configuration.\n");
|
||||
LOG_WARN("Unable to save GNSS module configuration.");
|
||||
} else {
|
||||
LOG_INFO("GNSS module configuration saved!\n");
|
||||
LOG_INFO("GNSS module configuration saved!");
|
||||
}
|
||||
}
|
||||
didSerialInit = true;
|
||||
|
@ -691,7 +691,7 @@ void GPS::setPowerState(GPSPowerState newState, uint32_t sleepTime)
|
|||
// Update the stored GPSPowerstate, and create local copies
|
||||
GPSPowerState oldState = powerState;
|
||||
powerState = newState;
|
||||
LOG_INFO("GPS power state moving from %s to %s\n", getGPSPowerStateString(oldState), getGPSPowerStateString(newState));
|
||||
LOG_INFO("GPS power state moving from %s to %s", getGPSPowerStateString(oldState), getGPSPowerStateString(newState));
|
||||
|
||||
#ifdef HELTEC_MESH_NODE_T114
|
||||
if ((oldState == GPS_OFF || oldState == GPS_HARDSLEEP) && (newState != GPS_OFF && newState != GPS_HARDSLEEP)) {
|
||||
|
@ -761,7 +761,7 @@ void GPS::writePinEN(bool on)
|
|||
// Write and log
|
||||
enablePin->set(on);
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("Pin EN %s\n", val == HIGH ? "HIGH" : "LOW");
|
||||
LOG_DEBUG("Pin EN %s", val == HIGH ? "HIGH" : "LOW");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -783,7 +783,7 @@ void GPS::writePinStandby(bool standby)
|
|||
pinMode(PIN_GPS_STANDBY, OUTPUT);
|
||||
digitalWrite(PIN_GPS_STANDBY, val);
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("Pin STANDBY %s\n", val == HIGH ? "HIGH" : "LOW");
|
||||
LOG_DEBUG("Pin STANDBY %s", val == HIGH ? "HIGH" : "LOW");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -817,7 +817,7 @@ void GPS::setPowerPMU(bool on)
|
|||
}
|
||||
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("PMU %s\n", on ? "on" : "off");
|
||||
LOG_DEBUG("PMU %s", on ? "on" : "off");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ void GPS::setPowerUBLOX(bool on, uint32_t sleepMs)
|
|||
gps->_serial_gps->write(0xFF);
|
||||
clearBuffer(); // This often returns old data, so drop it
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("UBLOX: wake\n");
|
||||
LOG_DEBUG("UBLOX: wake");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -869,7 +869,7 @@ void GPS::setPowerUBLOX(bool on, uint32_t sleepMs)
|
|||
gps->_serial_gps->write(gps->UBXscratch, msglen);
|
||||
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("UBLOX: sleep for %dmS\n", sleepMs);
|
||||
LOG_DEBUG("UBLOX: sleep for %dmS", sleepMs);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ void GPS::down()
|
|||
uint32_t sleepTime = scheduling.msUntilNextSearch();
|
||||
uint32_t updateInterval = Default::getConfiguredOrDefaultMs(config.position.gps_update_interval);
|
||||
|
||||
LOG_DEBUG("%us until next search\n", sleepTime / 1000);
|
||||
LOG_DEBUG("%us until next search", sleepTime / 1000);
|
||||
|
||||
// If update interval less than 10 seconds, no attempt to sleep
|
||||
if (updateInterval <= 10 * 1000UL || sleepTime == 0)
|
||||
|
@ -921,7 +921,7 @@ void GPS::down()
|
|||
// https://www.desmos.com/calculator/6gvjghoumr
|
||||
// This is not particularly accurate, but probably an impromevement over a single, fixed threshold
|
||||
uint32_t hardsleepThreshold = (2750 * pow(predictedSearchDuration / 1000, 1.22));
|
||||
LOG_DEBUG("gps_update_interval >= %us needed to justify hardsleep\n", hardsleepThreshold / 1000);
|
||||
LOG_DEBUG("gps_update_interval >= %us needed to justify hardsleep", hardsleepThreshold / 1000);
|
||||
|
||||
// If update interval too short: softsleep (if supported by hardware)
|
||||
if (updateInterval < hardsleepThreshold) {
|
||||
|
@ -940,7 +940,7 @@ void GPS::publishUpdate()
|
|||
shouldPublish = false;
|
||||
|
||||
// In debug logs, identify position by @timestamp:stage (stage 2 = publish)
|
||||
LOG_DEBUG("publishing pos@%x:2, hasVal=%d, Sats=%d, GPSlock=%d\n", p.timestamp, hasValidLocation, p.sats_in_view,
|
||||
LOG_DEBUG("publishing pos@%x:2, hasVal=%d, Sats=%d, GPSlock=%d", p.timestamp, hasValidLocation, p.sats_in_view,
|
||||
hasLock());
|
||||
|
||||
// Notify any status instances that are observing us
|
||||
|
@ -956,7 +956,7 @@ int32_t GPS::runOnce()
|
|||
{
|
||||
if (!GPSInitFinished) {
|
||||
if (!_serial_gps || config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT) {
|
||||
LOG_INFO("GPS set to not-present. Skipping probe.\n");
|
||||
LOG_INFO("GPS set to not-present. Skipping probe.");
|
||||
return disable();
|
||||
}
|
||||
if (!setup())
|
||||
|
@ -968,7 +968,7 @@ int32_t GPS::runOnce()
|
|||
}
|
||||
// ONCE we will factory reset the GPS for bug #327
|
||||
if (!devicestate.did_gps_reset) {
|
||||
LOG_WARN("GPS FactoryReset requested\n");
|
||||
LOG_WARN("GPS FactoryReset requested");
|
||||
if (gps->factoryReset()) { // If we don't succeed try again next time
|
||||
devicestate.did_gps_reset = true;
|
||||
nodeDB->saveToDisk(SEGMENT_DEVICESTATE);
|
||||
|
@ -991,7 +991,7 @@ int32_t GPS::runOnce()
|
|||
GNSS_MODEL_UBLOX10)) {
|
||||
// reset the GPS on next bootup
|
||||
if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) {
|
||||
LOG_DEBUG("GPS is not communicating, trying factory reset on next bootup.\n");
|
||||
LOG_DEBUG("GPS is not communicating, trying factory reset on next bootup.");
|
||||
devicestate.did_gps_reset = false;
|
||||
nodeDB->saveToDisk(SEGMENT_DEVICESTATE);
|
||||
return disable(); // Stop the GPS thread as it can do nothing useful until next reboot.
|
||||
|
@ -1001,7 +1001,7 @@ int32_t GPS::runOnce()
|
|||
// At least one GPS has a bad habit of losing its mind from time to time
|
||||
if (rebootsSeen > 2) {
|
||||
rebootsSeen = 0;
|
||||
LOG_DEBUG("Would normally factoryReset()\n");
|
||||
LOG_DEBUG("Would normally factoryReset()");
|
||||
// gps->factoryReset();
|
||||
}
|
||||
|
||||
|
@ -1018,23 +1018,23 @@ int32_t GPS::runOnce()
|
|||
|
||||
bool gotLoc = lookForLocation();
|
||||
if (gotLoc && !hasValidLocation) { // declare that we have location ASAP
|
||||
LOG_DEBUG("hasValidLocation RISING EDGE\n");
|
||||
LOG_DEBUG("hasValidLocation RISING EDGE");
|
||||
hasValidLocation = true;
|
||||
shouldPublish = true;
|
||||
}
|
||||
|
||||
bool tooLong = scheduling.searchedTooLong();
|
||||
if (tooLong)
|
||||
LOG_WARN("Couldn't publish a valid location: didn't get a GPS lock in time.\n");
|
||||
LOG_WARN("Couldn't publish a valid location: didn't get a GPS lock in time.");
|
||||
|
||||
// Once we get a location we no longer desperately want an update
|
||||
// LOG_DEBUG("gotLoc %d, tooLong %d, gotTime %d\n", gotLoc, tooLong, gotTime);
|
||||
// LOG_DEBUG("gotLoc %d, tooLong %d, gotTime %d", gotLoc, tooLong, gotTime);
|
||||
if ((gotLoc && gotTime) || tooLong) {
|
||||
|
||||
if (tooLong) {
|
||||
// we didn't get a location during this ack window, therefore declare loss of lock
|
||||
if (hasValidLocation) {
|
||||
LOG_DEBUG("hasValidLocation FALLING EDGE\n");
|
||||
LOG_DEBUG("hasValidLocation FALLING EDGE");
|
||||
}
|
||||
p = meshtastic_Position_init_default;
|
||||
hasValidLocation = false;
|
||||
|
@ -1066,13 +1066,13 @@ void GPS::clearBuffer()
|
|||
/// Prepare the GPS for the cpu entering deep or light sleep, expect to be gone for at least 100s of msecs
|
||||
int GPS::prepareDeepSleep(void *unused)
|
||||
{
|
||||
LOG_INFO("GPS deep sleep!\n");
|
||||
LOG_INFO("GPS deep sleep!");
|
||||
disable();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *PROBE_MESSAGE = "Trying %s (%s)...\n";
|
||||
const char *DETECTED_MESSAGE = "%s detected, using %s Module\n";
|
||||
const char *PROBE_MESSAGE = "Trying %s (%s)...";
|
||||
const char *DETECTED_MESSAGE = "%s detected, using %s Module";
|
||||
|
||||
#define PROBE_SIMPLE(CHIP, TOWRITE, RESPONSE, DRIVER, TIMEOUT, ...) \
|
||||
LOG_DEBUG(PROBE_MESSAGE, TOWRITE, CHIP); \
|
||||
|
@ -1094,7 +1094,7 @@ GnssModel_t GPS::probe(int serialSpeed)
|
|||
_serial_gps->begin(serialSpeed);
|
||||
#else
|
||||
if (_serial_gps->baudRate() != serialSpeed) {
|
||||
LOG_DEBUG("Setting Baud to %i\n", serialSpeed);
|
||||
LOG_DEBUG("Setting Baud to %i", serialSpeed);
|
||||
_serial_gps->updateBaudRate(serialSpeed);
|
||||
}
|
||||
#endif
|
||||
|
@ -1143,10 +1143,10 @@ GnssModel_t GPS::probe(int serialSpeed)
|
|||
// Check that the returned response class and message ID are correct
|
||||
GPS_RESPONSE response = getACK(0x06, 0x08, 750);
|
||||
if (response == GNSS_RESPONSE_NONE) {
|
||||
LOG_WARN("Failed to find GNSS Module (baudrate %d)\n", serialSpeed);
|
||||
LOG_WARN("Failed to find GNSS Module (baudrate %d)", serialSpeed);
|
||||
return GNSS_MODEL_UNKNOWN;
|
||||
} else if (response == GNSS_RESPONSE_FRAME_ERRORS) {
|
||||
LOG_INFO("UBlox Frame Errors (baudrate %d)\n", serialSpeed);
|
||||
LOG_INFO("UBlox Frame Errors (baudrate %d)", serialSpeed);
|
||||
}
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
@ -1163,7 +1163,7 @@ GnssModel_t GPS::probe(int serialSpeed)
|
|||
|
||||
uint16_t len = getACK(buffer, sizeof(buffer), 0x0A, 0x04, 1200);
|
||||
if (len) {
|
||||
// LOG_DEBUG("monver reply size = %d\n", len);
|
||||
// LOG_DEBUG("monver reply size = %d", len);
|
||||
uint16_t position = 0;
|
||||
for (int i = 0; i < 30; i++) {
|
||||
info.swVersion[i] = buffer[position];
|
||||
|
@ -1184,12 +1184,12 @@ GnssModel_t GPS::probe(int serialSpeed)
|
|||
break;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Module Info : \n");
|
||||
LOG_DEBUG("Soft version: %s\n", info.swVersion);
|
||||
LOG_DEBUG("Hard version: %s\n", info.hwVersion);
|
||||
LOG_DEBUG("Extensions:%d\n", info.extensionNo);
|
||||
LOG_DEBUG("Module Info : ");
|
||||
LOG_DEBUG("Soft version: %s", info.swVersion);
|
||||
LOG_DEBUG("Hard version: %s", info.hwVersion);
|
||||
LOG_DEBUG("Extensions:%d", info.extensionNo);
|
||||
for (int i = 0; i < info.extensionNo; i++) {
|
||||
LOG_DEBUG(" %s\n", info.extension[i]);
|
||||
LOG_DEBUG(" %s", info.extension[i]);
|
||||
}
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
@ -1202,10 +1202,10 @@ GnssModel_t GPS::probe(int serialSpeed)
|
|||
char *ptr = nullptr;
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
strncpy((char *)buffer, &(info.extension[i][8]), sizeof(buffer));
|
||||
LOG_DEBUG("Protocol Version:%s\n", (char *)buffer);
|
||||
LOG_DEBUG("Protocol Version:%s", (char *)buffer);
|
||||
if (strlen((char *)buffer)) {
|
||||
uBloxProtocolVersion = strtoul((char *)buffer, &ptr, 10);
|
||||
LOG_DEBUG("ProtVer=%d\n", uBloxProtocolVersion);
|
||||
LOG_DEBUG("ProtVer=%d", uBloxProtocolVersion);
|
||||
} else {
|
||||
uBloxProtocolVersion = 0;
|
||||
}
|
||||
|
@ -1228,7 +1228,7 @@ GnssModel_t GPS::probe(int serialSpeed)
|
|||
return GNSS_MODEL_UBLOX10;
|
||||
}
|
||||
}
|
||||
LOG_WARN("Failed to find GNSS Module (baudrate %d)\n", serialSpeed);
|
||||
LOG_WARN("Failed to find GNSS Module (baudrate %d)", serialSpeed);
|
||||
return GNSS_MODEL_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ GPS *GPS::createGps()
|
|||
// see NMEAGPS.h
|
||||
gsafixtype.begin(reader, NMEA_MSG_GXGSA, 2);
|
||||
gsapdop.begin(reader, NMEA_MSG_GXGSA, 15);
|
||||
LOG_DEBUG("Using " NMEA_MSG_GXGSA " for 3DFIX and PDOP\n");
|
||||
LOG_DEBUG("Using " NMEA_MSG_GXGSA " for 3DFIX and PDOP");
|
||||
#endif
|
||||
|
||||
// Make sure the GPS is awake before performing any init.
|
||||
|
@ -1310,8 +1310,8 @@ GPS *GPS::createGps()
|
|||
|
||||
// ESP32 has a special set of parameters vs other arduino ports
|
||||
#if defined(ARCH_ESP32)
|
||||
LOG_DEBUG("Using GPIO%d for GPS RX\n", new_gps->rx_gpio);
|
||||
LOG_DEBUG("Using GPIO%d for GPS TX\n", new_gps->tx_gpio);
|
||||
LOG_DEBUG("Using GPIO%d for GPS RX", new_gps->rx_gpio);
|
||||
LOG_DEBUG("Using GPIO%d for GPS TX", new_gps->tx_gpio);
|
||||
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, new_gps->rx_gpio, new_gps->tx_gpio);
|
||||
#elif defined(ARCH_RP2040)
|
||||
_serial_gps->setFIFOSize(256);
|
||||
|
@ -1369,11 +1369,11 @@ bool GPS::factoryReset()
|
|||
// delay(1000);
|
||||
} else if (gnssModel == GNSS_MODEL_MTK) {
|
||||
// send the CAS10 to perform a factory restart of the device (and other device that support PCAS statements)
|
||||
LOG_INFO("GNSS Factory Reset via PCAS10,3\n");
|
||||
LOG_INFO("GNSS Factory Reset via PCAS10,3");
|
||||
_serial_gps->write("$PCAS10,3*1F\r\n");
|
||||
delay(100);
|
||||
} else if (gnssModel == GNSS_MODEL_ATGM336H) {
|
||||
LOG_INFO("Factory Reset via CAS-CFG-RST\n");
|
||||
LOG_INFO("Factory Reset via CAS-CFG-RST");
|
||||
uint8_t msglen = makeCASPacket(0x06, 0x02, sizeof(_message_CAS_CFG_RST_FACTORY), _message_CAS_CFG_RST_FACTORY);
|
||||
_serial_gps->write(UBXscratch, msglen);
|
||||
delay(100);
|
||||
|
@ -1434,7 +1434,7 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
|
|||
t.tm_year = d.year() - 1900;
|
||||
t.tm_isdst = false;
|
||||
if (t.tm_mon > -1) {
|
||||
LOG_DEBUG("NMEA GPS time %02d-%02d-%02d %02d:%02d:%02d age %d\n", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min,
|
||||
LOG_DEBUG("NMEA GPS time %02d-%02d-%02d %02d:%02d:%02d age %d", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min,
|
||||
t.tm_sec, ti.age());
|
||||
perhapsSetRTC(RTCQualityGPS, t);
|
||||
return true;
|
||||
|
@ -1478,7 +1478,7 @@ bool GPS::lookForLocation()
|
|||
|
||||
#ifndef TINYGPS_OPTION_NO_STATISTICS
|
||||
if (reader.failedChecksum() > lastChecksumFailCount) {
|
||||
LOG_WARN("%u new GPS checksum failures, for a total of %u.\n", reader.failedChecksum() - lastChecksumFailCount,
|
||||
LOG_WARN("%u new GPS checksum failures, for a total of %u.", reader.failedChecksum() - lastChecksumFailCount,
|
||||
reader.failedChecksum());
|
||||
lastChecksumFailCount = reader.failedChecksum();
|
||||
}
|
||||
|
@ -1486,7 +1486,7 @@ bool GPS::lookForLocation()
|
|||
|
||||
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
|
||||
fixType = atoi(gsafixtype.value()); // will set to zero if no data
|
||||
// LOG_DEBUG("FIX QUAL=%d, TYPE=%d\n", fixQual, fixType);
|
||||
// LOG_DEBUG("FIX QUAL=%d, TYPE=%d", fixQual, fixType);
|
||||
#endif
|
||||
|
||||
// check if GPS has an acceptable lock
|
||||
|
@ -1494,7 +1494,7 @@ bool GPS::lookForLocation()
|
|||
return false;
|
||||
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("AGE: LOC=%d FIX=%d DATE=%d TIME=%d\n", reader.location.age(),
|
||||
LOG_DEBUG("AGE: LOC=%d FIX=%d DATE=%d TIME=%d", reader.location.age(),
|
||||
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
|
||||
gsafixtype.age(),
|
||||
#else
|
||||
|
@ -1515,7 +1515,7 @@ bool GPS::lookForLocation()
|
|||
(gsafixtype.age() < GPS_SOL_EXPIRY_MS) &&
|
||||
#endif
|
||||
(reader.time.age() < GPS_SOL_EXPIRY_MS) && (reader.date.age() < GPS_SOL_EXPIRY_MS))) {
|
||||
LOG_WARN("SOME data is TOO OLD: LOC %u, TIME %u, DATE %u\n", reader.location.age(), reader.time.age(), reader.date.age());
|
||||
LOG_WARN("SOME data is TOO OLD: LOC %u, TIME %u, DATE %u", reader.location.age(), reader.time.age(), reader.date.age());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1525,13 +1525,13 @@ bool GPS::lookForLocation()
|
|||
// Bail out EARLY to avoid overwriting previous good data (like #857)
|
||||
if (toDegInt(loc.lat) > 900000000) {
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("Bail out EARLY on LAT %i\n", toDegInt(loc.lat));
|
||||
LOG_DEBUG("Bail out EARLY on LAT %i", toDegInt(loc.lat));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
if (toDegInt(loc.lng) > 1800000000) {
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("Bail out EARLY on LNG %i\n", toDegInt(loc.lng));
|
||||
LOG_DEBUG("Bail out EARLY on LNG %i", toDegInt(loc.lng));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -1542,7 +1542,7 @@ bool GPS::lookForLocation()
|
|||
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
|
||||
p.HDOP = reader.hdop.value();
|
||||
p.PDOP = TinyGPSPlus::parseDecimal(gsapdop.value());
|
||||
// LOG_DEBUG("PDOP=%d, HDOP=%d\n", p.PDOP, p.HDOP);
|
||||
// LOG_DEBUG("PDOP=%d, HDOP=%d", p.PDOP, p.HDOP);
|
||||
#else
|
||||
// FIXME! naive PDOP emulation (assumes VDOP==HDOP)
|
||||
// correct formula is PDOP = SQRT(HDOP^2 + VDOP^2)
|
||||
|
@ -1552,7 +1552,7 @@ bool GPS::lookForLocation()
|
|||
|
||||
// Discard incomplete or erroneous readings
|
||||
if (reader.hdop.value() == 0) {
|
||||
LOG_WARN("BOGUS hdop.value() REJECTED: %d\n", reader.hdop.value());
|
||||
LOG_WARN("BOGUS hdop.value() REJECTED: %d", reader.hdop.value());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1589,7 +1589,7 @@ bool GPS::lookForLocation()
|
|||
p.ground_track =
|
||||
reader.course.value() * 1e3; // Scale the heading (in degrees * 10^-2) to match the expected degrees * 10^-5
|
||||
} else {
|
||||
LOG_WARN("BOGUS course.value() REJECTED: %d\n", reader.course.value());
|
||||
LOG_WARN("BOGUS course.value() REJECTED: %d", reader.course.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1629,12 +1629,12 @@ bool GPS::whileActive()
|
|||
}
|
||||
#ifdef SERIAL_BUFFER_SIZE
|
||||
if (_serial_gps->available() >= SERIAL_BUFFER_SIZE - 1) {
|
||||
LOG_WARN("GPS Buffer full with %u bytes waiting. Flushing to avoid corruption.\n", _serial_gps->available());
|
||||
LOG_WARN("GPS Buffer full with %u bytes waiting. Flushing to avoid corruption.", _serial_gps->available());
|
||||
clearBuffer();
|
||||
}
|
||||
#endif
|
||||
// if (_serial_gps->available() > 0)
|
||||
// LOG_DEBUG("GPS Bytes Waiting: %u\n", _serial_gps->available());
|
||||
// LOG_DEBUG("GPS Bytes Waiting: %u", _serial_gps->available());
|
||||
// First consume any chars that have piled up at the receiver
|
||||
while (_serial_gps->available() > 0) {
|
||||
int c = _serial_gps->read();
|
||||
|
@ -1679,17 +1679,17 @@ void GPS::toggleGpsMode()
|
|||
{
|
||||
if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
||||
config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_DISABLED;
|
||||
LOG_INFO("User toggled GpsMode. Now DISABLED.\n");
|
||||
LOG_INFO("User toggled GpsMode. Now DISABLED.");
|
||||
#ifdef GNSS_AIROHA
|
||||
if (powerState == GPS_ACTIVE) {
|
||||
LOG_DEBUG("User power Off GPS\n");
|
||||
LOG_DEBUG("User power Off GPS");
|
||||
digitalWrite(PIN_GPS_EN, LOW);
|
||||
}
|
||||
#endif
|
||||
disable();
|
||||
} else if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_DISABLED) {
|
||||
config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_ENABLED;
|
||||
LOG_INFO("User toggled GpsMode. Now ENABLED\n");
|
||||
LOG_INFO("User toggled GpsMode. Now ENABLED");
|
||||
enable();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ class GPS : private concurrency::OSThread
|
|||
static const uint8_t _message_CAS_CFG_NAVX_CONF[];
|
||||
static const uint8_t _message_CAS_CFG_RATE_1HZ[];
|
||||
|
||||
const char *ACK_SUCCESS_MESSAGE = "Get ack success!\n";
|
||||
const char *ACK_SUCCESS_MESSAGE = "Get ack success!";
|
||||
|
||||
meshtastic_Position p = meshtastic_Position_init_default;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ void GPSUpdateScheduling::informSearching()
|
|||
void GPSUpdateScheduling::informGotLock()
|
||||
{
|
||||
searchEndedMs = millis();
|
||||
LOG_DEBUG("Took %us to get lock\n", (searchEndedMs - searchStartedMs) / 1000);
|
||||
LOG_DEBUG("Took %us to get lock", (searchEndedMs - searchStartedMs) / 1000);
|
||||
updateLockTimePrediction();
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ void GPSUpdateScheduling::updateLockTimePrediction()
|
|||
|
||||
searchCount++; // Only tracked so we can diregard initial lock-times
|
||||
|
||||
LOG_DEBUG("Predicting %us to get next lock\n", predictedMsToGetLock / 1000);
|
||||
LOG_DEBUG("Predicting %us to get next lock", predictedMsToGetLock / 1000);
|
||||
}
|
||||
|
||||
// How long do we expect to spend searching for a lock?
|
||||
|
|
|
@ -46,7 +46,7 @@ void readFromRTC()
|
|||
tv.tv_usec = 0;
|
||||
|
||||
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||
LOG_DEBUG("Read RTC time from RV3028 getTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)\n", t.tm_year + 1900, t.tm_mon + 1,
|
||||
LOG_DEBUG("Read RTC time from RV3028 getTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)", t.tm_year + 1900, t.tm_mon + 1,
|
||||
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
|
||||
timeStartMsec = now;
|
||||
zeroOffsetSecs = tv.tv_sec;
|
||||
|
@ -77,8 +77,8 @@ void readFromRTC()
|
|||
tv.tv_usec = 0;
|
||||
|
||||
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||
LOG_DEBUG("Read RTC time from PCF8563 getDateTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)\n", t.tm_year + 1900,
|
||||
t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
|
||||
LOG_DEBUG("Read RTC time from PCF8563 getDateTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)", t.tm_year + 1900, t.tm_mon + 1,
|
||||
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
|
||||
timeStartMsec = now;
|
||||
zeroOffsetSecs = tv.tv_sec;
|
||||
if (currentQuality == RTCQualityNone) {
|
||||
|
@ -89,7 +89,7 @@ void readFromRTC()
|
|||
if (!gettimeofday(&tv, NULL)) {
|
||||
uint32_t now = millis();
|
||||
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||
LOG_DEBUG("Read RTC time as %ld\n", printableEpoch);
|
||||
LOG_DEBUG("Read RTC time as %ld", printableEpoch);
|
||||
timeStartMsec = now;
|
||||
zeroOffsetSecs = tv.tv_sec;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||
uint32_t printableEpoch = tv->tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||
#ifdef BUILD_EPOCH
|
||||
if (tv->tv_sec < BUILD_EPOCH) {
|
||||
LOG_WARN("Ignoring time (%ld) before build epoch (%ld)!\n", printableEpoch, BUILD_EPOCH);
|
||||
LOG_WARN("Ignoring time (%ld) before build epoch (%ld)!", printableEpoch, BUILD_EPOCH);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -120,21 +120,21 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||
bool shouldSet;
|
||||
if (forceUpdate) {
|
||||
shouldSet = true;
|
||||
LOG_DEBUG("Overriding current RTC quality (%s) with incoming time of RTC quality of %s\n", RtcName(currentQuality),
|
||||
LOG_DEBUG("Overriding current RTC quality (%s) with incoming time of RTC quality of %s", RtcName(currentQuality),
|
||||
RtcName(q));
|
||||
} else if (q > currentQuality) {
|
||||
shouldSet = true;
|
||||
LOG_DEBUG("Upgrading time to quality %s\n", RtcName(q));
|
||||
LOG_DEBUG("Upgrading time to quality %s", RtcName(q));
|
||||
} else if (q == RTCQualityGPS) {
|
||||
shouldSet = true;
|
||||
LOG_DEBUG("Reapplying GPS time: %ld secs\n", printableEpoch);
|
||||
LOG_DEBUG("Reapplying GPS time: %ld secs", printableEpoch);
|
||||
} else if (q == RTCQualityNTP && !Throttle::isWithinTimespanMs(lastSetMsec, (12 * 60 * 60 * 1000UL))) {
|
||||
// Every 12 hrs we will slam in a new NTP or Phone GPS / NTP time, to correct for local RTC clock drift
|
||||
shouldSet = true;
|
||||
LOG_DEBUG("Reapplying external time to correct clock drift %ld secs\n", printableEpoch);
|
||||
LOG_DEBUG("Reapplying external time to correct clock drift %ld secs", printableEpoch);
|
||||
} else {
|
||||
shouldSet = false;
|
||||
LOG_DEBUG("Current RTC quality: %s. Ignoring time of RTC quality of %s\n", RtcName(currentQuality), RtcName(q));
|
||||
LOG_DEBUG("Current RTC quality: %s. Ignoring time of RTC quality of %s", RtcName(currentQuality), RtcName(q));
|
||||
}
|
||||
|
||||
if (shouldSet) {
|
||||
|
@ -158,7 +158,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||
#endif
|
||||
tm *t = gmtime(&tv->tv_sec);
|
||||
rtc.setTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_wday, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
||||
LOG_DEBUG("RV3028_RTC setTime %02d-%02d-%02d %02d:%02d:%02d (%ld)\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
LOG_DEBUG("RV3028_RTC setTime %02d-%02d-%02d %02d:%02d:%02d (%ld)", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
t->tm_hour, t->tm_min, t->tm_sec, printableEpoch);
|
||||
}
|
||||
#elif defined(PCF8563_RTC)
|
||||
|
@ -172,8 +172,8 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||
#endif
|
||||
tm *t = gmtime(&tv->tv_sec);
|
||||
rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
||||
LOG_DEBUG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d (%ld)\n", t->tm_year + 1900, t->tm_mon + 1,
|
||||
t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, printableEpoch);
|
||||
LOG_DEBUG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d (%ld)", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
t->tm_hour, t->tm_min, t->tm_sec, printableEpoch);
|
||||
}
|
||||
#elif defined(ARCH_ESP32)
|
||||
settimeofday(tv, NULL);
|
||||
|
@ -228,9 +228,9 @@ bool perhapsSetRTC(RTCQuality q, struct tm &t)
|
|||
tv.tv_sec = res;
|
||||
tv.tv_usec = 0; // time.centisecond() * (10 / 1000);
|
||||
|
||||
// LOG_DEBUG("Got time from GPS month=%d, year=%d, unixtime=%ld\n", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||
// LOG_DEBUG("Got time from GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||
if (t.tm_year < 0 || t.tm_year >= 300) {
|
||||
// LOG_DEBUG("Ignoring invalid GPS month=%d, year=%d, unixtime=%ld\n", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||
// LOG_DEBUG("Ignoring invalid GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||
return false;
|
||||
} else {
|
||||
return perhapsSetRTC(q, &tv);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const char *failMessage = "Unable to %s\n";
|
||||
const char *failMessage = "Unable to %s";
|
||||
|
||||
#define SEND_UBX_PACKET(TYPE, ID, DATA, ERRMSG, TIMEOUT) \
|
||||
msglen = makeUBXPacket(TYPE, ID, sizeof(DATA), DATA); \
|
||||
|
|
|
@ -79,13 +79,13 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
|
|||
}
|
||||
|
||||
// Trigger the refresh in GxEPD2
|
||||
LOG_DEBUG("Updating E-Paper... ");
|
||||
LOG_DEBUG("Updating E-Paper");
|
||||
adafruitDisplay->nextPage();
|
||||
|
||||
// End the update process
|
||||
endUpdate();
|
||||
|
||||
LOG_DEBUG("done\n");
|
||||
LOG_DEBUG("done");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ void EInkDisplay::setDetected(uint8_t detected)
|
|||
// Connect to the display - variant specific
|
||||
bool EInkDisplay::connect()
|
||||
{
|
||||
LOG_INFO("Doing EInk init\n");
|
||||
LOG_INFO("Doing EInk init");
|
||||
|
||||
#ifdef PIN_EINK_EN
|
||||
// backlight power, HIGH is backlight on, LOW is off
|
||||
|
|
|
@ -119,7 +119,7 @@ void EInkDynamicDisplay::endOrDetach()
|
|||
awaitRefresh();
|
||||
else {
|
||||
// Async begins
|
||||
LOG_DEBUG("Async full-refresh begins (dropping frames)\n");
|
||||
LOG_DEBUG("Async full-refresh begins (dropping frames)");
|
||||
notifyLater(intervalPollAsyncRefresh, DUE_POLL_ASYNCREFRESH, true); // Hand-off to NotifiedWorkerThread
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void EInkDynamicDisplay::endOrDetach()
|
|||
if (previousRefresh == FULL || previousRefresh == FAST) { // If refresh wasn't skipped (on unspecified..)
|
||||
LOG_WARN(
|
||||
"GxEPD2 version has not been modified to support async refresh; using fallback behavior. Please update lib_deps in "
|
||||
"variant's platformio.ini file\n");
|
||||
"variant's platformio.ini file");
|
||||
EInkDisplay::endUpdate();
|
||||
}
|
||||
#endif
|
||||
|
@ -170,7 +170,7 @@ bool EInkDynamicDisplay::determineMode()
|
|||
checkFastRequested();
|
||||
|
||||
if (refresh == UNSPECIFIED)
|
||||
LOG_WARN("There was a flaw in the determineMode() logic.\n");
|
||||
LOG_WARN("There was a flaw in the determineMode() logic.");
|
||||
|
||||
// -- Decision has been reached --
|
||||
applyRefreshMode();
|
||||
|
@ -254,7 +254,7 @@ void EInkDynamicDisplay::checkRateLimiting()
|
|||
if (Throttle::isWithinTimespanMs(previousRunMs, EINK_LIMIT_RATE_RESPONSIVE_SEC * 1000)) {
|
||||
refresh = SKIPPED;
|
||||
reason = EXCEEDED_RATELIMIT_FAST;
|
||||
LOG_DEBUG("refresh=SKIPPED, reason=EXCEEDED_RATELIMIT_FAST, frameFlags=0x%x\n", frameFlags);
|
||||
LOG_DEBUG("refresh=SKIPPED, reason=EXCEEDED_RATELIMIT_FAST, frameFlags=0x%x", frameFlags);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void EInkDynamicDisplay::checkCosmetic()
|
|||
if (frameFlags & COSMETIC) {
|
||||
refresh = FULL;
|
||||
reason = FLAGGED_COSMETIC;
|
||||
LOG_DEBUG("refresh=FULL, reason=FLAGGED_COSMETIC, frameFlags=0x%x\n", frameFlags);
|
||||
LOG_DEBUG("refresh=FULL, reason=FLAGGED_COSMETIC, frameFlags=0x%x", frameFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ void EInkDynamicDisplay::checkDemandingFast()
|
|||
if (frameFlags & DEMAND_FAST) {
|
||||
refresh = FAST;
|
||||
reason = FLAGGED_DEMAND_FAST;
|
||||
LOG_DEBUG("refresh=FAST, reason=FLAGGED_DEMAND_FAST, frameFlags=0x%x\n", frameFlags);
|
||||
LOG_DEBUG("refresh=FAST, reason=FLAGGED_DEMAND_FAST, frameFlags=0x%x", frameFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ void EInkDynamicDisplay::checkFrameMatchesPrevious()
|
|||
if (frameFlags == BACKGROUND && fastRefreshCount > 0) {
|
||||
refresh = FULL;
|
||||
reason = REDRAW_WITH_FULL;
|
||||
LOG_DEBUG("refresh=FULL, reason=REDRAW_WITH_FULL, frameFlags=0x%x\n", frameFlags);
|
||||
LOG_DEBUG("refresh=FULL, reason=REDRAW_WITH_FULL, frameFlags=0x%x", frameFlags);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -314,7 +314,7 @@ void EInkDynamicDisplay::checkFrameMatchesPrevious()
|
|||
// Not redrawn, not COSMETIC, not DEMAND_FAST
|
||||
refresh = SKIPPED;
|
||||
reason = FRAME_MATCHED_PREVIOUS;
|
||||
LOG_DEBUG("refresh=SKIPPED, reason=FRAME_MATCHED_PREVIOUS, frameFlags=0x%x\n", frameFlags);
|
||||
LOG_DEBUG("refresh=SKIPPED, reason=FRAME_MATCHED_PREVIOUS, frameFlags=0x%x", frameFlags);
|
||||
}
|
||||
|
||||
// Have too many fast-refreshes occured consecutively, since last full refresh?
|
||||
|
@ -328,7 +328,7 @@ void EInkDynamicDisplay::checkConsecutiveFastRefreshes()
|
|||
if (fastRefreshCount >= EINK_LIMIT_FASTREFRESH) {
|
||||
refresh = FULL;
|
||||
reason = EXCEEDED_LIMIT_FASTREFRESH;
|
||||
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_LIMIT_FASTREFRESH, frameFlags=0x%x\n", frameFlags);
|
||||
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_LIMIT_FASTREFRESH, frameFlags=0x%x", frameFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,13 +343,13 @@ void EInkDynamicDisplay::checkFastRequested()
|
|||
// If we want BACKGROUND to use fast. (FULL only when a limit is hit)
|
||||
refresh = FAST;
|
||||
reason = BACKGROUND_USES_FAST;
|
||||
LOG_DEBUG("refresh=FAST, reason=BACKGROUND_USES_FAST, fastRefreshCount=%lu, frameFlags=0x%x\n", fastRefreshCount,
|
||||
LOG_DEBUG("refresh=FAST, reason=BACKGROUND_USES_FAST, fastRefreshCount=%lu, frameFlags=0x%x", fastRefreshCount,
|
||||
frameFlags);
|
||||
#else
|
||||
// If we do want to use FULL for BACKGROUND updates
|
||||
refresh = FULL;
|
||||
reason = FLAGGED_BACKGROUND;
|
||||
LOG_DEBUG("refresh=FULL, reason=FLAGGED_BACKGROUND\n");
|
||||
LOG_DEBUG("refresh=FULL, reason=FLAGGED_BACKGROUND");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ void EInkDynamicDisplay::checkFastRequested()
|
|||
if (frameFlags & RESPONSIVE) {
|
||||
refresh = FAST;
|
||||
reason = NO_OBJECTIONS;
|
||||
LOG_DEBUG("refresh=FAST, reason=NO_OBJECTIONS, fastRefreshCount=%lu, frameFlags=0x%x\n", fastRefreshCount, frameFlags);
|
||||
LOG_DEBUG("refresh=FAST, reason=NO_OBJECTIONS, fastRefreshCount=%lu, frameFlags=0x%x", fastRefreshCount, frameFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ void EInkDynamicDisplay::checkExcessiveGhosting()
|
|||
if (ghostPixelCount > EINK_LIMIT_GHOSTING_PX) {
|
||||
refresh = FULL;
|
||||
reason = EXCEEDED_GHOSTINGLIMIT;
|
||||
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_GHOSTINGLIMIT, frameFlags=0x%x\n", frameFlags);
|
||||
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_GHOSTINGLIMIT, frameFlags=0x%x", frameFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ void EInkDynamicDisplay::joinAsyncRefresh()
|
|||
if (!asyncRefreshRunning)
|
||||
return;
|
||||
|
||||
LOG_DEBUG("Joining an async refresh in progress\n");
|
||||
LOG_DEBUG("Joining an async refresh in progress");
|
||||
|
||||
// Continually poll the BUSY pin
|
||||
while (adafruitDisplay->epd2.isBusy())
|
||||
|
@ -479,7 +479,7 @@ void EInkDynamicDisplay::joinAsyncRefresh()
|
|||
adafruitDisplay->endAsyncFull(); // Run the end of nextPage() code
|
||||
EInkDisplay::endUpdate(); // Run base-class code to finish off update (NOT our derived class override)
|
||||
asyncRefreshRunning = false; // Unset the flag
|
||||
LOG_DEBUG("Refresh complete\n");
|
||||
LOG_DEBUG("Refresh complete");
|
||||
|
||||
// Note: this code only works because of a modification to meshtastic/GxEPD2.
|
||||
// It is only equipped to intercept calls to nextPage()
|
||||
|
@ -503,7 +503,7 @@ void EInkDynamicDisplay::pollAsyncRefresh()
|
|||
adafruitDisplay->endAsyncFull(); // Run the end of nextPage() code
|
||||
EInkDisplay::endUpdate(); // Run base-class code to finish off update (NOT our derived class override)
|
||||
asyncRefreshRunning = false; // Unset the flag
|
||||
LOG_DEBUG("Async full-refresh complete\n");
|
||||
LOG_DEBUG("Async full-refresh complete");
|
||||
|
||||
// Note: this code only works because of a modification to meshtastic/GxEPD2.
|
||||
// It is only equipped to intercept calls to nextPage()
|
||||
|
|
|
@ -144,7 +144,7 @@ static bool haveGlyphs(const char *str)
|
|||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("haveGlyphs=%d\n", have);
|
||||
LOG_DEBUG("haveGlyphs=%d", have);
|
||||
return have;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,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
|
||||
static void drawFunctionOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||
{
|
||||
// LOG_DEBUG("Drawing function overlay\n");
|
||||
// LOG_DEBUG("Drawing function overlay");
|
||||
if (functionSymbals.begin() != functionSymbals.end()) {
|
||||
char buf[64];
|
||||
display->setFont(FONT_SMALL);
|
||||
|
@ -310,7 +310,7 @@ static void drawDeepSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
|
|||
EINK_ADD_FRAMEFLAG(display, COSMETIC);
|
||||
EINK_ADD_FRAMEFLAG(display, BLOCKING);
|
||||
|
||||
LOG_DEBUG("Drawing deep sleep screen\n");
|
||||
LOG_DEBUG("Drawing deep sleep screen");
|
||||
|
||||
// Display displayStr on the screen
|
||||
drawIconScreen("Sleeping", display, state, x, y);
|
||||
|
@ -319,7 +319,7 @@ static void drawDeepSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
|
|||
/// Used on eink displays when screen updates are paused
|
||||
static void drawScreensaverOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||
{
|
||||
LOG_DEBUG("Drawing screensaver overlay\n");
|
||||
LOG_DEBUG("Drawing screensaver overlay");
|
||||
|
||||
EINK_ADD_FRAMEFLAG(display, COSMETIC); // Take the opportunity for a full-refresh
|
||||
|
||||
|
@ -385,9 +385,9 @@ static void drawModuleFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int
|
|||
} else {
|
||||
// otherwise, just display the module frame that's aligned with the current frame
|
||||
module_frame = state->currentFrame;
|
||||
// LOG_DEBUG("Screen is not in transition. Frame: %d\n\n", module_frame);
|
||||
// LOG_DEBUG("Screen is not in transition. Frame: %d", module_frame);
|
||||
}
|
||||
// LOG_DEBUG("Drawing Module Frame %d\n\n", module_frame);
|
||||
// LOG_DEBUG("Drawing Module Frame %d", module_frame);
|
||||
MeshModule &pi = *moduleFrames.at(module_frame);
|
||||
pi.drawFrame(display, state, x, y);
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|||
|
||||
const meshtastic_MeshPacket &mp = devicestate.rx_text_message;
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(getFrom(&mp));
|
||||
// LOG_DEBUG("drawing text message from 0x%x: %s\n", mp.from,
|
||||
// LOG_DEBUG("drawing text message from 0x%x: %s", mp.from,
|
||||
// mp.decoded.variant.data.decoded.bytes);
|
||||
|
||||
// Demo for drawStringMaxWidth:
|
||||
|
@ -1500,7 +1500,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||
if (!hasNodeHeading) {
|
||||
// direction to node is unknown so display question mark
|
||||
// Debug info for gps lock errors
|
||||
// LOG_DEBUG("ourNode %d, ourPos %d, theirPos %d\n", !!ourNode, ourNode && hasValidPosition(ourNode),
|
||||
// LOG_DEBUG("ourNode %d, ourPos %d, theirPos %d", !!ourNode, ourNode && hasValidPosition(ourNode),
|
||||
// hasValidPosition(node));
|
||||
display->drawString(compassX - FONT_HEIGHT_SMALL / 4, compassY - FONT_HEIGHT_SMALL / 2, "?");
|
||||
}
|
||||
|
@ -1549,7 +1549,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O
|
|||
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
||||
#elif ARCH_PORTDUINO
|
||||
if (settingsMap[displayPanel] != no_screen) {
|
||||
LOG_DEBUG("Making TFTDisplay!\n");
|
||||
LOG_DEBUG("Making TFTDisplay!");
|
||||
dispdev = new TFTDisplay(address.address, -1, -1, geometry,
|
||||
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
||||
} else {
|
||||
|
@ -1596,7 +1596,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
|
|||
|
||||
if (on != screenOn) {
|
||||
if (on) {
|
||||
LOG_INFO("Turning on screen\n");
|
||||
LOG_INFO("Turning on screen");
|
||||
powerMon->setState(meshtastic_PowerMon_State_Screen_On);
|
||||
#ifdef T_WATCH_S3
|
||||
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
||||
|
@ -1631,7 +1631,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
|
|||
// eInkScreensaver parameter is usually NULL (default argument), default frame used instead
|
||||
setScreensaverFrames(einkScreensaver);
|
||||
#endif
|
||||
LOG_INFO("Turning off screen\n");
|
||||
LOG_INFO("Turning off screen");
|
||||
dispdev->displayOff();
|
||||
#ifdef USE_ST7789
|
||||
SPI1.end();
|
||||
|
@ -1842,7 +1842,7 @@ int32_t Screen::runOnce()
|
|||
// serialSinceMsec adjusts for additional serial wait time during nRF52 bootup
|
||||
static bool showingBootScreen = true;
|
||||
if (showingBootScreen && (millis() > (logo_timeout + serialSinceMsec))) {
|
||||
LOG_INFO("Done with boot screen...\n");
|
||||
LOG_INFO("Done with boot screen...");
|
||||
stopBootScreen();
|
||||
showingBootScreen = false;
|
||||
}
|
||||
|
@ -1851,7 +1851,7 @@ int32_t Screen::runOnce()
|
|||
if (strlen(oemStore.oem_text) > 0) {
|
||||
static bool showingOEMBootScreen = true;
|
||||
if (showingOEMBootScreen && (millis() > ((logo_timeout / 2) + serialSinceMsec))) {
|
||||
LOG_INFO("Switch to OEM screen...\n");
|
||||
LOG_INFO("Switch to OEM screen...");
|
||||
// Change frames.
|
||||
static FrameCallback bootOEMFrames[] = {drawOEMBootScreen};
|
||||
static const int bootOEMFrameCount = sizeof(bootOEMFrames) / sizeof(bootOEMFrames[0]);
|
||||
|
@ -1917,7 +1917,7 @@ int32_t Screen::runOnce()
|
|||
free(cmd.print_text);
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("Invalid screen cmd\n");
|
||||
LOG_ERROR("Invalid screen cmd");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1955,12 +1955,12 @@ int32_t Screen::runOnce()
|
|||
EINK_ADD_FRAMEFLAG(dispdev, COSMETIC);
|
||||
#endif
|
||||
|
||||
LOG_DEBUG("LastScreenTransition exceeded %ums transitioning to next frame\n", (millis() - lastScreenTransition));
|
||||
LOG_DEBUG("LastScreenTransition exceeded %ums transitioning to next frame", (millis() - lastScreenTransition));
|
||||
handleOnPress();
|
||||
}
|
||||
}
|
||||
|
||||
// LOG_DEBUG("want fps %d, fixed=%d\n", targetFramerate,
|
||||
// LOG_DEBUG("want fps %d, fixed=%d", targetFramerate,
|
||||
// ui->getUiState()->frameState); If we are scrolling we need to be called
|
||||
// soon, otherwise just 1 fps (to save CPU) We also ask to be called twice
|
||||
// as fast as we really need so that any rounding errors still result with
|
||||
|
@ -1991,7 +1991,7 @@ void Screen::drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiStat
|
|||
void Screen::setSSLFrames()
|
||||
{
|
||||
if (address_found.address) {
|
||||
// LOG_DEBUG("showing SSL frames\n");
|
||||
// LOG_DEBUG("showing SSL frames");
|
||||
static FrameCallback sslFrames[] = {drawSSLScreen};
|
||||
ui->setFrames(sslFrames, 1);
|
||||
ui->update();
|
||||
|
@ -2003,7 +2003,7 @@ void Screen::setSSLFrames()
|
|||
void Screen::setWelcomeFrames()
|
||||
{
|
||||
if (address_found.address) {
|
||||
// LOG_DEBUG("showing Welcome frames\n");
|
||||
// LOG_DEBUG("showing Welcome frames");
|
||||
static FrameCallback frames[] = {drawWelcomeScreen};
|
||||
setFrameImmediateDraw(frames);
|
||||
}
|
||||
|
@ -2069,7 +2069,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||
uint8_t originalPosition = ui->getUiState()->currentFrame;
|
||||
FramesetInfo fsi; // Location of specific frames, for applying focus parameter
|
||||
|
||||
LOG_DEBUG("showing standard frames\n");
|
||||
LOG_DEBUG("showing standard frames");
|
||||
showingNormalScreen = true;
|
||||
|
||||
#ifdef USE_EINK
|
||||
|
@ -2082,10 +2082,10 @@ void Screen::setFrames(FrameFocus focus)
|
|||
#endif
|
||||
|
||||
moduleFrames = MeshModule::GetMeshModulesWithUIFrames();
|
||||
LOG_DEBUG("Showing %d module frames\n", moduleFrames.size());
|
||||
LOG_DEBUG("Showing %d module frames", moduleFrames.size());
|
||||
#ifdef DEBUG_PORT
|
||||
int totalFrameCount = MAX_NUM_NODES + NUM_EXTRA_FRAMES + moduleFrames.size();
|
||||
LOG_DEBUG("Total frame count: %d\n", totalFrameCount);
|
||||
LOG_DEBUG("Total frame count: %d", totalFrameCount);
|
||||
#endif
|
||||
|
||||
// We don't show the node info of our node (if we have it yet - we should)
|
||||
|
@ -2119,7 +2119,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||
numframes++;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Added modules. numframes: %d\n", numframes);
|
||||
LOG_DEBUG("Added modules. numframes: %d", numframes);
|
||||
|
||||
// If we have a critical fault, show it first
|
||||
fsi.positions.fault = numframes;
|
||||
|
@ -2164,7 +2164,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||
#endif
|
||||
|
||||
fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE
|
||||
LOG_DEBUG("Finished building frames. numframes: %d\n", numframes);
|
||||
LOG_DEBUG("Finished building frames. numframes: %d", numframes);
|
||||
|
||||
ui->setFrames(normalFrames, numframes);
|
||||
ui->enableAllIndicators();
|
||||
|
@ -2245,13 +2245,13 @@ void Screen::dismissCurrentFrame()
|
|||
bool dismissed = false;
|
||||
|
||||
if (currentFrame == framesetInfo.positions.textMessage && devicestate.has_rx_text_message) {
|
||||
LOG_INFO("Dismissing Text Message\n");
|
||||
LOG_INFO("Dismissing Text Message");
|
||||
devicestate.has_rx_text_message = false;
|
||||
dismissed = true;
|
||||
}
|
||||
|
||||
else if (currentFrame == framesetInfo.positions.waypoint && devicestate.has_rx_waypoint) {
|
||||
LOG_DEBUG("Dismissing Waypoint\n");
|
||||
LOG_DEBUG("Dismissing Waypoint");
|
||||
devicestate.has_rx_waypoint = false;
|
||||
dismissed = true;
|
||||
}
|
||||
|
@ -2263,7 +2263,7 @@ void Screen::dismissCurrentFrame()
|
|||
|
||||
void Screen::handleStartFirmwareUpdateScreen()
|
||||
{
|
||||
LOG_DEBUG("showing firmware screen\n");
|
||||
LOG_DEBUG("showing firmware screen");
|
||||
showingNormalScreen = false;
|
||||
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // E-Ink: Explicitly use fast-refresh for next frame
|
||||
|
||||
|
@ -2355,7 +2355,7 @@ void Screen::handlePrint(const char *text)
|
|||
{
|
||||
// the string passed into us probably has a newline, but that would confuse the logging system
|
||||
// so strip it
|
||||
LOG_DEBUG("Screen: %.*s\n", strlen(text) - 1, text);
|
||||
LOG_DEBUG("Screen: %.*s", strlen(text) - 1, text);
|
||||
if (!useDisplay || !showingNormalScreen)
|
||||
return;
|
||||
|
||||
|
@ -2708,7 +2708,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||
|
||||
int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
||||
{
|
||||
// LOG_DEBUG("Screen got status update %d\n", arg->getStatusType());
|
||||
// LOG_DEBUG("Screen got status update %d", arg->getStatusType());
|
||||
switch (arg->getStatusType()) {
|
||||
case STATUS_TYPE_NODE:
|
||||
if (showingNormalScreen && nodeStatus->getLastNumTotal() != nodeStatus->getNumTotal()) {
|
||||
|
|
|
@ -380,7 +380,7 @@ class LGFX : public lgfx::LGFX_Device
|
|||
_panel_instance->setBus(&_bus_instance); // set the bus on the panel.
|
||||
|
||||
auto cfg = _panel_instance->config(); // Gets a structure for display panel settings.
|
||||
LOG_DEBUG("Height: %d, Width: %d \n", settingsMap[displayHeight], settingsMap[displayWidth]);
|
||||
LOG_DEBUG("Height: %d, Width: %d ", settingsMap[displayHeight], settingsMap[displayWidth]);
|
||||
cfg.pin_cs = settingsMap[displayCS]; // Pin number where CS is connected (-1 = disable)
|
||||
cfg.pin_rst = settingsMap[displayReset];
|
||||
cfg.panel_width = settingsMap[displayWidth]; // actual displayable width
|
||||
|
@ -643,7 +643,7 @@ GpioPin *TFTDisplay::backlightEnable = NULL;
|
|||
|
||||
TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY geometry, HW_I2C i2cBus)
|
||||
{
|
||||
LOG_DEBUG("TFTDisplay!\n");
|
||||
LOG_DEBUG("TFTDisplay!");
|
||||
|
||||
#ifdef TFT_BL
|
||||
GpioPin *p = new GpioHwPin(TFT_BL);
|
||||
|
@ -712,7 +712,7 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||
// handle display on/off directly
|
||||
switch (com) {
|
||||
case DISPLAYON: {
|
||||
// LOG_DEBUG("Display on\n");
|
||||
// LOG_DEBUG("Display on");
|
||||
backlightEnable->set(true);
|
||||
#if ARCH_PORTDUINO
|
||||
display(true);
|
||||
|
@ -736,7 +736,7 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||
break;
|
||||
}
|
||||
case DISPLAYOFF: {
|
||||
// LOG_DEBUG("Display off\n");
|
||||
// LOG_DEBUG("Display off");
|
||||
backlightEnable->set(false);
|
||||
#if ARCH_PORTDUINO
|
||||
tft->clear();
|
||||
|
@ -772,14 +772,14 @@ void TFTDisplay::setDisplayBrightness(uint8_t _brightness)
|
|||
// todo
|
||||
#else
|
||||
tft->setBrightness(_brightness);
|
||||
LOG_DEBUG("Brightness is set to value: %i \n", _brightness);
|
||||
LOG_DEBUG("Brightness is set to value: %i ", _brightness);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TFTDisplay::flipScreenVertically()
|
||||
{
|
||||
#if defined(T_WATCH_S3)
|
||||
LOG_DEBUG("Flip TFT vertically\n"); // T-Watch S3 right-handed orientation
|
||||
LOG_DEBUG("Flip TFT vertically"); // T-Watch S3 right-handed orientation
|
||||
tft->setRotation(0);
|
||||
#endif
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ void TFTDisplay::setDetected(uint8_t detected)
|
|||
bool TFTDisplay::connect()
|
||||
{
|
||||
concurrency::LockGuard g(spiLock);
|
||||
LOG_INFO("Doing TFT init\n");
|
||||
LOG_INFO("Doing TFT init");
|
||||
#ifdef RAK14014
|
||||
tft = new TFT_eSPI;
|
||||
#else
|
||||
|
@ -831,7 +831,7 @@ bool TFTDisplay::connect()
|
|||
#endif
|
||||
|
||||
backlightEnable->set(true);
|
||||
LOG_INFO("Power to TFT Backlight\n");
|
||||
LOG_INFO("Power to TFT Backlight");
|
||||
|
||||
#ifdef UNPHONE
|
||||
unphone.backlight(true); // using unPhone library
|
||||
|
|
|
@ -233,7 +233,7 @@ void ExpressLRSFiveWay::sendAdhocPing()
|
|||
// Contained as one method for easier remapping of buttons by user
|
||||
void ExpressLRSFiveWay::shutdown()
|
||||
{
|
||||
LOG_INFO("Shutdown from long press\n");
|
||||
LOG_INFO("Shutdown from long press");
|
||||
powerFSM.trigger(EVENT_PRESS);
|
||||
screen->startAlert("Shutting down...");
|
||||
// Don't set alerting = true. We don't want to auto-dismiss this alert.
|
||||
|
|
|
@ -28,7 +28,7 @@ void RotaryEncoderInterruptBase::init(
|
|||
|
||||
this->rotaryLevelA = digitalRead(this->_pinA);
|
||||
this->rotaryLevelB = digitalRead(this->_pinB);
|
||||
LOG_INFO("Rotary initialized (%d, %d, %d)\n", this->_pinA, this->_pinB, pinPress);
|
||||
LOG_INFO("Rotary initialized (%d, %d, %d)", this->_pinA, this->_pinB, pinPress);
|
||||
}
|
||||
|
||||
int32_t RotaryEncoderInterruptBase::runOnce()
|
||||
|
@ -38,13 +38,13 @@ int32_t RotaryEncoderInterruptBase::runOnce()
|
|||
e.source = this->_originName;
|
||||
|
||||
if (this->action == ROTARY_ACTION_PRESSED) {
|
||||
LOG_DEBUG("Rotary event Press\n");
|
||||
LOG_DEBUG("Rotary event Press");
|
||||
e.inputEvent = this->_eventPressed;
|
||||
} else if (this->action == ROTARY_ACTION_CW) {
|
||||
LOG_DEBUG("Rotary event CW\n");
|
||||
LOG_DEBUG("Rotary event CW");
|
||||
e.inputEvent = this->_eventCw;
|
||||
} else if (this->action == ROTARY_ACTION_CCW) {
|
||||
LOG_DEBUG("Rotary event CCW\n");
|
||||
LOG_DEBUG("Rotary event CCW");
|
||||
e.inputEvent = this->_eventCcw;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ bool ScanAndSelectInput::init()
|
|||
// Connect our class to the canned message module
|
||||
inputBroker->registerSource(this);
|
||||
|
||||
LOG_INFO("Initialized 'Scan and Select' input for Canned Messages, using pin %d\n", pin);
|
||||
LOG_INFO("Initialized 'Scan and Select' input for Canned Messages, using pin %d", pin);
|
||||
return true; // Init succeded
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ int32_t SerialKeyboard::runOnce()
|
|||
digitalWrite(KB_LOAD, HIGH);
|
||||
digitalWrite(KB_CLK, LOW);
|
||||
prevKeys = 0b1111111111111111;
|
||||
LOG_DEBUG("Serial Keyboard setup\n");
|
||||
LOG_DEBUG("Serial Keyboard setup");
|
||||
}
|
||||
|
||||
if (INPUTBROKER_SERIAL_TYPE == 1) { // Chatter V1.0 & V2.0 keypads
|
||||
|
|
|
@ -23,7 +23,7 @@ TouchScreenBase::TouchScreenBase(const char *name, uint16_t width, uint16_t heig
|
|||
void TouchScreenBase::init(bool hasTouch)
|
||||
{
|
||||
if (hasTouch) {
|
||||
LOG_INFO("TouchScreen initialized %d %d\n", TOUCH_THRESHOLD_X, TOUCH_THRESHOLD_Y);
|
||||
LOG_INFO("TouchScreen initialized %d %d", TOUCH_THRESHOLD_X, TOUCH_THRESHOLD_Y);
|
||||
this->setInterval(100);
|
||||
} else {
|
||||
disable();
|
||||
|
@ -68,20 +68,20 @@ int32_t TouchScreenBase::runOnce()
|
|||
if (adx > ady && adx > TOUCH_THRESHOLD_X) {
|
||||
if (0 > dx) { // swipe right to left
|
||||
e.touchEvent = static_cast<char>(TOUCH_ACTION_LEFT);
|
||||
LOG_DEBUG("action SWIPE: right to left\n");
|
||||
LOG_DEBUG("action SWIPE: right to left");
|
||||
} else { // swipe left to right
|
||||
e.touchEvent = static_cast<char>(TOUCH_ACTION_RIGHT);
|
||||
LOG_DEBUG("action SWIPE: left to right\n");
|
||||
LOG_DEBUG("action SWIPE: left to right");
|
||||
}
|
||||
}
|
||||
// swipe vertical
|
||||
else if (ady > adx && ady > TOUCH_THRESHOLD_Y) {
|
||||
if (0 > dy) { // swipe bottom to top
|
||||
e.touchEvent = static_cast<char>(TOUCH_ACTION_UP);
|
||||
LOG_DEBUG("action SWIPE: bottom to top\n");
|
||||
LOG_DEBUG("action SWIPE: bottom to top");
|
||||
} else { // swipe top to bottom
|
||||
e.touchEvent = static_cast<char>(TOUCH_ACTION_DOWN);
|
||||
LOG_DEBUG("action SWIPE: top to bottom\n");
|
||||
LOG_DEBUG("action SWIPE: top to bottom");
|
||||
}
|
||||
}
|
||||
// tap
|
||||
|
@ -90,7 +90,7 @@ int32_t TouchScreenBase::runOnce()
|
|||
if (_tapped) {
|
||||
_tapped = false;
|
||||
e.touchEvent = static_cast<char>(TOUCH_ACTION_DOUBLE_TAP);
|
||||
LOG_DEBUG("action DOUBLE TAP(%d/%d)\n", x, y);
|
||||
LOG_DEBUG("action DOUBLE TAP(%d/%d)", x, y);
|
||||
} else {
|
||||
_tapped = true;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ int32_t TouchScreenBase::runOnce()
|
|||
if (_tapped && (time_t(millis()) - _start) > TIME_LONG_PRESS - 50) {
|
||||
_tapped = false;
|
||||
e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP);
|
||||
LOG_DEBUG("action TAP(%d/%d)\n", _last_x, _last_y);
|
||||
LOG_DEBUG("action TAP(%d/%d)", _last_x, _last_y);
|
||||
}
|
||||
|
||||
// fire LONG_PRESS event without the need for release
|
||||
|
@ -114,7 +114,7 @@ int32_t TouchScreenBase::runOnce()
|
|||
// tricky: prevent reoccurring events and another touch event when releasing
|
||||
_start = millis() + 30000;
|
||||
e.touchEvent = static_cast<char>(TOUCH_ACTION_LONG_PRESS);
|
||||
LOG_DEBUG("action LONG PRESS(%d/%d)\n", _last_x, _last_y);
|
||||
LOG_DEBUG("action LONG PRESS(%d/%d)", _last_x, _last_y);
|
||||
}
|
||||
|
||||
if (e.touchEvent != TOUCH_ACTION_NONE) {
|
||||
|
|
|
@ -30,7 +30,7 @@ void TrackballInterruptBase::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLef
|
|||
attachInterrupt(this->_pinLeft, onIntLeft, RISING);
|
||||
attachInterrupt(this->_pinRight, onIntRight, RISING);
|
||||
|
||||
LOG_DEBUG("Trackball GPIO initialized (%d, %d, %d, %d, %d)\n", this->_pinUp, this->_pinDown, this->_pinLeft, this->_pinRight,
|
||||
LOG_DEBUG("Trackball GPIO initialized (%d, %d, %d, %d, %d)", this->_pinUp, this->_pinDown, this->_pinLeft, this->_pinRight,
|
||||
pinPress);
|
||||
|
||||
this->setInterval(100);
|
||||
|
@ -42,19 +42,19 @@ int32_t TrackballInterruptBase::runOnce()
|
|||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
||||
|
||||
if (this->action == TB_ACTION_PRESSED) {
|
||||
// LOG_DEBUG("Trackball event Press\n");
|
||||
// LOG_DEBUG("Trackball event Press");
|
||||
e.inputEvent = this->_eventPressed;
|
||||
} else if (this->action == TB_ACTION_UP) {
|
||||
// LOG_DEBUG("Trackball event UP\n");
|
||||
// LOG_DEBUG("Trackball event UP");
|
||||
e.inputEvent = this->_eventUp;
|
||||
} else if (this->action == TB_ACTION_DOWN) {
|
||||
// LOG_DEBUG("Trackball event DOWN\n");
|
||||
// LOG_DEBUG("Trackball event DOWN");
|
||||
e.inputEvent = this->_eventDown;
|
||||
} else if (this->action == TB_ACTION_LEFT) {
|
||||
// LOG_DEBUG("Trackball event LEFT\n");
|
||||
// LOG_DEBUG("Trackball event LEFT");
|
||||
e.inputEvent = this->_eventLeft;
|
||||
} else if (this->action == TB_ACTION_RIGHT) {
|
||||
// LOG_DEBUG("Trackball event RIGHT\n");
|
||||
// LOG_DEBUG("Trackball event RIGHT");
|
||||
e.inputEvent = this->_eventRight;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void UpDownInterruptBase::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinPress,
|
|||
attachInterrupt(this->_pinDown, onIntDown, RISING);
|
||||
attachInterrupt(this->_pinUp, onIntUp, RISING);
|
||||
|
||||
LOG_DEBUG("Up/down/press GPIO initialized (%d, %d, %d)\n", this->_pinUp, this->_pinDown, pinPress);
|
||||
LOG_DEBUG("Up/down/press GPIO initialized (%d, %d, %d)", this->_pinUp, this->_pinDown, pinPress);
|
||||
|
||||
this->setInterval(100);
|
||||
}
|
||||
|
@ -34,13 +34,13 @@ int32_t UpDownInterruptBase::runOnce()
|
|||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
||||
|
||||
if (this->action == UPDOWN_ACTION_PRESSED) {
|
||||
LOG_DEBUG("GPIO event Press\n");
|
||||
LOG_DEBUG("GPIO event Press");
|
||||
e.inputEvent = this->_eventPressed;
|
||||
} else if (this->action == UPDOWN_ACTION_UP) {
|
||||
LOG_DEBUG("GPIO event Up\n");
|
||||
LOG_DEBUG("GPIO event Up");
|
||||
e.inputEvent = this->_eventUp;
|
||||
} else if (this->action == UPDOWN_ACTION_DOWN) {
|
||||
LOG_DEBUG("GPIO event Down\n");
|
||||
LOG_DEBUG("GPIO event Down");
|
||||
e.inputEvent = this->_eventDown;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ void CardKbI2cImpl::init()
|
|||
{
|
||||
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO)
|
||||
if (cardkb_found.address == 0x00) {
|
||||
LOG_DEBUG("Rescanning for I2C keyboard\n");
|
||||
LOG_DEBUG("Rescanning for I2C keyboard");
|
||||
uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR};
|
||||
uint8_t i2caddr_asize = 3;
|
||||
auto i2cScanner = std::unique_ptr<ScanI2CTwoWire>(new ScanI2CTwoWire());
|
||||
|
@ -41,7 +41,7 @@ void CardKbI2cImpl::init()
|
|||
break;
|
||||
default:
|
||||
// use this as default since it's also just zero
|
||||
LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00\n", kb_info.type);
|
||||
LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type);
|
||||
kb_model = 0x00;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ int32_t KbI2cBase::runOnce()
|
|||
switch (cardkb_found.port) {
|
||||
case ScanI2C::WIRE1:
|
||||
#if WIRE_INTERFACES_COUNT == 2
|
||||
LOG_DEBUG("Using I2C Bus 1 (the second one)\n");
|
||||
LOG_DEBUG("Using I2C Bus 1 (the second one)");
|
||||
i2cBus = &Wire1;
|
||||
if (cardkb_found.address == BBQ10_KB_ADDR) {
|
||||
Q10keyboard.begin(BBQ10_KB_ADDR, &Wire1);
|
||||
|
@ -43,7 +43,7 @@ int32_t KbI2cBase::runOnce()
|
|||
break;
|
||||
#endif
|
||||
case ScanI2C::WIRE:
|
||||
LOG_DEBUG("Using I2C Bus 0 (the first one)\n");
|
||||
LOG_DEBUG("Using I2C Bus 0 (the first one)");
|
||||
i2cBus = &Wire;
|
||||
if (cardkb_found.address == BBQ10_KB_ADDR) {
|
||||
Q10keyboard.begin(BBQ10_KB_ADDR, &Wire);
|
||||
|
@ -171,7 +171,7 @@ int32_t KbI2cBase::runOnce()
|
|||
}
|
||||
}
|
||||
if (PrintDataBuf != 0) {
|
||||
LOG_DEBUG("RAK14004 key 0x%x pressed\n", PrintDataBuf);
|
||||
LOG_DEBUG("RAK14004 key 0x%x pressed", PrintDataBuf);
|
||||
InputEvent e;
|
||||
e.inputEvent = MATRIXKEY;
|
||||
e.source = this->_originName;
|
||||
|
@ -326,7 +326,7 @@ int32_t KbI2cBase::runOnce()
|
|||
break;
|
||||
}
|
||||
default:
|
||||
LOG_WARN("Unknown kb_model 0x%02x\n", kb_model);
|
||||
LOG_WARN("Unknown kb_model 0x%02x", kb_model);
|
||||
}
|
||||
return 300;
|
||||
}
|
|
@ -70,7 +70,7 @@ int32_t KbMatrixBase::runOnce()
|
|||
// debounce
|
||||
if (key != prevkey) {
|
||||
if (key != 0) {
|
||||
LOG_DEBUG("Key 0x%x pressed\n", key);
|
||||
LOG_DEBUG("Key 0x%x pressed", key);
|
||||
// reset shift now that we have a keypress
|
||||
InputEvent e;
|
||||
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
|
||||
|
@ -122,7 +122,7 @@ int32_t KbMatrixBase::runOnce()
|
|||
}
|
||||
|
||||
} else {
|
||||
LOG_WARN("Unknown kb_model 0x%02x\n", INPUTBROKER_MATRIX_TYPE);
|
||||
LOG_WARN("Unknown kb_model 0x%02x", INPUTBROKER_MATRIX_TYPE);
|
||||
return disable();
|
||||
}
|
||||
return 50; // Keyscan every 50msec to avoid key bounce
|
||||
|
|
126
src/main.cpp
126
src/main.cpp
|
@ -238,7 +238,7 @@ void lateInitVariant() {}
|
|||
*/
|
||||
void printInfo()
|
||||
{
|
||||
LOG_INFO("S:B:%d,%s\n", HW_VENDOR, optstr(APP_VERSION));
|
||||
LOG_INFO("S:B:%d,%s", HW_VENDOR, optstr(APP_VERSION));
|
||||
}
|
||||
#ifndef PIO_UNIT_TESTING
|
||||
void setup()
|
||||
|
@ -277,7 +277,7 @@ void setup()
|
|||
|
||||
serialSinceMsec = millis();
|
||||
|
||||
LOG_INFO("\n\n//\\ E S H T /\\ S T / C\n\n");
|
||||
LOG_INFO("\n\n//\\ E S H T /\\ S T / C\n");
|
||||
|
||||
initDeepSleep();
|
||||
|
||||
|
@ -324,7 +324,7 @@ void setup()
|
|||
#ifdef PERIPHERAL_WARMUP_MS
|
||||
// Some peripherals may require additional time to stabilize after power is connected
|
||||
// e.g. I2C on Heltec Vision Master
|
||||
LOG_INFO("Waiting for peripherals to stabilize\n");
|
||||
LOG_INFO("Waiting for peripherals to stabilize");
|
||||
delay(PERIPHERAL_WARMUP_MS);
|
||||
#endif
|
||||
|
||||
|
@ -385,10 +385,10 @@ void setup()
|
|||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
#elif defined(ARCH_PORTDUINO)
|
||||
if (settingsStrings[i2cdev] != "") {
|
||||
LOG_INFO("Using %s as I2C device.\n", settingsStrings[i2cdev].c_str());
|
||||
LOG_INFO("Using %s as I2C device.", settingsStrings[i2cdev].c_str());
|
||||
Wire.begin(settingsStrings[i2cdev].c_str());
|
||||
} else {
|
||||
LOG_INFO("No I2C device configured, skipping.\n");
|
||||
LOG_INFO("No I2C device configured, skipping.");
|
||||
}
|
||||
#elif HAS_WIRE
|
||||
Wire.begin();
|
||||
|
@ -431,7 +431,7 @@ void setup()
|
|||
// accessories
|
||||
auto i2cScanner = std::unique_ptr<ScanI2CTwoWire>(new ScanI2CTwoWire());
|
||||
#if HAS_WIRE
|
||||
LOG_INFO("Scanning for i2c devices...\n");
|
||||
LOG_INFO("Scanning for i2c devices...");
|
||||
#endif
|
||||
|
||||
#if defined(I2C_SDA1) && defined(ARCH_RP2040)
|
||||
|
@ -456,7 +456,7 @@ void setup()
|
|||
i2cScanner->scanPort(ScanI2C::I2CPort::WIRE);
|
||||
#elif defined(ARCH_PORTDUINO)
|
||||
if (settingsStrings[i2cdev] != "") {
|
||||
LOG_INFO("Scanning for i2c devices...\n");
|
||||
LOG_INFO("Scanning for i2c devices...");
|
||||
i2cScanner->scanPort(ScanI2C::I2CPort::WIRE);
|
||||
}
|
||||
#elif HAS_WIRE
|
||||
|
@ -465,9 +465,9 @@ void setup()
|
|||
|
||||
auto i2cCount = i2cScanner->countDevices();
|
||||
if (i2cCount == 0) {
|
||||
LOG_INFO("No I2C devices found\n");
|
||||
LOG_INFO("No I2C devices found");
|
||||
} else {
|
||||
LOG_INFO("%i I2C devices found\n", i2cCount);
|
||||
LOG_INFO("%i I2C devices found", i2cCount);
|
||||
#ifdef SENSOR_GPS_CONFLICT
|
||||
sensor_detected = true;
|
||||
#endif
|
||||
|
@ -525,7 +525,7 @@ void setup()
|
|||
break;
|
||||
default:
|
||||
// use this as default since it's also just zero
|
||||
LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00\n", kb_info.type);
|
||||
LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type);
|
||||
kb_model = 0x00;
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ void setup()
|
|||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
auto acc_info = i2cScanner->firstAccelerometer();
|
||||
accelerometer_found = acc_info.type != ScanI2C::DeviceType::NONE ? acc_info.address : accelerometer_found;
|
||||
LOG_DEBUG("acc_info = %i\n", acc_info.type);
|
||||
LOG_DEBUG("acc_info = %i", acc_info.type);
|
||||
#endif
|
||||
|
||||
#define STRING(S) #S
|
||||
|
@ -572,7 +572,7 @@ void setup()
|
|||
if (found.type != ScanI2C::DeviceType::NONE) { \
|
||||
nodeTelemetrySensorsMap[PB_T].first = found.address.address; \
|
||||
nodeTelemetrySensorsMap[PB_T].second = i2cScanner->fetchI2CBus(found.address); \
|
||||
LOG_DEBUG("found i2c sensor %s\n", STRING(PB_T)); \
|
||||
LOG_DEBUG("found i2c sensor %s", STRING(PB_T)); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -624,7 +624,7 @@ void setup()
|
|||
// Hello
|
||||
printInfo();
|
||||
#ifdef BUILD_EPOCH
|
||||
LOG_INFO("Build timestamp: %ld\n", BUILD_EPOCH);
|
||||
LOG_INFO("Build timestamp: %ld", BUILD_EPOCH);
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
|
@ -661,7 +661,7 @@ void setup()
|
|||
if (config.power.is_power_saving == true &&
|
||||
IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
|
||||
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER, meshtastic_Config_DeviceConfig_Role_SENSOR))
|
||||
LOG_DEBUG("Tracker/Sensor: Skipping start melody\n");
|
||||
LOG_DEBUG("Tracker/Sensor: Skipping start melody");
|
||||
else
|
||||
playStartMelody();
|
||||
|
||||
|
@ -722,7 +722,7 @@ void setup()
|
|||
#else
|
||||
// ESP32
|
||||
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
|
||||
LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
|
||||
LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
|
||||
SPI.setFrequency(4000000);
|
||||
#endif
|
||||
|
||||
|
@ -731,9 +731,9 @@ void setup()
|
|||
|
||||
// setup TZ prior to time actions.
|
||||
#if !MESHTASTIC_EXCLUDE_TZ
|
||||
LOG_DEBUG("Using compiled/slipstreamed %s\n", slipstreamTZString); // important, removing this clobbers our magic string
|
||||
LOG_DEBUG("Using compiled/slipstreamed %s", slipstreamTZString); // important, removing this clobbers our magic string
|
||||
if (*config.device.tzdef && config.device.tzdef[0] != 0) {
|
||||
LOG_DEBUG("Saved TZ: %s \n", config.device.tzdef);
|
||||
LOG_DEBUG("Saved TZ: %s ", config.device.tzdef);
|
||||
setenv("TZ", config.device.tzdef, 1);
|
||||
} else {
|
||||
if (strncmp((const char *)slipstreamTZString, "tzpl", 4) == 0) {
|
||||
|
@ -744,7 +744,7 @@ void setup()
|
|||
}
|
||||
}
|
||||
tzset();
|
||||
LOG_DEBUG("Set Timezone to %s\n", getenv("TZ"));
|
||||
LOG_DEBUG("Set Timezone to %s", getenv("TZ"));
|
||||
#endif
|
||||
|
||||
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
|
||||
|
@ -761,7 +761,7 @@ void setup()
|
|||
if (gps) {
|
||||
gpsStatus->observe(&gps->newStatus);
|
||||
} else {
|
||||
LOG_DEBUG("Running without GPS.\n");
|
||||
LOG_DEBUG("Running without GPS.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ void setup()
|
|||
nodeStatus->observe(&nodeDB->newStatus);
|
||||
|
||||
#ifdef HAS_I2S
|
||||
LOG_DEBUG("Starting audio thread\n");
|
||||
LOG_DEBUG("Starting audio thread");
|
||||
audioThread = new AudioThread();
|
||||
#endif
|
||||
service = new MeshService();
|
||||
|
@ -821,63 +821,63 @@ void setup()
|
|||
#ifdef ARCH_PORTDUINO
|
||||
if (settingsMap[use_sx1262]) {
|
||||
if (!rIf) {
|
||||
LOG_DEBUG("Attempting to activate sx1262 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||
LOG_DEBUG("Attempting to activate sx1262 radio on SPI port %s", settingsStrings[spidev].c_str());
|
||||
LockingArduinoHal *RadioLibHAL =
|
||||
new LockingArduinoHal(SPI, spiSettings, (settingsMap[ch341Quirk] ? settingsMap[busy] : RADIOLIB_NC));
|
||||
rIf = new SX1262Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||
settingsMap[busy]);
|
||||
if (!rIf->init()) {
|
||||
LOG_ERROR("Failed to find SX1262 radio\n");
|
||||
LOG_ERROR("Failed to find SX1262 radio");
|
||||
delete rIf;
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
LOG_INFO("SX1262 Radio init succeeded, using SX1262 radio\n");
|
||||
LOG_INFO("SX1262 Radio init succeeded, using SX1262 radio");
|
||||
}
|
||||
}
|
||||
} else if (settingsMap[use_rf95]) {
|
||||
if (!rIf) {
|
||||
LOG_DEBUG("Attempting to activate rf95 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||
LOG_DEBUG("Attempting to activate rf95 radio on SPI port %s", settingsStrings[spidev].c_str());
|
||||
LockingArduinoHal *RadioLibHAL =
|
||||
new LockingArduinoHal(SPI, spiSettings, (settingsMap[ch341Quirk] ? settingsMap[busy] : RADIOLIB_NC));
|
||||
rIf = new RF95Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||
settingsMap[busy]);
|
||||
if (!rIf->init()) {
|
||||
LOG_ERROR("Failed to find RF95 radio\n");
|
||||
LOG_ERROR("Failed to find RF95 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
LOG_INFO("RF95 Radio init succeeded, using RF95 radio\n");
|
||||
LOG_INFO("RF95 Radio init succeeded, using RF95 radio");
|
||||
}
|
||||
}
|
||||
} else if (settingsMap[use_sx1280]) {
|
||||
if (!rIf) {
|
||||
LOG_DEBUG("Attempting to activate sx1280 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||
LOG_DEBUG("Attempting to activate sx1280 radio on SPI port %s", settingsStrings[spidev].c_str());
|
||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||
rIf = new SX1280Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||
settingsMap[busy]);
|
||||
if (!rIf->init()) {
|
||||
LOG_ERROR("Failed to find SX1280 radio\n");
|
||||
LOG_ERROR("Failed to find SX1280 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
LOG_INFO("SX1280 Radio init succeeded, using SX1280 radio\n");
|
||||
LOG_INFO("SX1280 Radio init succeeded, using SX1280 radio");
|
||||
}
|
||||
}
|
||||
} else if (settingsMap[use_sx1268]) {
|
||||
if (!rIf) {
|
||||
LOG_DEBUG("Attempting to activate sx1268 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||
LOG_DEBUG("Attempting to activate sx1268 radio on SPI port %s", settingsStrings[spidev].c_str());
|
||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||
rIf = new SX1268Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||
settingsMap[busy]);
|
||||
if (!rIf->init()) {
|
||||
LOG_ERROR("Failed to find SX1268 radio\n");
|
||||
LOG_ERROR("Failed to find SX1268 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
LOG_INFO("SX1268 Radio init succeeded, using SX1268 radio\n");
|
||||
LOG_INFO("SX1268 Radio init succeeded, using SX1268 radio");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -893,11 +893,11 @@ void setup()
|
|||
if (!rIf) {
|
||||
rIf = new STM32WLE5JCInterface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find STM32WL radio\n");
|
||||
LOG_WARN("Failed to find STM32WL radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("STM32WL Radio init succeeded, using STM32WL radio\n");
|
||||
LOG_INFO("STM32WL Radio init succeeded, using STM32WL radio");
|
||||
radioType = STM32WLx_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -907,11 +907,11 @@ void setup()
|
|||
if (!rIf) {
|
||||
rIf = new SimRadio;
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find simulated radio\n");
|
||||
LOG_WARN("Failed to find simulated radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("Using SIMULATED radio!\n");
|
||||
LOG_INFO("Using SIMULATED radio!");
|
||||
radioType = SIM_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -921,11 +921,11 @@ void setup()
|
|||
if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) {
|
||||
rIf = new RF95Interface(RadioLibHAL, LORA_CS, RF95_IRQ, RF95_RESET, RF95_DIO1);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find RF95 radio\n");
|
||||
LOG_WARN("Failed to find RF95 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("RF95 Radio init succeeded, using RF95 radio\n");
|
||||
LOG_INFO("RF95 Radio init succeeded, using RF95 radio");
|
||||
radioType = RF95_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -935,11 +935,11 @@ void setup()
|
|||
if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) {
|
||||
rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find SX1262 radio\n");
|
||||
LOG_WARN("Failed to find SX1262 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("SX1262 Radio init succeeded, using SX1262 radio\n");
|
||||
LOG_INFO("SX1262 Radio init succeeded, using SX1262 radio");
|
||||
radioType = SX1262_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -950,14 +950,12 @@ void setup()
|
|||
// Try using the specified TCXO voltage
|
||||
rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find SX1262 radio with TCXO using DIO3 reference voltage at %f V\n", tcxoVoltage);
|
||||
LOG_WARN("Failed to find SX1262 radio with TCXO, Vref %f V", tcxoVoltage);
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
tcxoVoltage = 0; // if it fails, set the TCXO voltage to zero for the next attempt
|
||||
} else {
|
||||
LOG_INFO("SX1262 Radio init succeeded, using ");
|
||||
LOG_WARN("SX1262 Radio with TCXO");
|
||||
LOG_INFO(", reference voltage at %f V\n", tcxoVoltage);
|
||||
LOG_WARN("SX1262 Radio init succeeded, TCXO, Vref %f V", tcxoVoltage);
|
||||
radioType = SX1262_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -966,14 +964,12 @@ void setup()
|
|||
// If specified TCXO voltage fails, attempt to use DIO3 as a reference instea
|
||||
rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find SX1262 radio with XTAL using DIO3 reference voltage at %f V\n", tcxoVoltage);
|
||||
LOG_WARN("Failed to find SX1262 radio with XTAL, Vref %f V", tcxoVoltage);
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if it fails, set the TCXO voltage back for the next radio search
|
||||
} else {
|
||||
LOG_INFO("SX1262 Radio init succeeded, using ");
|
||||
LOG_WARN("SX1262 Radio with XTAL");
|
||||
LOG_INFO(", reference voltage at %f V\n", tcxoVoltage);
|
||||
LOG_INFO("SX1262 Radio init succeeded, XTAL, Vref %f V", tcxoVoltage);
|
||||
radioType = SX1262_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -983,11 +979,11 @@ void setup()
|
|||
if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) {
|
||||
rIf = new SX1268Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find SX1268 radio\n");
|
||||
LOG_WARN("Failed to find SX1268 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("SX1268 Radio init succeeded, using SX1268 radio\n");
|
||||
LOG_INFO("SX1268 Radio init succeeded, using SX1268 radio");
|
||||
radioType = SX1268_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -997,11 +993,11 @@ void setup()
|
|||
if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) {
|
||||
rIf = new LLCC68Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find LLCC68 radio\n");
|
||||
LOG_WARN("Failed to find LLCC68 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("LLCC68 Radio init succeeded, using LLCC68 radio\n");
|
||||
LOG_INFO("LLCC68 Radio init succeeded, using LLCC68 radio");
|
||||
radioType = LLCC68_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -1011,11 +1007,11 @@ void setup()
|
|||
if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) {
|
||||
rIf = new LR1110Interface(RadioLibHAL, LR1110_SPI_NSS_PIN, LR1110_IRQ_PIN, LR1110_NRESET_PIN, LR1110_BUSY_PIN);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find LR1110 radio\n");
|
||||
LOG_WARN("Failed to find LR1110 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("LR1110 Radio init succeeded, using LR1110 radio\n");
|
||||
LOG_INFO("LR1110 Radio init succeeded, using LR1110 radio");
|
||||
radioType = LR1110_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -1025,11 +1021,11 @@ void setup()
|
|||
if (!rIf) {
|
||||
rIf = new LR1120Interface(RadioLibHAL, LR1120_SPI_NSS_PIN, LR1120_IRQ_PIN, LR1120_NRESET_PIN, LR1120_BUSY_PIN);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find LR1120 radio\n");
|
||||
LOG_WARN("Failed to find LR1120 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("LR1120 Radio init succeeded, using LR1120 radio\n");
|
||||
LOG_INFO("LR1120 Radio init succeeded, using LR1120 radio");
|
||||
radioType = LR1120_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -1039,11 +1035,11 @@ void setup()
|
|||
if (!rIf) {
|
||||
rIf = new LR1121Interface(RadioLibHAL, LR1121_SPI_NSS_PIN, LR1121_IRQ_PIN, LR1121_NRESET_PIN, LR1121_BUSY_PIN);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find LR1121 radio\n");
|
||||
LOG_WARN("Failed to find LR1121 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("LR1121 Radio init succeeded, using LR1121 radio\n");
|
||||
LOG_INFO("LR1121 Radio init succeeded, using LR1121 radio");
|
||||
radioType = LR1121_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -1053,11 +1049,11 @@ void setup()
|
|||
if (!rIf) {
|
||||
rIf = new SX1280Interface(RadioLibHAL, SX128X_CS, SX128X_DIO1, SX128X_RESET, SX128X_BUSY);
|
||||
if (!rIf->init()) {
|
||||
LOG_WARN("Failed to find SX1280 radio\n");
|
||||
LOG_WARN("Failed to find SX1280 radio");
|
||||
delete rIf;
|
||||
rIf = NULL;
|
||||
} else {
|
||||
LOG_INFO("SX1280 Radio init succeeded, using SX1280 radio\n");
|
||||
LOG_INFO("SX1280 Radio init succeeded, using SX1280 radio");
|
||||
radioType = SX1280_RADIO;
|
||||
}
|
||||
}
|
||||
|
@ -1065,11 +1061,11 @@ void setup()
|
|||
|
||||
// check if the radio chip matches the selected region
|
||||
if ((config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) {
|
||||
LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n");
|
||||
LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.");
|
||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET;
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
if (!rIf->reconfigure()) {
|
||||
LOG_WARN("Reconfigure failed, rebooting\n");
|
||||
LOG_WARN("Reconfigure failed, rebooting");
|
||||
screen->startAlert("Rebooting...");
|
||||
rebootAtMsec = millis() + 5000;
|
||||
}
|
||||
|
@ -1124,9 +1120,9 @@ void setup()
|
|||
router->addInterface(rIf);
|
||||
|
||||
// Log bit rate to debug output
|
||||
LOG_DEBUG("LoRA bitrate = %f bytes / sec\n", (float(meshtastic_Constants_DATA_PAYLOAD_LEN) /
|
||||
(float(rIf->getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN)))) *
|
||||
1000);
|
||||
LOG_DEBUG("LoRA bitrate = %f bytes / sec", (float(meshtastic_Constants_DATA_PAYLOAD_LEN) /
|
||||
(float(rIf->getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN)))) *
|
||||
1000);
|
||||
}
|
||||
|
||||
// This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values
|
||||
|
|
|
@ -175,31 +175,31 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
|
|||
k.length = channelSettings.psk.size;
|
||||
if (k.length == 0) {
|
||||
if (ch.role == meshtastic_Channel_Role_SECONDARY) {
|
||||
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key\n", ch.settings.name);
|
||||
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key", ch.settings.name);
|
||||
k = getKey(primaryIndex);
|
||||
} else {
|
||||
LOG_WARN("User disabled encryption\n");
|
||||
LOG_WARN("User disabled encryption");
|
||||
}
|
||||
} else if (k.length == 1) {
|
||||
// Convert the short single byte variants of psk into variant that can be used more generally
|
||||
|
||||
uint8_t pskIndex = k.bytes[0];
|
||||
LOG_DEBUG("Expanding short PSK #%d\n", pskIndex);
|
||||
LOG_DEBUG("Expanding short PSK #%d", pskIndex);
|
||||
if (pskIndex == 0)
|
||||
k.length = 0; // Turn off encryption
|
||||
else if (oemStore.oem_aes_key.size > 1) {
|
||||
// Use the OEM key
|
||||
LOG_DEBUG("Using OEM Key with %d bytes\n", oemStore.oem_aes_key.size);
|
||||
LOG_DEBUG("Using OEM Key with %d bytes", oemStore.oem_aes_key.size);
|
||||
memcpy(k.bytes, oemStore.oem_aes_key.bytes, oemStore.oem_aes_key.size);
|
||||
k.length = oemStore.oem_aes_key.size;
|
||||
// Bump up the last byte of PSK as needed
|
||||
uint8_t *last = k.bytes + oemStore.oem_aes_key.size - 1;
|
||||
*last = *last + pskIndex - 1; // index of 1 means no change vs defaultPSK
|
||||
if (k.length < 16) {
|
||||
LOG_WARN("OEM provided a too short AES128 key - padding\n");
|
||||
LOG_WARN("OEM provided a too short AES128 key - padding");
|
||||
k.length = 16;
|
||||
} else if (k.length < 32 && k.length != 16) {
|
||||
LOG_WARN("OEM provided a too short AES256 key - padding\n");
|
||||
LOG_WARN("OEM provided a too short AES256 key - padding");
|
||||
k.length = 32;
|
||||
}
|
||||
} else {
|
||||
|
@ -212,12 +212,12 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
|
|||
} else if (k.length < 16) {
|
||||
// Error! The user specified only the first few bits of an AES128 key. So by convention we just pad the rest of the
|
||||
// key with zeros
|
||||
LOG_WARN("User provided a too short AES128 key - padding\n");
|
||||
LOG_WARN("User provided a too short AES128 key - padding");
|
||||
k.length = 16;
|
||||
} else if (k.length < 32 && k.length != 16) {
|
||||
// Error! The user specified only the first few bits of an AES256 key. So by convention we just pad the rest of the
|
||||
// key with zeros
|
||||
LOG_WARN("User provided a too short AES256 key - padding\n");
|
||||
LOG_WARN("User provided a too short AES256 key - padding");
|
||||
k.length = 32;
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ void Channels::onConfigChanged()
|
|||
}
|
||||
#if !MESHTASTIC_EXCLUDE_MQTT
|
||||
if (channels.anyMqttEnabled() && mqtt && !mqtt->isEnabled()) {
|
||||
LOG_DEBUG("MQTT is enabled on at least one channel, so set MQTT thread to run immediately\n");
|
||||
LOG_DEBUG("MQTT is enabled on at least one channel, so set MQTT thread to run immediately");
|
||||
mqtt->start();
|
||||
}
|
||||
#endif
|
||||
|
@ -280,7 +280,7 @@ meshtastic_Channel &Channels::getByIndex(ChannelIndex chIndex)
|
|||
meshtastic_Channel *ch = channelFile.channels + chIndex;
|
||||
return *ch;
|
||||
} else {
|
||||
LOG_ERROR("Invalid channel index %d > %d, malformed packet received?\n", chIndex, channelFile.channels_count);
|
||||
LOG_ERROR("Invalid channel index %d > %d, malformed packet received?", chIndex, channelFile.channels_count);
|
||||
|
||||
static meshtastic_Channel *ch = (meshtastic_Channel *)malloc(sizeof(meshtastic_Channel));
|
||||
memset(ch, 0, sizeof(meshtastic_Channel));
|
||||
|
@ -384,11 +384,11 @@ bool Channels::hasDefaultChannel()
|
|||
bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash)
|
||||
{
|
||||
if (chIndex > getNumChannels() || getHash(chIndex) != channelHash) {
|
||||
// LOG_DEBUG("Skipping channel %d (hash %x) due to invalid hash/index, want=%x\n", chIndex, getHash(chIndex),
|
||||
// LOG_DEBUG("Skipping channel %d (hash %x) due to invalid hash/index, want=%x", chIndex, getHash(chIndex),
|
||||
// channelHash);
|
||||
return false;
|
||||
} else {
|
||||
LOG_DEBUG("Using channel %d (hash 0x%x)\n", chIndex, channelHash);
|
||||
LOG_DEBUG("Using channel %d (hash 0x%x)", chIndex, channelHash);
|
||||
setCrypto(chIndex);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
void CryptoEngine::generateKeyPair(uint8_t *pubKey, uint8_t *privKey)
|
||||
{
|
||||
LOG_DEBUG("Generating Curve25519 key pair...\n");
|
||||
LOG_DEBUG("Generating Curve25519 key pair...");
|
||||
Curve25519::dh1(public_key, private_key);
|
||||
memcpy(pubKey, public_key, sizeof(public_key));
|
||||
memcpy(privKey, private_key, sizeof(private_key));
|
||||
|
@ -35,14 +35,14 @@ bool CryptoEngine::regeneratePublicKey(uint8_t *pubKey, uint8_t *privKey)
|
|||
if (!memfll(privKey, 0, sizeof(private_key))) {
|
||||
Curve25519::eval(pubKey, privKey, 0);
|
||||
if (Curve25519::isWeakPoint(pubKey)) {
|
||||
LOG_ERROR("PKI key generation failed. Specified private key results in a weak\n");
|
||||
LOG_ERROR("PKI key generation failed. Specified private key results in a weak");
|
||||
memset(pubKey, 0, 32);
|
||||
return false;
|
||||
}
|
||||
memcpy(private_key, privKey, sizeof(private_key));
|
||||
memcpy(public_key, pubKey, sizeof(public_key));
|
||||
} else {
|
||||
LOG_WARN("X25519 key generation failed due to blank private key\n");
|
||||
LOG_WARN("X25519 key generation failed due to blank private key");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -68,9 +68,9 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, meshtas
|
|||
auth = bytesOut + numBytes;
|
||||
memcpy((uint8_t *)(auth + 8), &extraNonceTmp,
|
||||
sizeof(uint32_t)); // do not use dereference on potential non aligned pointers : *extraNonce = extraNonceTmp;
|
||||
LOG_INFO("Random nonce value: %d\n", extraNonceTmp);
|
||||
LOG_INFO("Random nonce value: %d", extraNonceTmp);
|
||||
if (remotePublic.size == 0) {
|
||||
LOG_DEBUG("Node %d or their public_key not found\n", toNode);
|
||||
LOG_DEBUG("Node %d or their public_key not found", toNode);
|
||||
return false;
|
||||
}
|
||||
if (!crypto->setDHPublicKey(remotePublic.bytes)) {
|
||||
|
@ -103,10 +103,10 @@ bool CryptoEngine::decryptCurve25519(uint32_t fromNode, meshtastic_UserLite_publ
|
|||
auth = bytes + numBytes - 12;
|
||||
memcpy(&extraNonce, auth + 8,
|
||||
sizeof(uint32_t)); // do not use dereference on potential non aligned pointers : (uint32_t *)(auth + 8);
|
||||
LOG_INFO("Random nonce value: %d\n", extraNonce);
|
||||
LOG_INFO("Random nonce value: %d", extraNonce);
|
||||
|
||||
if (remotePublic.size == 0) {
|
||||
LOG_DEBUG("Node or its public key not found in database\n");
|
||||
LOG_DEBUG("Node or its public key not found in database");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ bool CryptoEngine::setDHPublicKey(uint8_t *pubKey)
|
|||
// Calculate the shared secret with the specified node's public key and our private key
|
||||
// This includes an internal weak key check, which among other things looks for an all 0 public key and shared key.
|
||||
if (!Curve25519::dh2(shared_key, local_priv)) {
|
||||
LOG_WARN("Curve25519DH step 2 failed!\n");
|
||||
LOG_WARN("Curve25519DH step 2 failed!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -185,7 +185,7 @@ concurrency::Lock *cryptLock;
|
|||
|
||||
void CryptoEngine::setKey(const CryptoKey &k)
|
||||
{
|
||||
LOG_DEBUG("Using AES%d key!\n", k.length * 8);
|
||||
LOG_DEBUG("Using AES%d key!", k.length * 8);
|
||||
key = k;
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ void CryptoEngine::encryptPacket(uint32_t fromNode, uint64_t packetId, size_t nu
|
|||
if (numBytes <= MAX_BLOCKSIZE) {
|
||||
encryptAESCtr(key, nonce, numBytes, bytes);
|
||||
} else {
|
||||
LOG_ERROR("Packet too large for crypto engine: %d. noop encryption!\n", numBytes);
|
||||
LOG_ERROR("Packet too large for crypto engine: %d. noop encryption!", numBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||
bool isAckorReply = (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) && (p->decoded.request_id != 0);
|
||||
if (isAckorReply && !isToUs(p) && p->to != NODENUM_BROADCAST) {
|
||||
// do not flood direct message that is ACKed or replied to
|
||||
LOG_DEBUG("Rxd an ACK/reply not for me, cancel rebroadcast.\n");
|
||||
LOG_DEBUG("Rxd an ACK/reply not for me, cancel rebroadcast.");
|
||||
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
||||
}
|
||||
if (!isToUs(p) && (p->hop_limit > 0) && !isFromUs(p)) {
|
||||
|
@ -63,15 +63,15 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||
}
|
||||
#endif
|
||||
|
||||
LOG_INFO("Rebroadcasting received floodmsg\n");
|
||||
LOG_INFO("Rebroadcasting received floodmsg");
|
||||
// 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
|
||||
Router::send(tosend);
|
||||
} else {
|
||||
LOG_DEBUG("Not rebroadcasting: Role = CLIENT_MUTE or Rebroadcast Mode = NONE\n");
|
||||
LOG_DEBUG("Not rebroadcasting: Role = CLIENT_MUTE or Rebroadcast Mode = NONE");
|
||||
}
|
||||
} else {
|
||||
LOG_DEBUG("Ignoring 0 id broadcast\n");
|
||||
LOG_DEBUG("Ignoring 0 id broadcast");
|
||||
}
|
||||
}
|
||||
// handle the packet as normal
|
||||
|
|
|
@ -35,7 +35,7 @@ LR11x0Interface<T>::LR11x0Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs
|
|||
RADIOLIB_PIN_TYPE busy)
|
||||
: RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module)
|
||||
{
|
||||
LOG_WARN("LR11x0Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||
LOG_WARN("LR11x0Interface(cs=%d, irq=%d, rst=%d, busy=%d)", cs, irq, rst, busy);
|
||||
}
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
|
@ -54,10 +54,10 @@ template <typename T> bool LR11x0Interface<T>::init()
|
|||
0; // "TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip." per
|
||||
// https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/LR11x0/LR11x0.h#L471C26-L471C104
|
||||
// (DIO3 is free to be used as an IRQ)
|
||||
LOG_DEBUG("LR11X0_DIO3_TCXO_VOLTAGE not defined, not using DIO3 as TCXO reference voltage\n");
|
||||
LOG_DEBUG("LR11X0_DIO3_TCXO_VOLTAGE not defined, not using DIO3 as TCXO reference voltage");
|
||||
#else
|
||||
float tcxoVoltage = LR11X0_DIO3_TCXO_VOLTAGE;
|
||||
LOG_DEBUG("LR11X0_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at %f V\n", LR11X0_DIO3_TCXO_VOLTAGE);
|
||||
LOG_DEBUG("LR11X0_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at %f V", LR11X0_DIO3_TCXO_VOLTAGE);
|
||||
// (DIO3 is not free to be used as an IRQ)
|
||||
#endif
|
||||
|
||||
|
@ -75,31 +75,30 @@ template <typename T> bool LR11x0Interface<T>::init()
|
|||
#ifdef LR11X0_RF_SWITCH_SUBGHZ
|
||||
pinMode(LR11X0_RF_SWITCH_SUBGHZ, OUTPUT);
|
||||
digitalWrite(LR11X0_RF_SWITCH_SUBGHZ, getFreq() < 1e9 ? HIGH : LOW);
|
||||
LOG_DEBUG("Setting RF0 switch to %s\n", getFreq() < 1e9 ? "SubGHz" : "2.4GHz");
|
||||
LOG_DEBUG("Setting RF0 switch to %s", getFreq() < 1e9 ? "SubGHz" : "2.4GHz");
|
||||
#endif
|
||||
|
||||
#ifdef LR11X0_RF_SWITCH_2_4GHZ
|
||||
pinMode(LR11X0_RF_SWITCH_2_4GHZ, OUTPUT);
|
||||
digitalWrite(LR11X0_RF_SWITCH_2_4GHZ, getFreq() < 1e9 ? LOW : HIGH);
|
||||
LOG_DEBUG("Setting RF1 switch to %s\n", getFreq() < 1e9 ? "SubGHz" : "2.4GHz");
|
||||
LOG_DEBUG("Setting RF1 switch to %s", getFreq() < 1e9 ? "SubGHz" : "2.4GHz");
|
||||
#endif
|
||||
|
||||
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage);
|
||||
// \todo Display actual typename of the adapter, not just `LR11x0`
|
||||
LOG_INFO("LR11x0 init result %d\n", res);
|
||||
LOG_INFO("LR11x0 init result %d", res);
|
||||
if (res == RADIOLIB_ERR_CHIP_NOT_FOUND)
|
||||
return false;
|
||||
|
||||
LR11x0VersionInfo_t version;
|
||||
res = lora.getVersionInfo(&version);
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
LOG_DEBUG("LR11x0 Device %d, HW %d, FW %d.%d, WiFi %d.%d, GNSS %d.%d\n", version.device, version.hardware,
|
||||
version.fwMajor, version.fwMinor, version.fwMajorWiFi, version.fwMinorWiFi, version.fwGNSS,
|
||||
version.almanacGNSS);
|
||||
LOG_DEBUG("LR11x0 Device %d, HW %d, FW %d.%d, WiFi %d.%d, GNSS %d.%d", version.device, version.hardware, version.fwMajor,
|
||||
version.fwMinor, version.fwMajorWiFi, version.fwMinorWiFi, version.fwGNSS, version.almanacGNSS);
|
||||
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f", bw);
|
||||
LOG_INFO("Power output set to %d", power);
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
res = lora.setCRC(2);
|
||||
|
@ -121,16 +120,16 @@ template <typename T> bool LR11x0Interface<T>::init()
|
|||
|
||||
if (dioAsRfSwitch) {
|
||||
lora.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||
LOG_DEBUG("Setting DIO RF switch\n", res);
|
||||
LOG_DEBUG("Setting DIO RF switch", res);
|
||||
}
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE) {
|
||||
if (config.lora.sx126x_rx_boosted_gain) { // the name is unfortunate but historically accurate
|
||||
res = lora.setRxBoostedGainMode(true);
|
||||
LOG_INFO("Set RX gain to boosted mode; result: %d\n", res);
|
||||
LOG_INFO("Set RX gain to boosted mode; result: %d", res);
|
||||
} else {
|
||||
res = lora.setRxBoostedGainMode(false);
|
||||
LOG_INFO("Set RX gain to power saving mode (boosted mode off); result: %d\n", res);
|
||||
LOG_INFO("Set RX gain to power saving mode (boosted mode off); result: %d", res);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +199,7 @@ template <typename T> void LR11x0Interface<T>::setStandby()
|
|||
int err = lora.standby();
|
||||
|
||||
if (err != RADIOLIB_ERR_NONE) {
|
||||
LOG_DEBUG("LR11x0 standby failed with error %d\n", err);
|
||||
LOG_DEBUG("LR11x0 standby failed with error %d", err);
|
||||
}
|
||||
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
@ -217,7 +216,7 @@ template <typename T> void LR11x0Interface<T>::setStandby()
|
|||
*/
|
||||
template <typename T> void LR11x0Interface<T>::addReceiveMetadata(meshtastic_MeshPacket *mp)
|
||||
{
|
||||
// LOG_DEBUG("PacketStatus %x\n", lora.getPacketStatus());
|
||||
// LOG_DEBUG("PacketStatus %x", lora.getPacketStatus());
|
||||
mp->rx_snr = lora.getSNR();
|
||||
mp->rx_rssi = lround(lora.getRSSI());
|
||||
}
|
||||
|
@ -282,7 +281,7 @@ template <typename T> bool LR11x0Interface<T>::isActivelyReceiving()
|
|||
template <typename T> bool LR11x0Interface<T>::sleep()
|
||||
{
|
||||
// \todo Display actual typename of the adapter, not just `LR11x0`
|
||||
LOG_DEBUG("LR11x0 entering sleep mode\n");
|
||||
LOG_DEBUG("LR11x0 entering sleep mode");
|
||||
setStandby(); // Stop any pending operations
|
||||
|
||||
// turn off TCXO if it was powered
|
||||
|
|
|
@ -55,7 +55,7 @@ meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, Nod
|
|||
p->decoded.request_id = idFrom;
|
||||
p->channel = chIndex;
|
||||
if (err != meshtastic_Routing_Error_NONE)
|
||||
LOG_WARN("Alloc an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id);
|
||||
LOG_WARN("Alloc an err=%d,to=0x%x,idFrom=0x%x,id=0x%x", err, to, idFrom, p->id);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ meshtastic_MeshPacket *MeshModule::allocErrorResponse(meshtastic_Routing_Error e
|
|||
|
||||
void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src)
|
||||
{
|
||||
// LOG_DEBUG("In call modules\n");
|
||||
// LOG_DEBUG("In call modules");
|
||||
bool moduleFound = false;
|
||||
|
||||
// We now allow **encrypted** packets to pass through the modules
|
||||
|
@ -104,7 +104,7 @@ void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src)
|
|||
assert(!pi.myReply); // If it is !null it means we have a bug, because it should have been sent the previous time
|
||||
|
||||
if (wantsPacket) {
|
||||
LOG_DEBUG("Module '%s' wantsPacket=%d\n", pi.name, wantsPacket);
|
||||
LOG_DEBUG("Module '%s' wantsPacket=%d", pi.name, wantsPacket);
|
||||
|
||||
moduleFound = true;
|
||||
|
||||
|
@ -144,20 +144,20 @@ void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src)
|
|||
if (isDecoded && mp.decoded.want_response && toUs && (!isFromUs(&mp) || isToUs(&mp)) && !currentReply) {
|
||||
pi.sendResponse(mp);
|
||||
ignoreRequest = ignoreRequest || pi.ignoreRequest; // If at least one module asks it, we may ignore a request
|
||||
LOG_INFO("Asked module '%s' to send a response\n", pi.name);
|
||||
LOG_INFO("Asked module '%s' to send a response", pi.name);
|
||||
} else {
|
||||
LOG_DEBUG("Module '%s' considered\n", pi.name);
|
||||
LOG_DEBUG("Module '%s' considered", pi.name);
|
||||
}
|
||||
|
||||
// If the requester didn't ask for a response we might need to discard unused replies to prevent memory leaks
|
||||
if (pi.myReply) {
|
||||
LOG_DEBUG("Discarding an unneeded response\n");
|
||||
LOG_DEBUG("Discarding an unneeded response");
|
||||
packetPool.release(pi.myReply);
|
||||
pi.myReply = NULL;
|
||||
}
|
||||
|
||||
if (handled == ProcessMessage::STOP) {
|
||||
LOG_DEBUG("Module '%s' handled and skipped other processing\n", pi.name);
|
||||
LOG_DEBUG("Module '%s' handled and skipped other processing", pi.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src)
|
|||
// no response reply
|
||||
|
||||
// No one wanted to reply to this request, tell the requster that happened
|
||||
LOG_DEBUG("No one responded, send a nak\n");
|
||||
LOG_DEBUG("No one responded, send a nak");
|
||||
|
||||
// SECURITY NOTE! I considered sending back a different error code if we didn't find the psk (i.e. !isDecoded)
|
||||
// but opted NOT TO. Because it is not a good idea to let remote nodes 'probe' to find out which PSKs were "good" vs
|
||||
|
@ -187,8 +187,7 @@ void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src)
|
|||
}
|
||||
|
||||
if (!moduleFound && isDecoded) {
|
||||
LOG_DEBUG("No modules interested in portnum=%d, src=%s\n", mp.decoded.portnum,
|
||||
(src == RX_SRC_LOCAL) ? "LOCAL" : "REMOTE");
|
||||
LOG_DEBUG("No modules interested in portnum=%d, src=%s", mp.decoded.portnum, (src == RX_SRC_LOCAL) ? "LOCAL" : "REMOTE");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +210,7 @@ void MeshModule::sendResponse(const meshtastic_MeshPacket &req)
|
|||
currentReply = r;
|
||||
} else {
|
||||
// Ignore - this is now expected behavior for routing module (because it ignores some replies)
|
||||
// LOG_WARN("Client requested response but this module did not provide\n");
|
||||
// LOG_WARN("Client requested response but this module did not provide");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +239,7 @@ std::vector<MeshModule *> MeshModule::GetMeshModulesWithUIFrames()
|
|||
for (auto i = modules->begin(); i != modules->end(); ++i) {
|
||||
auto &pi = **i;
|
||||
if (pi.wantUIFrame()) {
|
||||
LOG_DEBUG("%s wants a UI Frame\n", pi.name);
|
||||
LOG_DEBUG("%s wants a UI Frame", pi.name);
|
||||
modulesWithUIFrames.push_back(&pi);
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +254,7 @@ void MeshModule::observeUIEvents(Observer<const UIFrameEvent *> *observer)
|
|||
auto &pi = **i;
|
||||
Observable<const UIFrameEvent *> *observable = pi.getUIFrameObservable();
|
||||
if (observable != NULL) {
|
||||
LOG_DEBUG("%s wants a UI Frame\n", pi.name);
|
||||
LOG_DEBUG("%s wants a UI Frame", pi.name);
|
||||
observer->observe(observable);
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +272,7 @@ AdminMessageHandleResult MeshModule::handleAdminMessageForAllModules(const mesht
|
|||
AdminMessageHandleResult h = pi.handleAdminMessageForModule(mp, request, response);
|
||||
if (h == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) {
|
||||
// In case we have a response it always has priority.
|
||||
LOG_DEBUG("Reply prepared by module '%s' of variant: %d\n", pi.name, response->which_payload_variant);
|
||||
LOG_DEBUG("Reply prepared by module '%s' of variant: %d", pi.name, response->which_payload_variant);
|
||||
handled = h;
|
||||
} else if ((handled != AdminMessageHandleResult::HANDLED_WITH_RESPONSE) && (h == AdminMessageHandleResult::HANDLED)) {
|
||||
// In case the message is handled it should be populated, but will not overwrite
|
||||
|
|
|
@ -80,15 +80,15 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
|
|||
nodeDB->updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio
|
||||
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
|
||||
mp->decoded.portnum == meshtastic_PortNum_TELEMETRY_APP && mp->decoded.request_id > 0) {
|
||||
LOG_DEBUG("Received telemetry response. Skip sending our NodeInfo.\n"); // because this potentially a Repeater which will
|
||||
// ignore our request for its NodeInfo
|
||||
LOG_DEBUG("Received telemetry response. Skip sending our NodeInfo."); // because this potentially a Repeater which will
|
||||
// ignore our request for its NodeInfo
|
||||
} else if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB->getMeshNode(mp->from)->has_user &&
|
||||
nodeInfoModule) {
|
||||
LOG_INFO("Heard new node on channel %d, sending NodeInfo and asking for a response.\n", mp->channel);
|
||||
LOG_INFO("Heard new node on channel %d, sending NodeInfo and asking for a response.", mp->channel);
|
||||
if (airTime->isTxAllowedChannelUtil(true)) {
|
||||
nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel);
|
||||
} else {
|
||||
LOG_DEBUG("Skip sending NodeInfo due to > 25 percent channel util.\n");
|
||||
LOG_DEBUG("Skip sending NodeInfo due to > 25 percent channel util.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ bool MeshService::reloadConfig(int saveWhat)
|
|||
/// The owner User record just got updated, update our node DB and broadcast the info into the mesh
|
||||
void MeshService::reloadOwner(bool shouldSave)
|
||||
{
|
||||
// LOG_DEBUG("reloadOwner()\n");
|
||||
// LOG_DEBUG("reloadOwner()");
|
||||
// update our local data directly
|
||||
nodeDB->updateUser(nodeDB->getNodeNum(), owner);
|
||||
assert(nodeInfoModule);
|
||||
|
@ -180,7 +180,7 @@ void MeshService::handleToRadio(meshtastic_MeshPacket &p)
|
|||
// Switch the port from PortNum_SIMULATOR_APP back to the original PortNum
|
||||
p.decoded.portnum = decoded->portnum;
|
||||
} else
|
||||
LOG_ERROR("Error decoding protobuf for simulator message!\n");
|
||||
LOG_ERROR("Error decoding protobuf for simulator message!");
|
||||
}
|
||||
// Let SimRadio receive as if it did via its LoRa chip
|
||||
SimRadio::instance->startReceive(&p);
|
||||
|
@ -222,7 +222,7 @@ ErrorCode MeshService::sendQueueStatusToPhone(const meshtastic_QueueStatus &qs,
|
|||
copied->mesh_packet_id = mesh_packet_id;
|
||||
|
||||
if (toPhoneQueueStatusQueue.numFree() == 0) {
|
||||
LOG_INFO("tophone queue status queue is full, discarding oldest\n");
|
||||
LOG_INFO("tophone queue status queue is full, discarding oldest");
|
||||
meshtastic_QueueStatus *d = toPhoneQueueStatusQueue.dequeuePtr(0);
|
||||
if (d)
|
||||
releaseQueueStatusToPool(d);
|
||||
|
@ -266,14 +266,14 @@ bool MeshService::trySendPosition(NodeNum dest, bool wantReplies)
|
|||
if (hasValidPosition(node)) {
|
||||
#if HAS_GPS && !MESHTASTIC_EXCLUDE_GPS
|
||||
if (positionModule) {
|
||||
LOG_INFO("Sending position ping to 0x%x, wantReplies=%d, channel=%d\n", dest, wantReplies, node->channel);
|
||||
LOG_INFO("Sending position ping to 0x%x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel);
|
||||
positionModule->sendOurPosition(dest, wantReplies, node->channel);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
if (nodeInfoModule) {
|
||||
LOG_INFO("Sending nodeinfo ping to 0x%x, wantReplies=%d, channel=%d\n", dest, wantReplies, node->channel);
|
||||
LOG_INFO("Sending nodeinfo ping to 0x%x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel);
|
||||
nodeInfoModule->sendOurNodeInfo(dest, wantReplies, node->channel);
|
||||
}
|
||||
}
|
||||
|
@ -298,12 +298,12 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p)
|
|||
if (toPhoneQueue.numFree() == 0) {
|
||||
if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP ||
|
||||
p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP) {
|
||||
LOG_WARN("ToPhone queue is full, discarding oldest\n");
|
||||
LOG_WARN("ToPhone queue is full, discarding oldest");
|
||||
meshtastic_MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
||||
if (d)
|
||||
releaseToPool(d);
|
||||
} else {
|
||||
LOG_WARN("ToPhone queue is full, dropping packet.\n");
|
||||
LOG_WARN("ToPhone queue is full, dropping packet.");
|
||||
releaseToPool(p);
|
||||
fromNum++; // Make sure to notify observers in case they are reconnected so they can get the packets
|
||||
return;
|
||||
|
@ -316,9 +316,9 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p)
|
|||
|
||||
void MeshService::sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage *m)
|
||||
{
|
||||
LOG_DEBUG("Sending mqtt message on topic '%s' to client for proxy\n", m->topic);
|
||||
LOG_DEBUG("Sending mqtt message on topic '%s' to client for proxy", m->topic);
|
||||
if (toPhoneMqttProxyQueue.numFree() == 0) {
|
||||
LOG_WARN("MqttClientProxyMessagePool queue is full, discarding oldest\n");
|
||||
LOG_WARN("MqttClientProxyMessagePool queue is full, discarding oldest");
|
||||
meshtastic_MqttClientProxyMessage *d = toPhoneMqttProxyQueue.dequeuePtr(0);
|
||||
if (d)
|
||||
releaseMqttClientProxyMessageToPool(d);
|
||||
|
@ -330,9 +330,9 @@ void MeshService::sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage
|
|||
|
||||
void MeshService::sendClientNotification(meshtastic_ClientNotification *n)
|
||||
{
|
||||
LOG_DEBUG("Sending client notification to phone\n");
|
||||
LOG_DEBUG("Sending client notification to phone");
|
||||
if (toPhoneClientNotificationQueue.numFree() == 0) {
|
||||
LOG_WARN("ClientNotification queue is full, discarding oldest\n");
|
||||
LOG_WARN("ClientNotification queue is full, discarding oldest");
|
||||
meshtastic_ClientNotification *d = toPhoneClientNotificationQueue.dequeuePtr(0);
|
||||
if (d)
|
||||
releaseClientNotificationToPool(d);
|
||||
|
@ -381,12 +381,12 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
|||
} else {
|
||||
// The GPS has lost lock
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("onGPSchanged() - lost validLocation\n");
|
||||
LOG_DEBUG("onGPSchanged() - lost validLocation");
|
||||
#endif
|
||||
}
|
||||
// Used fixed position if configured regardless of GPS lock
|
||||
if (config.position.fixed_position) {
|
||||
LOG_WARN("Using fixed position\n");
|
||||
LOG_WARN("Using fixed position");
|
||||
pos = TypeConversions::ConvertToPosition(node->position);
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
|||
pos.time = getValidTime(RTCQualityFromNet);
|
||||
|
||||
// In debug logs, identify position by @timestamp:stage (stage 4 = nodeDB)
|
||||
LOG_DEBUG("onGPSChanged() pos@%x time=%u lat=%d lon=%d alt=%d\n", pos.timestamp, pos.time, pos.latitude_i, pos.longitude_i,
|
||||
LOG_DEBUG("onGPSChanged() pos@%x time=%u lat=%d lon=%d alt=%d", pos.timestamp, pos.time, pos.latitude_i, pos.longitude_i,
|
||||
pos.altitude);
|
||||
|
||||
// Update our current position in the local DB
|
||||
|
|
|
@ -102,7 +102,7 @@ static uint8_t ourMacAddr[6];
|
|||
|
||||
NodeDB::NodeDB()
|
||||
{
|
||||
LOG_INFO("Initializing NodeDB\n");
|
||||
LOG_INFO("Initializing NodeDB");
|
||||
loadFromDisk();
|
||||
cleanupMeshDB();
|
||||
|
||||
|
@ -140,7 +140,7 @@ NodeDB::NodeDB()
|
|||
keygenSuccess = true;
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("Generating new PKI keys\n");
|
||||
LOG_INFO("Generating new PKI keys");
|
||||
crypto->generateKeyPair(config.security.public_key.bytes, config.security.private_key.bytes);
|
||||
keygenSuccess = true;
|
||||
}
|
||||
|
@ -167,11 +167,11 @@ NodeDB::NodeDB()
|
|||
preferences.begin("meshtastic", false);
|
||||
myNodeInfo.reboot_count = preferences.getUInt("rebootCounter", 0);
|
||||
preferences.end();
|
||||
LOG_DEBUG("Number of Device Reboots: %d\n", myNodeInfo.reboot_count);
|
||||
LOG_DEBUG("Number of Device Reboots: %d", myNodeInfo.reboot_count);
|
||||
#endif
|
||||
|
||||
resetRadioConfig(); // If bogus settings got saved, then fix them
|
||||
// nodeDB->LOG_DEBUG("region=%d, NODENUM=0x%x, dbsize=%d\n", config.lora.region, myNodeInfo.my_node_num, numMeshNodes);
|
||||
// nodeDB->LOG_DEBUG("region=%d, NODENUM=0x%x, dbsize=%d", config.lora.region, myNodeInfo.my_node_num, numMeshNodes);
|
||||
|
||||
if (devicestateCRC != crc32Buffer(&devicestate, sizeof(devicestate)))
|
||||
saveWhat |= SEGMENT_DEVICESTATE;
|
||||
|
@ -219,7 +219,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
|||
}
|
||||
|
||||
if (channelFile.channels_count != MAX_NUM_CHANNELS) {
|
||||
LOG_INFO("Setting default channel and radio preferences!\n");
|
||||
LOG_INFO("Setting default channel and radio preferences!");
|
||||
|
||||
channels.initDefaults();
|
||||
}
|
||||
|
@ -240,12 +240,12 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
|||
|
||||
bool NodeDB::factoryReset(bool eraseBleBonds)
|
||||
{
|
||||
LOG_INFO("Performing factory reset!\n");
|
||||
LOG_INFO("Performing factory reset!");
|
||||
// first, remove the "/prefs" (this removes most prefs)
|
||||
rmDir("/prefs");
|
||||
#ifdef FSCom
|
||||
if (FSCom.exists("/static/rangetest.csv") && !FSCom.remove("/static/rangetest.csv")) {
|
||||
LOG_ERROR("Could not remove rangetest.csv file\n");
|
||||
LOG_ERROR("Could not remove rangetest.csv file");
|
||||
}
|
||||
#endif
|
||||
// second, install default state (this will deal with the duplicate mac address issue)
|
||||
|
@ -256,14 +256,14 @@ bool NodeDB::factoryReset(bool eraseBleBonds)
|
|||
// third, write everything to disk
|
||||
saveToDisk();
|
||||
if (eraseBleBonds) {
|
||||
LOG_INFO("Erasing BLE bonds\n");
|
||||
LOG_INFO("Erasing BLE bonds");
|
||||
#ifdef ARCH_ESP32
|
||||
// This will erase what's in NVS including ssl keys, persistent variables and ble pairing
|
||||
nvs_flash_erase();
|
||||
#endif
|
||||
#ifdef ARCH_NRF52
|
||||
Bluefruit.begin();
|
||||
LOG_INFO("Clearing bluetooth bonds!\n");
|
||||
LOG_INFO("Clearing bluetooth bonds!");
|
||||
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
||||
bond_print_list(BLE_GAP_ROLE_CENTRAL);
|
||||
Bluefruit.Periph.clearBonds();
|
||||
|
@ -280,7 +280,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
|
|||
if (shouldPreserveKey) {
|
||||
memcpy(private_key_temp, config.security.private_key.bytes, config.security.private_key.size);
|
||||
}
|
||||
LOG_INFO("Installing default LocalConfig\n");
|
||||
LOG_INFO("Installing default LocalConfig");
|
||||
memset(&config, 0, sizeof(meshtastic_LocalConfig));
|
||||
config.version = DEVICESTATE_CUR_VER;
|
||||
config.has_device = true;
|
||||
|
@ -418,7 +418,7 @@ void NodeDB::initConfigIntervals()
|
|||
|
||||
void NodeDB::installDefaultModuleConfig()
|
||||
{
|
||||
LOG_INFO("Installing default ModuleConfig\n");
|
||||
LOG_INFO("Installing default ModuleConfig");
|
||||
memset(&moduleConfig, 0, sizeof(meshtastic_ModuleConfig));
|
||||
|
||||
moduleConfig.version = DEVICESTATE_CUR_VER;
|
||||
|
@ -551,7 +551,7 @@ void NodeDB::initModuleConfigIntervals()
|
|||
|
||||
void NodeDB::installDefaultChannels()
|
||||
{
|
||||
LOG_INFO("Installing default ChannelFile\n");
|
||||
LOG_INFO("Installing default ChannelFile");
|
||||
memset(&channelFile, 0, sizeof(meshtastic_ChannelFile));
|
||||
channelFile.version = DEVICESTATE_CUR_VER;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ void NodeDB::removeNodeByNum(NodeNum nodeNum)
|
|||
numMeshNodes -= removed;
|
||||
std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + 1,
|
||||
meshtastic_NodeInfoLite());
|
||||
LOG_DEBUG("NodeDB::removeNodeByNum purged %d entries. Saving changes...\n", removed);
|
||||
LOG_DEBUG("NodeDB::removeNodeByNum purged %d entries. Saving changes...", removed);
|
||||
saveDeviceStateToDisk();
|
||||
}
|
||||
|
||||
|
@ -612,12 +612,12 @@ void NodeDB::cleanupMeshDB()
|
|||
numMeshNodes -= removed;
|
||||
std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + removed,
|
||||
meshtastic_NodeInfoLite());
|
||||
LOG_DEBUG("cleanupMeshDB purged %d entries\n", removed);
|
||||
LOG_DEBUG("cleanupMeshDB purged %d entries", removed);
|
||||
}
|
||||
|
||||
void NodeDB::installDefaultDeviceState()
|
||||
{
|
||||
LOG_INFO("Installing default DeviceState\n");
|
||||
LOG_INFO("Installing default DeviceState");
|
||||
// memset(&devicestate, 0, sizeof(meshtastic_DeviceState));
|
||||
|
||||
numMeshNodes = 0;
|
||||
|
@ -671,11 +671,11 @@ void NodeDB::pickNewNodeNum()
|
|||
NodeNum candidate = random(NUM_RESERVED, LONG_MAX); // try a new random choice
|
||||
if (found)
|
||||
LOG_WARN("NOTE! Our desired nodenum 0x%x is invalid or in use, by MAC ending in 0x%02x%02x vs our 0x%02x%02x, so "
|
||||
"trying for 0x%x\n",
|
||||
"trying for 0x%x",
|
||||
nodeNum, found->user.macaddr[4], found->user.macaddr[5], ourMacAddr[4], ourMacAddr[5], candidate);
|
||||
nodeNum = candidate;
|
||||
}
|
||||
LOG_DEBUG("Using nodenum 0x%x \n", nodeNum);
|
||||
LOG_DEBUG("Using nodenum 0x%x ", nodeNum);
|
||||
|
||||
myNodeInfo.my_node_num = nodeNum;
|
||||
}
|
||||
|
@ -696,23 +696,23 @@ LoadFileResult NodeDB::loadProto(const char *filename, size_t protoSize, size_t
|
|||
auto f = FSCom.open(filename, FILE_O_READ);
|
||||
|
||||
if (f) {
|
||||
LOG_INFO("Loading %s\n", filename);
|
||||
LOG_INFO("Loading %s", filename);
|
||||
pb_istream_t stream = {&readcb, &f, protoSize};
|
||||
|
||||
memset(dest_struct, 0, objSize);
|
||||
if (!pb_decode(&stream, fields, dest_struct)) {
|
||||
LOG_ERROR("Error: can't decode protobuf %s\n", PB_GET_ERROR(&stream));
|
||||
LOG_ERROR("Error: can't decode protobuf %s", PB_GET_ERROR(&stream));
|
||||
state = LoadFileResult::DECODE_FAILED;
|
||||
} else {
|
||||
LOG_INFO("Loaded %s successfully\n", filename);
|
||||
LOG_INFO("Loaded %s successfully", filename);
|
||||
state = LoadFileResult::LOAD_SUCCESS;
|
||||
}
|
||||
f.close();
|
||||
} else {
|
||||
LOG_ERROR("Could not open / read %s\n", filename);
|
||||
LOG_ERROR("Could not open / read %s", filename);
|
||||
}
|
||||
#else
|
||||
LOG_ERROR("ERROR: Filesystem not implemented\n");
|
||||
LOG_ERROR("ERROR: Filesystem not implemented");
|
||||
state = LoadFileResult::NO_FILESYSTEM;
|
||||
#endif
|
||||
return state;
|
||||
|
@ -737,11 +737,10 @@ void NodeDB::loadFromDisk()
|
|||
// installDefaultDeviceState(); // Our in RAM copy might now be corrupt
|
||||
//} else {
|
||||
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
||||
LOG_WARN("Devicestate %d is old, discarding\n", devicestate.version);
|
||||
LOG_WARN("Devicestate %d is old, discarding", devicestate.version);
|
||||
installDefaultDeviceState();
|
||||
} else {
|
||||
LOG_INFO("Loaded saved devicestate version %d, with nodecount: %d\n", devicestate.version,
|
||||
devicestate.node_db_lite.size());
|
||||
LOG_INFO("Loaded saved devicestate version %d, with nodecount: %d", devicestate.version, devicestate.node_db_lite.size());
|
||||
meshNodes = &devicestate.node_db_lite;
|
||||
numMeshNodes = devicestate.node_db_lite.size();
|
||||
}
|
||||
|
@ -753,10 +752,10 @@ void NodeDB::loadFromDisk()
|
|||
installDefaultConfig(); // Our in RAM copy might now be corrupt
|
||||
} else {
|
||||
if (config.version < DEVICESTATE_MIN_VER) {
|
||||
LOG_WARN("config %d is old, discarding\n", config.version);
|
||||
LOG_WARN("config %d is old, discarding", config.version);
|
||||
installDefaultConfig(true);
|
||||
} else {
|
||||
LOG_INFO("Loaded saved config version %d\n", config.version);
|
||||
LOG_INFO("Loaded saved config version %d", config.version);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -766,10 +765,10 @@ void NodeDB::loadFromDisk()
|
|||
installDefaultModuleConfig(); // Our in RAM copy might now be corrupt
|
||||
} else {
|
||||
if (moduleConfig.version < DEVICESTATE_MIN_VER) {
|
||||
LOG_WARN("moduleConfig %d is old, discarding\n", moduleConfig.version);
|
||||
LOG_WARN("moduleConfig %d is old, discarding", moduleConfig.version);
|
||||
installDefaultModuleConfig();
|
||||
} else {
|
||||
LOG_INFO("Loaded saved moduleConfig version %d\n", moduleConfig.version);
|
||||
LOG_INFO("Loaded saved moduleConfig version %d", moduleConfig.version);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -779,22 +778,22 @@ void NodeDB::loadFromDisk()
|
|||
installDefaultChannels(); // Our in RAM copy might now be corrupt
|
||||
} else {
|
||||
if (channelFile.version < DEVICESTATE_MIN_VER) {
|
||||
LOG_WARN("channelFile %d is old, discarding\n", channelFile.version);
|
||||
LOG_WARN("channelFile %d is old, discarding", channelFile.version);
|
||||
installDefaultChannels();
|
||||
} else {
|
||||
LOG_INFO("Loaded saved channelFile version %d\n", channelFile.version);
|
||||
LOG_INFO("Loaded saved channelFile version %d", channelFile.version);
|
||||
}
|
||||
}
|
||||
|
||||
state = loadProto(oemConfigFile, meshtastic_OEMStore_size, sizeof(meshtastic_OEMStore), &meshtastic_OEMStore_msg, &oemStore);
|
||||
if (state == LoadFileResult::LOAD_SUCCESS) {
|
||||
LOG_INFO("Loaded OEMStore\n");
|
||||
LOG_INFO("Loaded OEMStore");
|
||||
hasOemStore = true;
|
||||
}
|
||||
|
||||
// 2.4.X - configuration migration to update new default intervals
|
||||
if (moduleConfig.version < 23) {
|
||||
LOG_DEBUG("ModuleConfig version %d is stale, upgrading to new default intervals\n", moduleConfig.version);
|
||||
LOG_DEBUG("ModuleConfig version %d is stale, upgrading to new default intervals", moduleConfig.version);
|
||||
moduleConfig.version = DEVICESTATE_CUR_VER;
|
||||
if (moduleConfig.telemetry.device_update_interval == 900)
|
||||
moduleConfig.telemetry.device_update_interval = 0;
|
||||
|
@ -821,11 +820,11 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
|||
#ifdef FSCom
|
||||
auto f = SafeFile(filename, fullAtomic);
|
||||
|
||||
LOG_INFO("Saving %s\n", filename);
|
||||
LOG_INFO("Saving %s", filename);
|
||||
pb_ostream_t stream = {&writecb, static_cast<Print *>(&f), protoSize};
|
||||
|
||||
if (!pb_encode(&stream, fields, dest_struct)) {
|
||||
LOG_ERROR("Error: can't encode protobuf %s\n", PB_GET_ERROR(&stream));
|
||||
LOG_ERROR("Error: can't encode protobuf %s", PB_GET_ERROR(&stream));
|
||||
} else {
|
||||
okay = true;
|
||||
}
|
||||
|
@ -833,10 +832,10 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
|||
bool writeSucceeded = f.close();
|
||||
|
||||
if (!okay || !writeSucceeded) {
|
||||
LOG_ERROR("Can't write prefs!\n");
|
||||
LOG_ERROR("Can't write prefs!");
|
||||
}
|
||||
#else
|
||||
LOG_ERROR("ERROR: Filesystem not implemented\n");
|
||||
LOG_ERROR("ERROR: Filesystem not implemented");
|
||||
#endif
|
||||
return okay;
|
||||
}
|
||||
|
@ -919,7 +918,7 @@ bool NodeDB::saveToDisk(int saveWhat)
|
|||
bool success = saveToDiskNoRetry(saveWhat);
|
||||
|
||||
if (!success) {
|
||||
LOG_ERROR("Failed to save to disk, retrying...\n");
|
||||
LOG_ERROR("Failed to save to disk, retrying...");
|
||||
#ifdef ARCH_NRF52 // @geeksville is not ready yet to say we should do this on other platforms. See bug #4184 discussion
|
||||
FSCom.format();
|
||||
|
||||
|
@ -997,7 +996,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou
|
|||
|
||||
if (src == RX_SRC_LOCAL) {
|
||||
// Local packet, fully authoritative
|
||||
LOG_INFO("updatePosition LOCAL pos@%x time=%u lat=%d lon=%d alt=%d\n", p.timestamp, p.time, p.latitude_i, p.longitude_i,
|
||||
LOG_INFO("updatePosition LOCAL pos@%x time=%u lat=%d lon=%d alt=%d", p.timestamp, p.time, p.latitude_i, p.longitude_i,
|
||||
p.altitude);
|
||||
|
||||
setLocalPosition(p);
|
||||
|
@ -1005,7 +1004,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou
|
|||
} else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.timestamp && !p.location_source) {
|
||||
// FIXME SPECIAL TIME SETTING PACKET FROM EUD TO RADIO
|
||||
// (stop-gap fix for issue #900)
|
||||
LOG_DEBUG("updatePosition SPECIAL time setting time=%u\n", p.time);
|
||||
LOG_DEBUG("updatePosition SPECIAL time setting time=%u", p.time);
|
||||
info->position.time = p.time;
|
||||
} else {
|
||||
// Be careful to only update fields that have been set by the REMOTE sender
|
||||
|
@ -1013,7 +1012,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou
|
|||
// recorded based on the packet rxTime
|
||||
//
|
||||
// FIXME perhaps handle RX_SRC_USER separately?
|
||||
LOG_INFO("updatePosition REMOTE node=0x%x time=%u lat=%d lon=%d\n", nodeId, p.time, p.latitude_i, p.longitude_i);
|
||||
LOG_INFO("updatePosition REMOTE node=0x%x time=%u lat=%d lon=%d", nodeId, p.time, p.latitude_i, p.longitude_i);
|
||||
|
||||
// First, back up fields that we want to protect from overwrite
|
||||
uint32_t tmp_time = info->position.time;
|
||||
|
@ -1043,9 +1042,9 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxS
|
|||
|
||||
if (src == RX_SRC_LOCAL) {
|
||||
// Local packet, fully authoritative
|
||||
LOG_DEBUG("updateTelemetry LOCAL\n");
|
||||
LOG_DEBUG("updateTelemetry LOCAL");
|
||||
} else {
|
||||
LOG_DEBUG("updateTelemetry REMOTE node=0x%x \n", nodeId);
|
||||
LOG_DEBUG("updateTelemetry REMOTE node=0x%x ", nodeId);
|
||||
}
|
||||
info->device_metrics = t.variant.device_metrics;
|
||||
info->has_device_metrics = true;
|
||||
|
@ -1062,16 +1061,16 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
|
|||
return false;
|
||||
}
|
||||
|
||||
LOG_DEBUG("old user %s/%s, channel=%d\n", info->user.long_name, info->user.short_name, info->channel);
|
||||
LOG_DEBUG("old user %s/%s, channel=%d", info->user.long_name, info->user.short_name, info->channel);
|
||||
#if !(MESHTASTIC_EXCLUDE_PKI)
|
||||
if (p.public_key.size > 0) {
|
||||
printBytes("Incoming Pubkey: ", p.public_key.bytes, 32);
|
||||
if (info->user.public_key.size > 0) { // if we have a key for this user already, don't overwrite with a new one
|
||||
LOG_INFO("Public Key set for node, not updating!\n");
|
||||
LOG_INFO("Public Key set for node, not updating!");
|
||||
// we copy the key into the incoming packet, to prevent overwrite
|
||||
memcpy(p.public_key.bytes, info->user.public_key.bytes, 32);
|
||||
} else {
|
||||
LOG_INFO("Updating Node Pubkey!\n");
|
||||
LOG_INFO("Updating Node Pubkey!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1086,8 +1085,7 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
|
|||
}
|
||||
if (nodeId != getNodeNum())
|
||||
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\n", changed, info->user.long_name, info->user.short_name,
|
||||
info->channel);
|
||||
LOG_DEBUG("updating changed=%d user %s/%s, channel=%d", changed, info->user.long_name, info->user.short_name, info->channel);
|
||||
info->has_user = true;
|
||||
|
||||
if (changed) {
|
||||
|
@ -1098,7 +1096,7 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
|
|||
// We just changed something about the user, store our DB
|
||||
Throttle::execute(
|
||||
&lastNodeDbSave, ONE_MINUTE_MS, []() { nodeDB->saveToDisk(SEGMENT_DEVICESTATE); },
|
||||
[]() { LOG_DEBUG("Deferring NodeDB saveToDisk for now\n"); }); // since we saved less than a minute ago
|
||||
[]() { LOG_DEBUG("Deferring NodeDB saveToDisk for now"); }); // since we saved less than a minute ago
|
||||
}
|
||||
|
||||
return changed;
|
||||
|
@ -1109,7 +1107,7 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
|
|||
void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
||||
{
|
||||
if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.from) {
|
||||
LOG_DEBUG("Update DB node 0x%x, rx_time=%u\n", mp.from, mp.rx_time);
|
||||
LOG_DEBUG("Update DB node 0x%x, rx_time=%u", mp.from, mp.rx_time);
|
||||
|
||||
meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getFrom(&mp));
|
||||
if (!info) {
|
||||
|
@ -1161,7 +1159,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
|||
if ((numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < MINIMUM_SAFE_FREE_HEAP)) {
|
||||
if (screen)
|
||||
screen->print("Warn: node database full!\nErasing oldest entry\n");
|
||||
LOG_WARN("Node database full with %i nodes and %i bytes free! Erasing oldest entry\n", numMeshNodes,
|
||||
LOG_WARN("Node database full with %i nodes and %i bytes free! Erasing oldest entry", numMeshNodes,
|
||||
memGet.getFreeHeap());
|
||||
// look for oldest node and erase it
|
||||
uint32_t oldest = UINT32_MAX;
|
||||
|
@ -1197,7 +1195,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
|||
// everything is missing except the nodenum
|
||||
memset(lite, 0, sizeof(*lite));
|
||||
lite->num = n;
|
||||
LOG_INFO("Adding node to database with %i nodes and %i bytes free!\n", numMeshNodes, memGet.getFreeHeap());
|
||||
LOG_INFO("Adding node to database with %i nodes and %i bytes free!", numMeshNodes, memGet.getFreeHeap());
|
||||
}
|
||||
|
||||
return lite;
|
||||
|
@ -1211,9 +1209,9 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
|
|||
if (screen)
|
||||
screen->print(lcd.c_str());
|
||||
if (filename) {
|
||||
LOG_ERROR("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address);
|
||||
LOG_ERROR("NOTE! Recording critical error %d at %s:%lu", code, filename, address);
|
||||
} else {
|
||||
LOG_ERROR("NOTE! Recording critical error %d, address=0x%lx\n", code, address);
|
||||
LOG_ERROR("NOTE! Recording critical error %d, address=0x%lx", code, address);
|
||||
}
|
||||
|
||||
// Record error to DB
|
||||
|
|
|
@ -154,12 +154,12 @@ class NodeDB
|
|||
void setLocalPosition(meshtastic_Position position, bool timeOnly = false)
|
||||
{
|
||||
if (timeOnly) {
|
||||
LOG_DEBUG("Setting local position time only: time=%u timestamp=%u\n", position.time, position.timestamp);
|
||||
LOG_DEBUG("Setting local position time only: time=%u timestamp=%u", position.time, position.timestamp);
|
||||
localPosition.time = position.time;
|
||||
localPosition.timestamp = position.timestamp > 0 ? position.timestamp : position.time;
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Setting local position: lat=%i lon=%i time=%u timestamp=%u\n", position.latitude_i, position.longitude_i,
|
||||
LOG_DEBUG("Setting local position: lat=%i lon=%i time=%u timestamp=%u", position.latitude_i, position.longitude_i,
|
||||
position.time, position.timestamp);
|
||||
localPosition = position;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ PacketHistory::PacketHistory()
|
|||
bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate)
|
||||
{
|
||||
if (p->id == 0) {
|
||||
LOG_DEBUG("Ignoring message with zero id\n");
|
||||
LOG_DEBUG("Ignoring message with zero id");
|
||||
return false; // Not a floodable message ID, so we don't care
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
|
|||
}
|
||||
|
||||
if (seenRecently) {
|
||||
LOG_DEBUG("Found existing packet record for fr=0x%x,to=0x%x,id=0x%x\n", p->from, p->to, p->id);
|
||||
LOG_DEBUG("Found existing packet record for fr=0x%x,to=0x%x,id=0x%x", p->from, p->to, p->id);
|
||||
}
|
||||
|
||||
if (withUpdate) {
|
||||
|
@ -64,7 +64,7 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
|
|||
*/
|
||||
void PacketHistory::clearExpiredRecentPackets()
|
||||
{
|
||||
LOG_DEBUG("recentPackets size=%ld\n", recentPackets.size());
|
||||
LOG_DEBUG("recentPackets size=%ld", recentPackets.size());
|
||||
|
||||
for (auto it = recentPackets.begin(); it != recentPackets.end();) {
|
||||
if (!Throttle::isWithinTimespanMs(it->rxTimeMsec, FLOOD_EXPIRE_TIME)) {
|
||||
|
@ -74,5 +74,5 @@ void PacketHistory::clearExpiredRecentPackets()
|
|||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("recentPackets size=%ld (after clearing expired packets)\n", recentPackets.size());
|
||||
LOG_DEBUG("recentPackets size=%ld (after clearing expired packets)", recentPackets.size());
|
||||
}
|
|
@ -55,16 +55,16 @@ void PhoneAPI::handleStartConfig()
|
|||
state = STATE_SEND_MY_INFO;
|
||||
pauseBluetoothLogging = true;
|
||||
filesManifest = getFiles("/", 10);
|
||||
LOG_DEBUG("Got %d files in manifest\n", filesManifest.size());
|
||||
LOG_DEBUG("Got %d files in manifest", filesManifest.size());
|
||||
|
||||
LOG_INFO("Starting API client config\n");
|
||||
LOG_INFO("Starting API client config");
|
||||
nodeInfoForPhone.num = 0; // Don't keep returning old nodeinfos
|
||||
resetReadIndex();
|
||||
}
|
||||
|
||||
void PhoneAPI::close()
|
||||
{
|
||||
LOG_INFO("PhoneAPI::close()\n");
|
||||
LOG_INFO("PhoneAPI::close()");
|
||||
|
||||
if (state != STATE_SEND_NOTHING) {
|
||||
state = STATE_SEND_NOTHING;
|
||||
|
@ -95,7 +95,7 @@ bool PhoneAPI::checkConnectionTimeout()
|
|||
if (isConnected()) {
|
||||
bool newContact = checkIsConnected();
|
||||
if (!newContact) {
|
||||
LOG_INFO("Lost phone connection\n");
|
||||
LOG_INFO("Lost phone connection");
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
@ -118,41 +118,41 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
|||
return handleToRadioPacket(toRadioScratch.packet);
|
||||
case meshtastic_ToRadio_want_config_id_tag:
|
||||
config_nonce = toRadioScratch.want_config_id;
|
||||
LOG_INFO("Client wants config, nonce=%u\n", config_nonce);
|
||||
LOG_INFO("Client wants config, nonce=%u", config_nonce);
|
||||
handleStartConfig();
|
||||
break;
|
||||
case meshtastic_ToRadio_disconnect_tag:
|
||||
LOG_INFO("Disconnecting from phone\n");
|
||||
LOG_INFO("Disconnecting from phone");
|
||||
close();
|
||||
break;
|
||||
case meshtastic_ToRadio_xmodemPacket_tag:
|
||||
LOG_INFO("Got xmodem packet\n");
|
||||
LOG_INFO("Got xmodem packet");
|
||||
#ifdef FSCom
|
||||
xModem.handlePacket(toRadioScratch.xmodemPacket);
|
||||
#endif
|
||||
break;
|
||||
#if !MESHTASTIC_EXCLUDE_MQTT
|
||||
case meshtastic_ToRadio_mqttClientProxyMessage_tag:
|
||||
LOG_INFO("Got MqttClientProxy message\n");
|
||||
LOG_INFO("Got MqttClientProxy message");
|
||||
if (mqtt && moduleConfig.mqtt.proxy_to_client_enabled && moduleConfig.mqtt.enabled &&
|
||||
(channels.anyMqttEnabled() || moduleConfig.mqtt.map_reporting_enabled)) {
|
||||
mqtt->onClientProxyReceive(toRadioScratch.mqttClientProxyMessage);
|
||||
} else {
|
||||
LOG_WARN("MqttClientProxy received but proxy is not enabled, no channels have up/downlink, or map reporting "
|
||||
"not enabled\n");
|
||||
"not enabled");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case meshtastic_ToRadio_heartbeat_tag:
|
||||
LOG_DEBUG("Got client heartbeat\n");
|
||||
LOG_DEBUG("Got client heartbeat");
|
||||
break;
|
||||
default:
|
||||
// Ignore nop messages
|
||||
// LOG_DEBUG("Error: unexpected ToRadio variant\n");
|
||||
// LOG_DEBUG("Error: unexpected ToRadio variant");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR("Error: ignoring malformed toradio\n");
|
||||
LOG_ERROR("Error: ignoring malformed toradio");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -179,7 +179,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
|||
size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
{
|
||||
if (!available()) {
|
||||
// LOG_DEBUG("getFromRadio=not available\n");
|
||||
// LOG_DEBUG("getFromRadio=not available");
|
||||
return 0;
|
||||
}
|
||||
// In case we send a FromRadio packet
|
||||
|
@ -188,11 +188,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
// Advance states as needed
|
||||
switch (state) {
|
||||
case STATE_SEND_NOTHING:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_NOTHING\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_NOTHING");
|
||||
break;
|
||||
|
||||
case STATE_SEND_MY_INFO:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_MY_INFO\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_MY_INFO");
|
||||
// If the user has specified they don't want our node to share its location, make sure to tell the phone
|
||||
// app not to send locations on our behalf.
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag;
|
||||
|
@ -203,7 +203,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
break;
|
||||
|
||||
case STATE_SEND_OWN_NODEINFO: {
|
||||
LOG_INFO("getFromRadio=STATE_SEND_OWN_NODEINFO\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_OWN_NODEINFO");
|
||||
auto us = nodeDB->readNextMeshNode(readIndex);
|
||||
if (us) {
|
||||
nodeInfoForPhone = TypeConversions::ConvertToNodeInfo(us);
|
||||
|
@ -219,14 +219,14 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
}
|
||||
|
||||
case STATE_SEND_METADATA:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_METADATA\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_METADATA");
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_metadata_tag;
|
||||
fromRadioScratch.metadata = getDeviceMetadata();
|
||||
state = STATE_SEND_CHANNELS;
|
||||
break;
|
||||
|
||||
case STATE_SEND_CHANNELS:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CHANNELS\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CHANNELS");
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_channel_tag;
|
||||
fromRadioScratch.channel = channels.getByIndex(config_state);
|
||||
config_state++;
|
||||
|
@ -238,7 +238,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
break;
|
||||
|
||||
case STATE_SEND_CONFIG:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CONFIG\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CONFIG");
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_tag;
|
||||
switch (config_state) {
|
||||
case meshtastic_Config_device_tag:
|
||||
|
@ -278,7 +278,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_sessionkey_tag;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("Unknown config type %d\n", config_state);
|
||||
LOG_ERROR("Unknown config type %d", config_state);
|
||||
}
|
||||
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
|
||||
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
||||
|
@ -293,7 +293,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
break;
|
||||
|
||||
case STATE_SEND_MODULECONFIG:
|
||||
LOG_INFO("getFromRadio=STATE_SEND_MODULECONFIG\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_MODULECONFIG");
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_moduleConfig_tag;
|
||||
switch (config_state) {
|
||||
case meshtastic_ModuleConfig_mqtt_tag:
|
||||
|
@ -349,7 +349,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
fromRadioScratch.moduleConfig.payload_variant.paxcounter = moduleConfig.paxcounter;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("Unknown module config type %d\n", config_state);
|
||||
LOG_ERROR("Unknown module config type %d", config_state);
|
||||
}
|
||||
|
||||
config_state++;
|
||||
|
@ -362,16 +362,16 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
break;
|
||||
|
||||
case STATE_SEND_OTHER_NODEINFOS: {
|
||||
LOG_INFO("getFromRadio=STATE_SEND_OTHER_NODEINFOS\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_OTHER_NODEINFOS");
|
||||
if (nodeInfoForPhone.num != 0) {
|
||||
LOG_INFO("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", nodeInfoForPhone.num, nodeInfoForPhone.last_heard,
|
||||
LOG_INFO("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s", nodeInfoForPhone.num, nodeInfoForPhone.last_heard,
|
||||
nodeInfoForPhone.user.id, nodeInfoForPhone.user.long_name);
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_node_info_tag;
|
||||
fromRadioScratch.node_info = nodeInfoForPhone;
|
||||
// Stay in current state until done sending nodeinfos
|
||||
nodeInfoForPhone.num = 0; // We just consumed a nodeinfo, will need a new one next time
|
||||
} else {
|
||||
LOG_INFO("Done sending nodeinfos\n");
|
||||
LOG_INFO("Done sending nodeinfos");
|
||||
state = STATE_SEND_FILEMANIFEST;
|
||||
// Go ahead and send that ID right now
|
||||
return getFromRadio(buf);
|
||||
|
@ -380,7 +380,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
}
|
||||
|
||||
case STATE_SEND_FILEMANIFEST: {
|
||||
LOG_INFO("getFromRadio=STATE_SEND_FILEMANIFEST\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_FILEMANIFEST");
|
||||
// last element
|
||||
if (config_state == filesManifest.size()) { // also handles an empty filesManifest
|
||||
config_state = 0;
|
||||
|
@ -390,7 +390,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
} else {
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_fileInfo_tag;
|
||||
fromRadioScratch.fileInfo = filesManifest.at(config_state);
|
||||
LOG_DEBUG("File: %s (%d) bytes\n", fromRadioScratch.fileInfo.file_name, fromRadioScratch.fileInfo.size_bytes);
|
||||
LOG_DEBUG("File: %s (%d) bytes", fromRadioScratch.fileInfo.file_name, fromRadioScratch.fileInfo.size_bytes);
|
||||
config_state++;
|
||||
}
|
||||
break;
|
||||
|
@ -403,7 +403,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
case STATE_SEND_PACKETS:
|
||||
pauseBluetoothLogging = false;
|
||||
// Do we have a message from the mesh or packet from the local device?
|
||||
LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_PACKETS");
|
||||
if (queueStatusPacketForPhone) {
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_queueStatus_tag;
|
||||
fromRadioScratch.queueStatus = *queueStatusPacketForPhone;
|
||||
|
@ -431,7 +431,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR("getFromRadio unexpected state %d\n", state);
|
||||
LOG_ERROR("getFromRadio unexpected state %d", state);
|
||||
}
|
||||
|
||||
// Do we have a message from the mesh?
|
||||
|
@ -441,17 +441,17 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
|
||||
// VERY IMPORTANT to not print debug messages while writing to fromRadioScratch - because we use that same buffer
|
||||
// for logging (when we are encapsulating with protobufs)
|
||||
// LOG_DEBUG("encoding toPhone packet to phone variant=%d, %d bytes\n", fromRadioScratch.which_payload_variant, numbytes);
|
||||
// LOG_DEBUG("encoding toPhone packet to phone variant=%d, %d bytes", fromRadioScratch.which_payload_variant, numbytes);
|
||||
return numbytes;
|
||||
}
|
||||
|
||||
LOG_DEBUG("no FromRadio packet available\n");
|
||||
LOG_DEBUG("no FromRadio packet available");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PhoneAPI::sendConfigComplete()
|
||||
{
|
||||
LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID");
|
||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag;
|
||||
fromRadioScratch.config_complete_id = config_nonce;
|
||||
config_nonce = 0;
|
||||
|
@ -551,11 +551,11 @@ bool PhoneAPI::available()
|
|||
if (!packetForPhone)
|
||||
packetForPhone = service->getForPhone();
|
||||
hasPacket = !!packetForPhone;
|
||||
// LOG_DEBUG("available hasPacket=%d\n", hasPacket);
|
||||
// LOG_DEBUG("available hasPacket=%d", hasPacket);
|
||||
return hasPacket;
|
||||
}
|
||||
default:
|
||||
LOG_ERROR("PhoneAPI::available unexpected state %d\n", state);
|
||||
LOG_ERROR("PhoneAPI::available unexpected state %d", state);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -597,20 +597,20 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
|
|||
printPacket("PACKET FROM PHONE", &p);
|
||||
|
||||
if (p.id > 0 && wasSeenRecently(p.id)) {
|
||||
LOG_DEBUG("Ignoring packet from phone, already seen recently\n");
|
||||
LOG_DEBUG("Ignoring packet from phone, already seen recently");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
||||
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) {
|
||||
LOG_WARN("Rate limiting portnum %d\n", p.decoded.portnum);
|
||||
LOG_WARN("Rate limiting portnum %d", p.decoded.portnum);
|
||||
sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "TraceRoute can only be sent once every 30 seconds");
|
||||
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||
service->sendQueueStatusToPhone(qs, 0, p.id);
|
||||
return false;
|
||||
} else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
||||
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
|
||||
LOG_WARN("Rate limiting portnum %d\n", p.decoded.portnum);
|
||||
LOG_WARN("Rate limiting portnum %d", p.decoded.portnum);
|
||||
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||
service->sendQueueStatusToPhone(qs, 0, p.id);
|
||||
// FIXME: Figure out why this continues to happen
|
||||
|
@ -629,10 +629,10 @@ int PhoneAPI::onNotify(uint32_t newValue)
|
|||
// doesn't call this from idle)
|
||||
|
||||
if (state == STATE_SEND_PACKETS) {
|
||||
LOG_INFO("Telling client we have new packets %u\n", newValue);
|
||||
LOG_INFO("Telling client we have new packets %u", newValue);
|
||||
onNowHasData(newValue);
|
||||
} else {
|
||||
LOG_DEBUG("(Client not yet interested in packets)\n");
|
||||
LOG_DEBUG("(Client not yet interested in packets)");
|
||||
}
|
||||
|
||||
return timeout ? -1 : 0; // If we timed out, MeshService should stop iterating through observers as we just removed one
|
||||
|
|
|
@ -47,7 +47,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
|||
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), fields, &payload);
|
||||
// LOG_DEBUG("did encode\n");
|
||||
// LOG_DEBUG("did encode");
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
|||
// it would be better to update even if the message was destined to others.
|
||||
|
||||
auto &p = mp.decoded;
|
||||
LOG_INFO("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d\n", name, mp.from, mp.id, p.portnum, p.payload.size);
|
||||
LOG_INFO("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d", name, mp.from, mp.id, p.portnum, p.payload.size);
|
||||
|
||||
T scratch;
|
||||
T *decoded = NULL;
|
||||
|
@ -91,7 +91,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
|||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding protobuf module!\n");
|
||||
LOG_ERROR("Error decoding protobuf module!");
|
||||
// if we can't decode it, nobody can process it!
|
||||
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)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding protobuf module!\n");
|
||||
LOG_ERROR("Error decoding protobuf module!");
|
||||
// if we can't decode it, nobody can process it!
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ RF95Interface::RF95Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIO
|
|||
RADIOLIB_PIN_TYPE busy)
|
||||
: RadioLibInterface(hal, cs, irq, rst, busy)
|
||||
{
|
||||
LOG_DEBUG("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||
LOG_DEBUG("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)", cs, irq, rst, busy);
|
||||
}
|
||||
|
||||
/** Some boards require GPIO control of tx vs rx paths */
|
||||
|
@ -176,12 +176,12 @@ bool RF95Interface::init()
|
|||
setTransmitEnable(false);
|
||||
|
||||
int res = lora->begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength);
|
||||
LOG_INFO("RF95 init result %d\n", res);
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
LOG_INFO("RF95 init result %d", res);
|
||||
LOG_INFO("Frequency set to %f", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f", bw);
|
||||
LOG_INFO("Power output set to %d", power);
|
||||
#if defined(RADIOMASTER_900_BANDIT_NANO) || defined(RADIOMASTER_900_BANDIT)
|
||||
LOG_INFO("DAC output set to %d\n", powerDAC);
|
||||
LOG_INFO("DAC output set to %d", powerDAC);
|
||||
#endif
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
|
@ -220,17 +220,17 @@ bool RF95Interface::reconfigure()
|
|||
|
||||
err = lora->setSyncWord(syncWord);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("RF95 setSyncWord %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("RF95 setSyncWord %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora->setCurrentLimit(currentLimit);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("RF95 setCurrentLimit %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("RF95 setCurrentLimit %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora->setPreambleLength(preambleLength);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR(" RF95 setPreambleLength %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR(" RF95 setPreambleLength %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora->setFrequency(getFreq());
|
||||
|
@ -266,7 +266,7 @@ void RF95Interface::setStandby()
|
|||
{
|
||||
int err = lora->standby();
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("RF95 standby %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("RF95 standby %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
isReceiving = false; // If we were receiving, not any more
|
||||
|
@ -290,7 +290,7 @@ void RF95Interface::startReceive()
|
|||
setStandby();
|
||||
int err = lora->startReceive();
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("RF95 startReceive %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("RF95 startReceive %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
isReceiving = true;
|
||||
|
@ -308,14 +308,14 @@ bool RF95Interface::isChannelActive()
|
|||
result = lora->scanChannel();
|
||||
|
||||
if (result == RADIOLIB_PREAMBLE_DETECTED) {
|
||||
// LOG_DEBUG("Channel is busy!\n");
|
||||
// LOG_DEBUG("Channel is busy!");
|
||||
return true;
|
||||
}
|
||||
if (result != RADIOLIB_CHANNEL_FREE)
|
||||
LOG_ERROR("RF95 isChannelActive %s%d\n", radioLibErr, result);
|
||||
LOG_ERROR("RF95 isChannelActive %s%d", radioLibErr, result);
|
||||
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
||||
|
||||
// LOG_DEBUG("Channel is free!\n");
|
||||
// LOG_DEBUG("Channel is free!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,11 +170,11 @@ void initRegion()
|
|||
#ifdef REGULATORY_LORA_REGIONCODE
|
||||
for (; r->code != meshtastic_Config_LoRaConfig_RegionCode_UNSET && r->code != REGULATORY_LORA_REGIONCODE; r++)
|
||||
;
|
||||
LOG_INFO("Wanted region %d, regulatory override to %s\n", config.lora.region, r->name);
|
||||
LOG_INFO("Wanted region %d, regulatory override to %s", config.lora.region, r->name);
|
||||
#else
|
||||
for (; r->code != meshtastic_Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++)
|
||||
;
|
||||
LOG_INFO("Wanted region %d, using %s\n", config.lora.region, r->name);
|
||||
LOG_INFO("Wanted region %d, using %s", config.lora.region, r->name);
|
||||
#endif
|
||||
myRegion = r;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ uint32_t RadioInterface::getRetransmissionMsec(const meshtastic_MeshPacket *p)
|
|||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded);
|
||||
uint32_t packetAirtime = getPacketTime(numbytes + sizeof(PacketHeader));
|
||||
// Make sure enough time has elapsed for this packet to be sent and an ACK is received.
|
||||
// LOG_DEBUG("Waiting for flooding message with airtime %d and slotTime is %d\n", packetAirtime, slotTimeMsec);
|
||||
// LOG_DEBUG("Waiting for flooding message with airtime %d and slotTime is %d", packetAirtime, slotTimeMsec);
|
||||
float channelUtil = airTime->channelUtilizationPercent();
|
||||
uint8_t CWsize = map(channelUtil, 0, 100, CWmin, CWmax);
|
||||
// Assuming we pick max. of CWsize and there will be a client with SNR at half the range
|
||||
|
@ -250,7 +250,7 @@ uint32_t RadioInterface::getTxDelayMsec()
|
|||
current channel utilization. */
|
||||
float channelUtil = airTime->channelUtilizationPercent();
|
||||
uint8_t CWsize = map(channelUtil, 0, 100, CWmin, CWmax);
|
||||
// LOG_DEBUG("Current channel utilization is %f so setting CWsize to %d\n", channelUtil, CWsize);
|
||||
// LOG_DEBUG("Current channel utilization is %f so setting CWsize to %d", channelUtil, CWsize);
|
||||
return random(0, pow(2, CWsize)) * slotTimeMsec;
|
||||
}
|
||||
|
||||
|
@ -267,15 +267,15 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
|
|||
// low SNR = small CW size (Short Delay)
|
||||
uint32_t delay = 0;
|
||||
uint8_t CWsize = map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax);
|
||||
// LOG_DEBUG("rx_snr of %f so setting CWsize to:%d\n", snr, CWsize);
|
||||
// LOG_DEBUG("rx_snr of %f so setting CWsize to:%d", snr, CWsize);
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
delay = random(0, 2 * CWsize) * slotTimeMsec;
|
||||
LOG_DEBUG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay);
|
||||
LOG_DEBUG("rx_snr found in packet. As a router, setting tx delay:%d", delay);
|
||||
} else {
|
||||
// offset the maximum delay for routers: (2 * CWmax * slotTimeMsec)
|
||||
delay = (2 * CWmax * slotTimeMsec) + random(0, pow(2, CWsize)) * slotTimeMsec;
|
||||
LOG_DEBUG("rx_snr found in packet. Setting tx delay:%d\n", delay);
|
||||
LOG_DEBUG("rx_snr found in packet. Setting tx delay:%d", delay);
|
||||
}
|
||||
|
||||
return delay;
|
||||
|
@ -329,7 +329,7 @@ void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
|
|||
out += DEBUG_PORT.mt_sprintf(" priority=%d", p->priority);
|
||||
|
||||
out += ")";
|
||||
LOG_DEBUG("%s\n", out.c_str());
|
||||
LOG_DEBUG("%s", out.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ bool RadioInterface::reconfigure()
|
|||
|
||||
bool RadioInterface::init()
|
||||
{
|
||||
LOG_INFO("Starting meshradio init...\n");
|
||||
LOG_INFO("Starting meshradio init...");
|
||||
|
||||
configChangedObserver.observe(&service->configChanged);
|
||||
preflightSleepObserver.observe(&preflightSleep);
|
||||
|
@ -494,8 +494,7 @@ void RadioInterface::applyModemConfig()
|
|||
}
|
||||
|
||||
if ((myRegion->freqEnd - myRegion->freqStart) < bw / 1000) {
|
||||
static const char *err_string =
|
||||
"Regional frequency range is smaller than bandwidth. Falling back to default preset.\n";
|
||||
static const char *err_string = "Regional frequency range is smaller than bandwidth. Falling back to default preset.";
|
||||
LOG_ERROR(err_string);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||
|
||||
|
@ -556,15 +555,15 @@ void RadioInterface::applyModemConfig()
|
|||
preambleTimeMsec = getPacketTime((uint32_t)0);
|
||||
maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader));
|
||||
|
||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, loraConfig.frequency_offset);
|
||||
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset,
|
||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f", freq, loraConfig.frequency_offset);
|
||||
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d", myRegion->name, channelName, loraConfig.modem_preset,
|
||||
channel_num, power);
|
||||
LOG_INFO("myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f MHz)\n", myRegion->freqStart, myRegion->freqEnd,
|
||||
LOG_INFO("myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f MHz)", myRegion->freqStart, myRegion->freqEnd,
|
||||
myRegion->freqEnd - myRegion->freqStart);
|
||||
LOG_INFO("numChannels: %d x %.3fkHz\n", numChannels, bw);
|
||||
LOG_INFO("channel_num: %d\n", channel_num + 1);
|
||||
LOG_INFO("frequency: %f\n", getFreq());
|
||||
LOG_INFO("Slot time: %u msec\n", slotTimeMsec);
|
||||
LOG_INFO("numChannels: %d x %.3fkHz", numChannels, bw);
|
||||
LOG_INFO("channel_num: %d", channel_num + 1);
|
||||
LOG_INFO("frequency: %f", getFreq());
|
||||
LOG_INFO("Slot time: %u msec", slotTimeMsec);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -579,11 +578,11 @@ void RadioInterface::limitPower()
|
|||
maxPower = myRegion->powerLimit;
|
||||
|
||||
if ((power > maxPower) && !devicestate.owner.is_licensed) {
|
||||
LOG_INFO("Lowering transmit power because of regulatory limits\n");
|
||||
LOG_INFO("Lowering transmit power because of regulatory limits");
|
||||
power = maxPower;
|
||||
}
|
||||
|
||||
LOG_INFO("Set radio: final power level=%d\n", power);
|
||||
LOG_INFO("Set radio: final power level=%d", power);
|
||||
}
|
||||
|
||||
void RadioInterface::deliverToReceiver(meshtastic_MeshPacket *p)
|
||||
|
@ -599,7 +598,7 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
|
|||
{
|
||||
assert(!sendingPacket);
|
||||
|
||||
// LOG_DEBUG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
||||
// LOG_DEBUG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
||||
assert(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag); // It should have already been encoded by now
|
||||
|
||||
lastTxStart = millis();
|
||||
|
@ -611,7 +610,7 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
|
|||
radioBuffer.header.next_hop = 0; // *** For future use ***
|
||||
radioBuffer.header.relay_node = 0; // *** For future use ***
|
||||
if (p->hop_limit > HOP_MAX) {
|
||||
LOG_WARN("hop limit %d is too high, setting to %d\n", p->hop_limit, HOP_RELIABLE);
|
||||
LOG_WARN("hop limit %d is too high, setting to %d", p->hop_limit, HOP_RELIABLE);
|
||||
p->hop_limit = HOP_RELIABLE;
|
||||
}
|
||||
radioBuffer.header.flags =
|
||||
|
|
|
@ -111,18 +111,18 @@ bool RadioLibInterface::canSendImmediately()
|
|||
|
||||
if (busyTx || busyRx) {
|
||||
if (busyTx) {
|
||||
LOG_WARN("Can not send yet, busyTx\n");
|
||||
LOG_WARN("Can not send yet, busyTx");
|
||||
}
|
||||
// If we've been trying to send the same packet more than one minute and we haven't gotten a
|
||||
// TX IRQ from the radio, the radio is probably broken.
|
||||
if (busyTx && !Throttle::isWithinTimespanMs(lastTxStart, 60000)) {
|
||||
LOG_ERROR("Hardware Failure! busyTx for more than 60s\n");
|
||||
LOG_ERROR("Hardware Failure! busyTx for more than 60s");
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_TRANSMIT_FAILED);
|
||||
// reboot in 5 seconds when this condition occurs.
|
||||
rebootAtMsec = lastTxStart + 65000;
|
||||
}
|
||||
if (busyRx) {
|
||||
LOG_WARN("Can not send yet, busyRx\n");
|
||||
LOG_WARN("Can not send yet, busyRx");
|
||||
}
|
||||
return false;
|
||||
} else
|
||||
|
@ -139,12 +139,12 @@ bool RadioLibInterface::receiveDetected(uint16_t irq, ulong syncWordHeaderValidF
|
|||
} else if (!Throttle::isWithinTimespanMs(activeReceiveStart, 2 * preambleTimeMsec) && !(irq & syncWordHeaderValidFlag)) {
|
||||
// The HEADER_VALID flag should be set by now if it was really a packet, so ignore PREAMBLE_DETECTED flag
|
||||
activeReceiveStart = 0;
|
||||
LOG_DEBUG("Ignore false preamble detection.\n");
|
||||
LOG_DEBUG("Ignore false preamble detection.");
|
||||
return false;
|
||||
} else if (!Throttle::isWithinTimespanMs(activeReceiveStart, maxPacketTimeMsec)) {
|
||||
// We should have gotten an RX_DONE IRQ by now if it was really a packet, so ignore HEADER_VALID flag
|
||||
activeReceiveStart = 0;
|
||||
LOG_DEBUG("Ignore false header detection.\n");
|
||||
LOG_DEBUG("Ignore false header detection.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -161,13 +161,13 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
|
|||
|
||||
if (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
LOG_WARN("send - !config.lora.tx_enabled");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_WARN("send - lora tx disabled because RegionCode_Unset\n");
|
||||
LOG_WARN("send - lora tx disabled because RegionCode_Unset");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
|
|||
#else
|
||||
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
LOG_WARN("send - !config.lora.tx_enabled");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
|
|||
#ifndef LORA_DISABLE_SENDING
|
||||
printPacket("enqueuing for send", p);
|
||||
|
||||
LOG_DEBUG("txGood=%d,txRelay=%d,rxGood=%d,rxBad=%d\n", 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;
|
||||
|
||||
if (res != ERRNO_OK) { // we weren't able to queue it, so we must drop it to prevent leaks
|
||||
|
@ -196,7 +196,7 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
|
|||
|
||||
// set (random) transmit delay to let others reconfigure their radio,
|
||||
// to avoid collisions and implement timing-based flooding
|
||||
// LOG_DEBUG("Set random delay before transmitting.\n");
|
||||
// LOG_DEBUG("Set random delay before transmitting.");
|
||||
setTransmitDelay();
|
||||
|
||||
return res;
|
||||
|
@ -221,7 +221,7 @@ bool RadioLibInterface::canSleep()
|
|||
{
|
||||
bool res = txQueue.empty();
|
||||
if (!res) { // only print debug messages if we are vetoing sleep
|
||||
LOG_DEBUG("radio wait to sleep, txEmpty=%d\n", res);
|
||||
LOG_DEBUG("radio wait to sleep, txEmpty=%d", res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ bool RadioLibInterface::cancelSending(NodeNum from, PacketId id)
|
|||
packetPool.release(p); // free the packet we just removed
|
||||
|
||||
bool result = (p != NULL);
|
||||
LOG_DEBUG("cancelSending id=0x%x, removed=%d\n", id, result);
|
||||
LOG_DEBUG("cancelSending id=0x%x, removed=%d", id, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -251,27 +251,27 @@ void RadioLibInterface::onNotify(uint32_t notification)
|
|||
case ISR_TX:
|
||||
handleTransmitInterrupt();
|
||||
startReceive();
|
||||
// LOG_DEBUG("tx complete - starting timer\n");
|
||||
// LOG_DEBUG("tx complete - starting timer");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case ISR_RX:
|
||||
handleReceiveInterrupt();
|
||||
startReceive();
|
||||
// LOG_DEBUG("rx complete - starting timer\n");
|
||||
// LOG_DEBUG("rx complete - starting timer");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case TRANSMIT_DELAY_COMPLETED:
|
||||
// LOG_DEBUG("delay done\n");
|
||||
// LOG_DEBUG("delay done");
|
||||
|
||||
// If we are not currently in receive mode, then restart the random delay (this can happen if the main thread
|
||||
// has placed the unit into standby) FIXME, how will this work if the chipset is in sleep mode?
|
||||
if (!txQueue.empty()) {
|
||||
if (!canSendImmediately()) {
|
||||
// LOG_DEBUG("Currently Rx/Tx-ing: set random delay\n");
|
||||
// LOG_DEBUG("Currently Rx/Tx-ing: set random delay");
|
||||
setTransmitDelay(); // currently Rx/Tx-ing: reset random delay
|
||||
} else {
|
||||
if (isChannelActive()) { // check if there is currently a LoRa packet on the channel
|
||||
// LOG_DEBUG("Channel is active, try receiving first.\n");
|
||||
// LOG_DEBUG("Channel is active, try receiving first.");
|
||||
startReceive(); // try receiving this packet, afterwards we'll be trying to transmit again
|
||||
setTransmitDelay();
|
||||
} else {
|
||||
|
@ -286,7 +286,7 @@ void RadioLibInterface::onNotify(uint32_t notification)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// LOG_DEBUG("done with txqueue\n");
|
||||
// LOG_DEBUG("done with txqueue");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -309,7 +309,7 @@ void RadioLibInterface::setTransmitDelay()
|
|||
startTransmitTimer(true);
|
||||
} else {
|
||||
// If there is a SNR, start a timer scaled based on that SNR.
|
||||
LOG_DEBUG("rx_snr found. hop_limit:%d rx_snr:%f\n", p->hop_limit, p->rx_snr);
|
||||
LOG_DEBUG("rx_snr found. hop_limit:%d rx_snr:%f", p->hop_limit, p->rx_snr);
|
||||
startTransmitTimerSNR(p->rx_snr);
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ void RadioLibInterface::startTransmitTimer(bool withDelay)
|
|||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delay = !withDelay ? 1 : getTxDelayMsec();
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
// LOG_DEBUG("xmit timer %d", delay);
|
||||
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
|
||||
}
|
||||
}
|
||||
|
@ -329,14 +329,14 @@ void RadioLibInterface::startTransmitTimerSNR(float snr)
|
|||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delay = getTxDelayMsecWeighted(snr);
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
// LOG_DEBUG("xmit timer %d", delay);
|
||||
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
|
||||
}
|
||||
}
|
||||
|
||||
void RadioLibInterface::handleTransmitInterrupt()
|
||||
{
|
||||
// LOG_DEBUG("handling lora TX interrupt\n");
|
||||
// LOG_DEBUG("handling lora TX interrupt");
|
||||
// This can be null if we forced the device to enter standby mode. In that case
|
||||
// ignore the transmit interrupt
|
||||
if (sendingPacket)
|
||||
|
@ -359,7 +359,7 @@ void RadioLibInterface::completeSending()
|
|||
|
||||
// We are done sending that packet, release it
|
||||
packetPool.release(p);
|
||||
// LOG_DEBUG("Done with send\n");
|
||||
// LOG_DEBUG("Done with send");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||
// when this is called, we should be in receive mode - if we are not, just jump out instead of bombing. Possible Race
|
||||
// Condition?
|
||||
if (!isReceiving) {
|
||||
LOG_ERROR("handleReceiveInterrupt called when not in receive mode, which shouldn't happen.\n");
|
||||
LOG_ERROR("handleReceiveInterrupt called when not in receive mode, which shouldn't happen.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||
|
||||
#ifndef DISABLE_WELCOME_UNSET
|
||||
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||
LOG_WARN("recv - lora rx disabled because RegionCode_Unset\n");
|
||||
LOG_WARN("recv - lora rx disabled because RegionCode_Unset");
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
return;
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||
|
||||
int state = iface->readData((uint8_t *)&radioBuffer, length);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_ERROR("ignoring received packet due to error=%d\n", state);
|
||||
LOG_ERROR("ignoring received packet due to error=%d", state);
|
||||
rxBad++;
|
||||
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
|
@ -402,14 +402,14 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||
|
||||
// check for short packets
|
||||
if (payloadLen < 0) {
|
||||
LOG_WARN("ignoring received packet too short\n");
|
||||
LOG_WARN("ignoring received packet too short");
|
||||
rxBad++;
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
} else {
|
||||
rxGood++;
|
||||
// altered packet with "from == 0" can do Remote Node Administration without permission
|
||||
if (radioBuffer.header.from == 0) {
|
||||
LOG_WARN("ignoring received packet without sender\n");
|
||||
LOG_WARN("ignoring received packet without sender");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ void RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
|||
{
|
||||
printPacket("Starting low level send", txp);
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_WARN("Drop Tx packet because LoRa Tx disabled\n");
|
||||
LOG_WARN("Drop Tx packet because LoRa Tx disabled");
|
||||
packetPool.release(txp);
|
||||
} else {
|
||||
configHardwareForSend(); // must be after setStandby
|
||||
|
@ -477,7 +477,7 @@ void RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
|||
|
||||
int res = iface->startTransmit((uint8_t *)&radioBuffer, numbytes);
|
||||
if (res != RADIOLIB_ERR_NONE) {
|
||||
LOG_ERROR("startTransmit failed, error=%d\n", res);
|
||||
LOG_ERROR("startTransmit failed, error=%d", res);
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_RADIO_SPI_BUG);
|
||||
|
||||
// This send failed, but make sure to 'complete' it properly
|
||||
|
|
|
@ -197,5 +197,5 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
|||
*/
|
||||
virtual void setStandby();
|
||||
|
||||
const char *radioLibErr = "RadioLib err=\n";
|
||||
const char *radioLibErr = "RadioLib err=";
|
||||
};
|
|
@ -18,8 +18,8 @@ int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_
|
|||
// current limit was removed from module' ctor
|
||||
// override default value (60 mA)
|
||||
state = setCurrentLimit(currentLimit);
|
||||
LOG_DEBUG("Current limit set to %f\n", currentLimit);
|
||||
LOG_DEBUG("Current limit set result %d\n", state);
|
||||
LOG_DEBUG("Current limit set to %f", currentLimit);
|
||||
LOG_DEBUG("Current limit set result %d", state);
|
||||
|
||||
// configure settings not accessible by API
|
||||
// state = config();
|
||||
|
@ -73,7 +73,7 @@ bool RadioLibRF95::isReceiving()
|
|||
{
|
||||
// 0x0b == Look for header info valid, signal synchronized or signal detected
|
||||
uint8_t reg = readReg(RADIOLIB_SX127X_REG_MODEM_STAT);
|
||||
// Serial.printf("reg %x\n", reg);
|
||||
// Serial.printf("reg %x", reg);
|
||||
return (reg & (RH_RF95_MODEM_STATUS_SIGNAL_DETECTED | RH_RF95_MODEM_STATUS_SIGNAL_SYNCHRONIZED |
|
||||
RH_RF95_MODEM_STATUS_HEADER_INFO_VALID)) != 0;
|
||||
}
|
||||
|
|
|
@ -53,14 +53,14 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
|||
auto key = GlobalPacketId(getFrom(p), p->id);
|
||||
auto old = findPendingPacket(key);
|
||||
if (old) {
|
||||
LOG_DEBUG("generating implicit ack\n");
|
||||
LOG_DEBUG("generating implicit ack");
|
||||
// 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
|
||||
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, old->packet->channel);
|
||||
|
||||
stopRetransmission(key);
|
||||
} else {
|
||||
LOG_DEBUG("didn't find pending packet\n");
|
||||
LOG_DEBUG("didn't find pending packet");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
|||
* flooding this ACK back to the original sender already adds redundancy. */
|
||||
bool isRepeated = p->hop_start == 0 ? (p->hop_limit == HOP_RELIABLE) : (p->hop_start == p->hop_limit);
|
||||
if (wasSeenRecently(p, false) && isRepeated && !MeshModule::currentReply && !isToUs(p)) {
|
||||
LOG_DEBUG("Resending implicit ack for a repeated floodmsg\n");
|
||||
LOG_DEBUG("Resending implicit ack for a repeated floodmsg");
|
||||
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p);
|
||||
tosend->hop_limit--; // bump down the hop count
|
||||
Router::send(tosend);
|
||||
|
@ -105,12 +105,12 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||
if (isToUs(p)) { // ignore ack/nak/want_ack packets that are not address to us (we only handle 0 hop reliability)
|
||||
if (p->want_ack) {
|
||||
if (MeshModule::currentReply) {
|
||||
LOG_DEBUG("Another module replied to this message, no need for 2nd ack\n");
|
||||
LOG_DEBUG("Another module replied to this message, no need for 2nd ack");
|
||||
} else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, p->hop_start, p->hop_limit);
|
||||
} else if (p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag && p->channel == 0 &&
|
||||
(nodeDB->getMeshNode(p->from) == nullptr || nodeDB->getMeshNode(p->from)->user.public_key.size == 0)) {
|
||||
LOG_INFO("PKI packet from unknown node, send PKI_UNKNOWN_PUBKEY\n");
|
||||
LOG_INFO("PKI packet from unknown node, send PKI_UNKNOWN_PUBKEY");
|
||||
sendAckNak(meshtastic_Routing_Error_PKI_UNKNOWN_PUBKEY, getFrom(p), p->id, channels.getPrimaryIndex(),
|
||||
p->hop_start, p->hop_limit);
|
||||
} else {
|
||||
|
@ -134,7 +134,7 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||
|
||||
// We intentionally don't check wasSeenRecently, because it is harmless to delete non existent retransmission records
|
||||
if (ackId || nakId) {
|
||||
LOG_DEBUG("Received a %s for 0x%x, stopping retransmissions\n", ackId ? "ACK" : "NAK", ackId);
|
||||
LOG_DEBUG("Received a %s for 0x%x, stopping retransmissions", ackId ? "ACK" : "NAK", ackId);
|
||||
if (ackId) {
|
||||
stopRetransmission(p->to, ackId);
|
||||
} else {
|
||||
|
@ -227,15 +227,15 @@ int32_t ReliableRouter::doRetransmissions()
|
|||
// FIXME, handle 51 day rolloever here!!!
|
||||
if (p.nextTxMsec <= now) {
|
||||
if (p.numRetransmissions == 0) {
|
||||
LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x\n", p.packet->from, p.packet->to,
|
||||
LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to,
|
||||
p.packet->id);
|
||||
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
|
||||
stopRetransmission(it->first);
|
||||
stillValid = false; // just deleted it
|
||||
} else {
|
||||
LOG_DEBUG("Sending reliable retransmission fr=0x%x,to=0x%x,id=0x%x, tries left=%d\n", p.packet->from,
|
||||
p.packet->to, p.packet->id, p.numRetransmissions);
|
||||
LOG_DEBUG("Sending reliable retransmission fr=0x%x,to=0x%x,id=0x%x, tries left=%d", p.packet->from, p.packet->to,
|
||||
p.packet->id, p.numRetransmissions);
|
||||
|
||||
// Note: we call the superclass version because we don't want to have our version of send() add a new
|
||||
// retransmission record
|
||||
|
|
|
@ -48,9 +48,9 @@ Router::Router() : concurrency::OSThread("Router"), fromRadioQueue(MAX_RX_FROMRA
|
|||
{
|
||||
// This is called pre main(), don't touch anything here, the following code is not safe
|
||||
|
||||
/* LOG_DEBUG("Size of NodeInfo %d\n", sizeof(NodeInfo));
|
||||
LOG_DEBUG("Size of SubPacket %d\n", sizeof(SubPacket));
|
||||
LOG_DEBUG("Size of MeshPacket %d\n", sizeof(MeshPacket)); */
|
||||
/* LOG_DEBUG("Size of NodeInfo %d", sizeof(NodeInfo));
|
||||
LOG_DEBUG("Size of SubPacket %d", sizeof(SubPacket));
|
||||
LOG_DEBUG("Size of MeshPacket %d", sizeof(MeshPacket)); */
|
||||
|
||||
fromRadioQueue.setReader(this);
|
||||
|
||||
|
@ -71,7 +71,7 @@ int32_t Router::runOnce()
|
|||
perhapsHandleReceived(mp);
|
||||
}
|
||||
|
||||
// LOG_DEBUG("sleeping forever!\n");
|
||||
// LOG_DEBUG("sleeping forever!");
|
||||
return INT32_MAX; // Wait a long time - until we get woken for the message queue
|
||||
}
|
||||
|
||||
|
@ -104,14 +104,14 @@ PacketId generatePacketId()
|
|||
// pick a random initial sequence number at boot (to prevent repeated reboots always starting at 0)
|
||||
// Note: we mask the high order bit to ensure that we never pass a 'negative' number to random
|
||||
rollingPacketId = random(UINT32_MAX & 0x7fffffff);
|
||||
LOG_DEBUG("Initial packet id %u\n", rollingPacketId);
|
||||
LOG_DEBUG("Initial packet id %u", rollingPacketId);
|
||||
}
|
||||
|
||||
rollingPacketId++;
|
||||
|
||||
rollingPacketId &= ID_COUNTER_MASK; // Mask out the top 22 bits
|
||||
PacketId id = rollingPacketId | random(UINT32_MAX & 0x7fffffff) << 10; // top 22 bits
|
||||
LOG_DEBUG("Partially randomized packet id %u\n", id);
|
||||
LOG_DEBUG("Partially randomized packet id %u", id);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -141,14 +141,14 @@ void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFro
|
|||
|
||||
void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p)
|
||||
{
|
||||
LOG_ERROR("Error=%d, returning NAK and dropping packet.\n", err);
|
||||
LOG_ERROR("Error=%d, returning NAK and dropping packet.", err);
|
||||
sendAckNak(err, getFrom(p), p->id, p->channel);
|
||||
packetPool.release(p);
|
||||
}
|
||||
|
||||
void Router::setReceivedMessage()
|
||||
{
|
||||
// LOG_DEBUG("set interval to ASAP\n");
|
||||
// LOG_DEBUG("set interval to ASAP");
|
||||
setInterval(0); // Run ASAP, so we can figure out our correct sleep time
|
||||
runASAP = true;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ meshtastic_QueueStatus Router::getQueueStatus()
|
|||
ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
|
||||
{
|
||||
if (p->to == 0) {
|
||||
LOG_ERROR("Packet received with to: of 0!\n");
|
||||
LOG_ERROR("Packet received with to: of 0!");
|
||||
}
|
||||
// No need to deliver externally if the destination is the local node
|
||||
if (isToUs(p)) {
|
||||
|
@ -189,7 +189,7 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
|
|||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->to);
|
||||
if (node && node->user.public_key.size == 0) {
|
||||
p->channel = node->channel;
|
||||
LOG_DEBUG("localSend to channel %d\n", p->channel);
|
||||
LOG_DEBUG("localSend to channel %d", p->channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
|
|||
ErrorCode Router::send(meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (isToUs(p)) {
|
||||
LOG_ERROR("BUG! send() called with packet destined for local node!\n");
|
||||
LOG_ERROR("BUG! send() called with packet destined for local node!");
|
||||
packetPool.release(p);
|
||||
return meshtastic_Routing_Error_BAD_REQUEST;
|
||||
} // should have already been handled by sendLocal
|
||||
|
@ -216,7 +216,7 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
|
|||
if (hourlyTxPercent > myRegion->dutyCycle) {
|
||||
#ifdef DEBUG_PORT
|
||||
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
|
||||
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.\n", silentMinutes);
|
||||
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.", silentMinutes);
|
||||
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
|
||||
cn->has_reply_id = true;
|
||||
cn->reply_id = p->id;
|
||||
|
@ -309,7 +309,7 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||
|
||||
if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_KNOWN_ONLY &&
|
||||
(nodeDB->getMeshNode(p->from) == NULL || !nodeDB->getMeshNode(p->from)->has_user)) {
|
||||
LOG_DEBUG("Node 0x%x not in nodeDB-> Rebroadcast mode KNOWN_ONLY will ignore packet\n", p->from);
|
||||
LOG_DEBUG("Node 0x%x not in nodeDB-> Rebroadcast mode KNOWN_ONLY will ignore packet", p->from);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||
|
||||
size_t rawSize = p->encrypted.size;
|
||||
if (rawSize > sizeof(bytes)) {
|
||||
LOG_ERROR("Packet too large to attempt decryption! (rawSize=%d > 256)\n", rawSize);
|
||||
LOG_ERROR("Packet too large to attempt decryption! (rawSize=%d > 256)", rawSize);
|
||||
return false;
|
||||
}
|
||||
bool decrypted = false;
|
||||
|
@ -331,28 +331,28 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||
if (p->channel == 0 && isToUs(p) && p->to > 0 && p->to != NODENUM_BROADCAST && nodeDB->getMeshNode(p->from) != nullptr &&
|
||||
nodeDB->getMeshNode(p->from)->user.public_key.size > 0 && nodeDB->getMeshNode(p->to)->user.public_key.size > 0 &&
|
||||
rawSize > MESHTASTIC_PKC_OVERHEAD) {
|
||||
LOG_DEBUG("Attempting PKI decryption\n");
|
||||
LOG_DEBUG("Attempting PKI decryption");
|
||||
|
||||
if (crypto->decryptCurve25519(p->from, nodeDB->getMeshNode(p->from)->user.public_key, p->id, rawSize, ScratchEncrypted,
|
||||
bytes)) {
|
||||
LOG_INFO("PKI Decryption worked!\n");
|
||||
LOG_INFO("PKI Decryption worked!");
|
||||
memset(&p->decoded, 0, sizeof(p->decoded));
|
||||
rawSize -= MESHTASTIC_PKC_OVERHEAD;
|
||||
if (pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &p->decoded) &&
|
||||
p->decoded.portnum != meshtastic_PortNum_UNKNOWN_APP) {
|
||||
decrypted = true;
|
||||
LOG_INFO("Packet decrypted using PKI!\n");
|
||||
LOG_INFO("Packet decrypted using PKI!");
|
||||
p->pki_encrypted = true;
|
||||
memcpy(&p->public_key.bytes, nodeDB->getMeshNode(p->from)->user.public_key.bytes, 32);
|
||||
p->public_key.size = 32;
|
||||
// memcpy(bytes, ScratchEncrypted, rawSize); // TODO: Rename the bytes buffers
|
||||
// chIndex = 8;
|
||||
} else {
|
||||
LOG_ERROR("PKC Decrypted, but pb_decode failed!\n");
|
||||
LOG_ERROR("PKC Decrypted, but pb_decode failed!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("PKC decrypt attempted but failed!\n");
|
||||
LOG_WARN("PKC decrypt attempted but failed!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -371,9 +371,9 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||
// Take those raw bytes and convert them back into a well structured protobuf we can understand
|
||||
memset(&p->decoded, 0, sizeof(p->decoded));
|
||||
if (!pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &p->decoded)) {
|
||||
LOG_ERROR("Invalid protobufs in received mesh packet id=0x%08x (bad psk?)!\n", p->id);
|
||||
LOG_ERROR("Invalid protobufs in received mesh packet id=0x%08x (bad psk?)!", p->id);
|
||||
} else if (p->decoded.portnum == meshtastic_PortNum_UNKNOWN_APP) {
|
||||
LOG_ERROR("Invalid portnum (bad psk?)!\n");
|
||||
LOG_ERROR("Invalid portnum (bad psk?)!");
|
||||
} else {
|
||||
decrypted = true;
|
||||
break;
|
||||
|
@ -400,7 +400,7 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||
|
||||
decompressed_len = unishox2_decompress_simple(compressed_in, p->decoded.payload.size, decompressed_out);
|
||||
|
||||
// LOG_DEBUG("\n\n**\n\nDecompressed length - %d \n", decompressed_len);
|
||||
// LOG_DEBUG("**Decompressed length - %d ", decompressed_len);
|
||||
|
||||
memcpy(p->decoded.payload.bytes, decompressed_out, decompressed_len);
|
||||
|
||||
|
@ -410,15 +410,15 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||
|
||||
printPacket("decoded message", p);
|
||||
#if ENABLE_JSON_LOGGING
|
||||
LOG_TRACE("%s\n", MeshPacketSerializer::JsonSerialize(p, false).c_str());
|
||||
LOG_TRACE("%s", MeshPacketSerializer::JsonSerialize(p, false).c_str());
|
||||
#elif ARCH_PORTDUINO
|
||||
if (settingsStrings[traceFilename] != "" || settingsMap[logoutputlevel] == level_trace) {
|
||||
LOG_TRACE("%s\n", MeshPacketSerializer::JsonSerialize(p, false).c_str());
|
||||
LOG_TRACE("%s", MeshPacketSerializer::JsonSerialize(p, false).c_str());
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
} else {
|
||||
LOG_WARN("No suitable channel found for decoding, hash was 0x%x!\n", p->channel);
|
||||
LOG_WARN("No suitable channel found for decoding, hash was 0x%x!", p->channel);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -453,20 +453,20 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
|||
int compressed_len;
|
||||
compressed_len = unishox2_compress_simple(original_payload, p->decoded.payload.size, compressed_out);
|
||||
|
||||
LOG_DEBUG("Original length - %d \n", p->decoded.payload.size);
|
||||
LOG_DEBUG("Compressed length - %d \n", compressed_len);
|
||||
LOG_DEBUG("Original message - %s \n", p->decoded.payload.bytes);
|
||||
LOG_DEBUG("Original length - %d ", p->decoded.payload.size);
|
||||
LOG_DEBUG("Compressed length - %d ", compressed_len);
|
||||
LOG_DEBUG("Original message - %s ", p->decoded.payload.bytes);
|
||||
|
||||
// If the compressed length is greater than or equal to the original size, don't use the compressed form
|
||||
if (compressed_len >= p->decoded.payload.size) {
|
||||
|
||||
LOG_DEBUG("Not using compressing message.\n");
|
||||
LOG_DEBUG("Not using compressing message.");
|
||||
// Set the uncompressed payload variant anyway. Shouldn't hurt?
|
||||
// p->decoded.which_payloadVariant = Data_payload_tag;
|
||||
|
||||
// Otherwise we use the compressor
|
||||
} else {
|
||||
LOG_DEBUG("Using compressed message.\n");
|
||||
LOG_DEBUG("Using compressed message.");
|
||||
// Copy the compressed data into the meshpacket
|
||||
|
||||
p->decoded.payload.size = compressed_len;
|
||||
|
@ -499,12 +499,12 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
|||
// Some portnums either make no sense to send with PKC
|
||||
p->decoded.portnum != meshtastic_PortNum_TRACEROUTE_APP && p->decoded.portnum != meshtastic_PortNum_NODEINFO_APP &&
|
||||
p->decoded.portnum != meshtastic_PortNum_ROUTING_APP && p->decoded.portnum != meshtastic_PortNum_POSITION_APP) {
|
||||
LOG_DEBUG("Using PKI!\n");
|
||||
LOG_DEBUG("Using PKI!");
|
||||
if (numbytes + MESHTASTIC_HEADER_LENGTH + MESHTASTIC_PKC_OVERHEAD > MAX_LORA_PAYLOAD_LEN)
|
||||
return meshtastic_Routing_Error_TOO_LARGE;
|
||||
if (p->pki_encrypted && !memfll(p->public_key.bytes, 0, 32) &&
|
||||
memcmp(p->public_key.bytes, node->user.public_key.bytes, 32) != 0) {
|
||||
LOG_WARN("Client public key differs from requested: 0x%02x, stored key begins 0x%02x\n", *p->public_key.bytes,
|
||||
LOG_WARN("Client public key differs from requested: 0x%02x, stored key begins 0x%02x", *p->public_key.bytes,
|
||||
*node->user.public_key.bytes);
|
||||
return meshtastic_Routing_Error_PKI_FAILED;
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
|||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
|
||||
p->decoded.portnum == meshtastic_PortNum_NEIGHBORINFO_APP &&
|
||||
(!moduleConfig.has_neighbor_info || !moduleConfig.neighbor_info.enabled)) {
|
||||
LOG_DEBUG("Neighbor info module is disabled, ignoring neighbor packet\n");
|
||||
LOG_DEBUG("Neighbor info module is disabled, ignoring neighbor packet");
|
||||
cancelSending(p->from, p->id);
|
||||
skipHandle = true;
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
|||
p->decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP ||
|
||||
p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP ||
|
||||
p->decoded.portnum == meshtastic_PortNum_REMOTE_HARDWARE_APP)) {
|
||||
LOG_DEBUG("Ignoring packet on blacklisted portnum during event\n");
|
||||
LOG_DEBUG("Ignoring packet on blacklisted portnum during event");
|
||||
cancelSending(p->from, p->id);
|
||||
skipHandle = true;
|
||||
}
|
||||
|
@ -631,35 +631,35 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
|||
#if ENABLE_JSON_LOGGING
|
||||
// Even ignored packets get logged in the trace
|
||||
p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone
|
||||
LOG_TRACE("%s\n", MeshPacketSerializer::JsonSerializeEncrypted(p).c_str());
|
||||
LOG_TRACE("%s", MeshPacketSerializer::JsonSerializeEncrypted(p).c_str());
|
||||
#elif ARCH_PORTDUINO
|
||||
// Even ignored packets get logged in the trace
|
||||
if (settingsStrings[traceFilename] != "" || settingsMap[logoutputlevel] == level_trace) {
|
||||
p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone
|
||||
LOG_TRACE("%s\n", MeshPacketSerializer::JsonSerializeEncrypted(p).c_str());
|
||||
LOG_TRACE("%s", MeshPacketSerializer::JsonSerializeEncrypted(p).c_str());
|
||||
}
|
||||
#endif
|
||||
// assert(radioConfig.has_preferences);
|
||||
if (is_in_repeated(config.lora.ignore_incoming, p->from)) {
|
||||
LOG_DEBUG("Ignoring msg, 0x%x is in our ignore list\n", p->from);
|
||||
LOG_DEBUG("Ignoring msg, 0x%x is in our ignore list", p->from);
|
||||
packetPool.release(p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->from == NODENUM_BROADCAST) {
|
||||
LOG_DEBUG("Ignoring msg from broadcast address\n");
|
||||
LOG_DEBUG("Ignoring msg from broadcast address");
|
||||
packetPool.release(p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.lora.ignore_mqtt && p->via_mqtt) {
|
||||
LOG_DEBUG("Msg came in via MQTT from 0x%x\n", p->from);
|
||||
LOG_DEBUG("Msg came in via MQTT from 0x%x", p->from);
|
||||
packetPool.release(p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldFilterReceived(p)) {
|
||||
LOG_DEBUG("Incoming msg was filtered from 0x%x\n", p->from);
|
||||
LOG_DEBUG("Incoming msg was filtered from 0x%x", p->from);
|
||||
packetPool.release(p);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ bool STM32WLE5JCInterface::init()
|
|||
|
||||
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage);
|
||||
|
||||
LOG_INFO("STM32WLx init result %d\n", res);
|
||||
LOG_INFO("STM32WLx init result %d", res);
|
||||
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f", bw);
|
||||
LOG_INFO("Power output set to %d", power);
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
startReceive(); // start receiving
|
||||
|
|
|
@ -20,7 +20,7 @@ SX126xInterface<T>::SX126xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs
|
|||
RADIOLIB_PIN_TYPE busy)
|
||||
: RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module)
|
||||
{
|
||||
LOG_DEBUG("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||
LOG_DEBUG("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)", cs, irq, rst, busy);
|
||||
}
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
|
@ -68,9 +68,9 @@ template <typename T> bool SX126xInterface<T>::init()
|
|||
// (DIO3 is not free to be used as an IRQ)
|
||||
#endif
|
||||
if (tcxoVoltage == 0)
|
||||
LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE not defined, not using DIO3 as TCXO reference voltage\n");
|
||||
LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE not defined, not using DIO3 as TCXO reference voltage");
|
||||
else
|
||||
LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at %f V\n", tcxoVoltage);
|
||||
LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at %f V", tcxoVoltage);
|
||||
|
||||
// FIXME: May want to set depending on a definition, currently all SX126x variant files use the DC-DC regulator option
|
||||
bool useRegulatorLDO = false; // Seems to depend on the connection to pin 9/DCC_SW - if an inductor DCDC?
|
||||
|
@ -84,13 +84,13 @@ template <typename T> bool SX126xInterface<T>::init()
|
|||
|
||||
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO);
|
||||
// \todo Display actual typename of the adapter, not just `SX126x`
|
||||
LOG_INFO("SX126x init result %d\n", res);
|
||||
LOG_INFO("SX126x init result %d", res);
|
||||
if (res == RADIOLIB_ERR_CHIP_NOT_FOUND)
|
||||
return false;
|
||||
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f", bw);
|
||||
LOG_INFO("Power output set to %d", power);
|
||||
|
||||
// Overriding current limit
|
||||
// (https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.cpp#L85) using
|
||||
|
@ -101,8 +101,8 @@ template <typename T> bool SX126xInterface<T>::init()
|
|||
// FIXME: Not ideal to increase SX1261 current limit above 60mA as it can only transmit max 15dBm, should probably only do it
|
||||
// if using SX1262 or SX1268
|
||||
res = lora.setCurrentLimit(currentLimit);
|
||||
LOG_DEBUG("Current limit set to %f\n", currentLimit);
|
||||
LOG_DEBUG("Current limit set result %d\n", res);
|
||||
LOG_DEBUG("Current limit set to %f", currentLimit);
|
||||
LOG_DEBUG("Current limit set result %d", res);
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE) {
|
||||
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
||||
|
@ -116,36 +116,36 @@ template <typename T> bool SX126xInterface<T>::init()
|
|||
bool dio2AsRfSwitch = false;
|
||||
#endif
|
||||
res = lora.setDio2AsRfSwitch(dio2AsRfSwitch);
|
||||
LOG_DEBUG("Set DIO2 as %sRF switch, result: %d\n", dio2AsRfSwitch ? "" : "not ", res);
|
||||
LOG_DEBUG("Set DIO2 as %sRF switch, result: %d", dio2AsRfSwitch ? "" : "not ", res);
|
||||
}
|
||||
|
||||
// If a pin isn't defined, we set it to RADIOLIB_NC, it is safe to always do external RF switching with RADIOLIB_NC as it has
|
||||
// no effect
|
||||
#if ARCH_PORTDUINO
|
||||
if (res == RADIOLIB_ERR_NONE) {
|
||||
LOG_DEBUG("Using MCU pin %i as RXEN and pin %i as TXEN to control RF switching\n", settingsMap[rxen], settingsMap[txen]);
|
||||
LOG_DEBUG("Using MCU pin %i as RXEN and pin %i as TXEN to control RF switching", settingsMap[rxen], settingsMap[txen]);
|
||||
lora.setRfSwitchPins(settingsMap[rxen], settingsMap[txen]);
|
||||
}
|
||||
#else
|
||||
#ifndef SX126X_RXEN
|
||||
#define SX126X_RXEN RADIOLIB_NC
|
||||
LOG_DEBUG("SX126X_RXEN not defined, defaulting to RADIOLIB_NC\n");
|
||||
LOG_DEBUG("SX126X_RXEN not defined, defaulting to RADIOLIB_NC");
|
||||
#endif
|
||||
#ifndef SX126X_TXEN
|
||||
#define SX126X_TXEN RADIOLIB_NC
|
||||
LOG_DEBUG("SX126X_TXEN not defined, defaulting to RADIOLIB_NC\n");
|
||||
LOG_DEBUG("SX126X_TXEN not defined, defaulting to RADIOLIB_NC");
|
||||
#endif
|
||||
if (res == RADIOLIB_ERR_NONE) {
|
||||
LOG_DEBUG("Using MCU pin %i as RXEN and pin %i as TXEN to control RF switching\n", SX126X_RXEN, SX126X_TXEN);
|
||||
LOG_DEBUG("Using MCU pin %i as RXEN and pin %i as TXEN to control RF switching", SX126X_RXEN, SX126X_TXEN);
|
||||
lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
|
||||
}
|
||||
#endif
|
||||
if (config.lora.sx126x_rx_boosted_gain) {
|
||||
uint16_t result = lora.setRxBoostedGainMode(true);
|
||||
LOG_INFO("Set RX gain to boosted mode; result: %d\n", result);
|
||||
LOG_INFO("Set RX gain to boosted mode; result: %d", result);
|
||||
} else {
|
||||
uint16_t result = lora.setRxBoostedGainMode(false);
|
||||
LOG_INFO("Set RX gain to power saving mode (boosted mode off); result: %d\n", result);
|
||||
LOG_INFO("Set RX gain to power saving mode (boosted mode off); result: %d", result);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -203,17 +203,17 @@ template <typename T> bool SX126xInterface<T>::reconfigure()
|
|||
|
||||
err = lora.setSyncWord(syncWord);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX126X setSyncWord %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX126X setSyncWord %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora.setCurrentLimit(currentLimit);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX126X setCurrentLimit %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX126X setCurrentLimit %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora.setPreambleLength(preambleLength);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX126X setPreambleLength %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX126X setPreambleLength %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora.setFrequency(getFreq());
|
||||
|
@ -225,7 +225,7 @@ template <typename T> bool SX126xInterface<T>::reconfigure()
|
|||
|
||||
err = lora.setOutputPower(power);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX126X setOutputPower %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX126X setOutputPower %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
startReceive(); // restart receiving
|
||||
|
@ -245,7 +245,7 @@ template <typename T> void SX126xInterface<T>::setStandby()
|
|||
int err = lora.standby();
|
||||
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_DEBUG("SX126x standby %s%d\n", radioLibErr, err);
|
||||
LOG_DEBUG("SX126x standby %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
isReceiving = false; // If we were receiving, not any more
|
||||
|
@ -260,7 +260,7 @@ template <typename T> void SX126xInterface<T>::setStandby()
|
|||
*/
|
||||
template <typename T> void SX126xInterface<T>::addReceiveMetadata(meshtastic_MeshPacket *mp)
|
||||
{
|
||||
// LOG_DEBUG("PacketStatus %x\n", lora.getPacketStatus());
|
||||
// LOG_DEBUG("PacketStatus %x", lora.getPacketStatus());
|
||||
mp->rx_snr = lora.getSNR();
|
||||
mp->rx_rssi = lround(lora.getRSSI());
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ template <typename T> void SX126xInterface<T>::startReceive()
|
|||
// Furthermore, we need the PREAMBLE_DETECTED and HEADER_VALID IRQ flag to detect whether we are actively receiving
|
||||
int err = lora.startReceiveDutyCycleAuto(preambleLength, 8, RADIOLIB_IRQ_RX_DEFAULT_FLAGS | RADIOLIB_IRQ_PREAMBLE_DETECTED);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX126X startReceiveDutyCycleAuto %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX126X startReceiveDutyCycleAuto %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
RadioLibInterface::startReceive();
|
||||
|
@ -308,7 +308,7 @@ template <typename T> bool SX126xInterface<T>::isChannelActive()
|
|||
if (result == RADIOLIB_LORA_DETECTED)
|
||||
return true;
|
||||
if (result != RADIOLIB_CHANNEL_FREE)
|
||||
LOG_ERROR("SX126X scanChannel %s%d\n", radioLibErr, result);
|
||||
LOG_ERROR("SX126X scanChannel %s%d", radioLibErr, result);
|
||||
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
||||
|
||||
return false;
|
||||
|
@ -326,8 +326,8 @@ template <typename T> bool SX126xInterface<T>::sleep()
|
|||
{
|
||||
// Not keeping config is busted - next time nrf52 board boots lora sending fails tcxo related? - see datasheet
|
||||
// \todo Display actual typename of the adapter, not just `SX126x`
|
||||
LOG_DEBUG("SX126x entering sleep mode\n"); // (FIXME, don't keep config)
|
||||
setStandby(); // Stop any pending operations
|
||||
LOG_DEBUG("SX126x entering sleep mode"); // (FIXME, don't keep config)
|
||||
setStandby(); // Stop any pending operations
|
||||
|
||||
// turn off TCXO if it was powered
|
||||
// FIXME - this isn't correct
|
||||
|
|
|
@ -19,7 +19,7 @@ SX128xInterface<T>::SX128xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs
|
|||
RADIOLIB_PIN_TYPE busy)
|
||||
: RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module)
|
||||
{
|
||||
LOG_DEBUG("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||
LOG_DEBUG("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)", cs, irq, rst, busy);
|
||||
}
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
|
@ -68,10 +68,10 @@ template <typename T> bool SX128xInterface<T>::init()
|
|||
|
||||
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength);
|
||||
// \todo Display actual typename of the adapter, not just `SX128x`
|
||||
LOG_INFO("SX128x init result %d\n", res);
|
||||
LOG_INFO("SX128x init result %d", res);
|
||||
|
||||
if ((config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) {
|
||||
LOG_WARN("Radio chip only supports 2.4GHz LoRa. Adjusting Region and rebooting.\n");
|
||||
LOG_WARN("Radio chip only supports 2.4GHz LoRa. Adjusting Region and rebooting.");
|
||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_LORA_24;
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
delay(2000);
|
||||
|
@ -80,13 +80,13 @@ template <typename T> bool SX128xInterface<T>::init()
|
|||
#elif defined(ARCH_NRF52)
|
||||
NVIC_SystemReset();
|
||||
#else
|
||||
LOG_ERROR("FIXME implement reboot for this platform. Skipping for now.\n");
|
||||
LOG_ERROR("FIXME implement reboot for this platform. Skipping for now.");
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f", bw);
|
||||
LOG_INFO("Power output set to %d", power);
|
||||
|
||||
#if defined(SX128X_TXEN) && (SX128X_TXEN != RADIOLIB_NC) && defined(SX128X_RXEN) && (SX128X_RXEN != RADIOLIB_NC)
|
||||
if (res == RADIOLIB_ERR_NONE) {
|
||||
|
@ -129,12 +129,12 @@ template <typename T> bool SX128xInterface<T>::reconfigure()
|
|||
|
||||
err = lora.setSyncWord(syncWord);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX128X setSyncWord %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX128X setSyncWord %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora.setPreambleLength(preambleLength);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX128X setPreambleLength %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX128X setPreambleLength %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
err = lora.setFrequency(getFreq());
|
||||
|
@ -146,7 +146,7 @@ template <typename T> bool SX128xInterface<T>::reconfigure()
|
|||
|
||||
err = lora.setOutputPower(power);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX128X setOutputPower %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX128X setOutputPower %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
startReceive(); // restart receiving
|
||||
|
@ -171,7 +171,7 @@ template <typename T> void SX128xInterface<T>::setStandby()
|
|||
int err = lora.standby();
|
||||
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX128x standby %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX128x standby %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
#if ARCH_PORTDUINO
|
||||
if (settingsMap[rxen] != RADIOLIB_NC) {
|
||||
|
@ -200,7 +200,7 @@ template <typename T> void SX128xInterface<T>::setStandby()
|
|||
*/
|
||||
template <typename T> void SX128xInterface<T>::addReceiveMetadata(meshtastic_MeshPacket *mp)
|
||||
{
|
||||
// LOG_DEBUG("PacketStatus %x\n", lora.getPacketStatus());
|
||||
// LOG_DEBUG("PacketStatus %x", lora.getPacketStatus());
|
||||
mp->rx_snr = lora.getSNR();
|
||||
mp->rx_rssi = lround(lora.getRSSI());
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ template <typename T> void SX128xInterface<T>::startReceive()
|
|||
int err = lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, RADIOLIB_IRQ_RX_DEFAULT_FLAGS | RADIOLIB_IRQ_PREAMBLE_DETECTED);
|
||||
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX128X startReceive %s%d\n", radioLibErr, err);
|
||||
LOG_ERROR("SX128X startReceive %s%d", radioLibErr, err);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
RadioLibInterface::startReceive();
|
||||
|
@ -282,7 +282,7 @@ template <typename T> bool SX128xInterface<T>::isChannelActive()
|
|||
if (result == RADIOLIB_LORA_DETECTED)
|
||||
return true;
|
||||
if (result != RADIOLIB_CHANNEL_FREE)
|
||||
LOG_ERROR("SX128X scanChannel %s%d\n", radioLibErr, result);
|
||||
LOG_ERROR("SX128X scanChannel %s%d", radioLibErr, result);
|
||||
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
||||
|
||||
return false;
|
||||
|
@ -298,8 +298,8 @@ template <typename T> bool SX128xInterface<T>::sleep()
|
|||
{
|
||||
// Not keeping config is busted - next time nrf52 board boots lora sending fails tcxo related? - see datasheet
|
||||
// \todo Display actual typename of the adapter, not just `SX128x`
|
||||
LOG_DEBUG("SX128x entering sleep mode\n"); // (FIXME, don't keep config)
|
||||
setStandby(); // Stop any pending operations
|
||||
LOG_DEBUG("SX128x entering sleep mode"); // (FIXME, don't keep config)
|
||||
setStandby(); // Stop any pending operations
|
||||
|
||||
// turn off TCXO if it was powered
|
||||
// FIXME - this isn't correct
|
||||
|
|
|
@ -115,7 +115,7 @@ void StreamAPI::emitRebooted()
|
|||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_rebooted_tag;
|
||||
fromRadioScratch.rebooted = true;
|
||||
|
||||
// LOG_DEBUG("Emitting reboot packet for serial shell\n");
|
||||
// LOG_DEBUG("Emitting reboot packet for serial shell");
|
||||
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
template <typename T>
|
||||
ServerAPI<T>::ServerAPI(T &_client) : StreamAPI(&client), concurrency::OSThread("ServerAPI"), client(_client)
|
||||
{
|
||||
LOG_INFO("Incoming API connection\n");
|
||||
LOG_INFO("Incoming API connection");
|
||||
}
|
||||
|
||||
template <typename T> ServerAPI<T>::~ServerAPI()
|
||||
|
@ -30,7 +30,7 @@ template <class T> int32_t ServerAPI<T>::runOnce()
|
|||
if (client.connected()) {
|
||||
return StreamAPI::runOncePart();
|
||||
} else {
|
||||
LOG_INFO("Client dropped connection, suspending API service\n");
|
||||
LOG_INFO("Client dropped connection, suspending API service");
|
||||
enabled = false; // we no longer need to run
|
||||
return 0;
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ template <class T, class U> int32_t APIServerPort<T, U>::runOnce()
|
|||
// Reconnections are delayed by full wait time
|
||||
if (waitTime < 400) {
|
||||
waitTime *= 2;
|
||||
LOG_INFO("Previous TCP connection still open, trying again in %dms\n", waitTime);
|
||||
LOG_INFO("Previous TCP connection still open, trying again in %dms", waitTime);
|
||||
return waitTime;
|
||||
}
|
||||
#endif
|
||||
LOG_INFO("Force closing previous TCP connection\n");
|
||||
LOG_INFO("Force closing previous TCP connection");
|
||||
delete openAPI;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ void initApiServer(int port)
|
|||
// Start API server on port 4403
|
||||
if (!apiPort) {
|
||||
apiPort = new WiFiServerPort(port);
|
||||
LOG_INFO("API server listening on TCP port %d\n", port);
|
||||
LOG_INFO("API server listening on TCP port %d", port);
|
||||
apiPort->init();
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ void deInitApiServer()
|
|||
|
||||
WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : ServerAPI(_client)
|
||||
{
|
||||
LOG_INFO("Incoming wifi connection\n");
|
||||
LOG_INFO("Incoming wifi connection");
|
||||
}
|
||||
|
||||
WiFiServerPort::WiFiServerPort(int port) : APIServerPort(port) {}
|
||||
|
|
|
@ -12,14 +12,14 @@ void initApiServer(int port)
|
|||
// Start API server on port 4403
|
||||
if (!apiPort) {
|
||||
apiPort = new ethServerPort(port);
|
||||
LOG_INFO("API server listening on TCP port %d\n", port);
|
||||
LOG_INFO("API server listening on TCP port %d", port);
|
||||
apiPort->init();
|
||||
}
|
||||
}
|
||||
|
||||
ethServerAPI::ethServerAPI(EthernetClient &_client) : ServerAPI(_client)
|
||||
{
|
||||
LOG_INFO("Incoming ethernet connection\n");
|
||||
LOG_INFO("Incoming ethernet connection");
|
||||
}
|
||||
|
||||
ethServerPort::ethServerPort(int port) : APIServerPort(port) {}
|
||||
|
|
|
@ -38,16 +38,16 @@ static int32_t reconnectETH()
|
|||
Ethernet.maintain();
|
||||
if (!ethStartupComplete) {
|
||||
// Start web server
|
||||
LOG_INFO("Starting Ethernet network services\n");
|
||||
LOG_INFO("Starting Ethernet network services");
|
||||
|
||||
#ifndef DISABLE_NTP
|
||||
LOG_INFO("Starting NTP time client\n");
|
||||
LOG_INFO("Starting NTP time client");
|
||||
timeClient.begin();
|
||||
timeClient.setUpdateInterval(60 * 60); // Update once an hour
|
||||
#endif
|
||||
|
||||
if (config.network.rsyslog_server[0]) {
|
||||
LOG_INFO("Starting Syslog client\n");
|
||||
LOG_INFO("Starting Syslog client");
|
||||
// Defaults
|
||||
int serverPort = 514;
|
||||
const char *serverAddr = config.network.rsyslog_server;
|
||||
|
@ -82,9 +82,9 @@ static int32_t reconnectETH()
|
|||
#ifndef DISABLE_NTP
|
||||
if (isEthernetAvailable() && (ntp_renew < millis())) {
|
||||
|
||||
LOG_INFO("Updating NTP time from %s\n", config.network.ntp_server);
|
||||
LOG_INFO("Updating NTP time from %s", config.network.ntp_server);
|
||||
if (timeClient.update()) {
|
||||
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n");
|
||||
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed");
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec = timeClient.getEpochTime();
|
||||
|
@ -94,7 +94,7 @@ static int32_t reconnectETH()
|
|||
|
||||
ntp_renew = millis() + 43200 * 1000; // success, refresh every 12 hours
|
||||
} else {
|
||||
LOG_ERROR("NTP Update failed\n");
|
||||
LOG_ERROR("NTP Update failed");
|
||||
ntp_renew = millis() + 300 * 1000; // failure, retry every 5 minutes
|
||||
}
|
||||
}
|
||||
|
@ -127,45 +127,45 @@ bool initEthernet()
|
|||
mac[0] &= 0xfe; // Make sure this is not a multicast MAC
|
||||
|
||||
if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_DHCP) {
|
||||
LOG_INFO("starting Ethernet DHCP\n");
|
||||
LOG_INFO("starting Ethernet DHCP");
|
||||
status = Ethernet.begin(mac);
|
||||
} else if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC) {
|
||||
LOG_INFO("starting Ethernet Static\n");
|
||||
LOG_INFO("starting Ethernet Static");
|
||||
Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.gateway,
|
||||
config.network.ipv4_config.subnet);
|
||||
status = 1;
|
||||
} else {
|
||||
LOG_INFO("Ethernet Disabled\n");
|
||||
LOG_INFO("Ethernet Disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (status == 0) {
|
||||
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
||||
LOG_ERROR("Ethernet shield was not found.\n");
|
||||
LOG_ERROR("Ethernet shield was not found.");
|
||||
return false;
|
||||
} else if (Ethernet.linkStatus() == LinkOFF) {
|
||||
LOG_ERROR("Ethernet cable is not connected.\n");
|
||||
LOG_ERROR("Ethernet cable is not connected.");
|
||||
return false;
|
||||
} else {
|
||||
LOG_ERROR("Unknown Ethernet error.\n");
|
||||
LOG_ERROR("Unknown Ethernet error.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("Local IP %u.%u.%u.%u\n", Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2],
|
||||
LOG_INFO("Local IP %u.%u.%u.%u", Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2],
|
||||
Ethernet.localIP()[3]);
|
||||
LOG_INFO("Subnet Mask %u.%u.%u.%u\n", Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2],
|
||||
LOG_INFO("Subnet Mask %u.%u.%u.%u", Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2],
|
||||
Ethernet.subnetMask()[3]);
|
||||
LOG_INFO("Gateway IP %u.%u.%u.%u\n", Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2],
|
||||
LOG_INFO("Gateway IP %u.%u.%u.%u", Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2],
|
||||
Ethernet.gatewayIP()[3]);
|
||||
LOG_INFO("DNS Server IP %u.%u.%u.%u\n", Ethernet.dnsServerIP()[0], Ethernet.dnsServerIP()[1],
|
||||
Ethernet.dnsServerIP()[2], Ethernet.dnsServerIP()[3]);
|
||||
LOG_INFO("DNS Server IP %u.%u.%u.%u", Ethernet.dnsServerIP()[0], Ethernet.dnsServerIP()[1], Ethernet.dnsServerIP()[2],
|
||||
Ethernet.dnsServerIP()[3]);
|
||||
}
|
||||
|
||||
ethEvent = new Periodic("ethConnect", reconnectETH);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
LOG_INFO("Not using Ethernet\n");
|
||||
LOG_INFO("Not using Ethernet");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer)
|
|||
void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res)
|
||||
{
|
||||
|
||||
LOG_DEBUG("webAPI handleAPIv1FromRadio\n");
|
||||
LOG_DEBUG("webAPI handleAPIv1FromRadio");
|
||||
|
||||
/*
|
||||
For documentation, see:
|
||||
|
@ -188,12 +188,12 @@ void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res)
|
|||
res->write(txBuf, len);
|
||||
}
|
||||
|
||||
LOG_DEBUG("webAPI handleAPIv1FromRadio, len %d\n", len);
|
||||
LOG_DEBUG("webAPI handleAPIv1FromRadio, len %d", len);
|
||||
}
|
||||
|
||||
void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res)
|
||||
{
|
||||
LOG_DEBUG("webAPI handleAPIv1ToRadio\n");
|
||||
LOG_DEBUG("webAPI handleAPIv1ToRadio");
|
||||
|
||||
/*
|
||||
For documentation, see:
|
||||
|
@ -216,11 +216,11 @@ void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res)
|
|||
byte buffer[MAX_TO_FROM_RADIO_SIZE];
|
||||
size_t s = req->readBytes(buffer, MAX_TO_FROM_RADIO_SIZE);
|
||||
|
||||
LOG_DEBUG("Received %d bytes from PUT request\n", s);
|
||||
LOG_DEBUG("Received %d bytes from PUT request", s);
|
||||
webAPI.handleToRadio(buffer, s);
|
||||
|
||||
res->write(buffer, s);
|
||||
LOG_DEBUG("webAPI handleAPIv1ToRadio\n");
|
||||
LOG_DEBUG("webAPI handleAPIv1ToRadio");
|
||||
}
|
||||
|
||||
void htmlDeleteDir(const char *dirname)
|
||||
|
@ -243,7 +243,7 @@ void htmlDeleteDir(const char *dirname)
|
|||
String fileName = String(file.name());
|
||||
file.flush();
|
||||
file.close();
|
||||
LOG_DEBUG(" %s\n", fileName.c_str());
|
||||
LOG_DEBUG(" %s", fileName.c_str());
|
||||
FSCom.remove(fileName);
|
||||
}
|
||||
file = root.openNextFile();
|
||||
|
@ -341,7 +341,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
if (params->getQueryParameter("delete", paramValDelete)) {
|
||||
std::string pathDelete = "/" + paramValDelete;
|
||||
if (FSCom.remove(pathDelete.c_str())) {
|
||||
LOG_INFO("%s\n", pathDelete.c_str());
|
||||
LOG_INFO("%s", pathDelete.c_str());
|
||||
JSONObject jsonObjOuter;
|
||||
jsonObjOuter["status"] = new JSONValue("ok");
|
||||
JSONValue *value = new JSONValue(jsonObjOuter);
|
||||
|
@ -349,7 +349,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
delete value;
|
||||
return;
|
||||
} else {
|
||||
LOG_INFO("%s\n", pathDelete.c_str());
|
||||
LOG_INFO("%s", pathDelete.c_str());
|
||||
JSONObject jsonObjOuter;
|
||||
jsonObjOuter["status"] = new JSONValue("Error");
|
||||
JSONValue *value = new JSONValue(jsonObjOuter);
|
||||
|
@ -385,13 +385,13 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
if (FSCom.exists(filename.c_str())) {
|
||||
file = FSCom.open(filename.c_str());
|
||||
if (!file.available()) {
|
||||
LOG_WARN("File not available - %s\n", filename.c_str());
|
||||
LOG_WARN("File not available - %s", filename.c_str());
|
||||
}
|
||||
} else if (FSCom.exists(filenameGzip.c_str())) {
|
||||
file = FSCom.open(filenameGzip.c_str());
|
||||
res->setHeader("Content-Encoding", "gzip");
|
||||
if (!file.available()) {
|
||||
LOG_WARN("File not available - %s\n", filenameGzip.c_str());
|
||||
LOG_WARN("File not available - %s", filenameGzip.c_str());
|
||||
}
|
||||
} else {
|
||||
has_set_content_type = true;
|
||||
|
@ -399,7 +399,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
file = FSCom.open(filenameGzip.c_str());
|
||||
res->setHeader("Content-Type", "text/html");
|
||||
if (!file.available()) {
|
||||
LOG_WARN("File not available - %s\n", filenameGzip.c_str());
|
||||
LOG_WARN("File not available - %s", filenameGzip.c_str());
|
||||
res->println("Web server is running.<br><br>The content you are looking for can't be found. Please see: <a "
|
||||
"href=https://meshtastic.org/docs/software/web-client/>FAQ</a>.<br><br><a "
|
||||
"href=/admin>admin</a>");
|
||||
|
@ -441,7 +441,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
|
||||
return;
|
||||
} else {
|
||||
LOG_ERROR("This should not have happened...\n");
|
||||
LOG_ERROR("This should not have happened...");
|
||||
res->println("ERROR: This should not have happened...");
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
||||
{
|
||||
|
||||
LOG_DEBUG("Form Upload - Disabling keep-alive\n");
|
||||
LOG_DEBUG("Form Upload - Disabling keep-alive");
|
||||
res->setHeader("Connection", "close");
|
||||
|
||||
// First, we need to check the encoding of the form that we have received.
|
||||
|
@ -457,7 +457,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
// Then we select the body parser based on the encoding.
|
||||
// Actually we do this only for documentary purposes, we know the form is going
|
||||
// to be multipart/form-data.
|
||||
LOG_DEBUG("Form Upload - Creating body parser reference\n");
|
||||
LOG_DEBUG("Form Upload - Creating body parser reference");
|
||||
HTTPBodyParser *parser;
|
||||
std::string contentType = req->getHeader("Content-Type");
|
||||
|
||||
|
@ -473,10 +473,10 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
|
||||
// Now, we can decide based on the content type:
|
||||
if (contentType == "multipart/form-data") {
|
||||
LOG_DEBUG("Form Upload - multipart/form-data\n");
|
||||
LOG_DEBUG("Form Upload - multipart/form-data");
|
||||
parser = new HTTPMultipartBodyParser(req);
|
||||
} else {
|
||||
LOG_DEBUG("Unknown POST Content-Type: %s\n", contentType.c_str());
|
||||
LOG_DEBUG("Unknown POST Content-Type: %s", contentType.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -503,19 +503,19 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
std::string filename = parser->getFieldFilename();
|
||||
std::string mimeType = parser->getFieldMimeType();
|
||||
// We log all three values, so that you can observe the upload on the serial monitor:
|
||||
LOG_DEBUG("handleFormUpload: field name='%s', filename='%s', mimetype='%s'\n", name.c_str(), filename.c_str(),
|
||||
LOG_DEBUG("handleFormUpload: field name='%s', filename='%s', mimetype='%s'", name.c_str(), filename.c_str(),
|
||||
mimeType.c_str());
|
||||
|
||||
// Double check that it is what we expect
|
||||
if (name != "file") {
|
||||
LOG_DEBUG("Skipping unexpected field\n");
|
||||
LOG_DEBUG("Skipping unexpected field");
|
||||
res->println("<p>No file found.</p>");
|
||||
return;
|
||||
}
|
||||
|
||||
// Double check that it is what we expect
|
||||
if (filename == "") {
|
||||
LOG_DEBUG("Skipping unexpected field\n");
|
||||
LOG_DEBUG("Skipping unexpected field");
|
||||
res->println("<p>No file found.</p>");
|
||||
return;
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
|
||||
byte buf[512];
|
||||
size_t readLength = parser->read(buf, 512);
|
||||
// LOG_DEBUG("\n\nreadLength - %i\n", readLength);
|
||||
// LOG_DEBUG("readLength - %i", readLength);
|
||||
|
||||
// Abort the transfer if there is less than 50k space left on the filesystem.
|
||||
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
|
||||
|
@ -553,7 +553,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
// if (readLength) {
|
||||
file.write(buf, readLength);
|
||||
fileLength += readLength;
|
||||
LOG_DEBUG("File Length %i\n", fileLength);
|
||||
LOG_DEBUG("File Length %i", fileLength);
|
||||
//}
|
||||
}
|
||||
// enableLoopWDT();
|
||||
|
@ -676,7 +676,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
|||
*/
|
||||
void handleHotspot(HTTPRequest *req, HTTPResponse *res)
|
||||
{
|
||||
LOG_INFO("Hotspot Request\n");
|
||||
LOG_INFO("Hotspot Request");
|
||||
|
||||
/*
|
||||
If we don't do a redirect, be sure to return a "Success" message
|
||||
|
@ -690,7 +690,7 @@ void handleHotspot(HTTPRequest *req, HTTPResponse *res)
|
|||
res->setHeader("Access-Control-Allow-Methods", "GET");
|
||||
|
||||
// res->println("<!DOCTYPE html>");
|
||||
res->println("<meta http-equiv=\"refresh\" content=\"0;url=/\" />\n");
|
||||
res->println("<meta http-equiv=\"refresh\" content=\"0;url=/\" />");
|
||||
}
|
||||
|
||||
void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res)
|
||||
|
@ -699,14 +699,14 @@ void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res)
|
|||
res->setHeader("Access-Control-Allow-Origin", "*");
|
||||
res->setHeader("Access-Control-Allow-Methods", "GET");
|
||||
|
||||
res->println("<h1>Meshtastic</h1>\n");
|
||||
res->println("<h1>Meshtastic</h1>");
|
||||
res->println("Deleting Content in /static/*");
|
||||
|
||||
LOG_INFO("Deleting files from /static/* : \n");
|
||||
LOG_INFO("Deleting files from /static/* : ");
|
||||
|
||||
htmlDeleteDir("/static");
|
||||
|
||||
res->println("<p><hr><p><a href=/admin>Back to admin</a>\n");
|
||||
res->println("<p><hr><p><a href=/admin>Back to admin</a>");
|
||||
}
|
||||
|
||||
void handleAdmin(HTTPRequest *req, HTTPResponse *res)
|
||||
|
@ -715,10 +715,10 @@ void handleAdmin(HTTPRequest *req, HTTPResponse *res)
|
|||
res->setHeader("Access-Control-Allow-Origin", "*");
|
||||
res->setHeader("Access-Control-Allow-Methods", "GET");
|
||||
|
||||
res->println("<h1>Meshtastic</h1>\n");
|
||||
// res->println("<a href=/admin/settings>Settings</a><br>\n");
|
||||
// res->println("<a href=/admin/fs>Manage Web Content</a><br>\n");
|
||||
res->println("<a href=/json/report>Device Report</a><br>\n");
|
||||
res->println("<h1>Meshtastic</h1>");
|
||||
// res->println("<a href=/admin/settings>Settings</a><br>");
|
||||
// res->println("<a href=/admin/fs>Manage Web Content</a><br>");
|
||||
res->println("<a href=/json/report>Device Report</a><br>");
|
||||
}
|
||||
|
||||
void handleAdminSettings(HTTPRequest *req, HTTPResponse *res)
|
||||
|
@ -727,20 +727,20 @@ void handleAdminSettings(HTTPRequest *req, HTTPResponse *res)
|
|||
res->setHeader("Access-Control-Allow-Origin", "*");
|
||||
res->setHeader("Access-Control-Allow-Methods", "GET");
|
||||
|
||||
res->println("<h1>Meshtastic</h1>\n");
|
||||
res->println("This isn't done.\n");
|
||||
res->println("<form action=/admin/settings/apply method=post>\n");
|
||||
res->println("<table border=1>\n");
|
||||
res->println("<tr><td>Set?</td><td>Setting</td><td>current value</td><td>new value</td></tr>\n");
|
||||
res->println("<tr><td><input type=checkbox></td><td>WiFi SSID</td><td>false</td><td><input type=radio></td></tr>\n");
|
||||
res->println("<tr><td><input type=checkbox></td><td>WiFi Password</td><td>false</td><td><input type=radio></td></tr>\n");
|
||||
res->println("<h1>Meshtastic</h1>");
|
||||
res->println("This isn't done.");
|
||||
res->println("<form action=/admin/settings/apply method=post>");
|
||||
res->println("<table border=1>");
|
||||
res->println("<tr><td>Set?</td><td>Setting</td><td>current value</td><td>new value</td></tr>");
|
||||
res->println("<tr><td><input type=checkbox></td><td>WiFi SSID</td><td>false</td><td><input type=radio></td></tr>");
|
||||
res->println("<tr><td><input type=checkbox></td><td>WiFi Password</td><td>false</td><td><input type=radio></td></tr>");
|
||||
res->println(
|
||||
"<tr><td><input type=checkbox></td><td>Smart Position Update</td><td>false</td><td><input type=radio></td></tr>\n");
|
||||
res->println("</table>\n");
|
||||
res->println("<table>\n");
|
||||
res->println("<input type=submit value=Apply New Settings>\n");
|
||||
res->println("<form>\n");
|
||||
res->println("<p><hr><p><a href=/admin>Back to admin</a>\n");
|
||||
"<tr><td><input type=checkbox></td><td>Smart Position Update</td><td>false</td><td><input type=radio></td></tr>");
|
||||
res->println("</table>");
|
||||
res->println("<table>");
|
||||
res->println("<input type=submit value=Apply New Settings>");
|
||||
res->println("<form>");
|
||||
res->println("<p><hr><p><a href=/admin>Back to admin</a>");
|
||||
}
|
||||
|
||||
void handleAdminSettingsApply(HTTPRequest *req, HTTPResponse *res)
|
||||
|
@ -748,11 +748,11 @@ void handleAdminSettingsApply(HTTPRequest *req, HTTPResponse *res)
|
|||
res->setHeader("Content-Type", "text/html");
|
||||
res->setHeader("Access-Control-Allow-Origin", "*");
|
||||
res->setHeader("Access-Control-Allow-Methods", "POST");
|
||||
res->println("<h1>Meshtastic</h1>\n");
|
||||
res->println("<h1>Meshtastic</h1>");
|
||||
res->println(
|
||||
"<html><head><meta http-equiv=\"refresh\" content=\"1;url=/admin/settings\" /><title>Settings Applied. </title>");
|
||||
|
||||
res->println("Settings Applied. Please wait.\n");
|
||||
res->println("Settings Applied. Please wait.");
|
||||
}
|
||||
|
||||
void handleFs(HTTPRequest *req, HTTPResponse *res)
|
||||
|
@ -761,10 +761,10 @@ void handleFs(HTTPRequest *req, HTTPResponse *res)
|
|||
res->setHeader("Access-Control-Allow-Origin", "*");
|
||||
res->setHeader("Access-Control-Allow-Methods", "GET");
|
||||
|
||||
res->println("<h1>Meshtastic</h1>\n");
|
||||
res->println("<h1>Meshtastic</h1>");
|
||||
res->println("<a href=/admin/fs/delete>Delete Web Content</a><p><form action=/admin/fs/update "
|
||||
"method=post><input type=submit value=UPDATE_WEB_CONTENT></form>Be patient!");
|
||||
res->println("<p><hr><p><a href=/admin>Back to admin</a>\n");
|
||||
res->println("<p><hr><p><a href=/admin>Back to admin</a>");
|
||||
}
|
||||
|
||||
void handleRestart(HTTPRequest *req, HTTPResponse *res)
|
||||
|
@ -773,10 +773,10 @@ void handleRestart(HTTPRequest *req, HTTPResponse *res)
|
|||
res->setHeader("Access-Control-Allow-Origin", "*");
|
||||
res->setHeader("Access-Control-Allow-Methods", "GET");
|
||||
|
||||
res->println("<h1>Meshtastic</h1>\n");
|
||||
res->println("<h1>Meshtastic</h1>");
|
||||
res->println("Restarting");
|
||||
|
||||
LOG_DEBUG("Restarted on HTTP(s) Request\n");
|
||||
LOG_DEBUG("Restarted on HTTP(s) Request");
|
||||
webServerThread->requestRestart = (millis() / 1000) + 5;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,19 +69,19 @@ static void taskCreateCert(void *parameter)
|
|||
|
||||
#if 0
|
||||
// Delete the saved certs (used in debugging)
|
||||
LOG_DEBUG("Deleting any saved SSL keys ...\n");
|
||||
LOG_DEBUG("Deleting any saved SSL keys ...");
|
||||
// prefs.clear();
|
||||
prefs.remove("PK");
|
||||
prefs.remove("cert");
|
||||
#endif
|
||||
|
||||
LOG_INFO("Checking if we have a previously saved SSL Certificate.\n");
|
||||
LOG_INFO("Checking if we have a previously saved SSL Certificate.");
|
||||
|
||||
size_t pkLen = prefs.getBytesLength("PK");
|
||||
size_t certLen = prefs.getBytesLength("cert");
|
||||
|
||||
if (pkLen && certLen) {
|
||||
LOG_INFO("Existing SSL Certificate found!\n");
|
||||
LOG_INFO("Existing SSL Certificate found!");
|
||||
|
||||
uint8_t *pkBuffer = new uint8_t[pkLen];
|
||||
prefs.getBytes("PK", pkBuffer, pkLen);
|
||||
|
@ -91,11 +91,11 @@ static void taskCreateCert(void *parameter)
|
|||
|
||||
cert = new SSLCert(certBuffer, certLen, pkBuffer, pkLen);
|
||||
|
||||
LOG_DEBUG("Retrieved Private Key: %d Bytes\n", cert->getPKLength());
|
||||
LOG_DEBUG("Retrieved Certificate: %d Bytes\n", cert->getCertLength());
|
||||
LOG_DEBUG("Retrieved Private Key: %d Bytes", cert->getPKLength());
|
||||
LOG_DEBUG("Retrieved Certificate: %d Bytes", cert->getCertLength());
|
||||
} else {
|
||||
|
||||
LOG_INFO("Creating the certificate. This may take a while. Please wait...\n");
|
||||
LOG_INFO("Creating the certificate. This may take a while. Please wait...");
|
||||
yield();
|
||||
cert = new SSLCert();
|
||||
yield();
|
||||
|
@ -104,13 +104,13 @@ static void taskCreateCert(void *parameter)
|
|||
yield();
|
||||
|
||||
if (createCertResult != 0) {
|
||||
LOG_ERROR("Creating the certificate failed\n");
|
||||
LOG_ERROR("Creating the certificate failed");
|
||||
} else {
|
||||
LOG_INFO("Creating the certificate was successful\n");
|
||||
LOG_INFO("Creating the certificate was successful");
|
||||
|
||||
LOG_DEBUG("Created Private Key: %d Bytes\n", cert->getPKLength());
|
||||
LOG_DEBUG("Created Private Key: %d Bytes", cert->getPKLength());
|
||||
|
||||
LOG_DEBUG("Created Certificate: %d Bytes\n", cert->getCertLength());
|
||||
LOG_DEBUG("Created Certificate: %d Bytes", cert->getCertLength());
|
||||
|
||||
prefs.putBytes("PK", (uint8_t *)cert->getPKData(), cert->getPKLength());
|
||||
prefs.putBytes("cert", (uint8_t *)cert->getCertData(), cert->getCertLength());
|
||||
|
@ -139,7 +139,7 @@ void createSSLCert()
|
|||
16, /* Priority of the task. */
|
||||
NULL); /* Task handle. */
|
||||
|
||||
LOG_DEBUG("Waiting for SSL Cert to be generated.\n");
|
||||
LOG_DEBUG("Waiting for SSL Cert to be generated.");
|
||||
while (!isCertReady) {
|
||||
if ((millis() / 500) % 2) {
|
||||
if (runLoop) {
|
||||
|
@ -158,7 +158,7 @@ void createSSLCert()
|
|||
runLoop = true;
|
||||
}
|
||||
}
|
||||
LOG_INFO("SSL Cert Ready!\n");
|
||||
LOG_INFO("SSL Cert Ready!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ int32_t WebServerThread::runOnce()
|
|||
|
||||
void initWebServer()
|
||||
{
|
||||
LOG_DEBUG("Initializing Web Server ...\n");
|
||||
LOG_DEBUG("Initializing Web Server ...");
|
||||
|
||||
// We can now use the new certificate to setup our server as usual.
|
||||
secureServer = new HTTPSServer(cert);
|
||||
|
@ -198,16 +198,16 @@ void initWebServer()
|
|||
registerHandlers(insecureServer, secureServer);
|
||||
|
||||
if (secureServer) {
|
||||
LOG_INFO("Starting Secure Web Server...\n");
|
||||
LOG_INFO("Starting Secure Web Server...");
|
||||
secureServer->start();
|
||||
}
|
||||
LOG_INFO("Starting Insecure Web Server...\n");
|
||||
LOG_INFO("Starting Insecure Web Server...");
|
||||
insecureServer->start();
|
||||
if (insecureServer->isRunning()) {
|
||||
LOG_INFO("Web Servers Ready! :-) \n");
|
||||
LOG_INFO("Web Servers Ready! :-) ");
|
||||
isWebServerReady = true;
|
||||
} else {
|
||||
LOG_ERROR("Web Servers Failed! ;-( \n");
|
||||
LOG_ERROR("Web Servers Failed! ;-( ");
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -13,7 +13,7 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc
|
|||
{
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
|
||||
if (!pb_encode(&stream, fields, src_struct)) {
|
||||
LOG_ERROR("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream));
|
||||
LOG_ERROR("Panic: can't encode protobuf reason='%s'", PB_GET_ERROR(&stream));
|
||||
assert(
|
||||
0); // If this assert fails it probably means you made a field too large for the max limits specified in mesh.options
|
||||
return 0;
|
||||
|
@ -27,7 +27,7 @@ bool pb_decode_from_bytes(const uint8_t *srcbuf, size_t srcbufsize, const pb_msg
|
|||
{
|
||||
pb_istream_t stream = pb_istream_from_buffer(srcbuf, srcbufsize);
|
||||
if (!pb_decode(&stream, fields, dest_struct)) {
|
||||
LOG_ERROR("Can't decode protobuf reason='%s', pb_msgdesc %p\n", PB_GET_ERROR(&stream), fields);
|
||||
LOG_ERROR("Can't decode protobuf reason='%s', pb_msgdesc %p", PB_GET_ERROR(&stream), fields);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -59,7 +59,7 @@ bool readcb(pb_istream_t *stream, uint8_t *buf, size_t count)
|
|||
bool writecb(pb_ostream_t *stream, const uint8_t *buf, size_t count)
|
||||
{
|
||||
auto file = (Print *)stream->state;
|
||||
// LOG_DEBUG("writing %d bytes to protobuf file\n", count);
|
||||
// LOG_DEBUG("writing %d bytes to protobuf file", count);
|
||||
return file->write(buf, count) == count;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -178,14 +178,14 @@ int callback_static_file(const struct _u_request *request, struct _u_response *r
|
|||
content_type = u_map_get_case(&configWeb.mime_types, get_filename_ext(file_requested));
|
||||
if (content_type == NULL) {
|
||||
content_type = u_map_get(&configWeb.mime_types, "*");
|
||||
LOG_DEBUG("Static File Server - Unknown mime type for extension %s \n", get_filename_ext(file_requested));
|
||||
LOG_DEBUG("Static File Server - Unknown mime type for extension %s ", get_filename_ext(file_requested));
|
||||
}
|
||||
u_map_put(response->map_header, "Content-Type", content_type);
|
||||
u_map_copy_into(response->map_header, &configWeb.map_header);
|
||||
|
||||
if (ulfius_set_stream_response(response, 200, callback_static_file_stream, callback_static_file_stream_free,
|
||||
length, STATIC_FILE_CHUNK, f) != U_OK) {
|
||||
LOG_DEBUG("callback_static_file - Error ulfius_set_stream_response\n ");
|
||||
LOG_DEBUG("callback_static_file - Error ulfius_set_stream_response");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -210,7 +210,7 @@ int callback_static_file(const struct _u_request *request, struct _u_response *r
|
|||
free(real_path); // realpath uses malloc
|
||||
return U_CALLBACK_CONTINUE;
|
||||
} else {
|
||||
LOG_DEBUG("Static File Server - Error, user_data is NULL or inconsistent\n");
|
||||
LOG_DEBUG("Static File Server - Error, user_data is NULL or inconsistent");
|
||||
return U_CALLBACK_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ static void handleWebResponse() {}
|
|||
*/
|
||||
int handleAPIv1ToRadio(const struct _u_request *req, struct _u_response *res, void *user_data)
|
||||
{
|
||||
LOG_DEBUG("handleAPIv1ToRadio web -> radio \n");
|
||||
LOG_DEBUG("handleAPIv1ToRadio web -> radio ");
|
||||
|
||||
ulfius_add_header_to_response(res, "Content-Type", "application/x-protobuf");
|
||||
ulfius_add_header_to_response(res, "Access-Control-Allow-Headers", "Content-Type");
|
||||
|
@ -246,9 +246,9 @@ int handleAPIv1ToRadio(const struct _u_request *req, struct _u_response *res, vo
|
|||
|
||||
portduinoVFS->mountpoint(configWeb.rootPath);
|
||||
|
||||
LOG_DEBUG("Received %d bytes from PUT request\n", s);
|
||||
LOG_DEBUG("Received %d bytes from PUT request", s);
|
||||
webAPI.handleToRadio(buffer, s);
|
||||
LOG_DEBUG("end web->radio \n");
|
||||
LOG_DEBUG("end web->radio ");
|
||||
return U_CALLBACK_COMPLETE;
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ int handleAPIv1ToRadio(const struct _u_request *req, struct _u_response *res, vo
|
|||
int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res, void *user_data)
|
||||
{
|
||||
|
||||
// LOG_DEBUG("handleAPIv1FromRadio radio -> web\n");
|
||||
// LOG_DEBUG("handleAPIv1FromRadio radio -> web");
|
||||
std::string valueAll;
|
||||
|
||||
// Status code is 200 OK by default.
|
||||
|
@ -278,21 +278,21 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res,
|
|||
ulfius_set_response_properties(res, U_OPT_STATUS, 200, U_OPT_BINARY_BODY, txBuf, len);
|
||||
const char *tmpa = (const char *)txBuf;
|
||||
ulfius_set_string_body_response(res, 200, tmpa);
|
||||
// LOG_DEBUG("\n----webAPI response all:----\n");
|
||||
// LOG_DEBUG("\n----webAPI response all:----");
|
||||
// LOG_DEBUG(tmpa);
|
||||
// LOG_DEBUG("\n");
|
||||
// LOG_DEBUG("");
|
||||
}
|
||||
// Otherwise, just return one protobuf
|
||||
} else {
|
||||
len = webAPI.getFromRadio(txBuf);
|
||||
const char *tmpa = (const char *)txBuf;
|
||||
ulfius_set_binary_body_response(res, 200, tmpa, len);
|
||||
// LOG_DEBUG("\n----webAPI response:\n");
|
||||
// LOG_DEBUG("\n----webAPI response:");
|
||||
// LOG_DEBUG(tmpa);
|
||||
// LOG_DEBUG("\n");
|
||||
// LOG_DEBUG("");
|
||||
}
|
||||
|
||||
// LOG_DEBUG("end radio->web\n", len);
|
||||
// LOG_DEBUG("end radio->web", len);
|
||||
return U_CALLBACK_COMPLETE;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ char *read_file_into_string(const char *filename)
|
|||
{
|
||||
FILE *file = fopen(filename, "rb");
|
||||
if (file == NULL) {
|
||||
LOG_ERROR("Error reading File : %s \n", filename);
|
||||
LOG_ERROR("Error reading File : %s ", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ char *read_file_into_string(const char *filename)
|
|||
// reserve mem for file + 1 byte
|
||||
char *buffer = (char *)malloc(filesize + 1);
|
||||
if (buffer == NULL) {
|
||||
LOG_ERROR("Malloc of mem failed for file : %s \n", filename);
|
||||
LOG_ERROR("Malloc of mem failed for file : %s ", filename);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ char *read_file_into_string(const char *filename)
|
|||
// read content
|
||||
size_t readSize = fread(buffer, 1, filesize, file);
|
||||
if (readSize != filesize) {
|
||||
LOG_ERROR("Error reading file into buffer\n");
|
||||
LOG_ERROR("Error reading file into buffer");
|
||||
free(buffer);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
|
@ -383,13 +383,13 @@ int PiWebServerThread::CheckSSLandLoad()
|
|||
// read certificate
|
||||
cert_pem = read_file_into_string("certificate.pem");
|
||||
if (cert_pem == NULL) {
|
||||
LOG_ERROR("ERROR SSL Certificate File can't be loaded or is missing\n");
|
||||
LOG_ERROR("ERROR SSL Certificate File can't be loaded or is missing");
|
||||
return 1;
|
||||
}
|
||||
// read private key
|
||||
key_pem = read_file_into_string("private_key.pem");
|
||||
if (key_pem == NULL) {
|
||||
LOG_ERROR("ERROR file private_key can't be loaded or is missing\n");
|
||||
LOG_ERROR("ERROR file private_key can't be loaded or is missing");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -403,19 +403,19 @@ int PiWebServerThread::CreateSSLCertificate()
|
|||
X509 *x509 = NULL;
|
||||
|
||||
if (generate_rsa_key(&pkey) != 0) {
|
||||
LOG_ERROR("Error generating RSA-Key.\n");
|
||||
LOG_ERROR("Error generating RSA-Key.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (generate_self_signed_x509(pkey, &x509) != 0) {
|
||||
LOG_ERROR("Error generating of X509-Certificat.\n");
|
||||
LOG_ERROR("Error generating of X509-Certificat.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Ope file to write private key file
|
||||
FILE *pkey_file = fopen("private_key.pem", "wb");
|
||||
if (!pkey_file) {
|
||||
LOG_ERROR("Error opening private key file.\n");
|
||||
LOG_ERROR("Error opening private key file.");
|
||||
return 3;
|
||||
}
|
||||
// write private key file
|
||||
|
@ -425,7 +425,7 @@ int PiWebServerThread::CreateSSLCertificate()
|
|||
// open Certificate file
|
||||
FILE *x509_file = fopen("certificate.pem", "wb");
|
||||
if (!x509_file) {
|
||||
LOG_ERROR("Error opening certificate.\n");
|
||||
LOG_ERROR("Error opening certificate.");
|
||||
return 4;
|
||||
}
|
||||
// write cirtificate
|
||||
|
@ -434,7 +434,7 @@ int PiWebServerThread::CreateSSLCertificate()
|
|||
|
||||
EVP_PKEY_free(pkey);
|
||||
X509_free(x509);
|
||||
LOG_INFO("Create SSL Certifictate -certificate.pem- succesfull \n");
|
||||
LOG_INFO("Create SSL Certifictate -certificate.pem- succesfull ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -447,24 +447,24 @@ PiWebServerThread::PiWebServerThread()
|
|||
if (CheckSSLandLoad() != 0) {
|
||||
CreateSSLCertificate();
|
||||
if (CheckSSLandLoad() != 0) {
|
||||
LOG_ERROR("Major Error Gen & Read SSL Certificate\n");
|
||||
LOG_ERROR("Major Error Gen & Read SSL Certificate");
|
||||
}
|
||||
}
|
||||
|
||||
if (settingsMap[webserverport] != 0) {
|
||||
webservport = settingsMap[webserverport];
|
||||
LOG_INFO("Using webserver port from yaml config. %i \n", webservport);
|
||||
LOG_INFO("Using webserver port from yaml config. %i ", webservport);
|
||||
} else {
|
||||
LOG_INFO("Webserver port in yaml config set to 0, so defaulting to port 443.\n");
|
||||
LOG_INFO("Webserver port in yaml config set to 0, so defaulting to port 443.");
|
||||
webservport = 443;
|
||||
}
|
||||
|
||||
// Web Content Service Instance
|
||||
if (ulfius_init_instance(&instanceWeb, webservport, NULL, DEFAULT_REALM) != U_OK) {
|
||||
LOG_ERROR("Webserver couldn't be started, abort execution\n");
|
||||
LOG_ERROR("Webserver couldn't be started, abort execution");
|
||||
} else {
|
||||
|
||||
LOG_INFO("Webserver started ....\n");
|
||||
LOG_INFO("Webserver started ....");
|
||||
u_map_init(&configWeb.mime_types);
|
||||
u_map_put(&configWeb.mime_types, "*", "application/octet-stream");
|
||||
u_map_put(&configWeb.mime_types, ".html", "text/html");
|
||||
|
@ -505,10 +505,10 @@ PiWebServerThread::PiWebServerThread()
|
|||
retssl = ulfius_start_secure_framework(&instanceWeb, key_pem, cert_pem);
|
||||
|
||||
if (retssl == U_OK) {
|
||||
LOG_INFO("Web Server framework started on port: %i \n", webservport);
|
||||
LOG_INFO("Web Server root %s\n", (char *)webrootpath.c_str());
|
||||
LOG_INFO("Web Server framework started on port: %i ", webservport);
|
||||
LOG_INFO("Web Server root %s", (char *)webrootpath.c_str());
|
||||
} else {
|
||||
LOG_ERROR("Error starting Web Server framework, error number: %d\n", retssl);
|
||||
LOG_ERROR("Error starting Web Server framework, error number: %d", retssl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,30 +57,30 @@ static void onNetworkConnected()
|
|||
{
|
||||
if (!APStartupComplete) {
|
||||
// Start web server
|
||||
LOG_INFO("Starting WiFi network services\n");
|
||||
LOG_INFO("Starting WiFi network services");
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
// start mdns
|
||||
if (!MDNS.begin("Meshtastic")) {
|
||||
LOG_ERROR("Error setting up MDNS responder!\n");
|
||||
LOG_ERROR("Error setting up MDNS responder!");
|
||||
} else {
|
||||
LOG_INFO("mDNS responder started\n");
|
||||
LOG_INFO("mDNS Host: Meshtastic.local\n");
|
||||
LOG_INFO("mDNS responder started");
|
||||
LOG_INFO("mDNS Host: Meshtastic.local");
|
||||
MDNS.addService("http", "tcp", 80);
|
||||
MDNS.addService("https", "tcp", 443);
|
||||
}
|
||||
#else // ESP32 handles this in WiFiEvent
|
||||
LOG_INFO("Obtained IP address: %s\n", WiFi.localIP().toString().c_str());
|
||||
LOG_INFO("Obtained IP address: %s", WiFi.localIP().toString().c_str());
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_NTP
|
||||
LOG_INFO("Starting NTP time client\n");
|
||||
LOG_INFO("Starting NTP time client");
|
||||
timeClient.begin();
|
||||
timeClient.setUpdateInterval(60 * 60); // Update once an hour
|
||||
#endif
|
||||
|
||||
if (config.network.rsyslog_server[0]) {
|
||||
LOG_INFO("Starting Syslog client\n");
|
||||
LOG_INFO("Starting Syslog client");
|
||||
// Defaults
|
||||
int serverPort = 514;
|
||||
const char *serverAddr = config.network.rsyslog_server;
|
||||
|
@ -132,7 +132,7 @@ static int32_t reconnectWiFi()
|
|||
#else
|
||||
WiFi.disconnect(false);
|
||||
#endif
|
||||
LOG_INFO("Reconnecting to WiFi access point %s\n", wifiName);
|
||||
LOG_INFO("Reconnecting to WiFi access point %s", wifiName);
|
||||
|
||||
delay(5000);
|
||||
|
||||
|
@ -144,9 +144,9 @@ static int32_t reconnectWiFi()
|
|||
|
||||
#ifndef DISABLE_NTP
|
||||
if (WiFi.isConnected() && (!Throttle::isWithinTimespanMs(lastrun_ntp, 43200000) || (lastrun_ntp == 0))) { // every 12 hours
|
||||
LOG_DEBUG("Updating NTP time from %s\n", config.network.ntp_server);
|
||||
LOG_DEBUG("Updating NTP time from %s", config.network.ntp_server);
|
||||
if (timeClient.update()) {
|
||||
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n");
|
||||
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed");
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec = timeClient.getEpochTime();
|
||||
|
@ -155,7 +155,7 @@ static int32_t reconnectWiFi()
|
|||
perhapsSetRTC(RTCQualityNTP, &tv);
|
||||
lastrun_ntp = millis();
|
||||
} else {
|
||||
LOG_DEBUG("NTP Update failed\n");
|
||||
LOG_DEBUG("NTP Update failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -188,7 +188,7 @@ bool isWifiAvailable()
|
|||
// Disable WiFi
|
||||
void deinitWifi()
|
||||
{
|
||||
LOG_INFO("WiFi deinit\n");
|
||||
LOG_INFO("WiFi deinit");
|
||||
|
||||
if (isWifiAvailable()) {
|
||||
#ifdef ARCH_ESP32
|
||||
|
@ -197,7 +197,7 @@ void deinitWifi()
|
|||
WiFi.disconnect(true);
|
||||
#endif
|
||||
WiFi.mode(WIFI_OFF);
|
||||
LOG_INFO("WiFi Turned Off\n");
|
||||
LOG_INFO("WiFi Turned Off");
|
||||
// WiFi.printDiag(Serial);
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ bool initWifi()
|
|||
|
||||
WiFi.onEvent(
|
||||
[](WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
LOG_WARN("WiFi lost connection. Reason: %d\n", info.wifi_sta_disconnected.reason);
|
||||
LOG_WARN("WiFi lost connection. Reason: %d", info.wifi_sta_disconnected.reason);
|
||||
|
||||
/*
|
||||
If we are disconnected from the AP for some reason,
|
||||
|
@ -260,12 +260,12 @@ bool initWifi()
|
|||
},
|
||||
WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
|
||||
#endif
|
||||
LOG_DEBUG("JOINING WIFI soon: ssid=%s\n", wifiName);
|
||||
LOG_DEBUG("JOINING WIFI soon: ssid=%s", wifiName);
|
||||
wifiReconnect = new Periodic("WifiConnect", reconnectWiFi);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
LOG_INFO("Not using WIFI\n");
|
||||
LOG_INFO("Not using WIFI");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -278,23 +278,23 @@ static void WiFiEvent(WiFiEvent_t event)
|
|||
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_WIFI_READY:
|
||||
LOG_INFO("WiFi interface ready\n");
|
||||
LOG_INFO("WiFi interface ready");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_SCAN_DONE:
|
||||
LOG_INFO("Completed scan for access points\n");
|
||||
LOG_INFO("Completed scan for access points");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_START:
|
||||
LOG_INFO("WiFi station started\n");
|
||||
LOG_INFO("WiFi station started");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_STOP:
|
||||
LOG_INFO("WiFi station stopped\n");
|
||||
LOG_INFO("WiFi station stopped");
|
||||
syslog.disable();
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
|
||||
LOG_INFO("Connected to access point\n");
|
||||
LOG_INFO("Connected to access point");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
|
||||
LOG_INFO("Disconnected from WiFi access point\n");
|
||||
LOG_INFO("Disconnected from WiFi access point");
|
||||
if (!isReconnecting) {
|
||||
WiFi.disconnect(false, true);
|
||||
syslog.disable();
|
||||
|
@ -303,22 +303,22 @@ static void WiFiEvent(WiFiEvent_t event)
|
|||
}
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE:
|
||||
LOG_INFO("Authentication mode of access point has changed\n");
|
||||
LOG_INFO("Authentication mode of access point has changed");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
|
||||
LOG_INFO("Obtained IP address: %s\n", WiFi.localIP().toString().c_str());
|
||||
LOG_INFO("Obtained IP address: %s", WiFi.localIP().toString().c_str());
|
||||
onNetworkConnected();
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
|
||||
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
|
||||
LOG_INFO("Obtained Local IP6 address: %s\n", WiFi.linkLocalIPv6().toString().c_str());
|
||||
LOG_INFO("Obtained GlobalIP6 address: %s\n", WiFi.globalIPv6().toString().c_str());
|
||||
LOG_INFO("Obtained Local IP6 address: %s", WiFi.linkLocalIPv6().toString().c_str());
|
||||
LOG_INFO("Obtained GlobalIP6 address: %s", WiFi.globalIPv6().toString().c_str());
|
||||
#else
|
||||
LOG_INFO("Obtained IP6 address: %s\n", WiFi.localIPv6().toString().c_str());
|
||||
LOG_INFO("Obtained IP6 address: %s", WiFi.localIPv6().toString().c_str());
|
||||
#endif
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_LOST_IP:
|
||||
LOG_INFO("Lost IP address and IP address is reset to 0\n");
|
||||
LOG_INFO("Lost IP address and IP address is reset to 0");
|
||||
if (!isReconnecting) {
|
||||
WiFi.disconnect(false, true);
|
||||
syslog.disable();
|
||||
|
@ -327,94 +327,94 @@ static void WiFiEvent(WiFiEvent_t event)
|
|||
}
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_SUCCESS:
|
||||
LOG_INFO("WiFi Protected Setup (WPS): succeeded in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): succeeded in enrollee mode");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_FAILED:
|
||||
LOG_INFO("WiFi Protected Setup (WPS): failed in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): failed in enrollee mode");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_TIMEOUT:
|
||||
LOG_INFO("WiFi Protected Setup (WPS): timeout in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): timeout in enrollee mode");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_PIN:
|
||||
LOG_INFO("WiFi Protected Setup (WPS): pin code in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): pin code in enrollee mode");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_PBC_OVERLAP:
|
||||
LOG_INFO("WiFi Protected Setup (WPS): push button overlap in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): push button overlap in enrollee mode");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_START:
|
||||
LOG_INFO("WiFi access point started\n");
|
||||
LOG_INFO("WiFi access point started");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STOP:
|
||||
LOG_INFO("WiFi access point stopped\n");
|
||||
LOG_INFO("WiFi access point stopped");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STACONNECTED:
|
||||
LOG_INFO("Client connected\n");
|
||||
LOG_INFO("Client connected");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED:
|
||||
LOG_INFO("Client disconnected\n");
|
||||
LOG_INFO("Client disconnected");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED:
|
||||
LOG_INFO("Assigned IP address to client\n");
|
||||
LOG_INFO("Assigned IP address to client");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED:
|
||||
LOG_INFO("Received probe request\n");
|
||||
LOG_INFO("Received probe request");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_GOT_IP6:
|
||||
LOG_INFO("IPv6 is preferred\n");
|
||||
LOG_INFO("IPv6 is preferred");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_FTM_REPORT:
|
||||
LOG_INFO("Fast Transition Management report\n");
|
||||
LOG_INFO("Fast Transition Management report");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
LOG_INFO("Ethernet started\n");
|
||||
LOG_INFO("Ethernet started");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
LOG_INFO("Ethernet stopped\n");
|
||||
LOG_INFO("Ethernet stopped");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||
LOG_INFO("Ethernet connected\n");
|
||||
LOG_INFO("Ethernet connected");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
LOG_INFO("Ethernet disconnected\n");
|
||||
LOG_INFO("Ethernet disconnected");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP:
|
||||
LOG_INFO("Obtained IP address (ARDUINO_EVENT_ETH_GOT_IP)\n");
|
||||
LOG_INFO("Obtained IP address (ARDUINO_EVENT_ETH_GOT_IP)");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP6:
|
||||
LOG_INFO("Obtained IP6 address (ARDUINO_EVENT_ETH_GOT_IP6)\n");
|
||||
LOG_INFO("Obtained IP6 address (ARDUINO_EVENT_ETH_GOT_IP6)");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_SCAN_DONE:
|
||||
LOG_INFO("SmartConfig: Scan done\n");
|
||||
LOG_INFO("SmartConfig: Scan done");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_FOUND_CHANNEL:
|
||||
LOG_INFO("SmartConfig: Found channel\n");
|
||||
LOG_INFO("SmartConfig: Found channel");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_GOT_SSID_PSWD:
|
||||
LOG_INFO("SmartConfig: Got SSID and password\n");
|
||||
LOG_INFO("SmartConfig: Got SSID and password");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_SEND_ACK_DONE:
|
||||
LOG_INFO("SmartConfig: Send ACK done\n");
|
||||
LOG_INFO("SmartConfig: Send ACK done");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_INIT:
|
||||
LOG_INFO("Provisioning: Init\n");
|
||||
LOG_INFO("Provisioning: Init");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_DEINIT:
|
||||
LOG_INFO("Provisioning: Stopped\n");
|
||||
LOG_INFO("Provisioning: Stopped");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_START:
|
||||
LOG_INFO("Provisioning: Started\n");
|
||||
LOG_INFO("Provisioning: Started");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_END:
|
||||
LOG_INFO("Provisioning: End\n");
|
||||
LOG_INFO("Provisioning: End");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_CRED_RECV:
|
||||
LOG_INFO("Provisioning: Credentials received\n");
|
||||
LOG_INFO("Provisioning: Credentials received");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_CRED_FAIL:
|
||||
LOG_INFO("Provisioning: Credentials failed\n");
|
||||
LOG_INFO("Provisioning: Credentials failed");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_CRED_SUCCESS:
|
||||
LOG_INFO("Provisioning: Credentials success\n");
|
||||
LOG_INFO("Provisioning: Credentials success");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -94,4 +94,18 @@ bool isOneOf(int item, int count, ...)
|
|||
}
|
||||
va_end(args);
|
||||
return found;
|
||||
}
|
||||
|
||||
const std::string vformat(const char *const zcFormat, ...)
|
||||
{
|
||||
va_list vaArgs;
|
||||
va_start(vaArgs, zcFormat);
|
||||
va_list vaArgsCopy;
|
||||
va_copy(vaArgsCopy, vaArgs);
|
||||
const int iLen = std::vsnprintf(NULL, 0, zcFormat, vaArgsCopy);
|
||||
va_end(vaArgsCopy);
|
||||
std::vector<char> zc(iLen + 1);
|
||||
std::vsnprintf(zc.data(), zc.size(), zcFormat, vaArgs);
|
||||
va_end(vaArgs);
|
||||
return std::string(zc.data(), iLen);
|
||||
}
|
|
@ -24,4 +24,6 @@ bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes);
|
|||
|
||||
bool isOneOf(int item, int count, ...);
|
||||
|
||||
const std::string vformat(const char *const zcFormat, ...);
|
||||
|
||||
#define IS_ONE_OF(item, ...) isOneOf(item, sizeof((int[]){__VA_ARGS__}) / sizeof(int), __VA_ARGS__)
|
||||
|
|
|
@ -74,15 +74,15 @@ 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
|
||||
// and only allowing responses from that remote.
|
||||
if (messageIsResponse(r)) {
|
||||
LOG_DEBUG("Allowing admin response message\n");
|
||||
LOG_DEBUG("Allowing admin response message");
|
||||
} else if (mp.from == 0) {
|
||||
if (config.security.is_managed) {
|
||||
LOG_INFO("Ignoring local admin payload because is_managed.\n");
|
||||
LOG_INFO("Ignoring local admin payload because is_managed.");
|
||||
return handled;
|
||||
}
|
||||
} else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) {
|
||||
if (!config.security.admin_channel_enabled) {
|
||||
LOG_INFO("Ignoring admin channel, as legacy admin is disabled.\n");
|
||||
LOG_INFO("Ignoring admin channel, as legacy admin is disabled.");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
|
||||
return handled;
|
||||
}
|
||||
|
@ -93,25 +93,25 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
memcmp(mp.public_key.bytes, config.security.admin_key[1].bytes, 32) == 0) ||
|
||||
(config.security.admin_key[2].size == 32 &&
|
||||
memcmp(mp.public_key.bytes, config.security.admin_key[2].bytes, 32) == 0)) {
|
||||
LOG_INFO("PKC admin payload with authorized sender key.\n");
|
||||
LOG_INFO("PKC admin payload with authorized sender key.");
|
||||
} else {
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_PUBLIC_KEY_UNAUTHORIZED, &mp);
|
||||
LOG_INFO("Received PKC admin payload, but the sender public key does not match the admin authorized key!\n");
|
||||
LOG_INFO("Received PKC admin payload, but the sender public key does not match the admin authorized key!");
|
||||
return handled;
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("Ignoring unauthorized admin payload %i\n", r->which_payload_variant);
|
||||
LOG_INFO("Ignoring unauthorized admin payload %i", r->which_payload_variant);
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
|
||||
return handled;
|
||||
}
|
||||
|
||||
LOG_INFO("Handling admin payload %i\n", r->which_payload_variant);
|
||||
LOG_INFO("Handling admin payload %i", r->which_payload_variant);
|
||||
|
||||
// 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
|
||||
if (mp.from != 0 && !messageIsRequest(r) && !messageIsResponse(r)) {
|
||||
if (!checkPassKey(r)) {
|
||||
LOG_WARN("Admin message without session_key!\n");
|
||||
LOG_WARN("Admin message without session_key!");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_BAD_SESSION_KEY, &mp);
|
||||
return handled;
|
||||
}
|
||||
|
@ -122,23 +122,23 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
* Getters
|
||||
*/
|
||||
case meshtastic_AdminMessage_get_owner_request_tag:
|
||||
LOG_INFO("Client is getting owner\n");
|
||||
LOG_INFO("Client is getting owner");
|
||||
handleGetOwner(mp);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_get_config_request_tag:
|
||||
LOG_INFO("Client is getting config\n");
|
||||
LOG_INFO("Client is getting config");
|
||||
handleGetConfig(mp, r->get_config_request);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_get_module_config_request_tag:
|
||||
LOG_INFO("Client is getting module config\n");
|
||||
LOG_INFO("Client is getting module config");
|
||||
handleGetModuleConfig(mp, r->get_module_config_request);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_get_channel_request_tag: {
|
||||
uint32_t i = r->get_channel_request - 1;
|
||||
LOG_INFO("Client is getting channel %u\n", i);
|
||||
LOG_INFO("Client is getting channel %u", i);
|
||||
if (i >= MAX_NUM_CHANNELS)
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
else
|
||||
|
@ -150,29 +150,29 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
* Setters
|
||||
*/
|
||||
case meshtastic_AdminMessage_set_owner_tag:
|
||||
LOG_INFO("Client is setting owner\n");
|
||||
LOG_INFO("Client is setting owner");
|
||||
handleSetOwner(r->set_owner);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_config_tag:
|
||||
LOG_INFO("Client is setting the config\n");
|
||||
LOG_INFO("Client is setting the config");
|
||||
handleSetConfig(r->set_config);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_module_config_tag:
|
||||
LOG_INFO("Client is setting the module config\n");
|
||||
LOG_INFO("Client is setting the module config");
|
||||
handleSetModuleConfig(r->set_module_config);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_channel_tag:
|
||||
LOG_INFO("Client is setting channel %d\n", r->set_channel.index);
|
||||
LOG_INFO("Client is setting channel %d", r->set_channel.index);
|
||||
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
else
|
||||
handleSetChannel(r->set_channel);
|
||||
break;
|
||||
case meshtastic_AdminMessage_set_ham_mode_tag:
|
||||
LOG_INFO("Client is setting ham mode\n");
|
||||
LOG_INFO("Client is setting ham mode");
|
||||
handleSetHamMode(r->set_ham_mode);
|
||||
break;
|
||||
|
||||
|
@ -187,15 +187,15 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
int32_t s = r->reboot_ota_seconds;
|
||||
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH
|
||||
if (BleOta::getOtaAppVersion().isEmpty()) {
|
||||
LOG_INFO("No OTA firmware available, scheduling regular reboot in %d seconds\n", s);
|
||||
LOG_INFO("No OTA firmware available, scheduling regular reboot in %d seconds", s);
|
||||
screen->startAlert("Rebooting...");
|
||||
} else {
|
||||
screen->startFirmwareUpdateScreen();
|
||||
BleOta::switchToOtaApp();
|
||||
LOG_INFO("Rebooting to OTA in %d seconds\n", s);
|
||||
LOG_INFO("Rebooting to OTA in %d seconds", s);
|
||||
}
|
||||
#else
|
||||
LOG_INFO("Not on ESP32, scheduling regular reboot in %d seconds\n", s);
|
||||
LOG_INFO("Not on ESP32, scheduling regular reboot in %d seconds", s);
|
||||
screen->startAlert("Rebooting...");
|
||||
#endif
|
||||
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
||||
|
@ -203,56 +203,56 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
}
|
||||
case meshtastic_AdminMessage_shutdown_seconds_tag: {
|
||||
int32_t s = r->shutdown_seconds;
|
||||
LOG_INFO("Shutdown in %d seconds\n", s);
|
||||
LOG_INFO("Shutdown in %d seconds", s);
|
||||
shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_device_metadata_request_tag: {
|
||||
LOG_INFO("Client is getting device metadata\n");
|
||||
LOG_INFO("Client is getting device metadata");
|
||||
handleGetDeviceMetadata(mp);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_factory_reset_config_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiating factory config reset\n");
|
||||
LOG_INFO("Initiating factory config reset");
|
||||
nodeDB->factoryReset();
|
||||
LOG_INFO("Factory config reset finished, rebooting soon.\n");
|
||||
LOG_INFO("Factory config reset finished, rebooting soon.");
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_factory_reset_device_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiating full factory reset\n");
|
||||
LOG_INFO("Initiating full factory reset");
|
||||
nodeDB->factoryReset(true);
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiating node-db reset\n");
|
||||
LOG_INFO("Initiating node-db reset");
|
||||
nodeDB->resetNodes();
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_begin_edit_settings_tag: {
|
||||
LOG_INFO("Beginning transaction for editing settings\n");
|
||||
LOG_INFO("Beginning transaction for editing settings");
|
||||
hasOpenEditTransaction = true;
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_commit_edit_settings_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Committing transaction for edited settings\n");
|
||||
LOG_INFO("Committing transaction for edited settings");
|
||||
hasOpenEditTransaction = false;
|
||||
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_device_connection_status_request_tag: {
|
||||
LOG_INFO("Client is getting device connection status\n");
|
||||
LOG_INFO("Client is getting device connection status");
|
||||
handleGetDeviceConnectionStatus(mp);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_module_config_response_tag: {
|
||||
LOG_INFO("Client is receiving a get_module_config response.\n");
|
||||
LOG_INFO("Client is receiving a get_module_config response.");
|
||||
if (fromOthers && r->get_module_config_response.which_payload_variant ==
|
||||
meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) {
|
||||
handleGetModuleConfigResponse(mp, r);
|
||||
|
@ -260,13 +260,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_by_nodenum_tag: {
|
||||
LOG_INFO("Client is receiving a remove_nodenum command.\n");
|
||||
LOG_INFO("Client is receiving a remove_nodenum command.");
|
||||
nodeDB->removeNodeByNum(r->remove_by_nodenum);
|
||||
this->notifyObservers(r); // Observed by screen
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_favorite_node_tag: {
|
||||
LOG_INFO("Client is receiving a set_favorite_node command.\n");
|
||||
LOG_INFO("Client is receiving a set_favorite_node command.");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
|
||||
if (node != NULL) {
|
||||
node->is_favorite = true;
|
||||
|
@ -275,7 +275,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_favorite_node_tag: {
|
||||
LOG_INFO("Client is receiving a remove_favorite_node command.\n");
|
||||
LOG_INFO("Client is receiving a remove_favorite_node command.");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
|
||||
if (node != NULL) {
|
||||
node->is_favorite = false;
|
||||
|
@ -284,7 +284,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_fixed_position_tag: {
|
||||
LOG_INFO("Client is receiving a set_fixed_position command.\n");
|
||||
LOG_INFO("Client is receiving a set_fixed_position command.");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
node->has_position = true;
|
||||
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
|
||||
|
@ -300,14 +300,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_fixed_position_tag: {
|
||||
LOG_INFO("Client is receiving a remove_fixed_position command.\n");
|
||||
LOG_INFO("Client is receiving a remove_fixed_position command.");
|
||||
nodeDB->clearLocalPosition();
|
||||
config.position.fixed_position = false;
|
||||
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_time_only_tag: {
|
||||
LOG_INFO("Client is receiving a set_time_only command.\n");
|
||||
LOG_INFO("Client is receiving a set_time_only command.");
|
||||
struct timeval tv;
|
||||
tv.tv_sec = r->set_time_only;
|
||||
tv.tv_usec = 0;
|
||||
|
@ -316,26 +316,26 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_enter_dfu_mode_request_tag: {
|
||||
LOG_INFO("Client is requesting to enter DFU mode.\n");
|
||||
LOG_INFO("Client is requesting to enter DFU mode.");
|
||||
#if defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
||||
enterDfuMode();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_delete_file_request_tag: {
|
||||
LOG_DEBUG("Client is requesting to delete file: %s\n", r->delete_file_request);
|
||||
LOG_DEBUG("Client is requesting to delete file: %s", r->delete_file_request);
|
||||
#ifdef FSCom
|
||||
if (FSCom.remove(r->delete_file_request)) {
|
||||
LOG_DEBUG("Successfully deleted file\n");
|
||||
LOG_DEBUG("Successfully deleted file");
|
||||
} else {
|
||||
LOG_DEBUG("Failed to delete file\n");
|
||||
LOG_DEBUG("Failed to delete file");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#ifdef ARCH_PORTDUINO
|
||||
case meshtastic_AdminMessage_exit_simulator_tag:
|
||||
LOG_INFO("Exiting simulator\n");
|
||||
LOG_INFO("Exiting simulator");
|
||||
_exit(0);
|
||||
break;
|
||||
#endif
|
||||
|
@ -348,10 +348,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||
setPassKey(&res);
|
||||
myReply = allocDataProtobuf(res);
|
||||
} else if (mp.decoded.want_response) {
|
||||
LOG_DEBUG("We did not responded to a request that wanted a respond. req.variant=%d\n", r->which_payload_variant);
|
||||
LOG_DEBUG("We did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant);
|
||||
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
|
||||
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
||||
LOG_INFO("Ignoring nonrelevant admin %d\n", r->which_payload_variant);
|
||||
LOG_INFO("Ignoring nonrelevant admin %d", r->which_payload_variant);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ void AdminModule::handleGetModuleConfigResponse(const meshtastic_MeshPacket &mp,
|
|||
// Skip if it's disabled or no pins are exposed
|
||||
if (!r->get_module_config_response.payload_variant.remote_hardware.enabled ||
|
||||
r->get_module_config_response.payload_variant.remote_hardware.available_pins_count == 0) {
|
||||
LOG_DEBUG("Remote hardware module disabled or no available_pins. Skipping...\n");
|
||||
LOG_DEBUG("Remote hardware module disabled or no available_pins. Skipping...");
|
||||
return;
|
||||
}
|
||||
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {
|
||||
|
@ -427,7 +427,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||
|
||||
switch (c.which_payload_variant) {
|
||||
case meshtastic_Config_device_tag:
|
||||
LOG_INFO("Setting config: Device\n");
|
||||
LOG_INFO("Setting config: Device");
|
||||
config.has_device = true;
|
||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
if (config.device.double_tap_as_button_press == false && c.payload_variant.device.double_tap_as_button_press == true &&
|
||||
|
@ -463,7 +463,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||
if (existingRole != c.payload_variant.device.role)
|
||||
nodeDB->installRoleDefaults(c.payload_variant.device.role);
|
||||
if (config.device.node_info_broadcast_secs < min_node_info_broadcast_secs) {
|
||||
LOG_DEBUG("Tried to set node_info_broadcast_secs too low, setting to %d\n", min_node_info_broadcast_secs);
|
||||
LOG_DEBUG("Tried to set node_info_broadcast_secs too low, setting to %d", min_node_info_broadcast_secs);
|
||||
config.device.node_info_broadcast_secs = min_node_info_broadcast_secs;
|
||||
}
|
||||
// Router Client is deprecated; Set it to client
|
||||
|
@ -484,14 +484,14 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||
#endif
|
||||
break;
|
||||
case meshtastic_Config_position_tag:
|
||||
LOG_INFO("Setting config: Position\n");
|
||||
LOG_INFO("Setting config: Position");
|
||||
config.has_position = true;
|
||||
config.position = c.payload_variant.position;
|
||||
// Save nodedb as well in case we got a fixed position packet
|
||||
saveChanges(SEGMENT_DEVICESTATE, false);
|
||||
break;
|
||||
case meshtastic_Config_power_tag:
|
||||
LOG_INFO("Setting config: Power\n");
|
||||
LOG_INFO("Setting config: Power");
|
||||
config.has_power = true;
|
||||
// Really just the adc override is the only thing that can change without a reboot
|
||||
if (config.power.device_battery_ina_address == c.payload_variant.power.device_battery_ina_address &&
|
||||
|
@ -506,12 +506,12 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||
config.power = c.payload_variant.power;
|
||||
break;
|
||||
case meshtastic_Config_network_tag:
|
||||
LOG_INFO("Setting config: WiFi\n");
|
||||
LOG_INFO("Setting config: WiFi");
|
||||
config.has_network = true;
|
||||
config.network = c.payload_variant.network;
|
||||
break;
|
||||
case meshtastic_Config_display_tag:
|
||||
LOG_INFO("Setting config: Display\n");
|
||||
LOG_INFO("Setting config: Display");
|
||||
config.has_display = true;
|
||||
if (config.display.screen_on_secs == c.payload_variant.display.screen_on_secs &&
|
||||
config.display.flip_screen == c.payload_variant.display.flip_screen &&
|
||||
|
@ -529,7 +529,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||
config.display = c.payload_variant.display;
|
||||
break;
|
||||
case meshtastic_Config_lora_tag:
|
||||
LOG_INFO("Setting config: LoRa\n");
|
||||
LOG_INFO("Setting config: LoRa");
|
||||
config.has_lora = true;
|
||||
// If no lora radio parameters change, don't need to reboot
|
||||
if (config.lora.use_preset == c.payload_variant.lora.use_preset && config.lora.region == c.payload_variant.lora.region &&
|
||||
|
@ -568,12 +568,12 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||
}
|
||||
break;
|
||||
case meshtastic_Config_bluetooth_tag:
|
||||
LOG_INFO("Setting config: Bluetooth\n");
|
||||
LOG_INFO("Setting config: Bluetooth");
|
||||
config.has_bluetooth = true;
|
||||
config.bluetooth = c.payload_variant.bluetooth;
|
||||
break;
|
||||
case meshtastic_Config_security_tag:
|
||||
LOG_INFO("Setting config: Security\n");
|
||||
LOG_INFO("Setting config: Security");
|
||||
config.security = c.payload_variant.security;
|
||||
#if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN) && !(MESHTASTIC_EXCLUDE_PKI)
|
||||
// We check for a potentially valid private key, and a blank public key, and regen the public key if needed.
|
||||
|
@ -608,71 +608,71 @@ void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
|||
disableBluetooth();
|
||||
switch (c.which_payload_variant) {
|
||||
case meshtastic_ModuleConfig_mqtt_tag:
|
||||
LOG_INFO("Setting module config: MQTT\n");
|
||||
LOG_INFO("Setting module config: MQTT");
|
||||
moduleConfig.has_mqtt = true;
|
||||
moduleConfig.mqtt = c.payload_variant.mqtt;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_serial_tag:
|
||||
LOG_INFO("Setting module config: Serial\n");
|
||||
LOG_INFO("Setting module config: Serial");
|
||||
moduleConfig.has_serial = true;
|
||||
moduleConfig.serial = c.payload_variant.serial;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_external_notification_tag:
|
||||
LOG_INFO("Setting module config: External Notification\n");
|
||||
LOG_INFO("Setting module config: External Notification");
|
||||
moduleConfig.has_external_notification = true;
|
||||
moduleConfig.external_notification = c.payload_variant.external_notification;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_store_forward_tag:
|
||||
LOG_INFO("Setting module config: Store & Forward\n");
|
||||
LOG_INFO("Setting module config: Store & Forward");
|
||||
moduleConfig.has_store_forward = true;
|
||||
moduleConfig.store_forward = c.payload_variant.store_forward;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_range_test_tag:
|
||||
LOG_INFO("Setting module config: Range Test\n");
|
||||
LOG_INFO("Setting module config: Range Test");
|
||||
moduleConfig.has_range_test = true;
|
||||
moduleConfig.range_test = c.payload_variant.range_test;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_telemetry_tag:
|
||||
LOG_INFO("Setting module config: Telemetry\n");
|
||||
LOG_INFO("Setting module config: Telemetry");
|
||||
moduleConfig.has_telemetry = true;
|
||||
moduleConfig.telemetry = c.payload_variant.telemetry;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_canned_message_tag:
|
||||
LOG_INFO("Setting module config: Canned Message\n");
|
||||
LOG_INFO("Setting module config: Canned Message");
|
||||
moduleConfig.has_canned_message = true;
|
||||
moduleConfig.canned_message = c.payload_variant.canned_message;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_audio_tag:
|
||||
LOG_INFO("Setting module config: Audio\n");
|
||||
LOG_INFO("Setting module config: Audio");
|
||||
moduleConfig.has_audio = true;
|
||||
moduleConfig.audio = c.payload_variant.audio;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_remote_hardware_tag:
|
||||
LOG_INFO("Setting module config: Remote Hardware\n");
|
||||
LOG_INFO("Setting module config: Remote Hardware");
|
||||
moduleConfig.has_remote_hardware = true;
|
||||
moduleConfig.remote_hardware = c.payload_variant.remote_hardware;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_neighbor_info_tag:
|
||||
LOG_INFO("Setting module config: Neighbor Info\n");
|
||||
LOG_INFO("Setting module config: Neighbor Info");
|
||||
moduleConfig.has_neighbor_info = true;
|
||||
if (moduleConfig.neighbor_info.update_interval < min_neighbor_info_broadcast_secs) {
|
||||
LOG_DEBUG("Tried to set update_interval too low, setting to %d\n", default_neighbor_info_broadcast_secs);
|
||||
LOG_DEBUG("Tried to set update_interval too low, setting to %d", default_neighbor_info_broadcast_secs);
|
||||
moduleConfig.neighbor_info.update_interval = default_neighbor_info_broadcast_secs;
|
||||
}
|
||||
moduleConfig.neighbor_info = c.payload_variant.neighbor_info;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_detection_sensor_tag:
|
||||
LOG_INFO("Setting module config: Detection Sensor\n");
|
||||
LOG_INFO("Setting module config: Detection Sensor");
|
||||
moduleConfig.has_detection_sensor = true;
|
||||
moduleConfig.detection_sensor = c.payload_variant.detection_sensor;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_ambient_lighting_tag:
|
||||
LOG_INFO("Setting module config: Ambient Lighting\n");
|
||||
LOG_INFO("Setting module config: Ambient Lighting");
|
||||
moduleConfig.has_ambient_lighting = true;
|
||||
moduleConfig.ambient_lighting = c.payload_variant.ambient_lighting;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_paxcounter_tag:
|
||||
LOG_INFO("Setting module config: Paxcounter\n");
|
||||
LOG_INFO("Setting module config: Paxcounter");
|
||||
moduleConfig.has_paxcounter = true;
|
||||
moduleConfig.paxcounter = c.payload_variant.paxcounter;
|
||||
break;
|
||||
|
@ -711,49 +711,49 @@ void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32
|
|||
if (req.decoded.want_response) {
|
||||
switch (configType) {
|
||||
case meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG:
|
||||
LOG_INFO("Getting config: Device\n");
|
||||
LOG_INFO("Getting config: Device");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_device_tag;
|
||||
res.get_config_response.payload_variant.device = config.device;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_POSITION_CONFIG:
|
||||
LOG_INFO("Getting config: Position\n");
|
||||
LOG_INFO("Getting config: Position");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_position_tag;
|
||||
res.get_config_response.payload_variant.position = config.position;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_POWER_CONFIG:
|
||||
LOG_INFO("Getting config: Power\n");
|
||||
LOG_INFO("Getting config: Power");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_power_tag;
|
||||
res.get_config_response.payload_variant.power = config.power;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG:
|
||||
LOG_INFO("Getting config: Network\n");
|
||||
LOG_INFO("Getting config: Network");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_network_tag;
|
||||
res.get_config_response.payload_variant.network = config.network;
|
||||
writeSecret(res.get_config_response.payload_variant.network.wifi_psk,
|
||||
sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||
LOG_INFO("Getting config: Display\n");
|
||||
LOG_INFO("Getting config: Display");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_display_tag;
|
||||
res.get_config_response.payload_variant.display = config.display;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_LORA_CONFIG:
|
||||
LOG_INFO("Getting config: LoRa\n");
|
||||
LOG_INFO("Getting config: LoRa");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_lora_tag;
|
||||
res.get_config_response.payload_variant.lora = config.lora;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG:
|
||||
LOG_INFO("Getting config: Bluetooth\n");
|
||||
LOG_INFO("Getting config: Bluetooth");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_bluetooth_tag;
|
||||
res.get_config_response.payload_variant.bluetooth = config.bluetooth;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_SECURITY_CONFIG:
|
||||
LOG_INFO("Getting config: Security\n");
|
||||
LOG_INFO("Getting config: Security");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_security_tag;
|
||||
res.get_config_response.payload_variant.security = config.security;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG:
|
||||
LOG_INFO("Getting config: Sessionkey\n");
|
||||
LOG_INFO("Getting config: Sessionkey");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_sessionkey_tag;
|
||||
break;
|
||||
}
|
||||
|
@ -777,67 +777,67 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
|
|||
if (req.decoded.want_response) {
|
||||
switch (configType) {
|
||||
case meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG:
|
||||
LOG_INFO("Getting module config: MQTT\n");
|
||||
LOG_INFO("Getting module config: MQTT");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag;
|
||||
res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG:
|
||||
LOG_INFO("Getting module config: Serial\n");
|
||||
LOG_INFO("Getting module config: Serial");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_serial_tag;
|
||||
res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
||||
LOG_INFO("Getting module config: External Notification\n");
|
||||
LOG_INFO("Getting module config: External Notification");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
||||
LOG_INFO("Getting module config: Store & Forward\n");
|
||||
LOG_INFO("Getting module config: Store & Forward");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
|
||||
LOG_INFO("Getting module config: Range Test\n");
|
||||
LOG_INFO("Getting module config: Range Test");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
|
||||
LOG_INFO("Getting module config: Telemetry\n");
|
||||
LOG_INFO("Getting module config: Telemetry");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
|
||||
res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
|
||||
LOG_INFO("Getting module config: Canned Message\n");
|
||||
LOG_INFO("Getting module config: Canned Message");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG:
|
||||
LOG_INFO("Getting module config: Audio\n");
|
||||
LOG_INFO("Getting module config: Audio");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
|
||||
res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
|
||||
LOG_INFO("Getting module config: Remote Hardware\n");
|
||||
LOG_INFO("Getting module config: Remote Hardware");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_NEIGHBORINFO_CONFIG:
|
||||
LOG_INFO("Getting module config: Neighbor Info\n");
|
||||
LOG_INFO("Getting module config: Neighbor Info");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG:
|
||||
LOG_INFO("Getting module config: Detection Sensor\n");
|
||||
LOG_INFO("Getting module config: Detection Sensor");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_AMBIENTLIGHTING_CONFIG:
|
||||
LOG_INFO("Getting module config: Ambient Lighting\n");
|
||||
LOG_INFO("Getting module config: Ambient Lighting");
|
||||
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;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG:
|
||||
LOG_INFO("Getting module config: Paxcounter\n");
|
||||
LOG_INFO("Getting module config: Paxcounter");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
|
||||
res.get_module_config_response.payload_variant.paxcounter = moduleConfig.paxcounter;
|
||||
break;
|
||||
|
@ -966,7 +966,7 @@ void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t ch
|
|||
|
||||
void AdminModule::reboot(int32_t seconds)
|
||||
{
|
||||
LOG_INFO("Rebooting in %d seconds\n", seconds);
|
||||
LOG_INFO("Rebooting in %d seconds", seconds);
|
||||
screen->startAlert("Rebooting...");
|
||||
rebootAtMsec = (seconds < 0) ? 0 : (millis() + seconds * 1000);
|
||||
}
|
||||
|
@ -974,10 +974,10 @@ void AdminModule::reboot(int32_t seconds)
|
|||
void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
|
||||
{
|
||||
if (!hasOpenEditTransaction) {
|
||||
LOG_INFO("Saving changes to disk\n");
|
||||
LOG_INFO("Saving changes to disk");
|
||||
service->reloadConfig(saveWhat); // Calls saveToDisk among other things
|
||||
} else {
|
||||
LOG_INFO("Delaying save of changes to disk until the open transaction is committed\n");
|
||||
LOG_INFO("Delaying save of changes to disk until the open transaction is committed");
|
||||
}
|
||||
if (shouldReboot && !hasOpenEditTransaction) {
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
|
|
|
@ -65,7 +65,7 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
|||
{
|
||||
// From Phone (EUD)
|
||||
if (mp.from == 0) {
|
||||
LOG_DEBUG("Received uncompressed TAK payload from phone: %d bytes\n", mp.decoded.payload.size);
|
||||
LOG_DEBUG("Received uncompressed TAK payload from phone: %d bytes", mp.decoded.payload.size);
|
||||
// Compress for LoRA transport
|
||||
auto compressed = cloneTAKPacketData(t);
|
||||
compressed.is_compressed = true;
|
||||
|
@ -73,28 +73,28 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
|||
auto length = unishox2_compress_lines(t->contact.callsign, strlen(t->contact.callsign), compressed.contact.callsign,
|
||||
sizeof(compressed.contact.callsign) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Compression overflowed contact.callsign. Reverting to uncompressed packet\n");
|
||||
LOG_WARN("Compression overflowed contact.callsign. Reverting to uncompressed packet");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Compressed callsign: %d bytes\n", length);
|
||||
LOG_DEBUG("Compressed callsign: %d bytes", length);
|
||||
length = unishox2_compress_lines(t->contact.device_callsign, strlen(t->contact.device_callsign),
|
||||
compressed.contact.device_callsign, sizeof(compressed.contact.device_callsign) - 1,
|
||||
USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Compression overflowed contact.device_callsign. Reverting to uncompressed packet\n");
|
||||
LOG_WARN("Compression overflowed contact.device_callsign. Reverting to uncompressed packet");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Compressed device_callsign: %d bytes\n", length);
|
||||
LOG_DEBUG("Compressed device_callsign: %d bytes", length);
|
||||
}
|
||||
if (t->which_payload_variant == meshtastic_TAKPacket_chat_tag) {
|
||||
auto length = unishox2_compress_lines(t->payload_variant.chat.message, strlen(t->payload_variant.chat.message),
|
||||
compressed.payload_variant.chat.message,
|
||||
sizeof(compressed.payload_variant.chat.message) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Compression overflowed chat.message. Reverting to uncompressed packet\n");
|
||||
LOG_WARN("Compression overflowed chat.message. Reverting to uncompressed packet");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Compressed chat message: %d bytes\n", length);
|
||||
LOG_DEBUG("Compressed chat message: %d bytes", length);
|
||||
|
||||
if (t->payload_variant.chat.has_to) {
|
||||
compressed.payload_variant.chat.has_to = true;
|
||||
|
@ -102,10 +102,10 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
|||
compressed.payload_variant.chat.to,
|
||||
sizeof(compressed.payload_variant.chat.to) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Compression overflowed chat.to. Reverting to uncompressed packet\n");
|
||||
LOG_WARN("Compression overflowed chat.to. Reverting to uncompressed packet");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Compressed chat to: %d bytes\n", length);
|
||||
LOG_DEBUG("Compressed chat to: %d bytes", length);
|
||||
}
|
||||
|
||||
if (t->payload_variant.chat.has_to_callsign) {
|
||||
|
@ -114,19 +114,19 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
|||
compressed.payload_variant.chat.to_callsign,
|
||||
sizeof(compressed.payload_variant.chat.to_callsign) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Compression overflowed chat.to_callsign. Reverting to uncompressed packet\n");
|
||||
LOG_WARN("Compression overflowed chat.to_callsign. Reverting to uncompressed packet");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Compressed chat to_callsign: %d bytes\n", length);
|
||||
LOG_DEBUG("Compressed chat to_callsign: %d bytes", length);
|
||||
}
|
||||
}
|
||||
mp.decoded.payload.size = pb_encode_to_bytes(mp.decoded.payload.bytes, sizeof(mp.decoded.payload.bytes),
|
||||
meshtastic_TAKPacket_fields, &compressed);
|
||||
LOG_DEBUG("Final payload: %d bytes\n", mp.decoded.payload.size);
|
||||
LOG_DEBUG("Final payload: %d bytes", mp.decoded.payload.size);
|
||||
} else {
|
||||
if (!t->is_compressed) {
|
||||
// Not compressed. Something is wrong
|
||||
LOG_WARN("Received uncompressed TAKPacket over radio! Skipping\n");
|
||||
LOG_WARN("Received uncompressed TAKPacket over radio! Skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -139,29 +139,29 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
|||
unishox2_decompress_lines(t->contact.callsign, strlen(t->contact.callsign), uncompressed.contact.callsign,
|
||||
sizeof(uncompressed.contact.callsign) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Decompression overflowed contact.callsign. Bailing out\n");
|
||||
LOG_WARN("Decompression overflowed contact.callsign. Bailing out");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Decompressed callsign: %d bytes\n", length);
|
||||
LOG_DEBUG("Decompressed callsign: %d bytes", length);
|
||||
|
||||
length = unishox2_decompress_lines(t->contact.device_callsign, strlen(t->contact.device_callsign),
|
||||
uncompressed.contact.device_callsign,
|
||||
sizeof(uncompressed.contact.device_callsign) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Decompression overflowed contact.device_callsign. Bailing out\n");
|
||||
LOG_WARN("Decompression overflowed contact.device_callsign. Bailing out");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Decompressed device_callsign: %d bytes\n", length);
|
||||
LOG_DEBUG("Decompressed device_callsign: %d bytes", length);
|
||||
}
|
||||
if (uncompressed.which_payload_variant == meshtastic_TAKPacket_chat_tag) {
|
||||
auto length = unishox2_decompress_lines(t->payload_variant.chat.message, strlen(t->payload_variant.chat.message),
|
||||
uncompressed.payload_variant.chat.message,
|
||||
sizeof(uncompressed.payload_variant.chat.message) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Decompression overflowed chat.message. Bailing out\n");
|
||||
LOG_WARN("Decompression overflowed chat.message. Bailing out");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Decompressed chat message: %d bytes\n", length);
|
||||
LOG_DEBUG("Decompressed chat message: %d bytes", length);
|
||||
|
||||
if (t->payload_variant.chat.has_to) {
|
||||
uncompressed.payload_variant.chat.has_to = true;
|
||||
|
@ -169,10 +169,10 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
|||
uncompressed.payload_variant.chat.to,
|
||||
sizeof(uncompressed.payload_variant.chat.to) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Decompression overflowed chat.to. Bailing out\n");
|
||||
LOG_WARN("Decompression overflowed chat.to. Bailing out");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Decompressed chat to: %d bytes\n", length);
|
||||
LOG_DEBUG("Decompressed chat to: %d bytes", length);
|
||||
}
|
||||
|
||||
if (t->payload_variant.chat.has_to_callsign) {
|
||||
|
@ -182,10 +182,10 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
|||
uncompressed.payload_variant.chat.to_callsign,
|
||||
sizeof(uncompressed.payload_variant.chat.to_callsign) - 1, USX_PSET_DFLT, NULL);
|
||||
if (length < 0) {
|
||||
LOG_WARN("Decompression overflowed chat.to_callsign. Bailing out\n");
|
||||
LOG_WARN("Decompression overflowed chat.to_callsign. Bailing out");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Decompressed chat to_callsign: %d bytes\n", length);
|
||||
LOG_DEBUG("Decompressed chat to_callsign: %d bytes", length);
|
||||
}
|
||||
}
|
||||
decompressedCopy->decoded.payload.size =
|
||||
|
|
|
@ -48,11 +48,11 @@ CannedMessageModule::CannedMessageModule()
|
|||
this->loadProtoForModule();
|
||||
if ((this->splitConfiguredMessages() <= 0) && (cardkb_found.address == 0x00) && !INPUTBROKER_MATRIX_TYPE &&
|
||||
!CANNED_MESSAGE_MODULE_ENABLE) {
|
||||
LOG_INFO("CannedMessageModule: No messages are configured. Module is disabled\n");
|
||||
LOG_INFO("CannedMessageModule: No messages are configured. Module is disabled");
|
||||
this->runState = CANNED_MESSAGE_RUN_STATE_DISABLED;
|
||||
disable();
|
||||
} else {
|
||||
LOG_INFO("CannedMessageModule is enabled\n");
|
||||
LOG_INFO("CannedMessageModule is enabled");
|
||||
|
||||
// T-Watch interface currently has no way to select destination type, so default to 'node'
|
||||
#if defined(T_WATCH_S3) || defined(RAK14014)
|
||||
|
@ -112,7 +112,7 @@ int CannedMessageModule::splitConfiguredMessages()
|
|||
}
|
||||
if (strlen(this->messages[messageIndex - 1]) > 0) {
|
||||
// We have a last message.
|
||||
LOG_DEBUG("CannedMessage %d is: '%s'\n", messageIndex - 1, this->messages[messageIndex - 1]);
|
||||
LOG_DEBUG("CannedMessage %d is: '%s'", messageIndex - 1, this->messages[messageIndex - 1]);
|
||||
this->messagesCount = messageIndex;
|
||||
} else {
|
||||
this->messagesCount = messageIndex - 1;
|
||||
|
@ -227,12 +227,12 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||
case INPUT_BROKER_MSG_BRIGHTNESS_UP: // make screen brighter
|
||||
if (screen)
|
||||
screen->increaseBrightness();
|
||||
LOG_DEBUG("increasing Screen Brightness\n");
|
||||
LOG_DEBUG("increasing Screen Brightness");
|
||||
break;
|
||||
case INPUT_BROKER_MSG_BRIGHTNESS_DOWN: // make screen dimmer
|
||||
if (screen)
|
||||
screen->decreaseBrightness();
|
||||
LOG_DEBUG("Decreasing Screen Brightness\n");
|
||||
LOG_DEBUG("Decreasing Screen Brightness");
|
||||
break;
|
||||
case INPUT_BROKER_MSG_FN_SYMBOL_ON: // draw modifier (function) symbal
|
||||
if (screen)
|
||||
|
@ -301,7 +301,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||
return 0;
|
||||
default:
|
||||
// pass the pressed key
|
||||
// LOG_DEBUG("Canned message ANYKEY (%x)\n", event->kbchar);
|
||||
// LOG_DEBUG("Canned message ANYKEY (%x)", event->kbchar);
|
||||
this->payload = event->kbchar;
|
||||
this->lastTouchMillis = millis();
|
||||
validEvent = true;
|
||||
|
@ -414,7 +414,7 @@ void CannedMessageModule::sendText(NodeNum dest, ChannelIndex channel, const cha
|
|||
// or raising a UIFrameEvent before another module has the chance
|
||||
this->waitingForAck = true;
|
||||
|
||||
LOG_INFO("Sending message id=%d, dest=%x, msg=%.*s\n", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes);
|
||||
LOG_INFO("Sending message id=%d, dest=%x, msg=%.*s", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes);
|
||||
|
||||
service->sendToMesh(
|
||||
p, RX_SRC_LOCAL,
|
||||
|
@ -428,7 +428,7 @@ int32_t CannedMessageModule::runOnce()
|
|||
temporaryMessage = "";
|
||||
return INT32_MAX;
|
||||
}
|
||||
// LOG_DEBUG("Check status\n");
|
||||
// LOG_DEBUG("Check status");
|
||||
UIFrameEvent e;
|
||||
if ((this->runState == CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE) ||
|
||||
(this->runState == CANNED_MESSAGE_RUN_STATE_ACK_NACK_RECEIVED) || (this->runState == CANNED_MESSAGE_RUN_STATE_MESSAGE)) {
|
||||
|
@ -481,7 +481,7 @@ int32_t CannedMessageModule::runOnce()
|
|||
}
|
||||
this->runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE;
|
||||
} else {
|
||||
// LOG_DEBUG("Reset message is empty.\n");
|
||||
// LOG_DEBUG("Reset message is empty.");
|
||||
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ int32_t CannedMessageModule::runOnce()
|
|||
return 2000;
|
||||
} else if ((this->runState != CANNED_MESSAGE_RUN_STATE_FREETEXT) && (this->currentMessageIndex == -1)) {
|
||||
this->currentMessageIndex = 0;
|
||||
LOG_DEBUG("First touch (%d):%s\n", this->currentMessageIndex, this->getCurrentMessage());
|
||||
LOG_DEBUG("First touch (%d):%s", this->currentMessageIndex, this->getCurrentMessage());
|
||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET; // We want to change the list of frames shown on-screen
|
||||
this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
|
||||
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_UP) {
|
||||
|
@ -512,7 +512,7 @@ int32_t CannedMessageModule::runOnce()
|
|||
#endif
|
||||
|
||||
this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
|
||||
LOG_DEBUG("MOVE UP (%d):%s\n", this->currentMessageIndex, this->getCurrentMessage());
|
||||
LOG_DEBUG("MOVE UP (%d):%s", this->currentMessageIndex, this->getCurrentMessage());
|
||||
}
|
||||
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_DOWN) {
|
||||
if (this->messagesCount > 0) {
|
||||
|
@ -525,7 +525,7 @@ int32_t CannedMessageModule::runOnce()
|
|||
#endif
|
||||
|
||||
this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
|
||||
LOG_DEBUG("MOVE DOWN (%d):%s\n", this->currentMessageIndex, this->getCurrentMessage());
|
||||
LOG_DEBUG("MOVE DOWN (%d):%s", this->currentMessageIndex, this->getCurrentMessage());
|
||||
}
|
||||
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT || this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) {
|
||||
switch (this->payload) {
|
||||
|
@ -1206,13 +1206,13 @@ AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const
|
|||
|
||||
switch (request->which_payload_variant) {
|
||||
case meshtastic_AdminMessage_get_canned_message_module_messages_request_tag:
|
||||
LOG_DEBUG("Client is getting radio canned messages\n");
|
||||
LOG_DEBUG("Client is getting radio canned messages");
|
||||
this->handleGetCannedMessageModuleMessages(mp, response);
|
||||
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_canned_message_module_messages_tag:
|
||||
LOG_DEBUG("Client is setting radio canned messages\n");
|
||||
LOG_DEBUG("Client is setting radio canned messages");
|
||||
this->handleSetCannedMessageModuleMessages(request->set_canned_message_module_messages);
|
||||
result = AdminMessageHandleResult::HANDLED;
|
||||
break;
|
||||
|
@ -1227,7 +1227,7 @@ AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const
|
|||
void CannedMessageModule::handleGetCannedMessageModuleMessages(const meshtastic_MeshPacket &req,
|
||||
meshtastic_AdminMessage *response)
|
||||
{
|
||||
LOG_DEBUG("*** handleGetCannedMessageModuleMessages\n");
|
||||
LOG_DEBUG("*** handleGetCannedMessageModuleMessages");
|
||||
if (req.decoded.want_response) {
|
||||
response->which_payload_variant = meshtastic_AdminMessage_get_canned_message_module_messages_response_tag;
|
||||
strncpy(response->get_canned_message_module_messages_response, cannedMessageModuleConfig.messages,
|
||||
|
@ -1242,7 +1242,7 @@ void CannedMessageModule::handleSetCannedMessageModuleMessages(const char *from_
|
|||
if (*from_msg) {
|
||||
changed |= strcmp(cannedMessageModuleConfig.messages, from_msg);
|
||||
strncpy(cannedMessageModuleConfig.messages, from_msg, sizeof(cannedMessageModuleConfig.messages));
|
||||
LOG_DEBUG("*** from_msg.text:%s\n", from_msg);
|
||||
LOG_DEBUG("*** from_msg.text:%s", from_msg);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
|
|
@ -76,15 +76,15 @@ int32_t DetectionSensorModule::runOnce()
|
|||
if (moduleConfig.detection_sensor.monitor_pin > 0) {
|
||||
pinMode(moduleConfig.detection_sensor.monitor_pin, moduleConfig.detection_sensor.use_pullup ? INPUT_PULLUP : INPUT);
|
||||
} else {
|
||||
LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disabling module...\n");
|
||||
LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disabling module...");
|
||||
return disable();
|
||||
}
|
||||
LOG_INFO("Detection Sensor Module: Initializing\n");
|
||||
LOG_INFO("Detection Sensor Module: Initializing");
|
||||
|
||||
return DELAYED_INTERVAL;
|
||||
}
|
||||
|
||||
// LOG_DEBUG("Detection Sensor Module: Current pin state: %i\n", digitalRead(moduleConfig.detection_sensor.monitor_pin));
|
||||
// LOG_DEBUG("Detection Sensor Module: Current pin state: %i", digitalRead(moduleConfig.detection_sensor.monitor_pin));
|
||||
|
||||
if (!Throttle::isWithinTimespanMs(lastSentToMesh,
|
||||
Default::getConfiguredOrDefaultMs(moduleConfig.detection_sensor.minimum_broadcast_secs))) {
|
||||
|
@ -118,7 +118,7 @@ int32_t DetectionSensorModule::runOnce()
|
|||
|
||||
void DetectionSensorModule::sendDetectionMessage()
|
||||
{
|
||||
LOG_DEBUG("Detected event observed. Sending message\n");
|
||||
LOG_DEBUG("Detected event observed. Sending message");
|
||||
char *message = new char[40];
|
||||
sprintf(message, "%s detected", moduleConfig.detection_sensor.name);
|
||||
meshtastic_MeshPacket *p = allocDataPacket();
|
||||
|
@ -130,7 +130,7 @@ void DetectionSensorModule::sendDetectionMessage()
|
|||
p->decoded.payload.bytes[p->decoded.payload.size + 1] = '\0'; // Bell character
|
||||
p->decoded.payload.size++;
|
||||
}
|
||||
LOG_INFO("Sending message id=%d, dest=%x, msg=%.*s\n", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes);
|
||||
LOG_INFO("Sending message id=%d, dest=%x, msg=%.*s", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes);
|
||||
lastSentToMesh = millis();
|
||||
service->sendToMesh(p);
|
||||
delete[] message;
|
||||
|
@ -145,7 +145,7 @@ void DetectionSensorModule::sendCurrentStateMessage(bool state)
|
|||
p->want_ack = false;
|
||||
p->decoded.payload.size = strlen(message);
|
||||
memcpy(p->decoded.payload.bytes, message, p->decoded.payload.size);
|
||||
LOG_INFO("Sending message id=%d, dest=%x, msg=%.*s\n", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes);
|
||||
LOG_INFO("Sending message id=%d, dest=%x, msg=%.*s", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes);
|
||||
lastSentToMesh = millis();
|
||||
service->sendToMesh(p);
|
||||
delete[] message;
|
||||
|
@ -154,6 +154,6 @@ void DetectionSensorModule::sendCurrentStateMessage(bool state)
|
|||
bool DetectionSensorModule::hasDetectionEvent()
|
||||
{
|
||||
bool currentState = digitalRead(moduleConfig.detection_sensor.monitor_pin);
|
||||
// LOG_DEBUG("Detection Sensor Module: Current state: %i\n", currentState);
|
||||
// LOG_DEBUG("Detection Sensor Module: Current state: %i", currentState);
|
||||
return (moduleConfig.detection_sensor.detection_trigger_type & 1) ? currentState : !currentState;
|
||||
}
|
|
@ -34,13 +34,13 @@ ProcessMessage DropzoneModule::handleReceived(const meshtastic_MeshPacket &mp)
|
|||
auto incomingMessage = reinterpret_cast<const char *>(p.payload.bytes);
|
||||
sprintf(matchCompare, "%s conditions", owner.short_name);
|
||||
if (strncasecmp(incomingMessage, matchCompare, strlen(matchCompare)) == 0) {
|
||||
LOG_DEBUG("Received dropzone conditions request\n");
|
||||
LOG_DEBUG("Received dropzone conditions request");
|
||||
startSendConditions = millis();
|
||||
}
|
||||
|
||||
sprintf(matchCompare, "%s conditions", owner.long_name);
|
||||
if (strncasecmp(incomingMessage, matchCompare, strlen(matchCompare)) == 0) {
|
||||
LOG_DEBUG("Received dropzone conditions request\n");
|
||||
LOG_DEBUG("Received dropzone conditions request");
|
||||
startSendConditions = millis();
|
||||
}
|
||||
return ProcessMessage::CONTINUE;
|
||||
|
@ -82,10 +82,10 @@ meshtastic_MeshPacket *DropzoneModule::sendConditions()
|
|||
sprintf(replyStr, "%s @ %02d:%02d:%02dz\nWind %.2f kts @ %d°\nBaro %.2f inHg %.2f°C", dropzoneStatus, hour, min, sec,
|
||||
windSpeed, windDirection, baro, temp);
|
||||
} else {
|
||||
LOG_ERROR("No sensor found\n");
|
||||
LOG_ERROR("No sensor found");
|
||||
sprintf(replyStr, "%s @ %02d:%02d:%02d\nNo sensor found", dropzoneStatus, hour, min, sec);
|
||||
}
|
||||
LOG_DEBUG("Conditions reply: %s\n", replyStr);
|
||||
LOG_DEBUG("Conditions reply: %s", replyStr);
|
||||
reply->decoded.payload.size = strlen(replyStr); // You must specify how many bytes are in the reply
|
||||
memcpy(reply->decoded.payload.bytes, replyStr, reply->decoded.payload.size);
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ int32_t ExternalNotificationModule::runOnce()
|
|||
externalTurnedOn[i] = 0;
|
||||
LOG_INFO("%d ", i);
|
||||
}
|
||||
LOG_INFO("\n");
|
||||
LOG_INFO("");
|
||||
#ifdef HAS_I2S
|
||||
// GPIO0 is used as mclk for I2S audio and set to OUTPUT by the sound library
|
||||
// T-Deck uses GPIO0 as trackball button, so restore the mode
|
||||
|
@ -369,34 +369,34 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||
sizeof(rtttlConfig.ringtone));
|
||||
}
|
||||
|
||||
LOG_INFO("Initializing External Notification Module\n");
|
||||
LOG_INFO("Initializing External Notification Module");
|
||||
|
||||
output = moduleConfig.external_notification.output ? moduleConfig.external_notification.output
|
||||
: EXT_NOTIFICATION_MODULE_OUTPUT;
|
||||
|
||||
// Set the direction of a pin
|
||||
if (output > 0) {
|
||||
LOG_INFO("Using Pin %i in digital mode\n", output);
|
||||
LOG_INFO("Using Pin %i in digital mode", output);
|
||||
pinMode(output, OUTPUT);
|
||||
}
|
||||
setExternalOff(0);
|
||||
externalTurnedOn[0] = 0;
|
||||
if (moduleConfig.external_notification.output_vibra) {
|
||||
LOG_INFO("Using Pin %i for vibra motor\n", moduleConfig.external_notification.output_vibra);
|
||||
LOG_INFO("Using Pin %i for vibra motor", moduleConfig.external_notification.output_vibra);
|
||||
pinMode(moduleConfig.external_notification.output_vibra, OUTPUT);
|
||||
setExternalOff(1);
|
||||
externalTurnedOn[1] = 0;
|
||||
}
|
||||
if (moduleConfig.external_notification.output_buzzer) {
|
||||
if (!moduleConfig.external_notification.use_pwm) {
|
||||
LOG_INFO("Using Pin %i for buzzer\n", moduleConfig.external_notification.output_buzzer);
|
||||
LOG_INFO("Using Pin %i for buzzer", moduleConfig.external_notification.output_buzzer);
|
||||
pinMode(moduleConfig.external_notification.output_buzzer, OUTPUT);
|
||||
setExternalOff(2);
|
||||
externalTurnedOn[2] = 0;
|
||||
} else {
|
||||
config.device.buzzer_gpio = config.device.buzzer_gpio ? config.device.buzzer_gpio : PIN_BUZZER;
|
||||
// in PWM Mode we force the buzzer pin if it is set
|
||||
LOG_INFO("Using Pin %i in PWM mode\n", config.device.buzzer_gpio);
|
||||
LOG_INFO("Using Pin %i in PWM mode", config.device.buzzer_gpio);
|
||||
}
|
||||
}
|
||||
#ifdef HAS_NCP5623
|
||||
|
@ -421,7 +421,7 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||
pixels.setBrightness(moduleConfig.ambient_lighting.current);
|
||||
#endif
|
||||
} else {
|
||||
LOG_INFO("External Notification Module Disabled\n");
|
||||
LOG_INFO("External Notification Module Disabled");
|
||||
disable();
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||
|
||||
if (moduleConfig.external_notification.alert_bell) {
|
||||
if (containsBell) {
|
||||
LOG_INFO("externalNotificationModule - Notification Bell\n");
|
||||
LOG_INFO("externalNotificationModule - Notification Bell");
|
||||
isNagging = true;
|
||||
setExternalOn(0);
|
||||
if (moduleConfig.external_notification.nag_timeout) {
|
||||
|
@ -460,7 +460,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||
|
||||
if (moduleConfig.external_notification.alert_bell_vibra) {
|
||||
if (containsBell) {
|
||||
LOG_INFO("externalNotificationModule - Notification Bell (Vibra)\n");
|
||||
LOG_INFO("externalNotificationModule - Notification Bell (Vibra)");
|
||||
isNagging = true;
|
||||
setExternalOn(1);
|
||||
if (moduleConfig.external_notification.nag_timeout) {
|
||||
|
@ -473,7 +473,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||
|
||||
if (moduleConfig.external_notification.alert_bell_buzzer) {
|
||||
if (containsBell) {
|
||||
LOG_INFO("externalNotificationModule - Notification Bell (Buzzer)\n");
|
||||
LOG_INFO("externalNotificationModule - Notification Bell (Buzzer)");
|
||||
isNagging = true;
|
||||
if (!moduleConfig.external_notification.use_pwm) {
|
||||
setExternalOn(2);
|
||||
|
@ -493,7 +493,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||
}
|
||||
|
||||
if (moduleConfig.external_notification.alert_message) {
|
||||
LOG_INFO("externalNotificationModule - Notification Module\n");
|
||||
LOG_INFO("externalNotificationModule - Notification Module");
|
||||
isNagging = true;
|
||||
setExternalOn(0);
|
||||
if (moduleConfig.external_notification.nag_timeout) {
|
||||
|
@ -504,7 +504,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||
}
|
||||
|
||||
if (moduleConfig.external_notification.alert_message_vibra) {
|
||||
LOG_INFO("externalNotificationModule - Notification Module (Vibra)\n");
|
||||
LOG_INFO("externalNotificationModule - Notification Module (Vibra)");
|
||||
isNagging = true;
|
||||
setExternalOn(1);
|
||||
if (moduleConfig.external_notification.nag_timeout) {
|
||||
|
@ -515,7 +515,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||
}
|
||||
|
||||
if (moduleConfig.external_notification.alert_message_buzzer) {
|
||||
LOG_INFO("externalNotificationModule - Notification Module (Buzzer)\n");
|
||||
LOG_INFO("externalNotificationModule - Notification Module (Buzzer)");
|
||||
isNagging = true;
|
||||
if (!moduleConfig.external_notification.use_pwm && !moduleConfig.external_notification.use_i2s_as_buzzer) {
|
||||
setExternalOn(2);
|
||||
|
@ -537,7 +537,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||
setIntervalFromNow(0); // run once so we know if we should do something
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("External Notification Module Disabled or muted\n");
|
||||
LOG_INFO("External Notification Module Disabled or muted");
|
||||
}
|
||||
|
||||
return ProcessMessage::CONTINUE; // Let others look at this message also if they want
|
||||
|
@ -560,13 +560,13 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
|
|||
|
||||
switch (request->which_payload_variant) {
|
||||
case meshtastic_AdminMessage_get_ringtone_request_tag:
|
||||
LOG_INFO("Client is getting ringtone\n");
|
||||
LOG_INFO("Client is getting ringtone");
|
||||
this->handleGetRingtone(mp, response);
|
||||
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_ringtone_message_tag:
|
||||
LOG_INFO("Client is setting ringtone\n");
|
||||
LOG_INFO("Client is setting ringtone");
|
||||
this->handleSetRingtone(request->set_canned_message_module_messages);
|
||||
result = AdminMessageHandleResult::HANDLED;
|
||||
break;
|
||||
|
@ -580,7 +580,7 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
|
|||
|
||||
void ExternalNotificationModule::handleGetRingtone(const meshtastic_MeshPacket &req, meshtastic_AdminMessage *response)
|
||||
{
|
||||
LOG_INFO("*** handleGetRingtone\n");
|
||||
LOG_INFO("*** handleGetRingtone");
|
||||
if (req.decoded.want_response) {
|
||||
response->which_payload_variant = meshtastic_AdminMessage_get_ringtone_response_tag;
|
||||
strncpy(response->get_ringtone_response, rtttlConfig.ringtone, sizeof(response->get_ringtone_response));
|
||||
|
@ -594,7 +594,7 @@ void ExternalNotificationModule::handleSetRingtone(const char *from_msg)
|
|||
if (*from_msg) {
|
||||
changed |= strcmp(rtttlConfig.ringtone, from_msg);
|
||||
strncpy(rtttlConfig.ringtone, from_msg, sizeof(rtttlConfig.ringtone));
|
||||
LOG_INFO("*** from_msg.text:%s\n", from_msg);
|
||||
LOG_INFO("*** from_msg.text:%s", from_msg);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
|
|
@ -14,11 +14,11 @@ NOTE: For debugging only
|
|||
*/
|
||||
void NeighborInfoModule::printNeighborInfo(const char *header, const meshtastic_NeighborInfo *np)
|
||||
{
|
||||
LOG_DEBUG("%s NEIGHBORINFO PACKET from Node 0x%x to Node 0x%x (last sent by 0x%x)\n", header, np->node_id,
|
||||
nodeDB->getNodeNum(), np->last_sent_by_id);
|
||||
LOG_DEBUG("Packet contains %d neighbors\n", np->neighbors_count);
|
||||
LOG_DEBUG("%s NEIGHBORINFO PACKET from Node 0x%x to Node 0x%x (last sent by 0x%x)", header, np->node_id, nodeDB->getNodeNum(),
|
||||
np->last_sent_by_id);
|
||||
LOG_DEBUG("Packet contains %d neighbors", np->neighbors_count);
|
||||
for (int i = 0; i < np->neighbors_count; i++) {
|
||||
LOG_DEBUG("Neighbor %d: node_id=0x%x, snr=%.2f\n", i, np->neighbors[i].node_id, np->neighbors[i].snr);
|
||||
LOG_DEBUG("Neighbor %d: node_id=0x%x, snr=%.2f", i, np->neighbors[i].node_id, np->neighbors[i].snr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ NOTE: for debugging only
|
|||
*/
|
||||
void NeighborInfoModule::printNodeDBNeighbors()
|
||||
{
|
||||
LOG_DEBUG("Our NodeDB contains %d neighbors\n", neighbors.size());
|
||||
LOG_DEBUG("Our NodeDB contains %d neighbors", neighbors.size());
|
||||
for (size_t i = 0; i < neighbors.size(); i++) {
|
||||
LOG_DEBUG("Node %d: node_id=0x%x, snr=%.2f\n", i, neighbors[i].node_id, neighbors[i].snr);
|
||||
LOG_DEBUG("Node %d: node_id=0x%x, snr=%.2f", i, neighbors[i].node_id, neighbors[i].snr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ NeighborInfoModule::NeighborInfoModule()
|
|||
setIntervalFromNow(Default::getConfiguredOrDefaultMs(moduleConfig.neighbor_info.update_interval,
|
||||
default_telemetry_broadcast_interval_secs));
|
||||
} else {
|
||||
LOG_DEBUG("NeighborInfoModule is disabled\n");
|
||||
LOG_DEBUG("NeighborInfoModule is disabled");
|
||||
disable();
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void NeighborInfoModule::cleanUpNeighbors()
|
|||
// 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
|
||||
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\n", it->node_id);
|
||||
LOG_DEBUG("Removing neighbor with node ID 0x%x", it->node_id);
|
||||
it = std::vector<meshtastic_Neighbor>::reverse_iterator(
|
||||
neighbors.erase(std::next(it).base())); // Erase the element and update the iterator
|
||||
} else {
|
||||
|
@ -205,7 +205,7 @@ meshtastic_Neighbor *NeighborInfoModule::getOrCreateNeighbor(NodeNum originalSen
|
|||
neighbors.push_back(new_nbr);
|
||||
} else {
|
||||
// If we have too many neighbors, replace the oldest one
|
||||
LOG_WARN("Neighbor DB is full, replacing oldest neighbor\n");
|
||||
LOG_WARN("Neighbor DB is full, replacing oldest neighbor");
|
||||
neighbors.erase(neighbors.begin());
|
||||
neighbors.push_back(new_nbr);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ bool NodeInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
|
|||
if (hasChanged && !wasBroadcast && !isToUs(&mp))
|
||||
service->sendToPhone(packetPool.allocCopy(mp));
|
||||
|
||||
// LOG_DEBUG("did handleReceived\n");
|
||||
// LOG_DEBUG("did handleReceived");
|
||||
return false; // Let others look at this message also if they want
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void NodeInfoModule::sendOurNodeInfo(NodeNum dest, bool wantReplies, uint8_t cha
|
|||
else
|
||||
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
|
||||
if (channel > 0) {
|
||||
LOG_DEBUG("sending ourNodeInfo to channel %d\n", channel);
|
||||
LOG_DEBUG("sending ourNodeInfo to channel %d", channel);
|
||||
p->channel = channel;
|
||||
}
|
||||
|
||||
|
@ -65,23 +65,23 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply()
|
|||
{
|
||||
if (!airTime->isTxAllowedChannelUtil(false)) {
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
LOG_DEBUG("Skip sending NodeInfo due to > 40 percent channel util.\n");
|
||||
LOG_DEBUG("Skip sending NodeInfo due to > 40 percent channel util.");
|
||||
return NULL;
|
||||
}
|
||||
// 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)) {
|
||||
LOG_DEBUG("Skip sending NodeInfo since we just sent it less than 5 minutes ago.\n");
|
||||
LOG_DEBUG("Skip sending NodeInfo since we just sent it less than 5 minutes ago.");
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
return NULL;
|
||||
} else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) {
|
||||
LOG_DEBUG("Skip sending actively requested NodeInfo since we just sent it less than 60 seconds ago.\n");
|
||||
LOG_DEBUG("Skip sending actively requested NodeInfo since we just sent it less than 60 seconds ago.");
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
return NULL;
|
||||
} else {
|
||||
ignoreRequest = false; // Don't ignore requests anymore
|
||||
meshtastic_User &u = owner;
|
||||
|
||||
LOG_INFO("sending owner %s/%s/%s\n", u.id, u.long_name, u.short_name);
|
||||
LOG_INFO("sending owner %s/%s/%s", u.id, u.long_name, u.short_name);
|
||||
lastSentToMesh = millis();
|
||||
return allocDataProtobuf(u);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ int32_t NodeInfoModule::runOnce()
|
|||
currentGeneration = radioGeneration;
|
||||
|
||||
if (airTime->isTxAllowedAirUtil() && config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_HIDDEN) {
|
||||
LOG_INFO("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies);
|
||||
LOG_INFO("Sending our nodeinfo to mesh (wantReplies=%d)", requestReplies);
|
||||
sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
|
||||
}
|
||||
return Default::getConfiguredOrDefaultMs(config.device.node_info_broadcast_secs, default_node_info_broadcast_secs);
|
||||
|
|
|
@ -39,7 +39,7 @@ PositionModule::PositionModule()
|
|||
if ((config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
|
||||
config.power.is_power_saving) {
|
||||
LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz\n");
|
||||
LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz");
|
||||
nodeDB->clearLocalPosition();
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
|
|||
if (isFromUs(&mp)) {
|
||||
isLocal = true;
|
||||
if (config.position.fixed_position) {
|
||||
LOG_DEBUG("Ignore incoming position update from myself except for time, because position.fixed_position is true\n");
|
||||
LOG_DEBUG("Ignore incoming position update from myself except for time, because position.fixed_position is true");
|
||||
|
||||
#ifdef T_WATCH_S3
|
||||
// Since we return early if position.fixed_position is true, set the T-Watch's RTC to the time received from the
|
||||
|
@ -70,14 +70,14 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
|
|||
nodeDB->setLocalPosition(p, true);
|
||||
return false;
|
||||
} else {
|
||||
LOG_DEBUG("Incoming update from MYSELF\n");
|
||||
LOG_DEBUG("Incoming update from MYSELF");
|
||||
nodeDB->setLocalPosition(p);
|
||||
}
|
||||
}
|
||||
|
||||
// Log packet size and data fields
|
||||
LOG_DEBUG("POSITION node=%08x l=%d lat=%d lon=%d msl=%d hae=%d geo=%d pdop=%d hdop=%d vdop=%d siv=%d fxq=%d fxt=%d pts=%d "
|
||||
"time=%d\n",
|
||||
"time=%d",
|
||||
getFrom(&mp), mp.decoded.payload.size, p.latitude_i, p.longitude_i, p.altitude, p.altitude_hae,
|
||||
p.altitude_geoidal_separation, p.PDOP, p.HDOP, p.VDOP, p.sats_in_view, p.fix_quality, p.fix_type, p.timestamp,
|
||||
p.time);
|
||||
|
@ -111,7 +111,7 @@ void PositionModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic
|
|||
{
|
||||
// Phone position packets need to be truncated to the channel precision
|
||||
if (isFromUs(&mp) && (precision < 32 && precision > 0)) {
|
||||
LOG_DEBUG("Truncating phone position to channel precision %i\n", precision);
|
||||
LOG_DEBUG("Truncating phone position to channel precision %i", precision);
|
||||
p->latitude_i = p->latitude_i & (UINT32_MAX << (32 - precision));
|
||||
p->longitude_i = p->longitude_i & (UINT32_MAX << (32 - precision));
|
||||
|
||||
|
@ -127,11 +127,11 @@ void PositionModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic
|
|||
void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal, bool forceUpdate)
|
||||
{
|
||||
if (hasQualityTimesource() && !isLocal) {
|
||||
LOG_DEBUG("Ignoring time from mesh because we have a GPS, RTC, or Phone/NTP time source in the past day\n");
|
||||
LOG_DEBUG("Ignoring time from mesh because we have a GPS, RTC, or Phone/NTP time source in the past day");
|
||||
return;
|
||||
}
|
||||
if (!isLocal && p.location_source < meshtastic_Position_LocSource_LOC_INTERNAL) {
|
||||
LOG_DEBUG("Ignoring time from mesh because it has a unknown or manual source\n");
|
||||
LOG_DEBUG("Ignoring time from mesh because it has a unknown or manual source");
|
||||
return;
|
||||
}
|
||||
struct timeval tv;
|
||||
|
@ -158,7 +158,7 @@ bool PositionModule::hasQualityTimesource()
|
|||
meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
{
|
||||
if (precision == 0) {
|
||||
LOG_DEBUG("Skipping location send because precision is set to 0!\n");
|
||||
LOG_DEBUG("Skipping location send because precision is set to 0!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -178,12 +178,12 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
|||
localPosition.seq_number++;
|
||||
|
||||
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) {
|
||||
LOG_WARN("Skipping position send because lat/lon are zero!\n");
|
||||
LOG_WARN("Skipping position send because lat/lon are zero!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// lat/lon are unconditionally included - IF AVAILABLE!
|
||||
LOG_DEBUG("Sending location with precision %i\n", precision);
|
||||
LOG_DEBUG("Sending location with precision %i", precision);
|
||||
if (precision < 32 && precision > 0) {
|
||||
p.latitude_i = localPosition.latitude_i & (UINT32_MAX << (32 - precision));
|
||||
p.longitude_i = localPosition.longitude_i & (UINT32_MAX << (32 - precision));
|
||||
|
@ -250,14 +250,14 @@ 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
|
||||
// without can get time.
|
||||
if (getRTCQuality() < RTCQualityNTP) {
|
||||
LOG_INFO("Stripping time %u from position send\n", p.time);
|
||||
LOG_INFO("Stripping time %u from position send", p.time);
|
||||
p.time = 0;
|
||||
} else {
|
||||
p.time = getValidTime(RTCQualityNTP);
|
||||
LOG_INFO("Providing time to mesh %u\n", p.time);
|
||||
LOG_INFO("Providing time to mesh %u", p.time);
|
||||
}
|
||||
|
||||
LOG_INFO("Position reply: time=%i lat=%i lon=%i\n", 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);
|
||||
|
||||
// TAK Tracker devices should send their position in a TAK packet over the ATAK port
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER)
|
||||
|
@ -268,7 +268,7 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
|||
|
||||
meshtastic_MeshPacket *PositionModule::allocAtakPli()
|
||||
{
|
||||
LOG_INFO("Sending TAK PLI packet\n");
|
||||
LOG_INFO("Sending TAK PLI packet");
|
||||
meshtastic_MeshPacket *mp = allocDataPacket();
|
||||
mp->decoded.portnum = meshtastic_PortNum_ATAK_PLUGIN;
|
||||
|
||||
|
@ -293,8 +293,8 @@ meshtastic_MeshPacket *PositionModule::allocAtakPli()
|
|||
|
||||
auto length = unishox2_compress_lines(owner.long_name, strlen(owner.long_name), takPacket.contact.device_callsign,
|
||||
sizeof(takPacket.contact.device_callsign) - 1, USX_PSET_DFLT, NULL);
|
||||
LOG_DEBUG("Uncompressed device_callsign '%s' - %d bytes\n", owner.long_name, strlen(owner.long_name));
|
||||
LOG_DEBUG("Compressed device_callsign '%s' - %d bytes\n", takPacket.contact.device_callsign, length);
|
||||
LOG_DEBUG("Uncompressed device_callsign '%s' - %d bytes", owner.long_name, strlen(owner.long_name));
|
||||
LOG_DEBUG("Compressed device_callsign '%s' - %d bytes", takPacket.contact.device_callsign, length);
|
||||
length = unishox2_compress_lines(owner.long_name, strlen(owner.long_name), takPacket.contact.callsign,
|
||||
sizeof(takPacket.contact.callsign) - 1, USX_PSET_DFLT, NULL);
|
||||
mp->decoded.payload.size =
|
||||
|
@ -308,7 +308,7 @@ void PositionModule::sendOurPosition()
|
|||
currentGeneration = radioGeneration;
|
||||
|
||||
// If we changed channels, ask everyone else for their latest info
|
||||
LOG_INFO("Sending pos@%x:6 to mesh (wantReplies=%d)\n", localPosition.timestamp, requestReplies);
|
||||
LOG_INFO("Sending pos@%x:6 to mesh (wantReplies=%d)", localPosition.timestamp, requestReplies);
|
||||
sendOurPosition(NODENUM_BROADCAST, requestReplies);
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
|
|||
|
||||
meshtastic_MeshPacket *p = allocReply();
|
||||
if (p == nullptr) {
|
||||
LOG_DEBUG("allocReply returned a nullptr\n");
|
||||
LOG_DEBUG("allocReply returned a nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
|
|||
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
|
||||
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
|
||||
config.power.is_power_saving) {
|
||||
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep.\n");
|
||||
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep.");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ int32_t PositionModule::runOnce()
|
|||
if (sleepOnNextExecution == true) {
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send position again.\n", nightyNightMs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send position again.", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, false);
|
||||
}
|
||||
|
||||
|
@ -407,10 +407,10 @@ int32_t PositionModule::runOnce()
|
|||
if (smartPosition.hasTraveledOverThreshold &&
|
||||
Throttle::execute(
|
||||
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
|
||||
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling\n"); })) {
|
||||
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling"); })) {
|
||||
|
||||
LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, "
|
||||
"minTimeInterval=%ims)\n",
|
||||
"minTimeInterval=%ims)",
|
||||
localPosition.timestamp, smartPosition.distanceTraveled, smartPosition.distanceThreshold,
|
||||
msSinceLastSend, minimumTimeThreshold);
|
||||
|
||||
|
@ -450,19 +450,19 @@ struct SmartPosition PositionModule::getDistanceTraveledSinceLastSend(meshtastic
|
|||
lastGpsLatitude * 1e-7, lastGpsLongitude * 1e-7, currentPosition.latitude_i * 1e-7, currentPosition.longitude_i * 1e-7);
|
||||
|
||||
#ifdef GPS_EXTRAVERBOSE
|
||||
LOG_DEBUG("--------LAST POSITION------------------------------------\n");
|
||||
LOG_DEBUG("lastGpsLatitude=%i, lastGpsLatitude=%i\n", lastGpsLatitude, lastGpsLongitude);
|
||||
LOG_DEBUG("--------LAST POSITION------------------------------------");
|
||||
LOG_DEBUG("lastGpsLatitude=%i, lastGpsLatitude=%i", lastGpsLatitude, lastGpsLongitude);
|
||||
|
||||
LOG_DEBUG("--------CURRENT POSITION---------------------------------\n");
|
||||
LOG_DEBUG("currentPosition.latitude_i=%i, currentPosition.longitude_i=%i\n", lastGpsLatitude, lastGpsLongitude);
|
||||
LOG_DEBUG("--------CURRENT POSITION---------------------------------");
|
||||
LOG_DEBUG("currentPosition.latitude_i=%i, currentPosition.longitude_i=%i", lastGpsLatitude, lastGpsLongitude);
|
||||
|
||||
LOG_DEBUG("--------SMART POSITION-----------------------------------\n");
|
||||
LOG_DEBUG("hasTraveledOverThreshold=%i, distanceTraveled=%f, distanceThreshold=%f\n",
|
||||
LOG_DEBUG("--------SMART POSITION-----------------------------------");
|
||||
LOG_DEBUG("hasTraveledOverThreshold=%i, distanceTraveled=%f, distanceThreshold=%f",
|
||||
abs(distanceTraveledSinceLastSend) >= distanceTravelThreshold, abs(distanceTraveledSinceLastSend),
|
||||
distanceTravelThreshold);
|
||||
|
||||
if (abs(distanceTraveledSinceLastSend) >= distanceTravelThreshold) {
|
||||
LOG_DEBUG("\n\n\nSMART SEEEEEEEEENDING\n\n\n");
|
||||
LOG_DEBUG("SMART SEEEEEEEEENDING");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -482,9 +482,9 @@ void PositionModule::handleNewPosition()
|
|||
if (smartPosition.hasTraveledOverThreshold &&
|
||||
Throttle::execute(
|
||||
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
|
||||
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling\n"); })) {
|
||||
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling"); })) {
|
||||
LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, "
|
||||
"minTimeInterval=%ims)\n",
|
||||
"minTimeInterval=%ims)",
|
||||
localPosition.timestamp, smartPosition.distanceTraveled, smartPosition.distanceThreshold, msSinceLastSend,
|
||||
minimumTimeThreshold);
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ bool PowerStressModule::handleReceivedProtobuf(const meshtastic_MeshPacket &req,
|
|||
// We only respond to messages if powermon debugging is already on
|
||||
if (config.power.powermon_enables) {
|
||||
auto p = *pptr;
|
||||
LOG_INFO("Received PowerStress cmd=%d\n", p.cmd);
|
||||
LOG_INFO("Received PowerStress cmd=%d", p.cmd);
|
||||
|
||||
// Some commands we can handle immediately, anything else gets deferred to be handled by our thread
|
||||
switch (p.cmd) {
|
||||
case meshtastic_PowerStressMessage_Opcode_UNSET:
|
||||
LOG_ERROR("PowerStress operation unset\n");
|
||||
LOG_ERROR("PowerStress operation unset");
|
||||
break;
|
||||
|
||||
case meshtastic_PowerStressMessage_Opcode_PRINT_INFO:
|
||||
|
@ -42,7 +42,7 @@ bool PowerStressModule::handleReceivedProtobuf(const meshtastic_MeshPacket &req,
|
|||
|
||||
default:
|
||||
if (currentMessage.cmd != meshtastic_PowerStressMessage_Opcode_UNSET)
|
||||
LOG_ERROR("PowerStress operation %d already in progress! Can't start new command\n", currentMessage.cmd);
|
||||
LOG_ERROR("PowerStress operation %d already in progress! Can't start new command", currentMessage.cmd);
|
||||
else
|
||||
currentMessage = p; // copy for use by thread (the message provided to us will be getting freed)
|
||||
break;
|
||||
|
@ -67,13 +67,13 @@ int32_t PowerStressModule::runOnce()
|
|||
p.cmd = meshtastic_PowerStressMessage_Opcode_UNSET;
|
||||
p.num_seconds = 0;
|
||||
isRunningCommand = false;
|
||||
LOG_INFO("S:PS:%u\n", p.cmd);
|
||||
LOG_INFO("S:PS:%u", p.cmd);
|
||||
} else {
|
||||
if (p.cmd != meshtastic_PowerStressMessage_Opcode_UNSET) {
|
||||
sleep_msec = (int32_t)(p.num_seconds * 1000);
|
||||
isRunningCommand = !!sleep_msec; // if the command wants us to sleep, make sure to mark that we have something running
|
||||
LOG_INFO(
|
||||
"S:PS:%u\n",
|
||||
"S:PS:%u",
|
||||
p.cmd); // Emit a structured log saying we are starting a powerstress state (to make it easier to parse later)
|
||||
|
||||
switch (p.cmd) {
|
||||
|
@ -124,7 +124,7 @@ int32_t PowerStressModule::runOnce()
|
|||
// FIXME - implement
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("PowerStress operation %d not yet implemented!\n", p.cmd);
|
||||
LOG_ERROR("PowerStress operation %d not yet implemented!", p.cmd);
|
||||
sleep_msec = 0; // Don't do whatever sleep was requested...
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ int32_t RangeTestModule::runOnce()
|
|||
firstTime = 0;
|
||||
|
||||
if (moduleConfig.range_test.sender) {
|
||||
LOG_INFO("Initializing Range Test Module -- Sender\n");
|
||||
LOG_INFO("Initializing Range Test Module -- Sender");
|
||||
started = millis(); // make a note of when we started
|
||||
return (5000); // Sending first message 5 seconds after initialization.
|
||||
} else {
|
||||
LOG_INFO("Initializing Range Test Module -- Receiver\n");
|
||||
LOG_INFO("Initializing Range Test Module -- Receiver");
|
||||
return disable();
|
||||
// This thread does not need to run as a receiver
|
||||
}
|
||||
|
@ -66,13 +66,13 @@ int32_t RangeTestModule::runOnce()
|
|||
|
||||
if (moduleConfig.range_test.sender) {
|
||||
// If sender
|
||||
LOG_INFO("Range Test Module - Sending heartbeat every %d ms\n", (senderHeartbeat));
|
||||
LOG_INFO("Range Test Module - Sending heartbeat every %d ms", (senderHeartbeat));
|
||||
|
||||
LOG_INFO("gpsStatus->getLatitude() %d\n", gpsStatus->getLatitude());
|
||||
LOG_INFO("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude());
|
||||
LOG_INFO("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
|
||||
LOG_INFO("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
|
||||
LOG_INFO("fixed_position() %d\n", config.position.fixed_position);
|
||||
LOG_INFO("gpsStatus->getLatitude() %d", gpsStatus->getLatitude());
|
||||
LOG_INFO("gpsStatus->getLongitude() %d", gpsStatus->getLongitude());
|
||||
LOG_INFO("gpsStatus->getHasLock() %d", gpsStatus->getHasLock());
|
||||
LOG_INFO("gpsStatus->getDOP() %d", gpsStatus->getDOP());
|
||||
LOG_INFO("fixed_position() %d", config.position.fixed_position);
|
||||
|
||||
// Only send packets if the channel is less than 25% utilized.
|
||||
if (airTime->isTxAllowedChannelUtil(true)) {
|
||||
|
@ -81,7 +81,7 @@ int32_t RangeTestModule::runOnce()
|
|||
|
||||
// If we have been running for more than 8 hours, turn module back off
|
||||
if (!Throttle::isWithinTimespanMs(started, 28800000)) {
|
||||
LOG_INFO("Range Test Module - Disabling after 8 hours\n");
|
||||
LOG_INFO("Range Test Module - Disabling after 8 hours");
|
||||
return disable();
|
||||
} else {
|
||||
return (senderHeartbeat);
|
||||
|
@ -92,7 +92,7 @@ int32_t RangeTestModule::runOnce()
|
|||
}
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("Range Test Module - Disabled\n");
|
||||
LOG_INFO("Range Test Module - Disabled");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -135,7 +135,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const meshtastic_MeshPacket
|
|||
|
||||
/*
|
||||
auto &p = mp.decoded;
|
||||
LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n",
|
||||
LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s",
|
||||
LOG_INFO.getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
|
||||
*/
|
||||
|
||||
|
@ -148,31 +148,31 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const meshtastic_MeshPacket
|
|||
/*
|
||||
NodeInfoLite *n = nodeDB->getMeshNode(getFrom(&mp));
|
||||
|
||||
LOG_DEBUG("-----------------------------------------\n");
|
||||
LOG_DEBUG("p.payload.bytes \"%s\"\n", p.payload.bytes);
|
||||
LOG_DEBUG("p.payload.size %d\n", p.payload.size);
|
||||
LOG_DEBUG("---- Received Packet:\n");
|
||||
LOG_DEBUG("mp.from %d\n", mp.from);
|
||||
LOG_DEBUG("mp.rx_snr %f\n", mp.rx_snr);
|
||||
LOG_DEBUG("mp.hop_limit %d\n", mp.hop_limit);
|
||||
// LOG_DEBUG("mp.decoded.position.latitude_i %d\n", mp.decoded.position.latitude_i); // Deprecated
|
||||
// LOG_DEBUG("mp.decoded.position.longitude_i %d\n", mp.decoded.position.longitude_i); // Deprecated
|
||||
LOG_DEBUG("---- Node Information of Received Packet (mp.from):\n");
|
||||
LOG_DEBUG("n->user.long_name %s\n", n->user.long_name);
|
||||
LOG_DEBUG("n->user.short_name %s\n", n->user.short_name);
|
||||
LOG_DEBUG("n->has_position %d\n", n->has_position);
|
||||
LOG_DEBUG("n->position.latitude_i %d\n", n->position.latitude_i);
|
||||
LOG_DEBUG("n->position.longitude_i %d\n", n->position.longitude_i);
|
||||
LOG_DEBUG("---- Current device location information:\n");
|
||||
LOG_DEBUG("gpsStatus->getLatitude() %d\n", gpsStatus->getLatitude());
|
||||
LOG_DEBUG("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude());
|
||||
LOG_DEBUG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
|
||||
LOG_DEBUG("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
|
||||
LOG_DEBUG("-----------------------------------------\n");
|
||||
LOG_DEBUG("-----------------------------------------");
|
||||
LOG_DEBUG("p.payload.bytes \"%s\"", p.payload.bytes);
|
||||
LOG_DEBUG("p.payload.size %d", p.payload.size);
|
||||
LOG_DEBUG("---- Received Packet:");
|
||||
LOG_DEBUG("mp.from %d", mp.from);
|
||||
LOG_DEBUG("mp.rx_snr %f", mp.rx_snr);
|
||||
LOG_DEBUG("mp.hop_limit %d", mp.hop_limit);
|
||||
// LOG_DEBUG("mp.decoded.position.latitude_i %d", mp.decoded.position.latitude_i); // Deprecated
|
||||
// LOG_DEBUG("mp.decoded.position.longitude_i %d", mp.decoded.position.longitude_i); // Deprecated
|
||||
LOG_DEBUG("---- Node Information of Received Packet (mp.from):");
|
||||
LOG_DEBUG("n->user.long_name %s", n->user.long_name);
|
||||
LOG_DEBUG("n->user.short_name %s", n->user.short_name);
|
||||
LOG_DEBUG("n->has_position %d", n->has_position);
|
||||
LOG_DEBUG("n->position.latitude_i %d", n->position.latitude_i);
|
||||
LOG_DEBUG("n->position.longitude_i %d", n->position.longitude_i);
|
||||
LOG_DEBUG("---- Current device location information:");
|
||||
LOG_DEBUG("gpsStatus->getLatitude() %d", gpsStatus->getLatitude());
|
||||
LOG_DEBUG("gpsStatus->getLongitude() %d", gpsStatus->getLongitude());
|
||||
LOG_DEBUG("gpsStatus->getHasLock() %d", gpsStatus->getHasLock());
|
||||
LOG_DEBUG("gpsStatus->getDOP() %d", gpsStatus->getDOP());
|
||||
LOG_DEBUG("-----------------------------------------");
|
||||
*/
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("Range Test Module Disabled\n");
|
||||
LOG_INFO("Range Test Module Disabled");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -187,35 +187,35 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
|||
|
||||
meshtastic_NodeInfoLite *n = nodeDB->getMeshNode(getFrom(&mp));
|
||||
/*
|
||||
LOG_DEBUG("-----------------------------------------\n");
|
||||
LOG_DEBUG("p.payload.bytes \"%s\"\n", p.payload.bytes);
|
||||
LOG_DEBUG("p.payload.size %d\n", p.payload.size);
|
||||
LOG_DEBUG("---- Received Packet:\n");
|
||||
LOG_DEBUG("mp.from %d\n", mp.from);
|
||||
LOG_DEBUG("mp.rx_snr %f\n", mp.rx_snr);
|
||||
LOG_DEBUG("mp.hop_limit %d\n", mp.hop_limit);
|
||||
// LOG_DEBUG("mp.decoded.position.latitude_i %d\n", mp.decoded.position.latitude_i); // Deprecated
|
||||
// LOG_DEBUG("mp.decoded.position.longitude_i %d\n", mp.decoded.position.longitude_i); // Deprecated
|
||||
LOG_DEBUG("---- Node Information of Received Packet (mp.from):\n");
|
||||
LOG_DEBUG("n->user.long_name %s\n", n->user.long_name);
|
||||
LOG_DEBUG("n->user.short_name %s\n", n->user.short_name);
|
||||
LOG_DEBUG("n->has_position %d\n", n->has_position);
|
||||
LOG_DEBUG("n->position.latitude_i %d\n", n->position.latitude_i);
|
||||
LOG_DEBUG("n->position.longitude_i %d\n", n->position.longitude_i);
|
||||
LOG_DEBUG("---- Current device location information:\n");
|
||||
LOG_DEBUG("gpsStatus->getLatitude() %d\n", gpsStatus->getLatitude());
|
||||
LOG_DEBUG("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude());
|
||||
LOG_DEBUG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
|
||||
LOG_DEBUG("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
|
||||
LOG_DEBUG("-----------------------------------------\n");
|
||||
LOG_DEBUG("-----------------------------------------");
|
||||
LOG_DEBUG("p.payload.bytes \"%s\"", p.payload.bytes);
|
||||
LOG_DEBUG("p.payload.size %d", p.payload.size);
|
||||
LOG_DEBUG("---- Received Packet:");
|
||||
LOG_DEBUG("mp.from %d", mp.from);
|
||||
LOG_DEBUG("mp.rx_snr %f", mp.rx_snr);
|
||||
LOG_DEBUG("mp.hop_limit %d", mp.hop_limit);
|
||||
// LOG_DEBUG("mp.decoded.position.latitude_i %d", mp.decoded.position.latitude_i); // Deprecated
|
||||
// LOG_DEBUG("mp.decoded.position.longitude_i %d", mp.decoded.position.longitude_i); // Deprecated
|
||||
LOG_DEBUG("---- Node Information of Received Packet (mp.from):");
|
||||
LOG_DEBUG("n->user.long_name %s", n->user.long_name);
|
||||
LOG_DEBUG("n->user.short_name %s", n->user.short_name);
|
||||
LOG_DEBUG("n->has_position %d", n->has_position);
|
||||
LOG_DEBUG("n->position.latitude_i %d", n->position.latitude_i);
|
||||
LOG_DEBUG("n->position.longitude_i %d", n->position.longitude_i);
|
||||
LOG_DEBUG("---- Current device location information:");
|
||||
LOG_DEBUG("gpsStatus->getLatitude() %d", gpsStatus->getLatitude());
|
||||
LOG_DEBUG("gpsStatus->getLongitude() %d", gpsStatus->getLongitude());
|
||||
LOG_DEBUG("gpsStatus->getHasLock() %d", gpsStatus->getHasLock());
|
||||
LOG_DEBUG("gpsStatus->getDOP() %d", gpsStatus->getDOP());
|
||||
LOG_DEBUG("-----------------------------------------");
|
||||
*/
|
||||
if (!FSBegin()) {
|
||||
LOG_DEBUG("An Error has occurred while mounting the filesystem\n");
|
||||
LOG_DEBUG("An Error has occurred while mounting the filesystem");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
|
||||
LOG_DEBUG("Filesystem doesn't have enough free space. Aborting write.\n");
|
||||
LOG_DEBUG("Filesystem doesn't have enough free space. Aborting write.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -227,16 +227,16 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
|||
File fileToWrite = FSCom.open("/static/rangetest.csv", FILE_WRITE);
|
||||
|
||||
if (!fileToWrite) {
|
||||
LOG_ERROR("There was an error opening the file for writing\n");
|
||||
LOG_ERROR("There was an error opening the file for writing");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Print the CSV header
|
||||
if (fileToWrite.println(
|
||||
"time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload")) {
|
||||
LOG_INFO("File was written\n");
|
||||
LOG_INFO("File was written");
|
||||
} else {
|
||||
LOG_ERROR("File write failed\n");
|
||||
LOG_ERROR("File write failed");
|
||||
}
|
||||
fileToWrite.flush();
|
||||
fileToWrite.close();
|
||||
|
@ -246,7 +246,7 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
|||
File fileToAppend = FSCom.open("/static/rangetest.csv", FILE_APPEND);
|
||||
|
||||
if (!fileToAppend) {
|
||||
LOG_ERROR("There was an error opening the file for appending\n");
|
||||
LOG_ERROR("There was an error opening the file for appending");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &r
|
|||
{
|
||||
if (moduleConfig.remote_hardware.enabled) {
|
||||
auto p = *pptr;
|
||||
LOG_INFO("Received RemoteHardware type=%d\n", p.type);
|
||||
LOG_INFO("Received RemoteHardware type=%d", p.type);
|
||||
|
||||
switch (p.type) {
|
||||
case meshtastic_HardwareMessage_Type_WRITE_GPIOS: {
|
||||
|
@ -122,7 +122,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &r
|
|||
~watchGpios; // generate a 'previous' value which is guaranteed to not match (to force an initial publish)
|
||||
enabled = true; // Let our thread run at least once
|
||||
setInterval(2000); // Set a new interval so we'll run soon
|
||||
LOG_INFO("Now watching GPIOs 0x%llx\n", watchGpios);
|
||||
LOG_INFO("Now watching GPIOs 0x%llx", watchGpios);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &r
|
|||
break; // Ignore - we might see our own replies
|
||||
|
||||
default:
|
||||
LOG_ERROR("Hardware operation %d not yet implemented! FIXME\n", p.type);
|
||||
LOG_ERROR("Hardware operation %d not yet implemented! FIXME", p.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ int32_t RemoteHardwareModule::runOnce()
|
|||
|
||||
if (curVal != previousWatch) {
|
||||
previousWatch = curVal;
|
||||
LOG_INFO("Broadcasting GPIOS 0x%llx changed!\n", curVal);
|
||||
LOG_INFO("Broadcasting GPIOS 0x%llx changed!", curVal);
|
||||
|
||||
// Something changed! Tell the world with a broadcast message
|
||||
meshtastic_HardwareMessage r = meshtastic_HardwareMessage_init_default;
|
||||
|
|
|
@ -12,7 +12,7 @@ meshtastic_MeshPacket *ReplyModule::allocReply()
|
|||
auto req = *currentRequest;
|
||||
auto &p = req.decoded;
|
||||
// The incoming message is in p.payload
|
||||
LOG_INFO("Received message from=0x%0x, id=%d, msg=%.*s\n", req.from, req.id, p.payload.size, p.payload.bytes);
|
||||
LOG_INFO("Received message from=0x%0x, id=%d, msg=%.*s", req.from, req.id, p.payload.size, p.payload.bytes);
|
||||
#endif
|
||||
|
||||
screen->print("Sending reply\n");
|
||||
|
|
|
@ -125,7 +125,7 @@ int32_t SerialModule::runOnce()
|
|||
if (moduleConfig.serial.override_console_serial_port || (moduleConfig.serial.rxd && moduleConfig.serial.txd)) {
|
||||
if (firstTime) {
|
||||
// Interface with the serial peripheral from in here.
|
||||
LOG_INFO("Initializing serial peripheral interface\n");
|
||||
LOG_INFO("Initializing serial peripheral interface");
|
||||
|
||||
uint32_t baud = getBaudRate();
|
||||
|
||||
|
@ -307,7 +307,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const meshtastic_MeshPacket &mp
|
|||
}
|
||||
|
||||
auto &p = mp.decoded;
|
||||
// LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n",
|
||||
// LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s",
|
||||
// nodeDB->getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
|
||||
|
||||
if (!isFromUs(&mp)) {
|
||||
|
@ -322,7 +322,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const meshtastic_MeshPacket &mp
|
|||
// TODO: need to find out why.
|
||||
if (lastRxID != mp.id) {
|
||||
lastRxID = mp.id;
|
||||
// LOG_DEBUG("* * Message came this device\n");
|
||||
// LOG_DEBUG("* * Message came this device");
|
||||
// serialPrint->println("* * Message came this device");
|
||||
serialPrint->printf("%s", p.payload.bytes);
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ void SerialModule::processWXSerial()
|
|||
}
|
||||
if (gotwind) {
|
||||
|
||||
LOG_INFO("WS85 : %i %.1fg%.1f %.1fv %.1fv\n", atoi(windDir), strtof(windVel, nullptr), strtof(windGust, nullptr),
|
||||
LOG_INFO("WS85 : %i %.1fg%.1f %.1fv %.1fv", atoi(windDir), strtof(windVel, nullptr), strtof(windGust, nullptr),
|
||||
batVoltageF, capVoltageF);
|
||||
}
|
||||
if (gotwind && !Throttle::isWithinTimespanMs(lastAveraged, averageIntervalMillis)) {
|
||||
|
@ -542,7 +542,7 @@ void SerialModule::processWXSerial()
|
|||
m.variant.environment_metrics.voltage =
|
||||
capVoltageF > batVoltageF ? capVoltageF : batVoltageF; // send the larger of the two voltage values.
|
||||
|
||||
LOG_INFO("WS85 Transmit speed=%fm/s, direction=%d , lull=%f, gust=%f, voltage=%f\n",
|
||||
LOG_INFO("WS85 Transmit speed=%fm/s, direction=%d , lull=%f, gust=%f, voltage=%f",
|
||||
m.variant.environment_metrics.wind_speed, m.variant.environment_metrics.wind_direction,
|
||||
m.variant.environment_metrics.wind_lull, m.variant.environment_metrics.wind_gust,
|
||||
m.variant.environment_metrics.voltage);
|
||||
|
|
|
@ -46,7 +46,7 @@ int32_t StoreForwardModule::runOnce()
|
|||
} else if (this->heartbeat && (!Throttle::isWithinTimespanMs(lastHeartbeat, heartbeatInterval * 1000)) &&
|
||||
airTime->isTxAllowedChannelUtil(true)) {
|
||||
lastHeartbeat = millis();
|
||||
LOG_INFO("Sending heartbeat\n");
|
||||
LOG_INFO("Sending heartbeat");
|
||||
meshtastic_StoreAndForward sf = meshtastic_StoreAndForward_init_zero;
|
||||
sf.rr = meshtastic_StoreAndForward_RequestResponse_ROUTER_HEARTBEAT;
|
||||
sf.which_variant = meshtastic_StoreAndForward_heartbeat_tag;
|
||||
|
@ -70,7 +70,7 @@ void StoreForwardModule::populatePSRAM()
|
|||
https://learn.upesy.com/en/programmation/psram.html#psram-tab
|
||||
*/
|
||||
|
||||
LOG_DEBUG("Before PSRAM init: heap %d/%d PSRAM %d/%d\n", memGet.getFreeHeap(), memGet.getHeapSize(), memGet.getFreePsram(),
|
||||
LOG_DEBUG("Before PSRAM init: heap %d/%d PSRAM %d/%d", memGet.getFreeHeap(), memGet.getHeapSize(), memGet.getFreePsram(),
|
||||
memGet.getPsramSize());
|
||||
|
||||
/* Use a maximum of 2/3 the available PSRAM unless otherwise specified.
|
||||
|
@ -86,9 +86,9 @@ void StoreForwardModule::populatePSRAM()
|
|||
|
||||
#endif
|
||||
|
||||
LOG_DEBUG("After PSRAM init: heap %d/%d PSRAM %d/%d\n", memGet.getFreeHeap(), memGet.getHeapSize(), memGet.getFreePsram(),
|
||||
LOG_DEBUG("After PSRAM init: heap %d/%d PSRAM %d/%d", memGet.getFreeHeap(), memGet.getHeapSize(), memGet.getFreePsram(),
|
||||
memGet.getPsramSize());
|
||||
LOG_DEBUG("numberOfPackets for packetHistory - %u\n", numberOfPackets);
|
||||
LOG_DEBUG("numberOfPackets for packetHistory - %u", numberOfPackets);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,11 +105,11 @@ void StoreForwardModule::historySend(uint32_t secAgo, uint32_t to)
|
|||
queueSize = this->historyReturnMax;
|
||||
|
||||
if (queueSize) {
|
||||
LOG_INFO("S&F - Sending %u message(s)\n", queueSize);
|
||||
LOG_INFO("S&F - Sending %u message(s)", queueSize);
|
||||
this->busy = true; // runOnce() will pickup the next steps once busy = true.
|
||||
this->busyTo = to;
|
||||
} else {
|
||||
LOG_INFO("S&F - No history\n");
|
||||
LOG_INFO("S&F - No history");
|
||||
}
|
||||
meshtastic_StoreAndForward sf = meshtastic_StoreAndForward_init_zero;
|
||||
sf.rr = meshtastic_StoreAndForward_RequestResponse_ROUTER_HISTORY;
|
||||
|
@ -187,7 +187,7 @@ void StoreForwardModule::historyAdd(const meshtastic_MeshPacket &mp)
|
|||
const auto &p = mp.decoded;
|
||||
|
||||
if (this->packetHistoryTotalCount == this->records) {
|
||||
LOG_WARN("S&F - PSRAM Full. Starting overwrite.\n");
|
||||
LOG_WARN("S&F - PSRAM Full. Starting overwrite.");
|
||||
this->packetHistoryTotalCount = 0;
|
||||
for (auto &i : lastRequest) {
|
||||
i.second = 0; // Clear the last request index for each client device
|
||||
|
@ -215,7 +215,7 @@ bool StoreForwardModule::sendPayload(NodeNum dest, uint32_t last_time)
|
|||
{
|
||||
meshtastic_MeshPacket *p = preparePayload(dest, last_time);
|
||||
if (p) {
|
||||
LOG_INFO("Sending S&F Payload\n");
|
||||
LOG_INFO("Sending S&F Payload");
|
||||
service->sendToMesh(p);
|
||||
this->requestCount++;
|
||||
return true;
|
||||
|
@ -335,7 +335,7 @@ void StoreForwardModule::sendErrorTextMessage(NodeNum dest, bool want_response)
|
|||
} else {
|
||||
str = "S&F not permitted on the public channel.";
|
||||
}
|
||||
LOG_WARN("%s\n", str);
|
||||
LOG_WARN("%s", str);
|
||||
memcpy(pr->decoded.payload.bytes, str, strlen(str));
|
||||
pr->decoded.payload.size = strlen(str);
|
||||
if (want_response) {
|
||||
|
@ -365,7 +365,7 @@ void StoreForwardModule::statsSend(uint32_t to)
|
|||
sf.variant.stats.return_max = this->historyReturnMax;
|
||||
sf.variant.stats.return_window = this->historyReturnWindow;
|
||||
|
||||
LOG_DEBUG("Sending S&F Stats\n");
|
||||
LOG_DEBUG("Sending S&F Stats");
|
||||
storeForwardModule->sendMessage(to, sf);
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &m
|
|||
if ((mp.decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP) && is_server) {
|
||||
auto &p = mp.decoded;
|
||||
if (isToUs(&mp) && (p.payload.bytes[0] == 'S') && (p.payload.bytes[1] == 'F') && (p.payload.bytes[2] == 0x00)) {
|
||||
LOG_DEBUG("Legacy Request to send\n");
|
||||
LOG_DEBUG("Legacy Request to send");
|
||||
|
||||
// Send the last 60 minutes of messages.
|
||||
if (this->busy || channels.isDefaultChannel(mp.channel)) {
|
||||
|
@ -393,7 +393,7 @@ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &m
|
|||
}
|
||||
} else {
|
||||
storeForwardModule->historyAdd(mp);
|
||||
LOG_INFO("S&F stored. Message history contains %u records now.\n", this->packetHistoryTotalCount);
|
||||
LOG_INFO("S&F stored. Message history contains %u records now.", this->packetHistoryTotalCount);
|
||||
}
|
||||
} else if (!isFromUs(&mp) && mp.decoded.portnum == meshtastic_PortNum_STORE_FORWARD_APP) {
|
||||
auto &p = mp.decoded;
|
||||
|
@ -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)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding protobuf module!\n");
|
||||
LOG_ERROR("Error decoding protobuf module!");
|
||||
// if we can't decode it, nobody can process it!
|
||||
return ProcessMessage::STOP;
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
|||
if (is_server) {
|
||||
// stop sending stuff, the client wants to abort or has another error
|
||||
if ((this->busy) && (this->busyTo == getFrom(&mp))) {
|
||||
LOG_ERROR("Client in ERROR or ABORT requested\n");
|
||||
LOG_ERROR("Client in ERROR or ABORT requested");
|
||||
this->requestCount = 0;
|
||||
this->busy = false;
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
|||
case meshtastic_StoreAndForward_RequestResponse_CLIENT_HISTORY:
|
||||
if (is_server) {
|
||||
requests_history++;
|
||||
LOG_INFO("Client Request to send HISTORY\n");
|
||||
LOG_INFO("Client Request to send HISTORY");
|
||||
// Send the last 60 minutes of messages.
|
||||
if (this->busy || channels.isDefaultChannel(mp.channel)) {
|
||||
sendErrorTextMessage(getFrom(&mp), mp.decoded.want_response);
|
||||
|
@ -479,10 +479,10 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
|||
|
||||
case meshtastic_StoreAndForward_RequestResponse_CLIENT_STATS:
|
||||
if (is_server) {
|
||||
LOG_INFO("Client Request to send STATS\n");
|
||||
LOG_INFO("Client Request to send STATS");
|
||||
if (this->busy) {
|
||||
storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY);
|
||||
LOG_INFO("S&F - Busy. Try again shortly.\n");
|
||||
LOG_INFO("S&F - Busy. Try again shortly.");
|
||||
} else {
|
||||
storeForwardModule->statsSend(getFrom(&mp));
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
|||
case meshtastic_StoreAndForward_RequestResponse_ROUTER_ERROR:
|
||||
case meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY:
|
||||
if (is_client) {
|
||||
LOG_DEBUG("StoreAndForward_RequestResponse_ROUTER_BUSY\n");
|
||||
LOG_DEBUG("StoreAndForward_RequestResponse_ROUTER_BUSY");
|
||||
// retry in messages_saved * packetTimeMax ms
|
||||
retry_delay = millis() + getNumAvailablePackets(this->busyTo, this->last_time) * packetTimeMax *
|
||||
(meshtastic_StoreAndForward_RequestResponse_ROUTER_ERROR ? 2 : 1);
|
||||
|
@ -508,7 +508,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
|||
heartbeatInterval = p->variant.heartbeat.period;
|
||||
}
|
||||
lastHeartbeat = millis();
|
||||
LOG_INFO("StoreAndForward Heartbeat received\n");
|
||||
LOG_INFO("StoreAndForward Heartbeat received");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -521,7 +521,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
|||
|
||||
case meshtastic_StoreAndForward_RequestResponse_ROUTER_STATS:
|
||||
if (is_client) {
|
||||
LOG_DEBUG("Router Response STATS\n");
|
||||
LOG_DEBUG("Router Response STATS");
|
||||
// These fields only have informational purpose on a client. Fill them to consume later.
|
||||
if (p->which_variant == meshtastic_StoreAndForward_stats_tag) {
|
||||
this->records = p->variant.stats.messages_max;
|
||||
|
@ -539,7 +539,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
|||
// These fields only have informational purpose on a client. Fill them to consume later.
|
||||
if (p->which_variant == meshtastic_StoreAndForward_history_tag) {
|
||||
this->historyReturnWindow = p->variant.history.window / 60000;
|
||||
LOG_INFO("Router Response HISTORY - Sending %d messages from last %d minutes\n",
|
||||
LOG_INFO("Router Response HISTORY - Sending %d messages from last %d minutes",
|
||||
p->variant.history.history_messages, this->historyReturnWindow);
|
||||
}
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ StoreForwardModule::StoreForwardModule()
|
|||
|
||||
// Router
|
||||
if ((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER || moduleConfig.store_forward.is_server)) {
|
||||
LOG_INFO("Initializing Store & Forward Module in Server mode\n");
|
||||
LOG_INFO("Initializing Store & Forward Module in Server mode");
|
||||
if (memGet.getPsramSize() > 0) {
|
||||
if (memGet.getFreePsram() >= 1024 * 1024) {
|
||||
|
||||
|
@ -601,17 +601,17 @@ StoreForwardModule::StoreForwardModule()
|
|||
this->populatePSRAM();
|
||||
is_server = true;
|
||||
} else {
|
||||
LOG_INFO(".\n");
|
||||
LOG_INFO("S&F: not enough PSRAM free, disabling.\n");
|
||||
LOG_INFO(".");
|
||||
LOG_INFO("S&F: not enough PSRAM free, disabling.");
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("S&F: device doesn't have PSRAM, disabling.\n");
|
||||
LOG_INFO("S&F: device doesn't have PSRAM, disabling.");
|
||||
}
|
||||
|
||||
// Client
|
||||
} else {
|
||||
is_client = true;
|
||||
LOG_INFO("Initializing Store & Forward Module in Client mode\n");
|
||||
LOG_INFO("Initializing Store & Forward Module in Client mode");
|
||||
}
|
||||
} else {
|
||||
disable();
|
||||
|
|
|
@ -33,9 +33,9 @@ int32_t AirQualityTelemetryModule::runOnce()
|
|||
firstTime = false;
|
||||
|
||||
if (moduleConfig.telemetry.air_quality_enabled) {
|
||||
LOG_INFO("Air quality Telemetry: Initializing\n");
|
||||
LOG_INFO("Air quality Telemetry: Initializing");
|
||||
if (!aqi.begin_I2C()) {
|
||||
LOG_WARN("Could not establish i2c connection to AQI sensor. Rescanning...\n");
|
||||
LOG_WARN("Could not establish i2c connection to AQI sensor. Rescanning...");
|
||||
// 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_asize = 1;
|
||||
|
@ -84,11 +84,11 @@ bool AirQualityTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPack
|
|||
#ifdef DEBUG_PORT
|
||||
const char *sender = getSenderShortName(mp);
|
||||
|
||||
LOG_INFO("(Received from %s): pm10_standard=%i, pm25_standard=%i, pm100_standard=%i\n", sender,
|
||||
LOG_INFO("(Received from %s): pm10_standard=%i, pm25_standard=%i, pm100_standard=%i", sender,
|
||||
t->variant.air_quality_metrics.pm10_standard, t->variant.air_quality_metrics.pm25_standard,
|
||||
t->variant.air_quality_metrics.pm100_standard);
|
||||
|
||||
LOG_INFO(" | PM1.0(Environmental)=%i, PM2.5(Environmental)=%i, PM10.0(Environmental)=%i\n",
|
||||
LOG_INFO(" | PM1.0(Environmental)=%i, PM2.5(Environmental)=%i, PM10.0(Environmental)=%i",
|
||||
t->variant.air_quality_metrics.pm10_environmental, t->variant.air_quality_metrics.pm25_environmental,
|
||||
t->variant.air_quality_metrics.pm100_environmental);
|
||||
#endif
|
||||
|
@ -105,7 +105,7 @@ bool AirQualityTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPack
|
|||
bool AirQualityTelemetryModule::getAirQualityTelemetry(meshtastic_Telemetry *m)
|
||||
{
|
||||
if (!aqi.read(&data)) {
|
||||
LOG_WARN("Skipping send measurements. Could not read AQIn\n");
|
||||
LOG_WARN("Skipping send measurements. Could not read AQIn");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -119,11 +119,11 @@ bool AirQualityTelemetryModule::getAirQualityTelemetry(meshtastic_Telemetry *m)
|
|||
m->variant.air_quality_metrics.pm25_environmental = data.pm25_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\n",
|
||||
LOG_INFO("(Sending): PM1.0(Standard)=%i, PM2.5(Standard)=%i, PM10.0(Standard)=%i",
|
||||
m->variant.air_quality_metrics.pm10_standard, m->variant.air_quality_metrics.pm25_standard,
|
||||
m->variant.air_quality_metrics.pm100_standard);
|
||||
|
||||
LOG_INFO(" | PM1.0(Environmental)=%i, PM2.5(Environmental)=%i, PM10.0(Environmental)=%i\n",
|
||||
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.pm100_environmental);
|
||||
|
||||
|
@ -141,14 +141,14 @@ meshtastic_MeshPacket *AirQualityTelemetryModule::allocReply()
|
|||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding AirQualityTelemetry module!\n");
|
||||
LOG_ERROR("Error decoding AirQualityTelemetry module!");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for air quality metrics
|
||||
if (decoded->which_variant == meshtastic_Telemetry_air_quality_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getAirQualityTelemetry(&m)) {
|
||||
LOG_INFO("Air quality telemetry replying to request\n");
|
||||
LOG_INFO("Air quality telemetry replying to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -176,10 +176,10 @@ bool AirQualityTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
|
||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||
if (phoneOnly) {
|
||||
LOG_INFO("Sending packet to phone\n");
|
||||
LOG_INFO("Sending packet to phone");
|
||||
service->sendToPhone(p);
|
||||
} else {
|
||||
LOG_INFO("Sending packet to mesh\n");
|
||||
LOG_INFO("Sending packet to mesh");
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -51,7 +51,7 @@ bool DeviceTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
|
|||
#ifdef DEBUG_PORT
|
||||
const char *sender = getSenderShortName(mp);
|
||||
|
||||
LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n", sender,
|
||||
LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f", sender,
|
||||
t->variant.device_metrics.air_util_tx, t->variant.device_metrics.channel_utilization,
|
||||
t->variant.device_metrics.battery_level, t->variant.device_metrics.voltage);
|
||||
#endif
|
||||
|
@ -71,12 +71,12 @@ meshtastic_MeshPacket *DeviceTelemetryModule::allocReply()
|
|||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding DeviceTelemetry module!\n");
|
||||
LOG_ERROR("Error decoding DeviceTelemetry module!");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for device metrics
|
||||
if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) {
|
||||
LOG_INFO("Device telemetry replying to request\n");
|
||||
LOG_INFO("Device telemetry replying to request");
|
||||
|
||||
meshtastic_Telemetry telemetry = getDeviceTelemetry();
|
||||
return allocDataProtobuf(telemetry);
|
||||
|
@ -134,13 +134,12 @@ void DeviceTelemetryModule::sendLocalStatsToPhone()
|
|||
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\n",
|
||||
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.num_total_nodes);
|
||||
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.air_util_tx, telemetry.variant.local_stats.num_online_nodes,
|
||||
telemetry.variant.local_stats.num_total_nodes);
|
||||
|
||||
LOG_INFO("num_packets_tx=%i, num_packets_rx=%i, num_packets_rx_bad=%i\n", telemetry.variant.local_stats.num_packets_tx,
|
||||
LOG_INFO("num_packets_tx=%i, num_packets_rx=%i, num_packets_rx_bad=%i", telemetry.variant.local_stats.num_packets_tx,
|
||||
telemetry.variant.local_stats.num_packets_rx, telemetry.variant.local_stats.num_packets_rx_bad);
|
||||
|
||||
meshtastic_MeshPacket *p = allocDataProtobuf(telemetry);
|
||||
|
@ -154,7 +153,7 @@ void DeviceTelemetryModule::sendLocalStatsToPhone()
|
|||
bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
{
|
||||
meshtastic_Telemetry telemetry = getDeviceTelemetry();
|
||||
LOG_INFO("(Sending): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f, uptime=%i\n",
|
||||
LOG_INFO("(Sending): 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.battery_level, telemetry.variant.device_metrics.voltage,
|
||||
telemetry.variant.device_metrics.uptime_seconds);
|
||||
|
@ -166,10 +165,10 @@ bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
|
||||
nodeDB->updateTelemetry(nodeDB->getNodeNum(), telemetry, RX_SRC_LOCAL);
|
||||
if (phoneOnly) {
|
||||
LOG_INFO("Sending packet to phone\n");
|
||||
LOG_INFO("Sending packet to phone");
|
||||
service->sendToPhone(p);
|
||||
} else {
|
||||
LOG_INFO("Sending packet to mesh\n");
|
||||
LOG_INFO("Sending packet to mesh");
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -73,7 +73,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.\n", nightyNightMs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||
firstTime = 0;
|
||||
|
||||
if (moduleConfig.telemetry.environment_measurement_enabled) {
|
||||
LOG_INFO("Environment Telemetry: Initializing\n");
|
||||
LOG_INFO("Environment Telemetry: Initializing");
|
||||
// it's possible to have this module enabled, only for displaying values on the screen.
|
||||
// therefore, we should only enable the sensor loop if measurement is also enabled
|
||||
#ifdef T1000X_SENSOR_EN
|
||||
|
@ -252,14 +252,14 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPac
|
|||
const char *sender = getSenderShortName(mp);
|
||||
|
||||
LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, "
|
||||
"temperature=%f\n",
|
||||
"temperature=%f",
|
||||
sender, t->variant.environment_metrics.barometric_pressure, t->variant.environment_metrics.current,
|
||||
t->variant.environment_metrics.gas_resistance, t->variant.environment_metrics.relative_humidity,
|
||||
t->variant.environment_metrics.temperature);
|
||||
LOG_INFO("(Received from %s): voltage=%f, IAQ=%d, distance=%f, lux=%f\n", sender, t->variant.environment_metrics.voltage,
|
||||
LOG_INFO("(Received from %s): voltage=%f, IAQ=%d, distance=%f, lux=%f", sender, t->variant.environment_metrics.voltage,
|
||||
t->variant.environment_metrics.iaq, t->variant.environment_metrics.distance, t->variant.environment_metrics.lux);
|
||||
|
||||
LOG_INFO("(Received from %s): wind speed=%fm/s, direction=%d degrees, weight=%fkg\n", sender,
|
||||
LOG_INFO("(Received from %s): wind speed=%fm/s, direction=%d degrees, weight=%fkg", sender,
|
||||
t->variant.environment_metrics.wind_speed, t->variant.environment_metrics.wind_direction,
|
||||
t->variant.environment_metrics.weight);
|
||||
|
||||
|
@ -373,13 +373,13 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m
|
|||
} else if (bmp280Sensor.hasSensor()) {
|
||||
// prefer bmp280 temp if both sensors are present, fetch only humidity
|
||||
meshtastic_Telemetry m_ahtx = meshtastic_Telemetry_init_zero;
|
||||
LOG_INFO("AHTX0+BMP280 module detected: using temp from BMP280 and humy from AHTX0\n");
|
||||
LOG_INFO("AHTX0+BMP280 module detected: using temp from BMP280 and humy from AHTX0");
|
||||
aht10Sensor.getMetrics(&m_ahtx);
|
||||
m->variant.environment_metrics.relative_humidity = m_ahtx.variant.environment_metrics.relative_humidity;
|
||||
} else {
|
||||
// prefer bmp3xx temp if both sensors are present, fetch only humidity
|
||||
meshtastic_Telemetry m_ahtx = meshtastic_Telemetry_init_zero;
|
||||
LOG_INFO("AHTX0+BMP3XX module detected: using temp from BMP3XX and humy from AHTX0\n");
|
||||
LOG_INFO("AHTX0+BMP3XX module detected: using temp from BMP3XX and humy from AHTX0");
|
||||
aht10Sensor.getMetrics(&m_ahtx);
|
||||
m->variant.environment_metrics.relative_humidity = m_ahtx.variant.environment_metrics.relative_humidity;
|
||||
}
|
||||
|
@ -404,14 +404,14 @@ meshtastic_MeshPacket *EnvironmentTelemetryModule::allocReply()
|
|||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding EnvironmentTelemetry module!\n");
|
||||
LOG_ERROR("Error decoding EnvironmentTelemetry module!");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for environment metrics
|
||||
if (decoded->which_variant == meshtastic_Telemetry_environment_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getEnvironmentTelemetry(&m)) {
|
||||
LOG_INFO("Environment telemetry replying to request\n");
|
||||
LOG_INFO("Environment telemetry replying to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -431,14 +431,14 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
#else
|
||||
if (getEnvironmentTelemetry(&m)) {
|
||||
#endif
|
||||
LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f\n",
|
||||
LOG_INFO("(Sending): 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.gas_resistance, m.variant.environment_metrics.relative_humidity,
|
||||
m.variant.environment_metrics.temperature);
|
||||
LOG_INFO("(Sending): voltage=%f, IAQ=%d, distance=%f, lux=%f\n", m.variant.environment_metrics.voltage,
|
||||
LOG_INFO("(Sending): 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);
|
||||
|
||||
LOG_INFO("(Sending): wind speed=%fm/s, direction=%d degrees, weight=%fkg\n", m.variant.environment_metrics.wind_speed,
|
||||
LOG_INFO("(Sending): 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);
|
||||
|
||||
sensor_read_error_count = 0;
|
||||
|
@ -456,14 +456,14 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
|
||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||
if (phoneOnly) {
|
||||
LOG_INFO("Sending packet to phone\n");
|
||||
LOG_INFO("Sending packet to phone");
|
||||
service->sendToPhone(p);
|
||||
} else {
|
||||
LOG_INFO("Sending packet to mesh\n");
|
||||
LOG_INFO("Sending packet to mesh");
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
||||
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep.\n");
|
||||
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep.");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ int32_t HealthTelemetryModule::runOnce()
|
|||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.health_update_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.\n", nightyNightMs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ int32_t HealthTelemetryModule::runOnce()
|
|||
firstTime = false;
|
||||
|
||||
if (moduleConfig.telemetry.health_measurement_enabled) {
|
||||
LOG_INFO("Health Telemetry: Initializing\n");
|
||||
LOG_INFO("Health Telemetry: Initializing");
|
||||
// Initialize sensors
|
||||
if (mlx90614Sensor.hasSensor())
|
||||
result = mlx90614Sensor.runOnce();
|
||||
|
@ -143,7 +143,7 @@ bool HealthTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
|
|||
#ifdef DEBUG_PORT
|
||||
const char *sender = getSenderShortName(mp);
|
||||
|
||||
LOG_INFO("(Received from %s): temperature=%f, heart_bpm=%d, spO2=%d,\n", sender, t->variant.health_metrics.temperature,
|
||||
LOG_INFO("(Received from %s): temperature=%f, heart_bpm=%d, spO2=%d,", sender, t->variant.health_metrics.temperature,
|
||||
t->variant.health_metrics.heart_bpm, t->variant.health_metrics.spO2);
|
||||
|
||||
#endif
|
||||
|
@ -188,14 +188,14 @@ meshtastic_MeshPacket *HealthTelemetryModule::allocReply()
|
|||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding HealthTelemetry module!\n");
|
||||
LOG_ERROR("Error decoding HealthTelemetry module!");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for health metrics
|
||||
if (decoded->which_variant == meshtastic_Telemetry_health_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getHealthTelemetry(&m)) {
|
||||
LOG_INFO("Health telemetry replying to request\n");
|
||||
LOG_INFO("Health telemetry replying to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -211,7 +211,7 @@ bool HealthTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
m.which_variant = meshtastic_Telemetry_health_metrics_tag;
|
||||
m.time = getTime();
|
||||
if (getHealthTelemetry(&m)) {
|
||||
LOG_INFO("(Sending): temperature=%f, heart_bpm=%d, spO2=%d\n", m.variant.health_metrics.temperature,
|
||||
LOG_INFO("(Sending): temperature=%f, heart_bpm=%d, spO2=%d", m.variant.health_metrics.temperature,
|
||||
m.variant.health_metrics.heart_bpm, m.variant.health_metrics.spO2);
|
||||
|
||||
sensor_read_error_count = 0;
|
||||
|
@ -229,14 +229,14 @@ bool HealthTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
|
||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||
if (phoneOnly) {
|
||||
LOG_INFO("Sending packet to phone\n");
|
||||
LOG_INFO("Sending packet to phone");
|
||||
service->sendToPhone(p);
|
||||
} else {
|
||||
LOG_INFO("Sending packet to mesh\n");
|
||||
LOG_INFO("Sending packet to mesh");
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
||||
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep.\n");
|
||||
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep.");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ int32_t PowerTelemetryModule::runOnce()
|
|||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.power_update_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.\n", nightyNightMs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ int32_t PowerTelemetryModule::runOnce()
|
|||
firstTime = 0;
|
||||
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
||||
if (moduleConfig.telemetry.power_measurement_enabled) {
|
||||
LOG_INFO("Power Telemetry: Initializing\n");
|
||||
LOG_INFO("Power Telemetry: Initializing");
|
||||
// it's possible to have this module enabled, only for displaying values on the screen.
|
||||
// therefore, we should only enable the sensor loop if measurement is also enabled
|
||||
if (ina219Sensor.hasSensor() && !ina219Sensor.isInitialized())
|
||||
|
@ -145,7 +145,7 @@ bool PowerTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &m
|
|||
const char *sender = getSenderShortName(mp);
|
||||
|
||||
LOG_INFO("(Received from %s): ch1_voltage=%.1f, ch1_current=%.1f, ch2_voltage=%.1f, ch2_current=%.1f, "
|
||||
"ch3_voltage=%.1f, ch3_current=%.1f\n",
|
||||
"ch3_voltage=%.1f, ch3_current=%.1f",
|
||||
sender, t->variant.power_metrics.ch1_voltage, t->variant.power_metrics.ch1_current,
|
||||
t->variant.power_metrics.ch2_voltage, t->variant.power_metrics.ch2_current, t->variant.power_metrics.ch3_voltage,
|
||||
t->variant.power_metrics.ch3_current);
|
||||
|
@ -192,14 +192,14 @@ meshtastic_MeshPacket *PowerTelemetryModule::allocReply()
|
|||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding PowerTelemetry module!\n");
|
||||
LOG_ERROR("Error decoding PowerTelemetry module!");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for power metrics
|
||||
if (decoded->which_variant == meshtastic_Telemetry_power_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getPowerTelemetry(&m)) {
|
||||
LOG_INFO("Power telemetry replying to request\n");
|
||||
LOG_INFO("Power telemetry replying to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -217,7 +217,7 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
m.time = getTime();
|
||||
if (getPowerTelemetry(&m)) {
|
||||
LOG_INFO("(Sending): ch1_voltage=%f, ch1_current=%f, ch2_voltage=%f, ch2_current=%f, "
|
||||
"ch3_voltage=%f, ch3_current=%f\n",
|
||||
"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.ch2_current, m.variant.power_metrics.ch3_voltage, m.variant.power_metrics.ch3_current);
|
||||
|
||||
|
@ -236,14 +236,14 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||
|
||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||
if (phoneOnly) {
|
||||
LOG_INFO("Sending packet to phone\n");
|
||||
LOG_INFO("Sending packet to phone");
|
||||
service->sendToPhone(p);
|
||||
} else {
|
||||
LOG_INFO("Sending packet to mesh\n");
|
||||
LOG_INFO("Sending packet to mesh");
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
||||
LOG_DEBUG("Starting next execution in 5s then going to sleep.\n");
|
||||
LOG_DEBUG("Starting next execution in 5s then going to sleep.");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ AHT10Sensor::AHT10Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_AHT1
|
|||
|
||||
int32_t AHT10Sensor::runOnce()
|
||||
{
|
||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||
LOG_INFO("Init sensor: %s", sensorName);
|
||||
if (!hasSensor()) {
|
||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ void AHT10Sensor::setup() {}
|
|||
|
||||
bool AHT10Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
LOG_DEBUG("AHT10Sensor::getMetrics\n");
|
||||
LOG_DEBUG("AHT10Sensor::getMetrics");
|
||||
|
||||
sensors_event_t humidity, temp;
|
||||
aht10.getEvent(&humidity, &temp);
|
||||
|
|
|
@ -12,7 +12,7 @@ BME280Sensor::BME280Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BM
|
|||
|
||||
int32_t BME280Sensor::runOnce()
|
||||
{
|
||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||
LOG_INFO("Init sensor: %s", sensorName);
|
||||
if (!hasSensor()) {
|
||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ bool BME280Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
measurement->variant.environment_metrics.has_relative_humidity = true;
|
||||
measurement->variant.environment_metrics.has_barometric_pressure = true;
|
||||
|
||||
LOG_DEBUG("BME280Sensor::getMetrics\n");
|
||||
LOG_DEBUG("BME280Sensor::getMetrics");
|
||||
bme280.takeForcedMeasurement();
|
||||
measurement->variant.environment_metrics.temperature = bme280.readTemperature();
|
||||
measurement->variant.environment_metrics.relative_humidity = bme280.readHumidity();
|
||||
|
|
|
@ -37,13 +37,13 @@ int32_t BME680Sensor::runOnce()
|
|||
checkStatus("updateSubscription");
|
||||
status = 0;
|
||||
}
|
||||
LOG_INFO("Init sensor: %s with the BSEC Library version %d.%d.%d.%d \n", sensorName, bme680.version.major,
|
||||
LOG_INFO("Init sensor: %s with the BSEC Library version %d.%d.%d.%d ", sensorName, bme680.version.major,
|
||||
bme680.version.minor, bme680.version.major_bugfix, bme680.version.minor_bugfix);
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
if (status == 0)
|
||||
LOG_DEBUG("BME680Sensor::runOnce: bme680.status %d\n", bme680.status);
|
||||
LOG_DEBUG("BME680Sensor::runOnce: bme680.status %d", bme680.status);
|
||||
|
||||
return initI2CSensor();
|
||||
}
|
||||
|
@ -80,12 +80,12 @@ void BME680Sensor::loadState()
|
|||
file.read((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE);
|
||||
file.close();
|
||||
bme680.setState(bsecState);
|
||||
LOG_INFO("%s state read from %s.\n", sensorName, bsecConfigFileName);
|
||||
LOG_INFO("%s state read from %s.", sensorName, bsecConfigFileName);
|
||||
} else {
|
||||
LOG_INFO("No %s state found (File: %s).\n", sensorName, bsecConfigFileName);
|
||||
LOG_INFO("No %s state found (File: %s).", sensorName, bsecConfigFileName);
|
||||
}
|
||||
#else
|
||||
LOG_ERROR("ERROR: Filesystem not implemented\n");
|
||||
LOG_ERROR("ERROR: Filesystem not implemented");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -97,16 +97,16 @@ void BME680Sensor::updateState()
|
|||
/* First state update when IAQ accuracy is >= 3 */
|
||||
accuracy = bme680.getData(BSEC_OUTPUT_IAQ).accuracy;
|
||||
if (accuracy >= 2) {
|
||||
LOG_DEBUG("%s state update IAQ accuracy %u >= 2\n", sensorName, accuracy);
|
||||
LOG_DEBUG("%s state update IAQ accuracy %u >= 2", sensorName, accuracy);
|
||||
update = true;
|
||||
stateUpdateCounter++;
|
||||
} else {
|
||||
LOG_DEBUG("%s not updated, IAQ accuracy is %u < 2\n", sensorName, accuracy);
|
||||
LOG_DEBUG("%s not updated, IAQ accuracy is %u < 2", sensorName, accuracy);
|
||||
}
|
||||
} else {
|
||||
/* Update every STATE_SAVE_PERIOD minutes */
|
||||
if ((stateUpdateCounter * STATE_SAVE_PERIOD) < millis()) {
|
||||
LOG_DEBUG("%s state update every %d minutes\n", sensorName, STATE_SAVE_PERIOD / 60000);
|
||||
LOG_DEBUG("%s state update every %d minutes", sensorName, STATE_SAVE_PERIOD / 60000);
|
||||
update = true;
|
||||
stateUpdateCounter++;
|
||||
}
|
||||
|
@ -115,34 +115,34 @@ void BME680Sensor::updateState()
|
|||
if (update) {
|
||||
bme680.getState(bsecState);
|
||||
if (FSCom.exists(bsecConfigFileName) && !FSCom.remove(bsecConfigFileName)) {
|
||||
LOG_WARN("Can't remove old state file\n");
|
||||
LOG_WARN("Can't remove old state file");
|
||||
}
|
||||
auto file = FSCom.open(bsecConfigFileName, FILE_O_WRITE);
|
||||
if (file) {
|
||||
LOG_INFO("%s state write to %s.\n", sensorName, bsecConfigFileName);
|
||||
LOG_INFO("%s state write to %s.", sensorName, bsecConfigFileName);
|
||||
file.write((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE);
|
||||
file.flush();
|
||||
file.close();
|
||||
} else {
|
||||
LOG_INFO("Can't write %s state (File: %s).\n", sensorName, bsecConfigFileName);
|
||||
LOG_INFO("Can't write %s state (File: %s).", sensorName, bsecConfigFileName);
|
||||
}
|
||||
}
|
||||
#else
|
||||
LOG_ERROR("ERROR: Filesystem not implemented\n");
|
||||
LOG_ERROR("ERROR: Filesystem not implemented");
|
||||
#endif
|
||||
}
|
||||
|
||||
void BME680Sensor::checkStatus(String functionName)
|
||||
{
|
||||
if (bme680.status < BSEC_OK)
|
||||
LOG_ERROR("%s BSEC2 code: %s\n", functionName.c_str(), String(bme680.status).c_str());
|
||||
LOG_ERROR("%s BSEC2 code: %s", functionName.c_str(), String(bme680.status).c_str());
|
||||
else if (bme680.status > BSEC_OK)
|
||||
LOG_WARN("%s BSEC2 code: %s\n", functionName.c_str(), String(bme680.status).c_str());
|
||||
LOG_WARN("%s BSEC2 code: %s", functionName.c_str(), String(bme680.status).c_str());
|
||||
|
||||
if (bme680.sensor.status < BME68X_OK)
|
||||
LOG_ERROR("%s BME68X code: %s\n", functionName.c_str(), String(bme680.sensor.status).c_str());
|
||||
LOG_ERROR("%s BME68X code: %s", functionName.c_str(), String(bme680.sensor.status).c_str());
|
||||
else if (bme680.sensor.status > BME68X_OK)
|
||||
LOG_WARN("%s BME68X code: %s\n", functionName.c_str(), String(bme680.sensor.status).c_str());
|
||||
LOG_WARN("%s BME68X code: %s", functionName.c_str(), String(bme680.sensor.status).c_str());
|
||||
}
|
||||
|
||||
#endif
|
|
@ -12,7 +12,7 @@ BMP085Sensor::BMP085Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BM
|
|||
|
||||
int32_t BMP085Sensor::runOnce()
|
||||
{
|
||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||
LOG_INFO("Init sensor: %s", sensorName);
|
||||
if (!hasSensor()) {
|
||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ bool BMP085Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
measurement->variant.environment_metrics.has_temperature = true;
|
||||
measurement->variant.environment_metrics.has_barometric_pressure = true;
|
||||
|
||||
LOG_DEBUG("BMP085Sensor::getMetrics\n");
|
||||
LOG_DEBUG("BMP085Sensor::getMetrics");
|
||||
measurement->variant.environment_metrics.temperature = bmp085.readTemperature();
|
||||
measurement->variant.environment_metrics.barometric_pressure = bmp085.readPressure() / 100.0F;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ BMP280Sensor::BMP280Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BM
|
|||
|
||||
int32_t BMP280Sensor::runOnce()
|
||||
{
|
||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||
LOG_INFO("Init sensor: %s", sensorName);
|
||||
if (!hasSensor()) {
|
||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ bool BMP280Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||
measurement->variant.environment_metrics.has_temperature = true;
|
||||
measurement->variant.environment_metrics.has_barometric_pressure = true;
|
||||
|
||||
LOG_DEBUG("BMP280Sensor::getMetrics\n");
|
||||
LOG_DEBUG("BMP280Sensor::getMetrics");
|
||||
bmp280.takeForcedMeasurement();
|
||||
measurement->variant.environment_metrics.temperature = bmp280.readTemperature();
|
||||
measurement->variant.environment_metrics.barometric_pressure = bmp280.readPressure() / 100.0F;
|
||||
|
|
|
@ -10,7 +10,7 @@ void BMP3XXSensor::setup() {}
|
|||
|
||||
int32_t BMP3XXSensor::runOnce()
|
||||
{
|
||||
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||
LOG_INFO("Init sensor: %s", sensorName);
|
||||
if (!hasSensor()) {
|
||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||
}
|
||||
|
@ -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.relative_humidity = 0.0f;
|
||||
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i temp: %.1f press %.1f\n", measurement->which_variant,
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i temp: %.1f press %.1f", measurement->which_variant,
|
||||
measurement->variant.environment_metrics.temperature,
|
||||
measurement->variant.environment_metrics.barometric_pressure);
|
||||
} else {
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i\n", measurement->which_variant);
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i", measurement->which_variant);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue