Replaced all of the logging with proper log levels

This commit is contained in:
Ben Meadors
2022-12-30 10:27:07 -06:00
parent 8193215294
commit f1cdfd163d
68 changed files with 519 additions and 524 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ class ButtonThread : public concurrency::OSThread
// may wake the board immediatedly. // may wake the board immediatedly.
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) { if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
screen->startShutdownScreen(); screen->startShutdownScreen();
LOG_DEBUG("Shutdown from long press"); LOG_INFO("Shutdown from long press");
playBeep(); playBeep();
#ifdef PIN_LED1 #ifdef PIN_LED1
ledOff(PIN_LED1); ledOff(PIN_LED1);
+3 -3
View File
@@ -21,13 +21,13 @@ bool copyFile(const char* from, const char* to)
File f1 = FSCom.open(from, FILE_O_READ); File f1 = FSCom.open(from, FILE_O_READ);
if (!f1){ if (!f1){
LOG_DEBUG("Failed to open source file %s\n", from); LOG_ERROR("Failed to open source file %s\n", from);
return false; return false;
} }
File f2 = FSCom.open(to, FILE_O_WRITE); File f2 = FSCom.open(to, FILE_O_WRITE);
if (!f2) { if (!f2) {
LOG_DEBUG("Failed to open destination file %s\n", to); LOG_ERROR("Failed to open destination file %s\n", to);
return false; return false;
} }
@@ -170,7 +170,7 @@ void fsInit()
#ifdef FSCom #ifdef FSCom
if (!FSBegin()) if (!FSBegin())
{ {
LOG_DEBUG("ERROR filesystem mount Failed. Formatting...\n"); LOG_ERROR("Filesystem mount Failed. Formatting...\n");
assert(0); // FIXME - report failure to phone assert(0); // FIXME - report failure to phone
} }
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
+1 -1
View File
@@ -114,7 +114,7 @@ class GPSStatus : public Status
if (isDirty && p.timestamp && (newStatus->p.timestamp == p.timestamp)) { if (isDirty && p.timestamp && (newStatus->p.timestamp == p.timestamp)) {
// We can NEVER be in two locations at the same time! (also PR #886) // We can NEVER be in two locations at the same time! (also PR #886)
LOG_DEBUG("BUG!! positional timestamp unchanged from prev solution\n"); LOG_ERROR("BUG: Positional timestamp unchanged from prev solution\n");
} }
initialized = true; initialized = true;
+5 -5
View File
@@ -242,7 +242,7 @@ void Power::shutdown()
#endif #endif
#ifdef HAS_PMU #ifdef HAS_PMU
LOG_DEBUG("Shutting down\n"); LOG_INFO("Shutting down\n");
if(PMU) { if(PMU) {
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF); PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
PMU->shutdown(); PMU->shutdown();
@@ -333,12 +333,12 @@ int32_t Power::runOnce()
PMU->getIrqStatus(); PMU->getIrqStatus();
if(PMU->isVbusRemoveIrq()){ if(PMU->isVbusRemoveIrq()){
LOG_DEBUG("USB unplugged\n"); LOG_INFO("USB unplugged\n");
powerFSM.trigger(EVENT_POWER_DISCONNECTED); powerFSM.trigger(EVENT_POWER_DISCONNECTED);
} }
if (PMU->isVbusInsertIrq()) { if (PMU->isVbusInsertIrq()) {
LOG_DEBUG("USB plugged In\n"); LOG_INFO("USB plugged In\n");
powerFSM.trigger(EVENT_POWER_CONNECTED); powerFSM.trigger(EVENT_POWER_CONNECTED);
} }
@@ -405,7 +405,7 @@ bool Power::axpChipInit()
delete PMU; delete PMU;
PMU = NULL; PMU = NULL;
} else { } else {
LOG_DEBUG("AXP2101 PMU init succeeded, using AXP2101 PMU\n"); LOG_INFO("AXP2101 PMU init succeeded, using AXP2101 PMU\n");
} }
} }
@@ -416,7 +416,7 @@ bool Power::axpChipInit()
delete PMU; delete PMU;
PMU = NULL; PMU = NULL;
} else { } else {
LOG_DEBUG("AXP192 PMU init succeeded, using AXP192 PMU\n"); LOG_INFO("AXP192 PMU init succeeded, using AXP192 PMU\n");
} }
} }
+17 -17
View File
@@ -32,7 +32,7 @@ static bool isPowered()
static void sdsEnter() static void sdsEnter()
{ {
LOG_DEBUG("Enter state: SDS\n"); LOG_INFO("Enter state: SDS\n");
// FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw // FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw
doDeepSleep(getConfiguredOrDefaultMs(config.power.sds_secs)); doDeepSleep(getConfiguredOrDefaultMs(config.power.sds_secs));
} }
@@ -41,7 +41,7 @@ extern Power *power;
static void shutdownEnter() static void shutdownEnter()
{ {
LOG_DEBUG("Enter state: SHUTDOWN\n"); LOG_INFO("Enter state: SHUTDOWN\n");
power->shutdown(); power->shutdown();
} }
@@ -51,16 +51,16 @@ static uint32_t secsSlept;
static void lsEnter() static void lsEnter()
{ {
LOG_DEBUG("lsEnter begin, ls_secs=%u\n", config.power.ls_secs); LOG_INFO("lsEnter begin, ls_secs=%u\n", config.power.ls_secs);
screen->setOn(false); screen->setOn(false);
secsSlept = 0; // How long have we been sleeping this time secsSlept = 0; // How long have we been sleeping this time
// LOG_DEBUG("lsEnter end\n"); // LOG_INFO("lsEnter end\n");
} }
static void lsIdle() static void lsIdle()
{ {
// LOG_DEBUG("lsIdle begin ls_secs=%u\n", getPref_ls_secs()); // LOG_INFO("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
@@ -82,7 +82,7 @@ static void lsIdle()
wakeCause2 = doLightSleep(1); // leave led on for 1ms wakeCause2 = doLightSleep(1); // leave led on for 1ms
secsSlept += sleepTime; secsSlept += sleepTime;
// LOG_DEBUG("sleeping, flash led!\n"); // LOG_INFO("sleeping, flash led!\n");
break; break;
case ESP_SLEEP_WAKEUP_UART: case ESP_SLEEP_WAKEUP_UART:
@@ -93,7 +93,7 @@ static void lsIdle()
default: default:
// We woke for some other reason (button press, device interrupt) // We woke for some other reason (button press, device interrupt)
// uint64_t status = esp_sleep_get_ext1_wakeup_status(); // uint64_t status = esp_sleep_get_ext1_wakeup_status();
LOG_DEBUG("wakeCause2 %d\n", wakeCause2); LOG_INFO("wakeCause2 %d\n", wakeCause2);
#ifdef BUTTON_PIN #ifdef BUTTON_PIN
bool pressed = !digitalRead(BUTTON_PIN); bool pressed = !digitalRead(BUTTON_PIN);
@@ -117,7 +117,7 @@ static void lsIdle()
} else { } else {
// Time to stop sleeping! // Time to stop sleeping!
setLed(false); setLed(false);
LOG_DEBUG("reached ls_secs, servicing loop()\n"); LOG_INFO("Reached ls_secs, servicing loop()\n");
powerFSM.trigger(EVENT_WAKE_TIMER); powerFSM.trigger(EVENT_WAKE_TIMER);
} }
#endif #endif
@@ -125,7 +125,7 @@ static void lsIdle()
static void lsExit() static void lsExit()
{ {
LOG_DEBUG("Exit state: LS\n"); LOG_INFO("Exit state: LS\n");
// setGPSPower(true); // restore GPS power // setGPSPower(true); // restore GPS power
if (gps) if (gps)
gps->forceWake(true); gps->forceWake(true);
@@ -133,7 +133,7 @@ static void lsExit()
static void nbEnter() static void nbEnter()
{ {
LOG_DEBUG("Enter state: NB\n"); LOG_INFO("Enter state: NB\n");
screen->setOn(false); screen->setOn(false);
setBluetoothEnable(false); setBluetoothEnable(false);
@@ -148,7 +148,7 @@ static void darkEnter()
static void serialEnter() static void serialEnter()
{ {
LOG_DEBUG("Enter state: SERIAL\n"); LOG_INFO("Enter state: SERIAL\n");
setBluetoothEnable(false); setBluetoothEnable(false);
screen->setOn(true); screen->setOn(true);
screen->print("Serial connected\n"); screen->print("Serial connected\n");
@@ -161,10 +161,10 @@ static void serialExit()
static void powerEnter() static void powerEnter()
{ {
LOG_DEBUG("Enter state: POWER\n"); LOG_INFO("Enter state: POWER\n");
if (!isPowered()) { if (!isPowered()) {
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things // If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
LOG_DEBUG("Loss of power in Powered\n"); LOG_INFO("Loss of power in Powered\n");
powerFSM.trigger(EVENT_POWER_DISCONNECTED); powerFSM.trigger(EVENT_POWER_DISCONNECTED);
} else { } else {
screen->setOn(true); screen->setOn(true);
@@ -177,7 +177,7 @@ static void powerIdle()
{ {
if (!isPowered()) { if (!isPowered()) {
// If we got here, we are in the wrong state // If we got here, we are in the wrong state
LOG_DEBUG("Loss of power in Powered\n"); LOG_INFO("Loss of power in Powered\n");
powerFSM.trigger(EVENT_POWER_DISCONNECTED); powerFSM.trigger(EVENT_POWER_DISCONNECTED);
} }
} }
@@ -191,7 +191,7 @@ static void powerExit()
static void onEnter() static void onEnter()
{ {
LOG_DEBUG("Enter state: ON\n"); LOG_INFO("Enter state: ON\n");
screen->setOn(true); screen->setOn(true);
setBluetoothEnable(true); setBluetoothEnable(true);
@@ -221,7 +221,7 @@ static void screenPress()
static void bootEnter() static void bootEnter()
{ {
LOG_DEBUG("Enter state: BOOT\n"); LOG_INFO("Enter state: BOOT\n");
} }
State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN"); State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN");
@@ -240,7 +240,7 @@ void PowerFSM_setup()
bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER ? 1 : 0); bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER ? 1 : 0);
bool hasPower = isPowered(); bool hasPower = isPowered();
LOG_DEBUG("PowerFSM init, USB power=%d\n", hasPower ? 1 : 0); LOG_INFO("PowerFSM init, USB power=%d\n", hasPower ? 1 : 0);
powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout"); powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout");
// wake timer expired or a packet arrived // wake timer expired or a packet arrived
+2 -2
View File
@@ -52,9 +52,9 @@ void scanEInkDevice(void)
d_writeCommand(0x20); d_writeCommand(0x20);
eink_found = (d_waitWhileBusy(150) > 0) ? true : false; eink_found = (d_waitWhileBusy(150) > 0) ? true : false;
if(eink_found) if(eink_found)
LOG_DEBUG("EInk display found\n"); LOG_DEBUG("EInk display found\n");
else else
LOG_DEBUG("EInk display not found\n"); LOG_DEBUG("EInk display not found\n");
SPI1.end(); SPI1.end();
} }
#endif #endif
+26 -26
View File
@@ -107,20 +107,20 @@ void scanI2Cdevice()
screen_found = addr; screen_found = addr;
screen_model = oled_probe(addr); screen_model = oled_probe(addr);
if (screen_model == 1) { if (screen_model == 1) {
LOG_DEBUG("ssd1306 display found\n"); LOG_INFO("ssd1306 display found\n");
} else if (screen_model == 2) { } else if (screen_model == 2) {
LOG_DEBUG("sh1106 display found\n"); LOG_INFO("sh1106 display found\n");
} else { } else {
LOG_DEBUG("unknown display found\n"); LOG_INFO("unknown display found\n");
} }
} }
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) #if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
if (addr == ATECC608B_ADDR) { if (addr == ATECC608B_ADDR) {
keystore_found = addr; keystore_found = addr;
if (atecc.begin(keystore_found) == true) { if (atecc.begin(keystore_found) == true) {
LOG_DEBUG("ATECC608B initialized\n"); LOG_INFO("ATECC608B initialized\n");
} else { } else {
LOG_DEBUG("ATECC608B initialization failed\n"); LOG_WARN("ATECC608B initialization failed\n");
} }
printATECCInfo(); printATECCInfo();
} }
@@ -128,7 +128,7 @@ void scanI2Cdevice()
#ifdef RV3028_RTC #ifdef RV3028_RTC
if (addr == RV3028_RTC){ if (addr == RV3028_RTC){
rtc_found = addr; rtc_found = addr;
LOG_DEBUG("RV3028 RTC found\n"); LOG_INFO("RV3028 RTC found\n");
Melopero_RV3028 rtc; Melopero_RV3028 rtc;
rtc.initI2C(); rtc.initI2C();
rtc.writeToRegister(0x35,0x07); // no Clkout rtc.writeToRegister(0x35,0x07); // no Clkout
@@ -138,7 +138,7 @@ void scanI2Cdevice()
#ifdef PCF8563_RTC #ifdef PCF8563_RTC
if (addr == PCF8563_RTC){ if (addr == PCF8563_RTC){
rtc_found = addr; rtc_found = addr;
LOG_DEBUG("PCF8563 RTC found\n"); LOG_INFO("PCF8563 RTC found\n");
} }
#endif #endif
if (addr == CARDKB_ADDR) { if (addr == CARDKB_ADDR) {
@@ -146,33 +146,33 @@ void scanI2Cdevice()
// Do we have the RAK14006 instead? // Do we have the RAK14006 instead?
registerValue = getRegisterValue(addr, 0x04, 1); registerValue = getRegisterValue(addr, 0x04, 1);
if (registerValue == 0x02) { // KEYPAD_VERSION if (registerValue == 0x02) { // KEYPAD_VERSION
LOG_DEBUG("RAK14004 found\n"); LOG_INFO("RAK14004 found\n");
kb_model = 0x02; kb_model = 0x02;
} else { } else {
LOG_DEBUG("m5 cardKB found\n"); LOG_INFO("m5 cardKB found\n");
kb_model = 0x00; kb_model = 0x00;
} }
} }
if (addr == ST7567_ADDRESS) { if (addr == ST7567_ADDRESS) {
screen_found = addr; screen_found = addr;
LOG_DEBUG("st7567 display found\n"); LOG_INFO("st7567 display found\n");
} }
#ifdef HAS_PMU #ifdef HAS_PMU
if (addr == XPOWERS_AXP192_AXP2101_ADDRESS) { if (addr == XPOWERS_AXP192_AXP2101_ADDRESS) {
pmu_found = true; pmu_found = true;
LOG_DEBUG("axp192/axp2101 PMU found\n"); LOG_INFO("axp192/axp2101 PMU found\n");
} }
#endif #endif
if (addr == BME_ADDR || addr == BME_ADDR_ALTERNATE) { if (addr == BME_ADDR || addr == BME_ADDR_ALTERNATE) {
registerValue = getRegisterValue(addr, 0xD0, 1); // GET_ID registerValue = getRegisterValue(addr, 0xD0, 1); // GET_ID
if (registerValue == 0x61) { if (registerValue == 0x61) {
LOG_DEBUG("BME-680 sensor found at address 0x%x\n", (uint8_t)addr); LOG_INFO("BME-680 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BME680] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_BME680] = addr;
} else if (registerValue == 0x60) { } else if (registerValue == 0x60) {
LOG_DEBUG("BME-280 sensor found at address 0x%x\n", (uint8_t)addr); LOG_INFO("BME-280 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr;
} else { } else {
LOG_DEBUG("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr); LOG_INFO("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BMP280] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_BMP280] = addr;
} }
} }
@@ -180,52 +180,52 @@ void scanI2Cdevice()
registerValue = getRegisterValue(addr, 0xFE, 2); registerValue = getRegisterValue(addr, 0xFE, 2);
LOG_DEBUG("Register MFG_UID: 0x%x\n", registerValue); LOG_DEBUG("Register MFG_UID: 0x%x\n", registerValue);
if (registerValue == 0x5449) { if (registerValue == 0x5449) {
LOG_DEBUG("INA260 sensor found at address 0x%x\n", (uint8_t)addr); LOG_INFO("INA260 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_INA260] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_INA260] = addr;
} else { // Assume INA219 if INA260 ID is not found } else { // Assume INA219 if INA260 ID is not found
LOG_DEBUG("INA219 sensor found at address 0x%x\n", (uint8_t)addr); LOG_INFO("INA219 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_INA219] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_INA219] = addr;
} }
} }
if (addr == MCP9808_ADDR) { if (addr == MCP9808_ADDR) {
nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr;
LOG_DEBUG("MCP9808 sensor found\n"); LOG_INFO("MCP9808 sensor found\n");
} }
if (addr == SHT31_ADDR) { if (addr == SHT31_ADDR) {
LOG_DEBUG("SHT31 sensor found\n"); LOG_INFO("SHT31 sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_SHT31] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_SHT31] = addr;
} }
if (addr == SHTC3_ADDR) { if (addr == SHTC3_ADDR) {
LOG_DEBUG("SHTC3 sensor found\n"); LOG_INFO("SHTC3 sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_SHTC3] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_SHTC3] = addr;
} }
if (addr == LPS22HB_ADDR || addr == LPS22HB_ADDR_ALT) { if (addr == LPS22HB_ADDR || addr == LPS22HB_ADDR_ALT) {
LOG_DEBUG("LPS22HB sensor found\n"); LOG_INFO("LPS22HB sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_LPS22] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_LPS22] = addr;
} }
// High rate sensors, will be processed internally // High rate sensors, will be processed internally
if (addr == QMC6310_ADDR) { if (addr == QMC6310_ADDR) {
LOG_DEBUG("QMC6310 Highrate 3-Axis magnetic sensor found\n"); LOG_INFO("QMC6310 Highrate 3-Axis magnetic sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_QMC6310] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_QMC6310] = addr;
} }
if (addr == QMI8658_ADDR) { if (addr == QMI8658_ADDR) {
LOG_DEBUG("QMI8658 Highrate 6-Axis inertial measurement sensor found\n"); LOG_INFO("QMI8658 Highrate 6-Axis inertial measurement sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658] = addr;
} }
if (addr == QMC5883L_ADDR) { if (addr == QMC5883L_ADDR) {
LOG_DEBUG("QMC5883L Highrate 3-Axis magnetic sensor found\n"); LOG_INFO("QMC5883L Highrate 3-Axis magnetic sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_QMC5883L] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_QMC5883L] = addr;
} }
} else if (err == 4) { } else if (err == 4) {
LOG_DEBUG("Unknow error at address 0x%x\n", addr); LOG_ERROR("Unknow error at address 0x%x\n", addr);
} }
} }
if (nDevices == 0) if (nDevices == 0)
LOG_DEBUG("No I2C devices found\n"); LOG_INFO("No I2C devices found\n");
else else
LOG_DEBUG("%i I2C devices found\n",nDevices); LOG_INFO("%i I2C devices found\n",nDevices);
} }
#else #else
void scanI2Cdevice() {} void scanI2Cdevice() {}
+6 -6
View File
@@ -361,7 +361,7 @@ void GPS::setNumSatellites(uint8_t n)
void GPS::setAwake(bool on) void GPS::setAwake(bool on)
{ {
if (!wakeAllowed && on) { if (!wakeAllowed && on) {
LOG_DEBUG("Inhibiting because !wakeAllowed\n"); LOG_WARN("Inhibiting because !wakeAllowed\n");
on = false; on = false;
} }
@@ -516,7 +516,7 @@ void GPS::forceWake(bool on)
/// Prepare the GPS for the cpu entering deep or light sleep, expect to be gone for at least 100s of msecs /// Prepare the GPS for the cpu entering deep or light sleep, expect to be gone for at least 100s of msecs
int GPS::prepareSleep(void *unused) int GPS::prepareSleep(void *unused)
{ {
LOG_DEBUG("GPS prepare sleep!\n"); LOG_INFO("GPS prepare sleep!\n");
forceWake(false); forceWake(false);
return 0; return 0;
@@ -525,7 +525,7 @@ int GPS::prepareSleep(void *unused)
/// Prepare the GPS for the cpu entering deep or light sleep, expect to be gone for at least 100s of msecs /// 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) int GPS::prepareDeepSleep(void *unused)
{ {
LOG_DEBUG("GPS deep sleep!\n"); LOG_INFO("GPS deep sleep!\n");
// For deep sleep we also want abandon any lock attempts (because we want minimum power) // For deep sleep we also want abandon any lock attempts (because we want minimum power)
getSleepTime(); getSleepTime();
@@ -568,7 +568,7 @@ GnssModel_t GPS::probe()
if(index != -1){ if(index != -1){
ver = ver.substring(index); ver = ver.substring(index);
if (ver.startsWith("$GPTXT,01,01,02")) { if (ver.startsWith("$GPTXT,01,01,02")) {
LOG_DEBUG("L76K GNSS init succeeded, using L76K GNSS Module\n"); LOG_INFO("L76K GNSS init succeeded, using L76K GNSS Module\n");
return GNSS_MODEL_MTK; return GNSS_MODEL_MTK;
} }
} }
@@ -631,9 +631,9 @@ GnssModel_t GPS::probe()
} }
if (strlen((char*)buffer)) { if (strlen((char*)buffer)) {
LOG_DEBUG("UBlox GNSS init succeeded, using UBlox %s GNSS Module\n" , buffer); LOG_INFO("UBlox GNSS init succeeded, using UBlox %s GNSS Module\n" , buffer);
}else{ }else{
LOG_DEBUG("UBlox GNSS init succeeded, using UBlox GNSS Module\n"); LOG_INFO("UBlox GNSS init succeeded, using UBlox GNSS Module\n");
} }
return GNSS_MODEL_UBLOX; return GNSS_MODEL_UBLOX;
+2 -2
View File
@@ -137,7 +137,7 @@ bool NMEAGPS::lookForLocation()
(reader.time.age() < GPS_SOL_EXPIRY_MS) && (reader.time.age() < GPS_SOL_EXPIRY_MS) &&
(reader.date.age() < GPS_SOL_EXPIRY_MS))) (reader.date.age() < GPS_SOL_EXPIRY_MS)))
{ {
LOG_DEBUG("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\n", reader.location.age(), reader.time.age(), reader.date.age());
return false; return false;
} }
@@ -212,7 +212,7 @@ bool NMEAGPS::lookForLocation()
if (reader.course.value() < 36000) { // sanity check if (reader.course.value() < 36000) { // sanity check
p.ground_track = reader.course.value() * 1e3; // Scale the heading (in degrees * 10^-2) to match the expected degrees * 10^-5 p.ground_track = reader.course.value() * 1e3; // Scale the heading (in degrees * 10^-2) to match the expected degrees * 10^-5
} else { } else {
LOG_DEBUG("BOGUS course.value() REJECTED: %d\n", LOG_WARN("BOGUS course.value() REJECTED: %d\n",
reader.course.value()); reader.course.value());
} }
} }
+1 -1
View File
@@ -162,7 +162,7 @@ void EInkDisplay::setDetected(uint8_t detected)
// Connect to the display // Connect to the display
bool EInkDisplay::connect() bool EInkDisplay::connect()
{ {
LOG_DEBUG("Doing EInk init\n"); LOG_INFO("Doing EInk init\n");
#ifdef PIN_EINK_PWR_ON #ifdef PIN_EINK_PWR_ON
digitalWrite(PIN_EINK_PWR_ON, HIGH); // If we need to assert a pin to power external peripherals digitalWrite(PIN_EINK_PWR_ON, HIGH); // If we need to assert a pin to power external peripherals
+5 -5
View File
@@ -936,14 +936,14 @@ void Screen::handleSetOn(bool on)
if (on != screenOn) { if (on != screenOn) {
if (on) { if (on) {
LOG_DEBUG("Turning on screen\n"); LOG_INFO("Turning on screen\n");
dispdev.displayOn(); dispdev.displayOn();
dispdev.displayOn(); dispdev.displayOn();
enabled = true; enabled = true;
setInterval(0); // Draw ASAP setInterval(0); // Draw ASAP
runASAP = true; runASAP = true;
} else { } else {
LOG_DEBUG("Turning off screen\n"); LOG_INFO("Turning off screen\n");
dispdev.displayOff(); dispdev.displayOff();
enabled = false; enabled = false;
} }
@@ -1056,7 +1056,7 @@ int32_t Screen::runOnce()
// serialSinceMsec adjusts for additional serial wait time during nRF52 bootup // serialSinceMsec adjusts for additional serial wait time during nRF52 bootup
static bool showingBootScreen = true; static bool showingBootScreen = true;
if (showingBootScreen && (millis() > (logo_timeout + serialSinceMsec))) { if (showingBootScreen && (millis() > (logo_timeout + serialSinceMsec))) {
LOG_DEBUG("Done with boot screen...\n"); LOG_INFO("Done with boot screen...\n");
stopBootScreen(); stopBootScreen();
showingBootScreen = false; showingBootScreen = false;
} }
@@ -1065,7 +1065,7 @@ int32_t Screen::runOnce()
if (strlen(oemStore.oem_text) > 0) { if (strlen(oemStore.oem_text) > 0) {
static bool showingOEMBootScreen = true; static bool showingOEMBootScreen = true;
if (showingOEMBootScreen && (millis() > ((logo_timeout / 2) + serialSinceMsec))) { if (showingOEMBootScreen && (millis() > ((logo_timeout / 2) + serialSinceMsec))) {
LOG_DEBUG("Switch to OEM screen...\n"); LOG_INFO("Switch to OEM screen...\n");
// Change frames. // Change frames.
static FrameCallback bootOEMFrames[] = {drawOEMBootScreen}; static FrameCallback bootOEMFrames[] = {drawOEMBootScreen};
static const int bootOEMFrameCount = sizeof(bootOEMFrames) / sizeof(bootOEMFrames[0]); static const int bootOEMFrameCount = sizeof(bootOEMFrames) / sizeof(bootOEMFrames[0]);
@@ -1127,7 +1127,7 @@ int32_t Screen::runOnce()
handleRebootScreen(); handleRebootScreen();
break; break;
default: default:
LOG_DEBUG("BUG: invalid cmd\n"); LOG_ERROR("Invalid screen cmd\n");
} }
} }
+1 -1
View File
@@ -59,7 +59,7 @@ void TFTDisplay::setDetected(uint8_t detected)
bool TFTDisplay::connect() bool TFTDisplay::connect()
{ {
concurrency::LockGuard g(spiLock); concurrency::LockGuard g(spiLock);
LOG_DEBUG("Doing TFT init\n"); LOG_INFO("Doing TFT init\n");
#ifdef TFT_BL #ifdef TFT_BL
digitalWrite(TFT_BL, HIGH); digitalWrite(TFT_BL, HIGH);
+1 -1
View File
@@ -28,7 +28,7 @@ void RotaryEncoderInterruptBase::init(
this->rotaryLevelA = digitalRead(this->_pinA); this->rotaryLevelA = digitalRead(this->_pinA);
this->rotaryLevelB = digitalRead(this->_pinB); this->rotaryLevelB = digitalRead(this->_pinB);
LOG_DEBUG("Rotary initialized (%d, %d, %d)\n", this->_pinA, this->_pinB, pinPress); LOG_INFO("Rotary initialized (%d, %d, %d)\n", this->_pinA, this->_pinB, pinPress);
} }
int32_t RotaryEncoderInterruptBase::runOnce() int32_t RotaryEncoderInterruptBase::runOnce()
+7 -7
View File
@@ -256,7 +256,7 @@ void setup()
Wire1.beginTransmission(PCF8563_RTC); Wire1.beginTransmission(PCF8563_RTC);
if (Wire1.endTransmission() == 0){ if (Wire1.endTransmission() == 0){
rtc_found = PCF8563_RTC; rtc_found = PCF8563_RTC;
LOG_DEBUG("PCF8563 RTC found\n"); LOG_INFO("PCF8563 RTC found\n");
} }
#endif #endif
@@ -378,7 +378,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_DEBUG("RF95 Radio init succeeded, using RF95 radio\n"); LOG_INFO("RF95 Radio init succeeded, using RF95 radio\n");
} }
} }
#endif #endif
@@ -391,7 +391,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_DEBUG("SX1280 Radio init succeeded, using SX1280 radio\n"); LOG_INFO("SX1280 Radio init succeeded, using SX1280 radio\n");
} }
} }
#endif #endif
@@ -404,7 +404,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_DEBUG("SX1262 Radio init succeeded, using SX1262 radio\n"); LOG_INFO("SX1262 Radio init succeeded, using SX1262 radio\n");
} }
} }
#endif #endif
@@ -417,7 +417,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_DEBUG("SX1268 Radio init succeeded, using SX1268 radio\n"); LOG_INFO("SX1268 Radio init succeeded, using SX1268 radio\n");
} }
} }
#endif #endif
@@ -430,7 +430,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_DEBUG("LLCC68 Radio init succeeded, using LLCC68 radio\n"); LOG_INFO("LLCC68 Radio init succeeded, using LLCC68 radio\n");
} }
} }
#endif #endif
@@ -443,7 +443,7 @@ void setup()
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
} else { } else {
LOG_DEBUG("Using SIMULATED radio!\n"); LOG_INFO("Using SIMULATED radio!\n");
} }
} }
#endif #endif
+1 -1
View File
@@ -270,7 +270,7 @@ static int mem_test(uint32_t *_start, size_t len, bool doRead = true, bool doWri
for (addr = start, val = pattern; addr < end; addr++) { for (addr = start, val = pattern; addr < end; addr++) {
readback = *addr; readback = *addr;
if (readback != val) { if (readback != val) {
LOG_DEBUG("Mem error @ 0x%08X: " LOG_ERROR("Mem error @ 0x%08X: "
"found 0x%08lX, expected 0x%08lX\n", "found 0x%08lX, expected 0x%08lX\n",
addr, readback, val); addr, readback, val);
rcode++; rcode++;
+1 -1
View File
@@ -47,7 +47,7 @@ void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
traceRouteModule->updateRoute(tosend); traceRouteModule->updateRoute(tosend);
} }
printPacket("Rebroadcasting received floodmsg to neighbors", p); LOG_INFO("Rebroadcasting received floodmsg to neighbors", p);
// Note: we are careful to resend using the original senders node id // Note: we are careful to resend using the original senders node id
// We are careful not to call our hooked version of send() - because we don't want to check this again // We are careful not to call our hooked version of send() - because we don't want to check this again
Router::send(tosend); Router::send(tosend);
+2 -2
View File
@@ -52,7 +52,7 @@ MeshPacket *MeshModule::allocAckNak(Routing_Error err, NodeNum to, PacketId idFr
p->to = to; p->to = to;
p->decoded.request_id = idFrom; p->decoded.request_id = idFrom;
p->channel = chIndex; p->channel = chIndex;
LOG_DEBUG("Alloc an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id); LOG_ERROR("Alloc an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id);
return p; return p;
} }
@@ -134,7 +134,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
// any other node. // any other node.
if (mp.decoded.want_response && toUs && (getFrom(&mp) != ourNodeNum || mp.to == ourNodeNum) && !currentReply) { if (mp.decoded.want_response && toUs && (getFrom(&mp) != ourNodeNum || mp.to == ourNodeNum) && !currentReply) {
pi.sendResponse(mp); pi.sendResponse(mp);
LOG_DEBUG("Module '%s' sent a response\n", pi.name); LOG_INFO("Module '%s' sent a response\n", pi.name);
} else { } else {
LOG_DEBUG("Module '%s' considered\n", pi.name); LOG_DEBUG("Module '%s' considered\n", pi.name);
} }
+4 -4
View File
@@ -140,7 +140,7 @@ void MeshService::handleToRadio(MeshPacket &p)
// Switch the port from PortNum_SIMULATOR_APP back to the original PortNum // Switch the port from PortNum_SIMULATOR_APP back to the original PortNum
p.decoded.portnum = decoded->portnum; p.decoded.portnum = decoded->portnum;
} else } else
LOG_DEBUG("Error decoding protobuf for simulator message!\n"); LOG_ERROR("Error decoding protobuf for simulator message!\n");
} }
// Let SimRadio receive as if it did via its LoRa chip // Let SimRadio receive as if it did via its LoRa chip
SimRadio::instance->startReceive(&p); SimRadio::instance->startReceive(&p);
@@ -198,12 +198,12 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) { if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) {
if (positionModule) { if (positionModule) {
LOG_DEBUG("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies); LOG_INFO("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
positionModule->sendOurPosition(dest, wantReplies); positionModule->sendOurPosition(dest, wantReplies);
} }
} else { } else {
if (nodeInfoModule) { if (nodeInfoModule) {
LOG_DEBUG("Sending nodeinfo ping to 0x%x, wantReplies=%d\n", dest, wantReplies); LOG_INFO("Sending nodeinfo ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
nodeInfoModule->sendOurNodeInfo(dest, wantReplies); nodeInfoModule->sendOurNodeInfo(dest, wantReplies);
} }
} }
@@ -212,7 +212,7 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
void MeshService::sendToPhone(MeshPacket *p) void MeshService::sendToPhone(MeshPacket *p)
{ {
if (toPhoneQueue.numFree() == 0) { if (toPhoneQueue.numFree() == 0) {
LOG_DEBUG("NOTE: tophone queue is full, discarding oldest\n"); LOG_WARN("ToPhone queue is full, discarding oldest\n");
MeshPacket *d = toPhoneQueue.dequeuePtr(0); MeshPacket *d = toPhoneQueue.dequeuePtr(0);
if (d) if (d)
releaseToPool(d); releaseToPool(d);
+22 -22
View File
@@ -86,7 +86,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
} }
if (channelFile.channels_count != MAX_NUM_CHANNELS) { if (channelFile.channels_count != MAX_NUM_CHANNELS) {
LOG_DEBUG("Setting default channel and radio preferences!\n"); LOG_INFO("Setting default channel and radio preferences!\n");
channels.initDefaults(); channels.initDefaults();
} }
@@ -114,7 +114,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
initRegion(); initRegion();
if (didFactoryReset) { if (didFactoryReset) {
LOG_DEBUG("Rebooting due to factory reset"); LOG_INFO("Rebooting due to factory reset");
screen->startRebootScreen(); screen->startRebootScreen();
rebootAtMsec = millis() + (5 * 1000); rebootAtMsec = millis() + (5 * 1000);
} }
@@ -124,7 +124,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
bool NodeDB::factoryReset() bool NodeDB::factoryReset()
{ {
LOG_DEBUG("Performing factory reset!\n"); LOG_INFO("Performing factory reset!\n");
// first, remove the "/prefs" (this removes most prefs) // first, remove the "/prefs" (this removes most prefs)
rmDir("/prefs"); rmDir("/prefs");
// second, install default state (this will deal with the duplicate mac address issue) // second, install default state (this will deal with the duplicate mac address issue)
@@ -140,7 +140,7 @@ bool NodeDB::factoryReset()
#endif #endif
#ifdef ARCH_NRF52 #ifdef ARCH_NRF52
Bluefruit.begin(); Bluefruit.begin();
LOG_DEBUG("Clearing bluetooth bonds!\n"); LOG_INFO("Clearing bluetooth bonds!\n");
bond_print_list(BLE_GAP_ROLE_PERIPH); bond_print_list(BLE_GAP_ROLE_PERIPH);
bond_print_list(BLE_GAP_ROLE_CENTRAL); bond_print_list(BLE_GAP_ROLE_CENTRAL);
Bluefruit.Periph.clearBonds(); Bluefruit.Periph.clearBonds();
@@ -151,7 +151,7 @@ bool NodeDB::factoryReset()
void NodeDB::installDefaultConfig() void NodeDB::installDefaultConfig()
{ {
LOG_DEBUG("Installing default LocalConfig\n"); LOG_INFO("Installing default LocalConfig\n");
memset(&config, 0, sizeof(LocalConfig)); memset(&config, 0, sizeof(LocalConfig));
config.version = DEVICESTATE_CUR_VER; config.version = DEVICESTATE_CUR_VER;
config.has_device = true; config.has_device = true;
@@ -376,7 +376,7 @@ bool NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, c
auto f = FSCom.open(filename, FILE_O_READ); auto f = FSCom.open(filename, FILE_O_READ);
if (f) { if (f) {
LOG_DEBUG("Loading %s\n", filename); LOG_INFO("Loading %s\n", filename);
pb_istream_t stream = {&readcb, &f, protoSize}; pb_istream_t stream = {&readcb, &f, protoSize};
// LOG_DEBUG("Preload channel name=%s\n", channelSettings.name); // LOG_DEBUG("Preload channel name=%s\n", channelSettings.name);
@@ -390,7 +390,7 @@ bool NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, c
f.close(); f.close();
} else { } else {
LOG_DEBUG("No %s preferences found\n", filename); LOG_INFO("No %s preferences found\n", filename);
} }
#else #else
LOG_ERROR("ERROR: Filesystem not implemented\n"); LOG_ERROR("ERROR: Filesystem not implemented\n");
@@ -408,7 +408,7 @@ void NodeDB::loadFromDisk()
LOG_WARN("Devicestate %d is old, discarding\n", devicestate.version); LOG_WARN("Devicestate %d is old, discarding\n", devicestate.version);
factoryReset(); factoryReset();
} else { } else {
LOG_DEBUG("Loaded saved devicestate version %d\n", devicestate.version); LOG_INFO("Loaded saved devicestate version %d\n", devicestate.version);
} }
} }
@@ -419,7 +419,7 @@ void NodeDB::loadFromDisk()
LOG_WARN("config %d is old, discarding\n", config.version); LOG_WARN("config %d is old, discarding\n", config.version);
installDefaultConfig(); installDefaultConfig();
} else { } else {
LOG_DEBUG("Loaded saved config version %d\n", config.version); LOG_INFO("Loaded saved config version %d\n", config.version);
} }
} }
@@ -430,7 +430,7 @@ void NodeDB::loadFromDisk()
LOG_WARN("moduleConfig %d is old, discarding\n", moduleConfig.version); LOG_WARN("moduleConfig %d is old, discarding\n", moduleConfig.version);
installDefaultModuleConfig(); installDefaultModuleConfig();
} else { } else {
LOG_DEBUG("Loaded saved moduleConfig version %d\n", moduleConfig.version); LOG_INFO("Loaded saved moduleConfig version %d\n", moduleConfig.version);
} }
} }
@@ -441,12 +441,12 @@ void NodeDB::loadFromDisk()
LOG_WARN("channelFile %d is old, discarding\n", channelFile.version); LOG_WARN("channelFile %d is old, discarding\n", channelFile.version);
installDefaultChannels(); installDefaultChannels();
} else { } else {
LOG_DEBUG("Loaded saved channelFile version %d\n", channelFile.version); LOG_INFO("Loaded saved channelFile version %d\n", channelFile.version);
} }
} }
if (loadProto(oemConfigFile, OEMStore_size, sizeof(OEMStore), &OEMStore_msg, &oemStore)) if (loadProto(oemConfigFile, OEMStore_size, sizeof(OEMStore), &OEMStore_msg, &oemStore))
LOG_DEBUG("Loaded OEMStore\n"); LOG_INFO("Loaded OEMStore\n");
} }
/** Save a protobuf from a file, return true for success */ /** Save a protobuf from a file, return true for success */
@@ -459,11 +459,11 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
filenameTmp += ".tmp"; filenameTmp += ".tmp";
auto f = FSCom.open(filenameTmp.c_str(), FILE_O_WRITE); auto f = FSCom.open(filenameTmp.c_str(), FILE_O_WRITE);
if (f) { if (f) {
LOG_DEBUG("Saving %s\n", filename); LOG_INFO("Saving %s\n", filename);
pb_ostream_t stream = {&writecb, &f, protoSize}; pb_ostream_t stream = {&writecb, &f, protoSize};
if (!pb_encode(&stream, fields, dest_struct)) { if (!pb_encode(&stream, fields, dest_struct)) {
LOG_DEBUG("Error: can't encode protobuf %s\n", PB_GET_ERROR(&stream)); LOG_ERROR("Error: can't encode protobuf %s\n", PB_GET_ERROR(&stream));
} else { } else {
okay = true; okay = true;
} }
@@ -473,9 +473,9 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
if (FSCom.exists(filename) && !FSCom.remove(filename)) if (FSCom.exists(filename) && !FSCom.remove(filename))
LOG_WARN("Can't remove old pref file\n"); LOG_WARN("Can't remove old pref file\n");
if (!renameFile(filenameTmp.c_str(), filename)) if (!renameFile(filenameTmp.c_str(), filename))
LOG_DEBUG("Error: can't rename new pref file\n"); LOG_ERROR("Error: can't rename new pref file\n");
} else { } else {
LOG_DEBUG("Can't write prefs\n"); LOG_ERROR("Can't write prefs\n");
#ifdef ARCH_NRF52 #ifdef ARCH_NRF52
static uint8_t failedCounter = 0; static uint8_t failedCounter = 0;
failedCounter++; failedCounter++;
@@ -487,7 +487,7 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
#endif #endif
} }
#else #else
LOG_DEBUG("ERROR: Filesystem not implemented\n"); LOG_ERROR("ERROR: Filesystem not implemented\n");
#endif #endif
return okay; return okay;
} }
@@ -599,7 +599,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
if (src == RX_SRC_LOCAL) { if (src == RX_SRC_LOCAL) {
// Local packet, fully authoritative // Local packet, fully authoritative
LOG_DEBUG("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i, LOG_INFO("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
p.longitude_i, p.altitude); p.longitude_i, p.altitude);
info->position = p; info->position = p;
@@ -615,7 +615,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
// recorded based on the packet rxTime // recorded based on the packet rxTime
// //
// FIXME perhaps handle RX_SRC_USER separately? // FIXME perhaps handle RX_SRC_USER separately?
LOG_DEBUG("updatePosition REMOTE node=0x%x time=%u, latI=%d, lonI=%d\n", nodeId, p.time, p.latitude_i, p.longitude_i); LOG_INFO("updatePosition REMOTE node=0x%x time=%u, latI=%d, lonI=%d\n", nodeId, p.time, p.latitude_i, p.longitude_i);
// First, back up fields that we want to protect from overwrite // First, back up fields that we want to protect from overwrite
uint32_t tmp_time = info->position.time; uint32_t tmp_time = info->position.time;
@@ -756,9 +756,9 @@ void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *f
String lcd = String("Critical error ") + code + "!\n"; String lcd = String("Critical error ") + code + "!\n";
screen->print(lcd.c_str()); screen->print(lcd.c_str());
if (filename) if (filename)
LOG_DEBUG("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address); LOG_ERROR("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address);
else else
LOG_DEBUG("NOTE! Recording critical error %d, address=0x%lx\n", code, address); LOG_ERROR("NOTE! Recording critical error %d, address=0x%lx\n", code, address);
// Record error to DB // Record error to DB
myNodeInfo.error_code = code; myNodeInfo.error_code = code;
@@ -767,7 +767,7 @@ void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *f
// Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend // Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend
#ifdef ARCH_PORTDUINO #ifdef ARCH_PORTDUINO
LOG_DEBUG("A critical failure occurred, portduino is exiting..."); LOG_ERROR("A critical failure occurred, portduino is exiting...");
exit(2); exit(2);
#endif #endif
} }
+17 -17
View File
@@ -37,7 +37,7 @@ void PhoneAPI::handleStartConfig()
// even if we were already connected - restart our state machine // even if we were already connected - restart our state machine
state = STATE_SEND_MY_INFO; state = STATE_SEND_MY_INFO;
LOG_DEBUG("Starting API client config\n"); LOG_INFO("Starting API client config\n");
nodeInfoForPhone = NULL; // Don't keep returning old nodeinfos nodeInfoForPhone = NULL; // Don't keep returning old nodeinfos
nodeDB.resetReadPointer(); // FIXME, this read pointer should be moved out of nodeDB and into this class - because nodeDB.resetReadPointer(); // FIXME, this read pointer should be moved out of nodeDB and into this class - because
// this will break once we have multiple instances of PhoneAPI running independently // this will break once we have multiple instances of PhoneAPI running independently
@@ -60,7 +60,7 @@ void PhoneAPI::checkConnectionTimeout()
if (isConnected()) { if (isConnected()) {
bool newContact = checkIsConnected(); bool newContact = checkIsConnected();
if (!newContact) { if (!newContact) {
LOG_DEBUG("Lost phone connection\n"); LOG_INFO("Lost phone connection\n");
close(); close();
} }
} }
@@ -83,11 +83,11 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
return handleToRadioPacket(toRadioScratch.packet); return handleToRadioPacket(toRadioScratch.packet);
case ToRadio_want_config_id_tag: case ToRadio_want_config_id_tag:
config_nonce = toRadioScratch.want_config_id; config_nonce = toRadioScratch.want_config_id;
LOG_DEBUG("Client wants config, nonce=%u\n", config_nonce); LOG_INFO("Client wants config, nonce=%u\n", config_nonce);
handleStartConfig(); handleStartConfig();
break; break;
case ToRadio_disconnect_tag: case ToRadio_disconnect_tag:
LOG_DEBUG("Disconnecting from phone\n"); LOG_INFO("Disconnecting from phone\n");
close(); close();
break; break;
default: default:
@@ -96,7 +96,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
break; break;
} }
} else { } else {
LOG_DEBUG("Error: ignoring malformed toradio\n"); LOG_ERROR("Error: ignoring malformed toradio\n");
} }
return false; return false;
@@ -128,11 +128,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// Advance states as needed // Advance states as needed
switch (state) { switch (state) {
case STATE_SEND_NOTHING: case STATE_SEND_NOTHING:
LOG_DEBUG("getFromRadio=STATE_SEND_NOTHING\n"); LOG_INFO("getFromRadio=STATE_SEND_NOTHING\n");
break; break;
case STATE_SEND_MY_INFO: case STATE_SEND_MY_INFO:
LOG_DEBUG("getFromRadio=STATE_SEND_MY_INFO\n"); LOG_INFO("getFromRadio=STATE_SEND_MY_INFO\n");
// If the user has specified they don't want our node to share its location, make sure to tell the phone // 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. // app not to send locations on our behalf.
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
@@ -144,18 +144,18 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_NODEINFO: { case STATE_SEND_NODEINFO: {
LOG_DEBUG("getFromRadio=STATE_SEND_NODEINFO\n"); LOG_INFO("getFromRadio=STATE_SEND_NODEINFO\n");
const NodeInfo *info = nodeInfoForPhone; const NodeInfo *info = nodeInfoForPhone;
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
if (info) { if (info) {
LOG_DEBUG("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id, LOG_INFO("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
info->user.long_name); info->user.long_name);
fromRadioScratch.which_payload_variant = FromRadio_node_info_tag; fromRadioScratch.which_payload_variant = FromRadio_node_info_tag;
fromRadioScratch.node_info = *info; fromRadioScratch.node_info = *info;
// Stay in current state until done sending nodeinfos // Stay in current state until done sending nodeinfos
} else { } else {
LOG_DEBUG("Done sending nodeinfos\n"); LOG_INFO("Done sending nodeinfos\n");
state = STATE_SEND_CHANNELS; state = STATE_SEND_CHANNELS;
// Go ahead and send that ID right now // Go ahead and send that ID right now
return getFromRadio(buf); return getFromRadio(buf);
@@ -164,7 +164,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
} }
case STATE_SEND_CHANNELS: case STATE_SEND_CHANNELS:
LOG_DEBUG("getFromRadio=STATE_SEND_CHANNELS\n"); LOG_INFO("getFromRadio=STATE_SEND_CHANNELS\n");
fromRadioScratch.which_payload_variant = FromRadio_channel_tag; fromRadioScratch.which_payload_variant = FromRadio_channel_tag;
fromRadioScratch.channel = channels.getByIndex(config_state); fromRadioScratch.channel = channels.getByIndex(config_state);
config_state++; config_state++;
@@ -176,7 +176,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_CONFIG: case STATE_SEND_CONFIG:
LOG_DEBUG("getFromRadio=STATE_SEND_CONFIG\n"); LOG_INFO("getFromRadio=STATE_SEND_CONFIG\n");
fromRadioScratch.which_payload_variant = FromRadio_config_tag; fromRadioScratch.which_payload_variant = FromRadio_config_tag;
switch (config_state) { switch (config_state) {
case Config_device_tag: case Config_device_tag:
@@ -222,7 +222,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_MODULECONFIG: case STATE_SEND_MODULECONFIG:
LOG_DEBUG("getFromRadio=STATE_SEND_MODULECONFIG\n"); LOG_INFO("getFromRadio=STATE_SEND_MODULECONFIG\n");
fromRadioScratch.which_payload_variant = FromRadio_moduleConfig_tag; fromRadioScratch.which_payload_variant = FromRadio_moduleConfig_tag;
switch (config_state) { switch (config_state) {
case ModuleConfig_mqtt_tag: case ModuleConfig_mqtt_tag:
@@ -272,7 +272,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_COMPLETE_ID: case STATE_SEND_COMPLETE_ID:
LOG_DEBUG("getFromRadio=STATE_SEND_COMPLETE_ID\n"); LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n");
fromRadioScratch.which_payload_variant = FromRadio_config_complete_id_tag; fromRadioScratch.which_payload_variant = FromRadio_config_complete_id_tag;
fromRadioScratch.config_complete_id = config_nonce; fromRadioScratch.config_complete_id = config_nonce;
config_nonce = 0; config_nonce = 0;
@@ -281,7 +281,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
case STATE_SEND_PACKETS: case STATE_SEND_PACKETS:
// Do we have a message from the mesh? // Do we have a message from the mesh?
LOG_DEBUG("getFromRadio=STATE_SEND_PACKETS\n"); LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n");
if (packetForPhone) { if (packetForPhone) {
printPacket("phone downloaded packet", packetForPhone); printPacket("phone downloaded packet", packetForPhone);
@@ -311,7 +311,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
void PhoneAPI::handleDisconnect() void PhoneAPI::handleDisconnect()
{ {
LOG_DEBUG("PhoneAPI disconnect\n"); LOG_INFO("PhoneAPI disconnect\n");
} }
void PhoneAPI::releasePhonePacket() void PhoneAPI::releasePhonePacket()
@@ -373,7 +373,7 @@ int PhoneAPI::onNotify(uint32_t newValue)
// from idle) // from idle)
if (state == STATE_SEND_PACKETS) { if (state == STATE_SEND_PACKETS) {
LOG_DEBUG("Telling client we have new packets %u\n", newValue); LOG_INFO("Telling client we have new packets %u\n", newValue);
onNowHasData(newValue); onNowHasData(newValue);
} else } else
LOG_DEBUG("(Client not yet interested in packets)\n"); LOG_DEBUG("(Client not yet interested in packets)\n");
+2 -2
View File
@@ -70,7 +70,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
// it would be better to update even if the message was destined to others. // it would be better to update even if the message was destined to others.
auto &p = mp.decoded; auto &p = mp.decoded;
LOG_DEBUG("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d\n", name, mp.from, mp.id, p.portnum, 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); p.payload.size);
T scratch; T scratch;
@@ -80,7 +80,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) { if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) {
decoded = &scratch; decoded = &scratch;
} else { } else {
LOG_DEBUG("Error decoding protobuf module!\n"); LOG_ERROR("Error decoding protobuf module!\n");
// if we can't decode it, nobody can process it! // if we can't decode it, nobody can process it!
return ProcessMessage::STOP; return ProcessMessage::STOP;
} }
+4 -4
View File
@@ -68,11 +68,11 @@ bool RF95Interface::init()
setTransmitEnable(false); setTransmitEnable(false);
int res = lora->begin(getFreq(), bw, sf, cr, syncWord, power, currentLimit, preambleLength); int res = lora->begin(getFreq(), bw, sf, cr, syncWord, power, currentLimit, preambleLength);
LOG_DEBUG("RF95 init result %d\n", res); LOG_INFO("RF95 init result %d\n", res);
LOG_DEBUG("Frequency set to %f\n", getFreq()); LOG_INFO("Frequency set to %f\n", getFreq());
LOG_DEBUG("Bandwidth set to %f\n", bw); LOG_INFO("Bandwidth set to %f\n", bw);
LOG_DEBUG("Power output set to %d\n", power); LOG_INFO("Power output set to %d\n", power);
// current limit was removed from module' ctor // current limit was removed from module' ctor
// override default value (60 mA) // override default value (60 mA)
+11 -11
View File
@@ -117,7 +117,7 @@ void initRegion()
for (; r->code != Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++) for (; r->code != Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++)
; ;
myRegion = r; myRegion = r;
LOG_DEBUG("Wanted region %d, using %s\n", config.lora.region, r->name); LOG_INFO("Wanted region %d, using %s\n", config.lora.region, r->name);
} }
/** /**
@@ -284,7 +284,7 @@ bool RadioInterface::reconfigure()
bool RadioInterface::init() bool RadioInterface::init()
{ {
LOG_DEBUG("Starting meshradio init...\n"); LOG_INFO("Starting meshradio init...\n");
configChangedObserver.observe(&service.configChanged); configChangedObserver.observe(&service.configChanged);
preflightSleepObserver.observe(&preflightSleep); preflightSleepObserver.observe(&preflightSleep);
@@ -449,13 +449,13 @@ void RadioInterface::applyModemConfig()
saveChannelNum(channel_num); saveChannelNum(channel_num);
saveFreq(freq + config.lora.frequency_offset); saveFreq(freq + config.lora.frequency_offset);
LOG_DEBUG("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, config.lora.frequency_offset); LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, config.lora.frequency_offset);
LOG_DEBUG("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power); LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power);
LOG_DEBUG("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart); LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart);
LOG_DEBUG("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw); LOG_INFO("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw);
LOG_DEBUG("Radio channel_num: %d\n", channel_num); LOG_INFO("Radio channel_num: %d\n", channel_num);
LOG_DEBUG("Radio frequency: %f\n", getFreq()); LOG_INFO("Radio frequency: %f\n", getFreq());
LOG_DEBUG("Slot time: %u msec\n", slotTimeMsec); LOG_INFO("Slot time: %u msec\n", slotTimeMsec);
} }
/** /**
@@ -470,11 +470,11 @@ void RadioInterface::limitPower()
maxPower = myRegion->powerLimit; maxPower = myRegion->powerLimit;
if ((power > maxPower) && !devicestate.owner.is_licensed) { if ((power > maxPower) && !devicestate.owner.is_licensed) {
LOG_DEBUG("Lowering transmit power because of regulatory limits\n"); LOG_INFO("Lowering transmit power because of regulatory limits\n");
power = maxPower; power = maxPower;
} }
LOG_DEBUG("Set radio: final power level=%d\n", power); LOG_INFO("Set radio: final power level=%d\n", power);
} }
+10 -10
View File
@@ -82,17 +82,17 @@ bool RadioLibInterface::canSendImmediately()
if (busyTx || busyRx) { if (busyTx || busyRx) {
if (busyTx) if (busyTx)
LOG_DEBUG("Can not send yet, busyTx\n"); LOG_WARN("Can not send yet, busyTx\n");
// If we've been trying to send the same packet more than one minute and we haven't gotten a // 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. // TX IRQ from the radio, the radio is probably broken.
if (busyTx && (millis() - lastTxStart > 60000)) { if (busyTx && (millis() - lastTxStart > 60000)) {
LOG_DEBUG("Hardware Failure! busyTx for more than 60s\n"); LOG_ERROR("Hardware Failure! busyTx for more than 60s\n");
RECORD_CRITICALERROR(CriticalErrorCode_TRANSMIT_FAILED); RECORD_CRITICALERROR(CriticalErrorCode_TRANSMIT_FAILED);
// reboot in 5 seconds when this condition occurs. // reboot in 5 seconds when this condition occurs.
rebootAtMsec = lastTxStart + 65000; rebootAtMsec = lastTxStart + 65000;
} }
if (busyRx) if (busyRx)
LOG_DEBUG("Can not send yet, busyRx\n"); LOG_WARN("Can not send yet, busyRx\n");
return false; return false;
} else } else
return true; return true;
@@ -111,13 +111,13 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) { if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) {
if (disabled || !config.lora.tx_enabled) { if (disabled || !config.lora.tx_enabled) {
LOG_DEBUG("send - !config.lora.tx_enabled\n"); LOG_WARN("send - !config.lora.tx_enabled\n");
packetPool.release(p); packetPool.release(p);
return ERRNO_DISABLED; return ERRNO_DISABLED;
} }
} else { } else {
LOG_DEBUG("send - lora tx disable because RegionCode_Unset\n"); LOG_WARN("send - lora tx disable because RegionCode_Unset\n");
packetPool.release(p); packetPool.release(p);
return ERRNO_DISABLED; return ERRNO_DISABLED;
} }
@@ -127,7 +127,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
#else #else
if (disabled || !config.lora.tx_enabled) { if (disabled || !config.lora.tx_enabled) {
LOG_DEBUG("send - !config.lora.tx_enabled\n"); LOG_WARN("send - !config.lora.tx_enabled\n");
packetPool.release(p); packetPool.release(p);
return ERRNO_DISABLED; return ERRNO_DISABLED;
} }
@@ -319,7 +319,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
int state = iface->readData(radiobuf, length); int state = iface->readData(radiobuf, length);
if (state != RADIOLIB_ERR_NONE) { if (state != RADIOLIB_ERR_NONE) {
LOG_DEBUG("ignoring received packet due to error=%d\n", state); LOG_ERROR("ignoring received packet due to error=%d\n", state);
rxBad++; rxBad++;
airTime->logAirtime(RX_ALL_LOG, xmitMsec); airTime->logAirtime(RX_ALL_LOG, xmitMsec);
@@ -331,7 +331,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
// check for short packets // check for short packets
if (payloadLen < 0) { if (payloadLen < 0) {
LOG_DEBUG("ignoring received packet too short\n"); LOG_WARN("ignoring received packet too short\n");
rxBad++; rxBad++;
airTime->logAirtime(RX_ALL_LOG, xmitMsec); airTime->logAirtime(RX_ALL_LOG, xmitMsec);
} else { } else {
@@ -374,7 +374,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
{ {
printPacket("Starting low level send", txp); printPacket("Starting low level send", txp);
if (disabled || !config.lora.tx_enabled) { if (disabled || !config.lora.tx_enabled) {
LOG_DEBUG("startSend is dropping tx packet because we are disabled\n"); LOG_WARN("startSend is dropping tx packet because we are disabled\n");
packetPool.release(txp); packetPool.release(txp);
} else { } else {
setStandby(); // Cancel any already in process receives setStandby(); // Cancel any already in process receives
@@ -385,7 +385,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
int res = iface->startTransmit(radiobuf, numbytes); int res = iface->startTransmit(radiobuf, numbytes);
if (res != RADIOLIB_ERR_NONE) { if (res != RADIOLIB_ERR_NONE) {
LOG_DEBUG("startTransmit failed, error=%d\n", res); LOG_ERROR("startTransmit failed, error=%d\n", res);
RECORD_CRITICALERROR(CriticalErrorCode_RADIO_SPI_BUG); RECORD_CRITICALERROR(CriticalErrorCode_RADIO_SPI_BUG);
// This send failed, but make sure to 'complete' it properly // This send failed, but make sure to 'complete' it properly
+5 -5
View File
@@ -136,7 +136,7 @@ void Router::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelI
void Router::abortSendAndNak(Routing_Error err, MeshPacket *p) void Router::abortSendAndNak(Routing_Error err, MeshPacket *p)
{ {
LOG_DEBUG("Error=%d, returning NAK and dropping packet.\n", err); LOG_ERROR("Error=%d, returning NAK and dropping packet.\n", err);
sendAckNak(Routing_Error_NO_INTERFACE, getFrom(p), p->id, p->channel); sendAckNak(Routing_Error_NO_INTERFACE, getFrom(p), p->id, p->channel);
packetPool.release(p); packetPool.release(p);
} }
@@ -239,7 +239,7 @@ ErrorCode Router::send(MeshPacket *p)
shouldActuallyEncrypt = false; shouldActuallyEncrypt = false;
} }
LOG_DEBUG("Should encrypt MQTT?: %d\n", shouldActuallyEncrypt); LOG_INFO("Should encrypt MQTT?: %d\n", shouldActuallyEncrypt);
// the packet is currently in a decrypted state. send it now if they want decrypted packets // the packet is currently in a decrypted state. send it now if they want decrypted packets
if (mqtt && !shouldActuallyEncrypt) if (mqtt && !shouldActuallyEncrypt)
@@ -307,9 +307,9 @@ bool perhapsDecode(MeshPacket *p)
// Take those raw bytes and convert them back into a well structured protobuf we can understand // Take those raw bytes and convert them back into a well structured protobuf we can understand
memset(&p->decoded, 0, sizeof(p->decoded)); memset(&p->decoded, 0, sizeof(p->decoded));
if (!pb_decode_from_bytes(bytes, rawSize, &Data_msg, &p->decoded)) { if (!pb_decode_from_bytes(bytes, rawSize, &Data_msg, &p->decoded)) {
LOG_DEBUG("Invalid protobufs in received mesh packet (bad psk?)!\n"); LOG_ERROR("Invalid protobufs in received mesh packet (bad psk?)!\n");
} else if (p->decoded.portnum == PortNum_UNKNOWN_APP) { } else if (p->decoded.portnum == PortNum_UNKNOWN_APP) {
LOG_DEBUG("Invalid portnum (bad psk?)!\n"); LOG_ERROR("Invalid portnum (bad psk?)!\n");
} else { } else {
// parsing was successful // parsing was successful
p->which_payload_variant = MeshPacket_decoded_tag; // change type to decoded p->which_payload_variant = MeshPacket_decoded_tag; // change type to decoded
@@ -348,7 +348,7 @@ bool perhapsDecode(MeshPacket *p)
} }
} }
LOG_DEBUG("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!\n", p->channel);
return false; return false;
} }
+5 -5
View File
@@ -12,7 +12,7 @@ SX126xInterface<T>::SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq,
SPIClass &spi) SPIClass &spi)
: RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module) : RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module)
{ {
LOG_DEBUG("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy); LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
} }
/// Initialise the Driver transport hardware and software. /// Initialise the Driver transport hardware and software.
@@ -55,11 +55,11 @@ bool SX126xInterface<T>::init()
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO); int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO);
// \todo Display actual typename of the adapter, not just `SX126x` // \todo Display actual typename of the adapter, not just `SX126x`
LOG_DEBUG("SX126x init result %d\n", res); LOG_INFO("SX126x init result %d\n", res);
LOG_DEBUG("Frequency set to %f\n", getFreq()); LOG_INFO("Frequency set to %f\n", getFreq());
LOG_DEBUG("Bandwidth set to %f\n", bw); LOG_INFO("Bandwidth set to %f\n", bw);
LOG_DEBUG("Power output set to %d\n", power); LOG_INFO("Power output set to %d\n", power);
// current limit was removed from module' ctor // current limit was removed from module' ctor
// override default value (60 mA) // override default value (60 mA)
+6 -6
View File
@@ -49,7 +49,7 @@ bool SX128xInterface<T>::init()
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength); int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength);
// \todo Display actual typename of the adapter, not just `SX128x` // \todo Display actual typename of the adapter, not just `SX128x`
LOG_DEBUG("SX128x init result %d\n", res); LOG_INFO("SX128x init result %d\n", res);
if((config.lora.region != Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) { if((config.lora.region != 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.\n");
@@ -61,13 +61,13 @@ bool SX128xInterface<T>::init()
#elif defined(ARCH_NRF52) #elif defined(ARCH_NRF52)
NVIC_SystemReset(); NVIC_SystemReset();
#else #else
LOG_DEBUG("FIXME implement reboot for this platform. Skipping for now.\n"); LOG_ERROR("FIXME implement reboot for this platform. Skipping for now.\n");
#endif #endif
} }
LOG_DEBUG("Frequency set to %f\n", getFreq()); LOG_INFO("Frequency set to %f\n", getFreq());
LOG_DEBUG("Bandwidth set to %f\n", bw); LOG_INFO("Bandwidth set to %f\n", bw);
LOG_DEBUG("Power output set to %d\n", power); LOG_INFO("Power output set to %d\n", power);
if (res == RADIOLIB_ERR_NONE) if (res == RADIOLIB_ERR_NONE)
res = lora.setCRC(2); res = lora.setCRC(2);
@@ -145,7 +145,7 @@ void SX128xInterface<T>::setStandby()
int err = lora.standby(); int err = lora.standby();
if (err != RADIOLIB_ERR_NONE) if (err != RADIOLIB_ERR_NONE)
LOG_DEBUG("SX128x standby failed with error %d\n", err); LOG_ERROR("SX128x standby failed with error %d\n", err);
assert(err == RADIOLIB_ERR_NONE); assert(err == RADIOLIB_ERR_NONE);
+15 -15
View File
@@ -29,10 +29,10 @@ static int32_t reconnectETH()
Ethernet.maintain(); Ethernet.maintain();
if (!ethStartupComplete) { if (!ethStartupComplete) {
// Start web server // Start web server
LOG_DEBUG("... Starting network services\n"); LOG_INFO("... Starting network services\n");
#ifndef DISABLE_NTP #ifndef DISABLE_NTP
LOG_DEBUG("Starting NTP time client\n"); LOG_INFO("Starting NTP time client\n");
timeClient.begin(); timeClient.begin();
timeClient.setUpdateInterval(60 * 60); // Update once an hour timeClient.setUpdateInterval(60 * 60); // Update once an hour
#endif #endif
@@ -51,7 +51,7 @@ static int32_t reconnectETH()
#ifndef DISABLE_NTP #ifndef DISABLE_NTP
if (isEthernetAvailable() && (ntp_renew < millis())) { if (isEthernetAvailable() && (ntp_renew < millis())) {
LOG_DEBUG("Updating NTP time from %s\n", config.network.ntp_server); LOG_INFO("Updating NTP time from %s\n", config.network.ntp_server);
if (timeClient.update()) { if (timeClient.update()) {
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n"); LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n");
@@ -64,7 +64,7 @@ static int32_t reconnectETH()
ntp_renew = millis() + 43200 * 1000; // success, refresh every 12 hours ntp_renew = millis() + 43200 * 1000; // success, refresh every 12 hours
} else { } else {
LOG_DEBUG("NTP Update failed\n"); LOG_ERROR("NTP Update failed\n");
ntp_renew = millis() + 300 * 1000; // failure, retry every 5 minutes ntp_renew = millis() + 300 * 1000; // failure, retry every 5 minutes
} }
} }
@@ -96,32 +96,32 @@ bool initEthernet()
getMacAddr(mac); // FIXME use the BLE MAC for now... getMacAddr(mac); // FIXME use the BLE MAC for now...
if (config.network.eth_mode == Config_NetworkConfig_EthMode_DHCP) { if (config.network.eth_mode == Config_NetworkConfig_EthMode_DHCP) {
LOG_DEBUG("starting Ethernet DHCP\n"); LOG_INFO("starting Ethernet DHCP\n");
status = Ethernet.begin(mac); status = Ethernet.begin(mac);
} else if (config.network.eth_mode == Config_NetworkConfig_EthMode_STATIC) { } else if (config.network.eth_mode == Config_NetworkConfig_EthMode_STATIC) {
LOG_DEBUG("starting Ethernet Static\n"); LOG_INFO("starting Ethernet Static\n");
Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.subnet); Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.subnet);
} else { } else {
LOG_DEBUG("Ethernet Disabled\n"); LOG_INFO("Ethernet Disabled\n");
return false; return false;
} }
if (status == 0) { if (status == 0) {
if (Ethernet.hardwareStatus() == EthernetNoHardware) { if (Ethernet.hardwareStatus() == EthernetNoHardware) {
LOG_DEBUG("Ethernet shield was not found.\n"); LOG_ERROR("Ethernet shield was not found.\n");
return false; return false;
} else if (Ethernet.linkStatus() == LinkOFF) { } else if (Ethernet.linkStatus() == LinkOFF) {
LOG_DEBUG("Ethernet cable is not connected.\n"); LOG_ERROR("Ethernet cable is not connected.\n");
return false; return false;
} else{ } else{
LOG_DEBUG("Unknown Ethernet error.\n"); LOG_ERROR("Unknown Ethernet error.\n");
return false; return false;
} }
} else { } else {
LOG_DEBUG("Local IP %u.%u.%u.%u\n",Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]); LOG_INFO("Local IP %u.%u.%u.%u\n",Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
LOG_DEBUG("Subnet Mask %u.%u.%u.%u\n",Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2], Ethernet.subnetMask()[3]); LOG_INFO("Subnet Mask %u.%u.%u.%u\n",Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2], Ethernet.subnetMask()[3]);
LOG_DEBUG("Gateway IP %u.%u.%u.%u\n",Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2], Ethernet.gatewayIP()[3]); LOG_INFO("Gateway IP %u.%u.%u.%u\n",Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2], Ethernet.gatewayIP()[3]);
LOG_DEBUG("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\n",Ethernet.dnsServerIP()[0], Ethernet.dnsServerIP()[1], Ethernet.dnsServerIP()[2], Ethernet.dnsServerIP()[3]);
} }
ethEvent = new Periodic("ethConnect", reconnectETH); ethEvent = new Periodic("ethConnect", reconnectETH);
@@ -129,7 +129,7 @@ bool initEthernet()
return true; return true;
} else { } else {
LOG_DEBUG("Not using Ethernet\n"); LOG_INFO("Not using Ethernet\n");
return false; return false;
} }
} }
+4 -4
View File
@@ -9,14 +9,14 @@ void initApiServer(int port)
// Start API server on port 4403 // Start API server on port 4403
if (!apiPort) { if (!apiPort) {
apiPort = new ethServerPort(port); apiPort = new ethServerPort(port);
LOG_DEBUG("API server listening on TCP port %d\n", port); LOG_INFO("API server listening on TCP port %d\n", port);
apiPort->init(); apiPort->init();
} }
} }
ethServerAPI::ethServerAPI(EthernetClient &_client) : StreamAPI(&client), concurrency::OSThread("ethServerAPI"), client(_client) ethServerAPI::ethServerAPI(EthernetClient &_client) : StreamAPI(&client), concurrency::OSThread("ethServerAPI"), client(_client)
{ {
LOG_DEBUG("Incoming ethernet connection\n"); LOG_INFO("Incoming ethernet connection\n");
} }
ethServerAPI::~ethServerAPI() ethServerAPI::~ethServerAPI()
@@ -44,7 +44,7 @@ int32_t ethServerAPI::runOnce()
if (client.connected()) { if (client.connected()) {
return StreamAPI::runOncePart(); return StreamAPI::runOncePart();
} else { } else {
LOG_DEBUG("Client dropped connection, suspending API service\n"); LOG_INFO("Client dropped connection, suspending API service\n");
enabled = false; // we no longer need to run enabled = false; // we no longer need to run
return 0; return 0;
} }
@@ -71,7 +71,7 @@ int32_t ethServerPort::runOnce()
if (client) { if (client) {
// Close any previous connection (see FIXME in header file) // Close any previous connection (see FIXME in header file)
if (openAPI) { if (openAPI) {
LOG_DEBUG("Force closing previous TCP connection\n"); LOG_WARN("Force closing previous TCP connection\n");
delete openAPI; delete openAPI;
} }
+9 -9
View File
@@ -335,7 +335,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
if (params->getQueryParameter("delete", paramValDelete)) { if (params->getQueryParameter("delete", paramValDelete)) {
std::string pathDelete = "/" + paramValDelete; std::string pathDelete = "/" + paramValDelete;
if (FSCom.remove(pathDelete.c_str())) { if (FSCom.remove(pathDelete.c_str())) {
Serial.println(pathDelete.c_str()); LOG_INFO("%s\n", pathDelete.c_str());
JSONObject jsonObjOuter; JSONObject jsonObjOuter;
jsonObjOuter["status"] = new JSONValue("ok"); jsonObjOuter["status"] = new JSONValue("ok");
JSONValue *value = new JSONValue(jsonObjOuter); JSONValue *value = new JSONValue(jsonObjOuter);
@@ -343,7 +343,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
delete value; delete value;
return; return;
} else { } else {
Serial.println(pathDelete.c_str()); LOG_INFO("%s\n", pathDelete.c_str());
JSONObject jsonObjOuter; JSONObject jsonObjOuter;
jsonObjOuter["status"] = new JSONValue("Error"); jsonObjOuter["status"] = new JSONValue("Error");
JSONValue *value = new JSONValue(jsonObjOuter); JSONValue *value = new JSONValue(jsonObjOuter);
@@ -379,13 +379,13 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
if (FSCom.exists(filename.c_str())) { if (FSCom.exists(filename.c_str())) {
file = FSCom.open(filename.c_str()); file = FSCom.open(filename.c_str());
if (!file.available()) { if (!file.available()) {
LOG_DEBUG("File not available - %s\n", filename.c_str()); LOG_WARN("File not available - %s\n", filename.c_str());
} }
} else if (FSCom.exists(filenameGzip.c_str())) { } else if (FSCom.exists(filenameGzip.c_str())) {
file = FSCom.open(filenameGzip.c_str()); file = FSCom.open(filenameGzip.c_str());
res->setHeader("Content-Encoding", "gzip"); res->setHeader("Content-Encoding", "gzip");
if (!file.available()) { if (!file.available()) {
LOG_DEBUG("File not available - %s\n", filenameGzip.c_str()); LOG_WARN("File not available - %s\n", filenameGzip.c_str());
} }
} else { } else {
has_set_content_type = true; has_set_content_type = true;
@@ -393,7 +393,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
file = FSCom.open(filenameGzip.c_str()); file = FSCom.open(filenameGzip.c_str());
res->setHeader("Content-Type", "text/html"); res->setHeader("Content-Type", "text/html");
if (!file.available()) { if (!file.available()) {
LOG_DEBUG("File not available - %s\n", filenameGzip.c_str()); LOG_WARN("File not available - %s\n", filenameGzip.c_str());
res->println("Web server is running.<br><br>The content you are looking for can't be found. Please see: <a " 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/getting-started/faq#wifi--web-browser>FAQ</a>.<br><br><a " "href=https://meshtastic.org/docs/getting-started/faq#wifi--web-browser>FAQ</a>.<br><br><a "
"href=/admin>admin</a>"); "href=/admin>admin</a>");
@@ -437,7 +437,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
return; return;
} else { } else {
LOG_DEBUG("ERROR: This should not have happened...\n"); LOG_ERROR("This should not have happened...\n");
res->println("ERROR: This should not have happened..."); res->println("ERROR: This should not have happened...");
} }
} }
@@ -472,7 +472,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
LOG_DEBUG("Form Upload - multipart/form-data\n"); LOG_DEBUG("Form Upload - multipart/form-data\n");
parser = new HTTPMultipartBodyParser(req); parser = new HTTPMultipartBodyParser(req);
} else { } else {
Serial.printf("Unknown POST Content-Type: %s\n", contentType.c_str()); LOG_DEBUG("Unknown POST Content-Type: %s\n", contentType.c_str());
return; return;
} }
@@ -671,7 +671,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
*/ */
void handleHotspot(HTTPRequest *req, HTTPResponse *res) void handleHotspot(HTTPRequest *req, HTTPResponse *res)
{ {
LOG_DEBUG("Hotspot Request\n"); LOG_INFO("Hotspot Request\n");
/* /*
If we don't do a redirect, be sure to return a "Success" message If we don't do a redirect, be sure to return a "Success" message
@@ -697,7 +697,7 @@ void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res)
res->println("<h1>Meshtastic</h1>\n"); res->println("<h1>Meshtastic</h1>\n");
res->println("Deleting Content in /static/*"); res->println("Deleting Content in /static/*");
LOG_DEBUG("Deleting files from /static/* : \n"); LOG_INFO("Deleting files from /static/* : \n");
htmlDeleteDir("/static"); htmlDeleteDir("/static");
+10 -10
View File
@@ -74,13 +74,13 @@ static void taskCreateCert(void *parameter)
prefs.remove("cert"); prefs.remove("cert");
#endif #endif
LOG_DEBUG("Checking if we have a previously saved SSL Certificate.\n"); LOG_INFO("Checking if we have a previously saved SSL Certificate.\n");
size_t pkLen = prefs.getBytesLength("PK"); size_t pkLen = prefs.getBytesLength("PK");
size_t certLen = prefs.getBytesLength("cert"); size_t certLen = prefs.getBytesLength("cert");
if (pkLen && certLen) { if (pkLen && certLen) {
LOG_DEBUG("Existing SSL Certificate found!\n"); LOG_INFO("Existing SSL Certificate found!\n");
uint8_t *pkBuffer = new uint8_t[pkLen]; uint8_t *pkBuffer = new uint8_t[pkLen];
prefs.getBytes("PK", pkBuffer, pkLen); prefs.getBytes("PK", pkBuffer, pkLen);
@@ -95,7 +95,7 @@ static void taskCreateCert(void *parameter)
} else { } else {
LOG_DEBUG("Creating the certificate. This may take a while. Please wait...\n"); LOG_INFO("Creating the certificate. This may take a while. Please wait...\n");
yield(); yield();
cert = new SSLCert(); cert = new SSLCert();
yield(); yield();
@@ -104,10 +104,10 @@ static void taskCreateCert(void *parameter)
yield(); yield();
if (createCertResult != 0) { if (createCertResult != 0) {
LOG_DEBUG("Creating the certificate failed\n"); LOG_ERROR("Creating the certificate failed\n");
} else { } else {
LOG_DEBUG("Creating the certificate was successful\n"); LOG_INFO("Creating the certificate was successful\n");
LOG_DEBUG("Created Private Key: %d Bytes\n", cert->getPKLength()); LOG_DEBUG("Created Private Key: %d Bytes\n", cert->getPKLength());
@@ -159,7 +159,7 @@ void createSSLCert()
runLoop = true; runLoop = true;
} }
} }
LOG_DEBUG("SSL Cert Ready!\n"); LOG_INFO("SSL Cert Ready!\n");
} }
} }
@@ -191,15 +191,15 @@ void initWebServer()
registerHandlers(insecureServer, secureServer); registerHandlers(insecureServer, secureServer);
if (secureServer) { if (secureServer) {
LOG_DEBUG("Starting Secure Web Server...\n"); LOG_INFO("Starting Secure Web Server...\n");
secureServer->start(); secureServer->start();
} }
LOG_DEBUG("Starting Insecure Web Server...\n"); LOG_INFO("Starting Insecure Web Server...\n");
insecureServer->start(); insecureServer->start();
if (insecureServer->isRunning()) { if (insecureServer->isRunning()) {
LOG_DEBUG("Web Servers Ready! :-) \n"); LOG_INFO("Web Servers Ready! :-) \n");
isWebServerReady = true; isWebServerReady = true;
} else { } else {
LOG_DEBUG("Web Servers Failed! ;-( \n"); LOG_ERROR("Web Servers Failed! ;-( \n");
} }
} }
+50 -53
View File
@@ -56,7 +56,7 @@ static int32_t reconnectWiFi()
// Make sure we clear old connection credentials // Make sure we clear old connection credentials
WiFi.disconnect(false, true); WiFi.disconnect(false, true);
LOG_DEBUG("Reconnecting to WiFi access point %s\n",wifiName); LOG_INFO("Reconnecting to WiFi access point %s\n",wifiName);
WiFi.mode(WIFI_MODE_STA); WiFi.mode(WIFI_MODE_STA);
WiFi.begin(wifiName, wifiPsw); WiFi.begin(wifiName, wifiPsw);
@@ -101,12 +101,12 @@ bool isWifiAvailable()
// Disable WiFi // Disable WiFi
void deinitWifi() void deinitWifi()
{ {
LOG_DEBUG("WiFi deinit\n"); LOG_INFO("WiFi deinit\n");
if (isWifiAvailable()) { if (isWifiAvailable()) {
WiFi.disconnect(true); WiFi.disconnect(true);
WiFi.mode(WIFI_MODE_NULL); WiFi.mode(WIFI_MODE_NULL);
LOG_DEBUG("WiFi Turned Off\n"); LOG_INFO("WiFi Turned Off\n");
// WiFi.printDiag(Serial); // WiFi.printDiag(Serial);
} }
} }
@@ -115,20 +115,20 @@ static void onNetworkConnected()
{ {
if (!APStartupComplete) { if (!APStartupComplete) {
// Start web server // Start web server
LOG_DEBUG("Starting network services\n"); LOG_INFO("Starting network services\n");
// start mdns // start mdns
if (!MDNS.begin("Meshtastic")) { if (!MDNS.begin("Meshtastic")) {
LOG_DEBUG("Error setting up MDNS responder!\n"); LOG_ERROR("Error setting up MDNS responder!\n");
} else { } else {
LOG_DEBUG("mDNS responder started\n"); LOG_INFO("mDNS responder started\n");
LOG_DEBUG("mDNS Host: Meshtastic.local\n"); LOG_INFO("mDNS Host: Meshtastic.local\n");
MDNS.addService("http", "tcp", 80); MDNS.addService("http", "tcp", 80);
MDNS.addService("https", "tcp", 443); MDNS.addService("https", "tcp", 443);
} }
#ifndef DISABLE_NTP #ifndef DISABLE_NTP
LOG_DEBUG("Starting NTP time client\n"); LOG_INFO("Starting NTP time client\n");
timeClient.begin(); timeClient.begin();
timeClient.setUpdateInterval(60 * 60); // Update once an hour timeClient.setUpdateInterval(60 * 60); // Update once an hour
#endif #endif
@@ -182,8 +182,7 @@ bool initWifi()
WiFi.onEvent( WiFi.onEvent(
[](WiFiEvent_t event, WiFiEventInfo_t info) { [](WiFiEvent_t event, WiFiEventInfo_t info) {
Serial.print("WiFi lost connection. Reason: "); LOG_WARN("WiFi lost connection. Reason: %s", info.wifi_sta_disconnected.reason);
Serial.println(info.wifi_sta_disconnected.reason);
/* /*
If we are disconnected from the AP for some reason, If we are disconnected from the AP for some reason,
@@ -201,7 +200,7 @@ bool initWifi()
} }
return true; return true;
} else { } else {
LOG_DEBUG("Not using WIFI\n"); LOG_INFO("Not using WIFI\n");
return false; return false;
} }
} }
@@ -213,133 +212,131 @@ static void WiFiEvent(WiFiEvent_t event)
switch (event) { switch (event) {
case ARDUINO_EVENT_WIFI_READY: case ARDUINO_EVENT_WIFI_READY:
LOG_DEBUG("WiFi interface ready\n"); LOG_INFO("WiFi interface ready\n");
break; break;
case ARDUINO_EVENT_WIFI_SCAN_DONE: case ARDUINO_EVENT_WIFI_SCAN_DONE:
LOG_DEBUG("Completed scan for access points\n"); LOG_INFO("Completed scan for access points\n");
break; break;
case ARDUINO_EVENT_WIFI_STA_START: case ARDUINO_EVENT_WIFI_STA_START:
LOG_DEBUG("WiFi station started\n"); LOG_INFO("WiFi station started\n");
break; break;
case ARDUINO_EVENT_WIFI_STA_STOP: case ARDUINO_EVENT_WIFI_STA_STOP:
LOG_DEBUG("WiFi station stopped\n"); LOG_INFO("WiFi station stopped\n");
break; break;
case ARDUINO_EVENT_WIFI_STA_CONNECTED: case ARDUINO_EVENT_WIFI_STA_CONNECTED:
LOG_DEBUG("Connected to access point\n"); LOG_INFO("Connected to access point\n");
break; break;
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
LOG_DEBUG("Disconnected from WiFi access point\n"); LOG_INFO("Disconnected from WiFi access point\n");
WiFi.disconnect(false, true); WiFi.disconnect(false, true);
needReconnect = true; needReconnect = true;
wifiReconnect->setIntervalFromNow(1000); wifiReconnect->setIntervalFromNow(1000);
break; break;
case ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE: case ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE:
LOG_DEBUG("Authentication mode of access point has changed\n"); LOG_INFO("Authentication mode of access point has changed\n");
break; break;
case ARDUINO_EVENT_WIFI_STA_GOT_IP: case ARDUINO_EVENT_WIFI_STA_GOT_IP:
LOG_DEBUG("Obtained IP address: "); LOG_INFO("Obtained IP address: ", WiFi.localIPv6());
Serial.println(WiFi.localIP());
onNetworkConnected(); onNetworkConnected();
break; break;
case ARDUINO_EVENT_WIFI_STA_GOT_IP6: case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
LOG_DEBUG("Obtained IP6 address: "); LOG_INFO("Obtained IP6 address: %s", WiFi.localIPv6());
Serial.println(WiFi.localIPv6());
break; break;
case ARDUINO_EVENT_WIFI_STA_LOST_IP: case ARDUINO_EVENT_WIFI_STA_LOST_IP:
LOG_DEBUG("Lost IP address and IP address is reset to 0\n"); LOG_INFO("Lost IP address and IP address is reset to 0\n");
WiFi.disconnect(false, true); WiFi.disconnect(false, true);
needReconnect = true; needReconnect = true;
wifiReconnect->setIntervalFromNow(1000); wifiReconnect->setIntervalFromNow(1000);
break; break;
case ARDUINO_EVENT_WPS_ER_SUCCESS: case ARDUINO_EVENT_WPS_ER_SUCCESS:
LOG_DEBUG("WiFi Protected Setup (WPS): succeeded in enrollee mode\n"); LOG_INFO("WiFi Protected Setup (WPS): succeeded in enrollee mode\n");
break; break;
case ARDUINO_EVENT_WPS_ER_FAILED: case ARDUINO_EVENT_WPS_ER_FAILED:
LOG_DEBUG("WiFi Protected Setup (WPS): failed in enrollee mode\n"); LOG_INFO("WiFi Protected Setup (WPS): failed in enrollee mode\n");
break; break;
case ARDUINO_EVENT_WPS_ER_TIMEOUT: case ARDUINO_EVENT_WPS_ER_TIMEOUT:
LOG_DEBUG("WiFi Protected Setup (WPS): timeout in enrollee mode\n"); LOG_INFO("WiFi Protected Setup (WPS): timeout in enrollee mode\n");
break; break;
case ARDUINO_EVENT_WPS_ER_PIN: case ARDUINO_EVENT_WPS_ER_PIN:
LOG_DEBUG("WiFi Protected Setup (WPS): pin code in enrollee mode\n"); LOG_INFO("WiFi Protected Setup (WPS): pin code in enrollee mode\n");
break; break;
case ARDUINO_EVENT_WPS_ER_PBC_OVERLAP: case ARDUINO_EVENT_WPS_ER_PBC_OVERLAP:
LOG_DEBUG("WiFi Protected Setup (WPS): push button overlap in enrollee mode\n"); LOG_INFO("WiFi Protected Setup (WPS): push button overlap in enrollee mode\n");
break; break;
case ARDUINO_EVENT_WIFI_AP_START: case ARDUINO_EVENT_WIFI_AP_START:
LOG_DEBUG("WiFi access point started\n"); LOG_INFO("WiFi access point started\n");
break; break;
case ARDUINO_EVENT_WIFI_AP_STOP: case ARDUINO_EVENT_WIFI_AP_STOP:
LOG_DEBUG("WiFi access point stopped\n"); LOG_INFO("WiFi access point stopped\n");
break; break;
case ARDUINO_EVENT_WIFI_AP_STACONNECTED: case ARDUINO_EVENT_WIFI_AP_STACONNECTED:
LOG_DEBUG("Client connected\n"); LOG_INFO("Client connected\n");
break; break;
case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED: case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED:
LOG_DEBUG("Client disconnected\n"); LOG_INFO("Client disconnected\n");
break; break;
case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED: case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED:
LOG_DEBUG("Assigned IP address to client\n"); LOG_INFO("Assigned IP address to client\n");
break; break;
case ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED: case ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED:
LOG_DEBUG("Received probe request\n"); LOG_INFO("Received probe request\n");
break; break;
case ARDUINO_EVENT_WIFI_AP_GOT_IP6: case ARDUINO_EVENT_WIFI_AP_GOT_IP6:
LOG_DEBUG("IPv6 is preferred\n"); LOG_INFO("IPv6 is preferred\n");
break; break;
case ARDUINO_EVENT_WIFI_FTM_REPORT: case ARDUINO_EVENT_WIFI_FTM_REPORT:
LOG_DEBUG("Fast Transition Management report\n"); LOG_INFO("Fast Transition Management report\n");
break; break;
case ARDUINO_EVENT_ETH_START: case ARDUINO_EVENT_ETH_START:
LOG_DEBUG("Ethernet started\n"); LOG_INFO("Ethernet started\n");
break; break;
case ARDUINO_EVENT_ETH_STOP: case ARDUINO_EVENT_ETH_STOP:
LOG_DEBUG("Ethernet stopped\n"); LOG_INFO("Ethernet stopped\n");
break; break;
case ARDUINO_EVENT_ETH_CONNECTED: case ARDUINO_EVENT_ETH_CONNECTED:
LOG_DEBUG("Ethernet connected\n"); LOG_INFO("Ethernet connected\n");
break; break;
case ARDUINO_EVENT_ETH_DISCONNECTED: case ARDUINO_EVENT_ETH_DISCONNECTED:
LOG_DEBUG("Ethernet disconnected\n"); LOG_INFO("Ethernet disconnected\n");
break; break;
case ARDUINO_EVENT_ETH_GOT_IP: case ARDUINO_EVENT_ETH_GOT_IP:
LOG_DEBUG("Obtained IP address (ARDUINO_EVENT_ETH_GOT_IP)\n"); LOG_INFO("Obtained IP address (ARDUINO_EVENT_ETH_GOT_IP)\n");
break; break;
case ARDUINO_EVENT_ETH_GOT_IP6: case ARDUINO_EVENT_ETH_GOT_IP6:
LOG_DEBUG("Obtained IP6 address (ARDUINO_EVENT_ETH_GOT_IP6)\n"); LOG_INFO("Obtained IP6 address (ARDUINO_EVENT_ETH_GOT_IP6)\n");
break; break;
case ARDUINO_EVENT_SC_SCAN_DONE: case ARDUINO_EVENT_SC_SCAN_DONE:
LOG_DEBUG("SmartConfig: Scan done\n"); LOG_INFO("SmartConfig: Scan done\n");
break; break;
case ARDUINO_EVENT_SC_FOUND_CHANNEL: case ARDUINO_EVENT_SC_FOUND_CHANNEL:
LOG_DEBUG("SmartConfig: Found channel\n"); LOG_INFO("SmartConfig: Found channel\n");
break; break;
case ARDUINO_EVENT_SC_GOT_SSID_PSWD: case ARDUINO_EVENT_SC_GOT_SSID_PSWD:
LOG_DEBUG("SmartConfig: Got SSID and password\n"); LOG_INFO("SmartConfig: Got SSID and password\n");
break; break;
case ARDUINO_EVENT_SC_SEND_ACK_DONE: case ARDUINO_EVENT_SC_SEND_ACK_DONE:
LOG_DEBUG("SmartConfig: Send ACK done\n"); LOG_INFO("SmartConfig: Send ACK done\n");
break; break;
case ARDUINO_EVENT_PROV_INIT: case ARDUINO_EVENT_PROV_INIT:
LOG_DEBUG("Provisioning: Init\n"); LOG_INFO("Provisioning: Init\n");
break; break;
case ARDUINO_EVENT_PROV_DEINIT: case ARDUINO_EVENT_PROV_DEINIT:
LOG_DEBUG("Provisioning: Stopped\n"); LOG_INFO("Provisioning: Stopped\n");
break; break;
case ARDUINO_EVENT_PROV_START: case ARDUINO_EVENT_PROV_START:
LOG_DEBUG("Provisioning: Started\n"); LOG_INFO("Provisioning: Started\n");
break; break;
case ARDUINO_EVENT_PROV_END: case ARDUINO_EVENT_PROV_END:
LOG_DEBUG("Provisioning: End\n"); LOG_INFO("Provisioning: End\n");
break; break;
case ARDUINO_EVENT_PROV_CRED_RECV: case ARDUINO_EVENT_PROV_CRED_RECV:
LOG_DEBUG("Provisioning: Credentials received\n"); LOG_INFO("Provisioning: Credentials received\n");
break; break;
case ARDUINO_EVENT_PROV_CRED_FAIL: case ARDUINO_EVENT_PROV_CRED_FAIL:
LOG_DEBUG("Provisioning: Credentials failed\n"); LOG_INFO("Provisioning: Credentials failed\n");
break; break;
case ARDUINO_EVENT_PROV_CRED_SUCCESS: case ARDUINO_EVENT_PROV_CRED_SUCCESS:
LOG_DEBUG("Provisioning: Credentials success\n"); LOG_INFO("Provisioning: Credentials success\n");
break; break;
default: default:
break; break;
+2 -2
View File
@@ -12,7 +12,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); pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
if (!pb_encode(&stream, fields, src_struct)) { if (!pb_encode(&stream, fields, src_struct)) {
LOG_DEBUG("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream)); LOG_ERROR("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream));
assert(0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options assert(0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options
} else { } else {
return stream.bytes_written; return stream.bytes_written;
@@ -24,7 +24,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); pb_istream_t stream = pb_istream_from_buffer(srcbuf, srcbufsize);
if (!pb_decode(&stream, fields, dest_struct)) { if (!pb_decode(&stream, fields, dest_struct)) {
LOG_DEBUG("Error: can't decode protobuf reason='%s', pb_msgdesc 0x%p\n", PB_GET_ERROR(&stream), fields); LOG_ERROR("Can't decode protobuf reason='%s', pb_msgdesc 0x%p\n", PB_GET_ERROR(&stream), fields);
return false; return false;
} else { } else {
return true; return true;
+4 -4
View File
@@ -9,14 +9,14 @@ void initApiServer(int port)
// Start API server on port 4403 // Start API server on port 4403
if (!apiPort) { if (!apiPort) {
apiPort = new WiFiServerPort(port); apiPort = new WiFiServerPort(port);
LOG_DEBUG("API server listening on TCP port %d\n", port); LOG_INFO("API server listening on TCP port %d\n", port);
apiPort->init(); apiPort->init();
} }
} }
WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : StreamAPI(&client), concurrency::OSThread("WiFiServerAPI"), client(_client) WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : StreamAPI(&client), concurrency::OSThread("WiFiServerAPI"), client(_client)
{ {
LOG_DEBUG("Incoming wifi connection\n"); LOG_INFO("Incoming wifi connection\n");
} }
WiFiServerAPI::~WiFiServerAPI() WiFiServerAPI::~WiFiServerAPI()
@@ -44,7 +44,7 @@ int32_t WiFiServerAPI::runOnce()
if (client.connected()) { if (client.connected()) {
return StreamAPI::runOncePart(); return StreamAPI::runOncePart();
} else { } else {
LOG_DEBUG("Client dropped connection, suspending API service\n"); LOG_INFO("Client dropped connection, suspending API service\n");
enabled = false; // we no longer need to run enabled = false; // we no longer need to run
return 0; return 0;
} }
@@ -71,7 +71,7 @@ int32_t WiFiServerPort::runOnce()
if (client) { if (client) {
// Close any previous connection (see FIXME in header file) // Close any previous connection (see FIXME in header file)
if (openAPI) { if (openAPI) {
LOG_DEBUG("Force closing previous TCP connection\n"); LOG_INFO("Force closing previous TCP connection\n");
delete openAPI; delete openAPI;
} }
+54 -54
View File
@@ -50,23 +50,23 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
* Getters * Getters
*/ */
case AdminMessage_get_owner_request_tag: case AdminMessage_get_owner_request_tag:
LOG_DEBUG("Client is getting owner\n"); LOG_INFO("Client is getting owner\n");
handleGetOwner(mp); handleGetOwner(mp);
break; break;
case AdminMessage_get_config_request_tag: case AdminMessage_get_config_request_tag:
LOG_DEBUG("Client is getting config\n"); LOG_INFO("Client is getting config\n");
handleGetConfig(mp, r->get_config_request); handleGetConfig(mp, r->get_config_request);
break; break;
case AdminMessage_get_module_config_request_tag: case AdminMessage_get_module_config_request_tag:
LOG_DEBUG("Client is getting module config\n"); LOG_INFO("Client is getting module config\n");
handleGetModuleConfig(mp, r->get_module_config_request); handleGetModuleConfig(mp, r->get_module_config_request);
break; break;
case AdminMessage_get_channel_request_tag: { case AdminMessage_get_channel_request_tag: {
uint32_t i = r->get_channel_request - 1; uint32_t i = r->get_channel_request - 1;
LOG_DEBUG("Client is getting channel %u\n", i); LOG_INFO("Client is getting channel %u\n", i);
if (i >= MAX_NUM_CHANNELS) if (i >= MAX_NUM_CHANNELS)
myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp); myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp);
else else
@@ -78,22 +78,22 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
* Setters * Setters
*/ */
case AdminMessage_set_owner_tag: case AdminMessage_set_owner_tag:
LOG_DEBUG("Client is setting owner\n"); LOG_INFO("Client is setting owner\n");
handleSetOwner(r->set_owner); handleSetOwner(r->set_owner);
break; break;
case AdminMessage_set_config_tag: case AdminMessage_set_config_tag:
LOG_DEBUG("Client is setting the config\n"); LOG_INFO("Client is setting the config\n");
handleSetConfig(r->set_config); handleSetConfig(r->set_config);
break; break;
case AdminMessage_set_module_config_tag: case AdminMessage_set_module_config_tag:
LOG_DEBUG("Client is setting the module config\n"); LOG_INFO("Client is setting the module config\n");
handleSetModuleConfig(r->set_module_config); handleSetModuleConfig(r->set_module_config);
break; break;
case AdminMessage_set_channel_tag: case AdminMessage_set_channel_tag:
LOG_DEBUG("Client is setting channel %d\n", r->set_channel.index); LOG_INFO("Client is setting channel %d\n", r->set_channel.index);
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS) if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp); myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp);
else else
@@ -111,15 +111,15 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
int32_t s = r->reboot_ota_seconds; int32_t s = r->reboot_ota_seconds;
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
if (BleOta::getOtaAppVersion().isEmpty()) { if (BleOta::getOtaAppVersion().isEmpty()) {
LOG_DEBUG("No OTA firmware available, scheduling regular reboot in %d seconds\n", s); LOG_INFO("No OTA firmware available, scheduling regular reboot in %d seconds\n", s);
screen->startRebootScreen(); screen->startRebootScreen();
}else{ }else{
screen->startFirmwareUpdateScreen(); screen->startFirmwareUpdateScreen();
BleOta::switchToOtaApp(); BleOta::switchToOtaApp();
LOG_DEBUG("Rebooting to OTA in %d seconds\n", s); LOG_INFO("Rebooting to OTA in %d seconds\n", s);
} }
#else #else
LOG_DEBUG("Not on ESP32, scheduling regular reboot in %d seconds\n", s); LOG_INFO("Not on ESP32, scheduling regular reboot in %d seconds\n", s);
screen->startRebootScreen(); screen->startRebootScreen();
#endif #endif
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000); rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
@@ -127,40 +127,40 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
} }
case AdminMessage_shutdown_seconds_tag: { case AdminMessage_shutdown_seconds_tag: {
int32_t s = r->shutdown_seconds; int32_t s = r->shutdown_seconds;
LOG_DEBUG("Shutdown in %d seconds\n", s); LOG_INFO("Shutdown in %d seconds\n", s);
shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000); shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
break; break;
} }
case AdminMessage_get_device_metadata_request_tag: { case AdminMessage_get_device_metadata_request_tag: {
LOG_DEBUG("Client is getting device metadata\n"); LOG_INFO("Client is getting device metadata\n");
handleGetDeviceMetadata(mp); handleGetDeviceMetadata(mp);
break; break;
} }
case AdminMessage_factory_reset_tag: { case AdminMessage_factory_reset_tag: {
LOG_DEBUG("Initiating factory reset\n"); LOG_INFO("Initiating factory reset\n");
nodeDB.factoryReset(); nodeDB.factoryReset();
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
break; break;
} case AdminMessage_nodedb_reset_tag: { } case AdminMessage_nodedb_reset_tag: {
LOG_DEBUG("Initiating node-db reset\n"); LOG_INFO("Initiating node-db reset\n");
nodeDB.resetNodes(); nodeDB.resetNodes();
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
break; break;
} }
case AdminMessage_begin_edit_settings_tag: { case AdminMessage_begin_edit_settings_tag: {
LOG_DEBUG("Beginning transaction for editing settings\n"); LOG_INFO("Beginning transaction for editing settings\n");
hasOpenEditTransaction = true; hasOpenEditTransaction = true;
break; break;
} }
case AdminMessage_commit_edit_settings_tag: { case AdminMessage_commit_edit_settings_tag: {
LOG_DEBUG("Committing transaction for edited settings\n"); LOG_INFO("Committing transaction for edited settings\n");
hasOpenEditTransaction = false; hasOpenEditTransaction = false;
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
break; break;
} }
#ifdef ARCH_PORTDUINO #ifdef ARCH_PORTDUINO
case AdminMessage_exit_simulator_tag: case AdminMessage_exit_simulator_tag:
LOG_DEBUG("Exiting simulator\n"); LOG_INFO("Exiting simulator\n");
_exit(0); _exit(0);
break; break;
#endif #endif
@@ -175,7 +175,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
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\n", r->which_payload_variant);
} else if (handleResult != AdminMessageHandleResult::HANDLED) { } else if (handleResult != AdminMessageHandleResult::HANDLED) {
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages // Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
LOG_DEBUG("Ignoring nonrelevant admin %d\n", r->which_payload_variant); LOG_INFO("Ignoring nonrelevant admin %d\n", r->which_payload_variant);
} }
break; break;
} }
@@ -229,7 +229,7 @@ void AdminModule::handleSetConfig(const Config &c)
switch (c.which_payload_variant) { switch (c.which_payload_variant) {
case Config_device_tag: case Config_device_tag:
LOG_DEBUG("Setting config: Device\n"); LOG_INFO("Setting config: Device\n");
config.has_device = true; config.has_device = true;
config.device = c.payload_variant.device; config.device = c.payload_variant.device;
// If we're setting router role for the first time, install its intervals // If we're setting router role for the first time, install its intervals
@@ -240,29 +240,29 @@ void AdminModule::handleSetConfig(const Config &c)
} }
break; break;
case Config_position_tag: case Config_position_tag:
LOG_DEBUG("Setting config: Position\n"); LOG_INFO("Setting config: Position\n");
config.has_position = true; config.has_position = true;
config.position = c.payload_variant.position; config.position = c.payload_variant.position;
// Save nodedb as well in case we got a fixed position packet // Save nodedb as well in case we got a fixed position packet
saveChanges(SEGMENT_DEVICESTATE, false); saveChanges(SEGMENT_DEVICESTATE, false);
break; break;
case Config_power_tag: case Config_power_tag:
LOG_DEBUG("Setting config: Power\n"); LOG_INFO("Setting config: Power\n");
config.has_power = true; config.has_power = true;
config.power = c.payload_variant.power; config.power = c.payload_variant.power;
break; break;
case Config_network_tag: case Config_network_tag:
LOG_DEBUG("Setting config: WiFi\n"); LOG_INFO("Setting config: WiFi\n");
config.has_network = true; config.has_network = true;
config.network = c.payload_variant.network; config.network = c.payload_variant.network;
break; break;
case Config_display_tag: case Config_display_tag:
LOG_DEBUG("Setting config: Display\n"); LOG_INFO("Setting config: Display\n");
config.has_display = true; config.has_display = true;
config.display = c.payload_variant.display; config.display = c.payload_variant.display;
break; break;
case Config_lora_tag: case Config_lora_tag:
LOG_DEBUG("Setting config: LoRa\n"); LOG_INFO("Setting config: LoRa\n");
config.has_lora = true; config.has_lora = true;
config.lora = c.payload_variant.lora; config.lora = c.payload_variant.lora;
if (isRegionUnset && if (isRegionUnset &&
@@ -271,7 +271,7 @@ void AdminModule::handleSetConfig(const Config &c)
} }
break; break;
case Config_bluetooth_tag: case Config_bluetooth_tag:
LOG_DEBUG("Setting config: Bluetooth\n"); LOG_INFO("Setting config: Bluetooth\n");
config.has_bluetooth = true; config.has_bluetooth = true;
config.bluetooth = c.payload_variant.bluetooth; config.bluetooth = c.payload_variant.bluetooth;
break; break;
@@ -284,47 +284,47 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
{ {
switch (c.which_payload_variant) { switch (c.which_payload_variant) {
case ModuleConfig_mqtt_tag: case ModuleConfig_mqtt_tag:
LOG_DEBUG("Setting module config: MQTT\n"); LOG_INFO("Setting module config: MQTT\n");
moduleConfig.has_mqtt = true; moduleConfig.has_mqtt = true;
moduleConfig.mqtt = c.payload_variant.mqtt; moduleConfig.mqtt = c.payload_variant.mqtt;
break; break;
case ModuleConfig_serial_tag: case ModuleConfig_serial_tag:
LOG_DEBUG("Setting module config: Serial\n"); LOG_INFO("Setting module config: Serial\n");
moduleConfig.has_serial = true; moduleConfig.has_serial = true;
moduleConfig.serial = c.payload_variant.serial; moduleConfig.serial = c.payload_variant.serial;
break; break;
case ModuleConfig_external_notification_tag: case ModuleConfig_external_notification_tag:
LOG_DEBUG("Setting module config: External Notification\n"); LOG_INFO("Setting module config: External Notification\n");
moduleConfig.has_external_notification = true; moduleConfig.has_external_notification = true;
moduleConfig.external_notification = c.payload_variant.external_notification; moduleConfig.external_notification = c.payload_variant.external_notification;
break; break;
case ModuleConfig_store_forward_tag: case ModuleConfig_store_forward_tag:
LOG_DEBUG("Setting module config: Store & Forward\n"); LOG_INFO("Setting module config: Store & Forward\n");
moduleConfig.has_store_forward = true; moduleConfig.has_store_forward = true;
moduleConfig.store_forward = c.payload_variant.store_forward; moduleConfig.store_forward = c.payload_variant.store_forward;
break; break;
case ModuleConfig_range_test_tag: case ModuleConfig_range_test_tag:
LOG_DEBUG("Setting module config: Range Test\n"); LOG_INFO("Setting module config: Range Test\n");
moduleConfig.has_range_test = true; moduleConfig.has_range_test = true;
moduleConfig.range_test = c.payload_variant.range_test; moduleConfig.range_test = c.payload_variant.range_test;
break; break;
case ModuleConfig_telemetry_tag: case ModuleConfig_telemetry_tag:
LOG_DEBUG("Setting module config: Telemetry\n"); LOG_INFO("Setting module config: Telemetry\n");
moduleConfig.has_telemetry = true; moduleConfig.has_telemetry = true;
moduleConfig.telemetry = c.payload_variant.telemetry; moduleConfig.telemetry = c.payload_variant.telemetry;
break; break;
case ModuleConfig_canned_message_tag: case ModuleConfig_canned_message_tag:
LOG_DEBUG("Setting module config: Canned Message\n"); LOG_INFO("Setting module config: Canned Message\n");
moduleConfig.has_canned_message = true; moduleConfig.has_canned_message = true;
moduleConfig.canned_message = c.payload_variant.canned_message; moduleConfig.canned_message = c.payload_variant.canned_message;
break; break;
case ModuleConfig_audio_tag: case ModuleConfig_audio_tag:
LOG_DEBUG("Setting module config: Audio\n"); LOG_INFO("Setting module config: Audio\n");
moduleConfig.has_audio = true; moduleConfig.has_audio = true;
moduleConfig.audio = c.payload_variant.audio; moduleConfig.audio = c.payload_variant.audio;
break; break;
case ModuleConfig_remote_hardware_tag: case ModuleConfig_remote_hardware_tag:
LOG_DEBUG("Setting module config: Remote Hardware\n"); LOG_INFO("Setting module config: Remote Hardware\n");
moduleConfig.has_remote_hardware = true; moduleConfig.has_remote_hardware = true;
moduleConfig.remote_hardware = c.payload_variant.remote_hardware; moduleConfig.remote_hardware = c.payload_variant.remote_hardware;
break; break;
@@ -363,38 +363,38 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
if (req.decoded.want_response) { if (req.decoded.want_response) {
switch (configType) { switch (configType) {
case AdminMessage_ConfigType_DEVICE_CONFIG: case AdminMessage_ConfigType_DEVICE_CONFIG:
LOG_DEBUG("Getting config: Device\n"); LOG_INFO("Getting config: Device\n");
res.get_config_response.which_payload_variant = Config_device_tag; res.get_config_response.which_payload_variant = Config_device_tag;
res.get_config_response.payload_variant.device = config.device; res.get_config_response.payload_variant.device = config.device;
break; break;
case AdminMessage_ConfigType_POSITION_CONFIG: case AdminMessage_ConfigType_POSITION_CONFIG:
LOG_DEBUG("Getting config: Position\n"); LOG_INFO("Getting config: Position\n");
res.get_config_response.which_payload_variant = Config_position_tag; res.get_config_response.which_payload_variant = Config_position_tag;
res.get_config_response.payload_variant.position = config.position; res.get_config_response.payload_variant.position = config.position;
break; break;
case AdminMessage_ConfigType_POWER_CONFIG: case AdminMessage_ConfigType_POWER_CONFIG:
LOG_DEBUG("Getting config: Power\n"); LOG_INFO("Getting config: Power\n");
res.get_config_response.which_payload_variant = Config_power_tag; res.get_config_response.which_payload_variant = Config_power_tag;
res.get_config_response.payload_variant.power = config.power; res.get_config_response.payload_variant.power = config.power;
break; break;
case AdminMessage_ConfigType_NETWORK_CONFIG: case AdminMessage_ConfigType_NETWORK_CONFIG:
LOG_DEBUG("Getting config: Network\n"); LOG_INFO("Getting config: Network\n");
res.get_config_response.which_payload_variant = Config_network_tag; res.get_config_response.which_payload_variant = Config_network_tag;
res.get_config_response.payload_variant.network = config.network; res.get_config_response.payload_variant.network = config.network;
writeSecret(res.get_config_response.payload_variant.network.wifi_psk, config.network.wifi_psk); writeSecret(res.get_config_response.payload_variant.network.wifi_psk, config.network.wifi_psk);
break; break;
case AdminMessage_ConfigType_DISPLAY_CONFIG: case AdminMessage_ConfigType_DISPLAY_CONFIG:
LOG_DEBUG("Getting config: Display\n"); LOG_INFO("Getting config: Display\n");
res.get_config_response.which_payload_variant = Config_display_tag; res.get_config_response.which_payload_variant = Config_display_tag;
res.get_config_response.payload_variant.display = config.display; res.get_config_response.payload_variant.display = config.display;
break; break;
case AdminMessage_ConfigType_LORA_CONFIG: case AdminMessage_ConfigType_LORA_CONFIG:
LOG_DEBUG("Getting config: LoRa\n"); LOG_INFO("Getting config: LoRa\n");
res.get_config_response.which_payload_variant = Config_lora_tag; res.get_config_response.which_payload_variant = Config_lora_tag;
res.get_config_response.payload_variant.lora = config.lora; res.get_config_response.payload_variant.lora = config.lora;
break; break;
case AdminMessage_ConfigType_BLUETOOTH_CONFIG: case AdminMessage_ConfigType_BLUETOOTH_CONFIG:
LOG_DEBUG("Getting config: Bluetooth\n"); LOG_INFO("Getting config: Bluetooth\n");
res.get_config_response.which_payload_variant = Config_bluetooth_tag; res.get_config_response.which_payload_variant = Config_bluetooth_tag;
res.get_config_response.payload_variant.bluetooth = config.bluetooth; res.get_config_response.payload_variant.bluetooth = config.bluetooth;
break; break;
@@ -418,48 +418,48 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
if (req.decoded.want_response) { if (req.decoded.want_response) {
switch (configType) { switch (configType) {
case AdminMessage_ModuleConfigType_MQTT_CONFIG: case AdminMessage_ModuleConfigType_MQTT_CONFIG:
LOG_DEBUG("Getting module config: MQTT\n"); LOG_INFO("Getting module config: MQTT\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_mqtt_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_mqtt_tag;
res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt; res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt;
break; break;
case AdminMessage_ModuleConfigType_SERIAL_CONFIG: case AdminMessage_ModuleConfigType_SERIAL_CONFIG:
LOG_DEBUG("Getting module config: Serial\n"); LOG_INFO("Getting module config: Serial\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_serial_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_serial_tag;
res.get_module_config_response.payload_variant.serial = moduleConfig.serial; res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
break; break;
case AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG: case AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
LOG_DEBUG("Getting module config: External Notification\n"); LOG_INFO("Getting module config: External Notification\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_external_notification_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_external_notification_tag;
res.get_module_config_response.payload_variant.external_notification = res.get_module_config_response.payload_variant.external_notification =
moduleConfig.external_notification; moduleConfig.external_notification;
break; break;
case AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG: case AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
LOG_DEBUG("Getting module config: Store & Forward\n"); LOG_INFO("Getting module config: Store & Forward\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_store_forward_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_store_forward_tag;
res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward; res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
break; break;
case AdminMessage_ModuleConfigType_RANGETEST_CONFIG: case AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
LOG_DEBUG("Getting module config: Range Test\n"); LOG_INFO("Getting module config: Range Test\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_range_test_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_range_test_tag;
res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test; res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
break; break;
case AdminMessage_ModuleConfigType_TELEMETRY_CONFIG: case AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
LOG_DEBUG("Getting module config: Telemetry\n"); LOG_INFO("Getting module config: Telemetry\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_telemetry_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_telemetry_tag;
res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry; res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry;
break; break;
case AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG: case AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
LOG_DEBUG("Getting module config: Canned Message\n"); LOG_INFO("Getting module config: Canned Message\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_canned_message_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_canned_message_tag;
res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message; res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
break; break;
case AdminMessage_ModuleConfigType_AUDIO_CONFIG: case AdminMessage_ModuleConfigType_AUDIO_CONFIG:
LOG_DEBUG("Getting module config: Audio\n"); LOG_INFO("Getting module config: Audio\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_audio_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_audio_tag;
res.get_module_config_response.payload_variant.audio = moduleConfig.audio; res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
break; break;
case AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG: case AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
LOG_DEBUG("Getting module config: Remote Hardware\n"); LOG_INFO("Getting module config: Remote Hardware\n");
res.get_module_config_response.which_payload_variant = ModuleConfig_remote_hardware_tag; res.get_module_config_response.which_payload_variant = ModuleConfig_remote_hardware_tag;
res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware; res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware;
break; break;
@@ -506,7 +506,7 @@ void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
void AdminModule::reboot(int32_t seconds) void AdminModule::reboot(int32_t seconds)
{ {
LOG_DEBUG("Rebooting in %d seconds\n", seconds); LOG_INFO("Rebooting in %d seconds\n", seconds);
screen->startRebootScreen(); screen->startRebootScreen();
rebootAtMsec = (seconds < 0) ? 0 : (millis() + seconds * 1000); rebootAtMsec = (seconds < 0) ? 0 : (millis() + seconds * 1000);
} }
@@ -514,10 +514,10 @@ void AdminModule::reboot(int32_t seconds)
void AdminModule::saveChanges(int saveWhat, bool shouldReboot) void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
{ {
if (!hasOpenEditTransaction) { if (!hasOpenEditTransaction) {
LOG_DEBUG("Saving changes to disk\n"); LOG_INFO("Saving changes to disk\n");
service.reloadConfig(saveWhat); // Calls saveToDisk among other things service.reloadConfig(saveWhat); // Calls saveToDisk among other things
} else { } else {
LOG_DEBUG("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\n");
} }
if (shouldReboot) if (shouldReboot)
{ {
+3 -3
View File
@@ -49,10 +49,10 @@ CannedMessageModule::CannedMessageModule()
if (moduleConfig.canned_message.enabled) { if (moduleConfig.canned_message.enabled) {
this->loadProtoForModule(); this->loadProtoForModule();
if ((this->splitConfiguredMessages() <= 0) && (cardkb_found != CARDKB_ADDR)) { if ((this->splitConfiguredMessages() <= 0) && (cardkb_found != CARDKB_ADDR)) {
LOG_DEBUG("CannedMessageModule: No messages are configured. Module is disabled\n"); LOG_INFO("CannedMessageModule: No messages are configured. Module is disabled\n");
this->runState = CANNED_MESSAGE_RUN_STATE_DISABLED; this->runState = CANNED_MESSAGE_RUN_STATE_DISABLED;
} else { } else {
LOG_DEBUG("CannedMessageModule is enabled\n"); LOG_INFO("CannedMessageModule is enabled\n");
this->inputObserver.observe(inputBroker); this->inputObserver.observe(inputBroker);
} }
} }
@@ -198,7 +198,7 @@ void CannedMessageModule::sendText(NodeNum dest, const char *message, bool wantR
p->decoded.payload.size++; p->decoded.payload.size++;
} }
LOG_DEBUG("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\n", p->id, p->to, p->decoded.payload.size, p->decoded.payload.bytes);
service.sendToMesh(p); service.sendToMesh(p);
} }
+20 -20
View File
@@ -48,15 +48,15 @@ int32_t ExternalNotificationModule::runOnce()
if (nagCycleCutoff < millis()) { if (nagCycleCutoff < millis()) {
#endif #endif
nagCycleCutoff = UINT32_MAX; nagCycleCutoff = UINT32_MAX;
LOG_DEBUG("Turning off external notification: "); LOG_INFO("Turning off external notification: ");
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (getExternal(i)) { if (getExternal(i)) {
setExternalOff(i); setExternalOff(i);
externalTurnedOn[i] = 0; externalTurnedOn[i] = 0;
LOG_DEBUG("%d ", i); LOG_INFO("%d ", i);
} }
} }
LOG_DEBUG("\n"); LOG_INFO("\n");
return INT32_MAX; // save cycles till we're needed again return INT32_MAX; // save cycles till we're needed again
} }
@@ -175,26 +175,26 @@ ExternalNotificationModule::ExternalNotificationModule()
strncpy(rtttlConfig.ringtone, "a:d=8,o=5,b=125:4d#6,a#,2d#6,16p,g#,4a#,4d#.,p,16g,16a#,d#6,a#,f6,2d#6,16p,c#.6,16c6,16a#,g#.,2a#", sizeof(rtttlConfig.ringtone)); strncpy(rtttlConfig.ringtone, "a:d=8,o=5,b=125:4d#6,a#,2d#6,16p,g#,4a#,4d#.,p,16g,16a#,d#6,a#,f6,2d#6,16p,c#.6,16c6,16a#,g#.,2a#", sizeof(rtttlConfig.ringtone));
} }
LOG_DEBUG("Initializing External Notification Module\n"); LOG_INFO("Initializing External Notification Module\n");
output = moduleConfig.external_notification.output output = moduleConfig.external_notification.output
? moduleConfig.external_notification.output ? moduleConfig.external_notification.output
: EXT_NOTIFICATION_MODULE_OUTPUT; : EXT_NOTIFICATION_MODULE_OUTPUT;
// Set the direction of a pin // Set the direction of a pin
LOG_DEBUG("Using Pin %i in digital mode\n", output); LOG_INFO("Using Pin %i in digital mode\n", output);
pinMode(output, OUTPUT); pinMode(output, OUTPUT);
setExternalOff(0); setExternalOff(0);
externalTurnedOn[0] = 0; externalTurnedOn[0] = 0;
if(moduleConfig.external_notification.output_vibra) { if(moduleConfig.external_notification.output_vibra) {
LOG_DEBUG("Using Pin %i for vibra motor\n", moduleConfig.external_notification.output_vibra); LOG_INFO("Using Pin %i for vibra motor\n", moduleConfig.external_notification.output_vibra);
pinMode(moduleConfig.external_notification.output_vibra, OUTPUT); pinMode(moduleConfig.external_notification.output_vibra, OUTPUT);
setExternalOff(1); setExternalOff(1);
externalTurnedOn[1] = 0; externalTurnedOn[1] = 0;
} }
if(moduleConfig.external_notification.output_buzzer) { if(moduleConfig.external_notification.output_buzzer) {
if (!moduleConfig.external_notification.use_pwm) { if (!moduleConfig.external_notification.use_pwm) {
LOG_DEBUG("Using Pin %i for buzzer\n", moduleConfig.external_notification.output_buzzer); LOG_INFO("Using Pin %i for buzzer\n", moduleConfig.external_notification.output_buzzer);
pinMode(moduleConfig.external_notification.output_buzzer, OUTPUT); pinMode(moduleConfig.external_notification.output_buzzer, OUTPUT);
setExternalOff(2); setExternalOff(2);
externalTurnedOn[2] = 0; externalTurnedOn[2] = 0;
@@ -203,11 +203,11 @@ ExternalNotificationModule::ExternalNotificationModule()
? config.device.buzzer_gpio ? config.device.buzzer_gpio
: PIN_BUZZER; : PIN_BUZZER;
// in PWM Mode we force the buzzer pin if it is set // in PWM Mode we force the buzzer pin if it is set
LOG_DEBUG("Using Pin %i in PWM mode\n", config.device.buzzer_gpio); LOG_INFO("Using Pin %i in PWM mode\n", config.device.buzzer_gpio);
} }
} }
} else { } else {
LOG_DEBUG("External Notification Module Disabled\n"); LOG_INFO("External Notification Module Disabled\n");
enabled = false; enabled = false;
} }
} }
@@ -229,7 +229,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
if (moduleConfig.external_notification.alert_bell) { if (moduleConfig.external_notification.alert_bell) {
if (containsBell) { if (containsBell) {
LOG_DEBUG("externalNotificationModule - Notification Bell\n"); LOG_INFO("externalNotificationModule - Notification Bell\n");
setExternalOn(0); setExternalOn(0);
if (moduleConfig.external_notification.nag_timeout) { if (moduleConfig.external_notification.nag_timeout) {
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000; nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
@@ -241,7 +241,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
if (moduleConfig.external_notification.alert_bell_vibra) { if (moduleConfig.external_notification.alert_bell_vibra) {
if (containsBell) { if (containsBell) {
LOG_DEBUG("externalNotificationModule - Notification Bell (Vibra)\n"); LOG_INFO("externalNotificationModule - Notification Bell (Vibra)\n");
setExternalOn(1); setExternalOn(1);
if (moduleConfig.external_notification.nag_timeout) { if (moduleConfig.external_notification.nag_timeout) {
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000; nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
@@ -253,7 +253,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
if (moduleConfig.external_notification.alert_bell_buzzer) { if (moduleConfig.external_notification.alert_bell_buzzer) {
if (containsBell) { if (containsBell) {
LOG_DEBUG("externalNotificationModule - Notification Bell (Buzzer)\n"); LOG_INFO("externalNotificationModule - Notification Bell (Buzzer)\n");
if (!moduleConfig.external_notification.use_pwm) { if (!moduleConfig.external_notification.use_pwm) {
setExternalOn(2); setExternalOn(2);
} else { } else {
@@ -270,7 +270,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
} }
if (moduleConfig.external_notification.alert_message) { if (moduleConfig.external_notification.alert_message) {
LOG_DEBUG("externalNotificationModule - Notification Module\n"); LOG_INFO("externalNotificationModule - Notification Module\n");
setExternalOn(0); setExternalOn(0);
if (moduleConfig.external_notification.nag_timeout) { if (moduleConfig.external_notification.nag_timeout) {
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000; nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
@@ -281,7 +281,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
if (!moduleConfig.external_notification.use_pwm) { if (!moduleConfig.external_notification.use_pwm) {
if (moduleConfig.external_notification.alert_message_vibra) { if (moduleConfig.external_notification.alert_message_vibra) {
LOG_DEBUG("externalNotificationModule - Notification Module (Vibra)\n"); LOG_INFO("externalNotificationModule - Notification Module (Vibra)\n");
setExternalOn(1); setExternalOn(1);
if (moduleConfig.external_notification.nag_timeout) { if (moduleConfig.external_notification.nag_timeout) {
nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000; nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
@@ -291,7 +291,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
} }
if (moduleConfig.external_notification.alert_message_buzzer) { if (moduleConfig.external_notification.alert_message_buzzer) {
LOG_DEBUG("externalNotificationModule - Notification Module (Buzzer)\n"); LOG_INFO("externalNotificationModule - Notification Module (Buzzer)\n");
if (!moduleConfig.external_notification.use_pwm) { if (!moduleConfig.external_notification.use_pwm) {
setExternalOn(2); setExternalOn(2);
} else { } else {
@@ -310,7 +310,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
} }
} else { } else {
LOG_DEBUG("External Notification Module Disabled\n"); LOG_INFO("External Notification Module Disabled\n");
} }
return ProcessMessage::CONTINUE; // Let others look at this message also if they want return ProcessMessage::CONTINUE; // Let others look at this message also if they want
@@ -331,13 +331,13 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
switch (request->which_payload_variant) { switch (request->which_payload_variant) {
case AdminMessage_get_ringtone_request_tag: case AdminMessage_get_ringtone_request_tag:
LOG_DEBUG("Client is getting ringtone\n"); LOG_INFO("Client is getting ringtone\n");
this->handleGetRingtone(mp, response); this->handleGetRingtone(mp, response);
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE; result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
break; break;
case AdminMessage_set_ringtone_message_tag: case AdminMessage_set_ringtone_message_tag:
LOG_DEBUG("Client is setting ringtone\n"); LOG_INFO("Client is setting ringtone\n");
this->handleSetRingtone(request->set_canned_message_module_messages); this->handleSetRingtone(request->set_canned_message_module_messages);
result = AdminMessageHandleResult::HANDLED; result = AdminMessageHandleResult::HANDLED;
break; break;
@@ -351,7 +351,7 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
void ExternalNotificationModule::handleGetRingtone(const MeshPacket &req, AdminMessage *response) void ExternalNotificationModule::handleGetRingtone(const MeshPacket &req, AdminMessage *response)
{ {
LOG_DEBUG("*** handleGetRingtone\n"); LOG_INFO("*** handleGetRingtone\n");
assert(req.decoded.want_response); assert(req.decoded.want_response);
response->which_payload_variant = AdminMessage_get_ringtone_response_tag; response->which_payload_variant = AdminMessage_get_ringtone_response_tag;
@@ -366,7 +366,7 @@ void ExternalNotificationModule::handleSetRingtone(const char *from_msg)
if (*from_msg) { if (*from_msg) {
changed |= strcmp(rtttlConfig.ringtone, from_msg); changed |= strcmp(rtttlConfig.ringtone, from_msg);
strcpy(rtttlConfig.ringtone, from_msg); strcpy(rtttlConfig.ringtone, from_msg);
LOG_DEBUG("*** from_msg.text:%s\n", from_msg); LOG_INFO("*** from_msg.text:%s\n", from_msg);
} }
if (changed) { if (changed) {
+2 -2
View File
@@ -46,7 +46,7 @@ MeshPacket *NodeInfoModule::allocReply()
{ {
User &u = owner; User &u = owner;
LOG_DEBUG("sending owner %s/%s/%s\n", u.id, u.long_name, u.short_name); LOG_INFO("sending owner %s/%s/%s\n", u.id, u.long_name, u.short_name);
return allocDataProtobuf(u); return allocDataProtobuf(u);
} }
@@ -65,7 +65,7 @@ int32_t NodeInfoModule::runOnce()
bool requestReplies = currentGeneration != radioGeneration; bool requestReplies = currentGeneration != radioGeneration;
currentGeneration = radioGeneration; currentGeneration = radioGeneration;
LOG_DEBUG("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies); LOG_INFO("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies);
sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies) sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
return default_broadcast_interval_secs * 1000; return default_broadcast_interval_secs * 1000;
+8 -8
View File
@@ -32,7 +32,7 @@ bool PositionModule::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr
} }
// Log packet size and list of fields // Log packet size and list of fields
LOG_DEBUG("POSITION node=%08x l=%d %s%s%s%s%s%s%s%s%s%s%s%s%s\n", getFrom(&mp), mp.decoded.payload.size, LOG_INFO("POSITION node=%08x l=%d %s%s%s%s%s%s%s%s%s%s%s%s%s\n", getFrom(&mp), mp.decoded.payload.size,
p.latitude_i ? "LAT " : "", p.longitude_i ? "LON " : "", p.altitude ? "MSL " : "", p.altitude_hae ? "HAE " : "", p.latitude_i ? "LAT " : "", p.longitude_i ? "LON " : "", p.altitude ? "MSL " : "", p.altitude_hae ? "HAE " : "",
p.altitude_geoidal_separation ? "GEO " : "", p.PDOP ? "PDOP " : "", p.HDOP ? "HDOP " : "", p.VDOP ? "VDOP " : "", p.altitude_geoidal_separation ? "GEO " : "", p.PDOP ? "PDOP " : "", p.HDOP ? "HDOP " : "", p.VDOP ? "VDOP " : "",
p.sats_in_view ? "SIV " : "", p.fix_quality ? "FXQ " : "", p.fix_type ? "FXT " : "", p.timestamp ? "PTS " : "", p.sats_in_view ? "SIV " : "", p.fix_quality ? "FXQ " : "", p.fix_type ? "FXT " : "", p.timestamp ? "PTS " : "",
@@ -109,12 +109,12 @@ MeshPacket *PositionModule::allocReply()
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS to include the time, so that gpsless // nodes shouldn't trust it anyways) Note: we allow a device with a local GPS to include the time, so that gpsless
// devices can get time. // devices can get time.
if (getRTCQuality() < RTCQualityDevice) { if (getRTCQuality() < RTCQualityDevice) {
LOG_DEBUG("Stripping time %u from position send\n", p.time); LOG_INFO("Stripping time %u from position send\n", p.time);
p.time = 0; p.time = 0;
} else } else
LOG_DEBUG("Providing time to mesh %u\n", p.time); LOG_INFO("Providing time to mesh %u\n", p.time);
LOG_DEBUG("Position reply: time=%i, latI=%i, lonI=-%i\n", p.time, p.latitude_i, p.longitude_i); LOG_INFO("Position reply: time=%i, latI=%i, lonI=-%i\n", p.time, p.latitude_i, p.longitude_i);
return allocDataProtobuf(p); return allocDataProtobuf(p);
} }
@@ -155,11 +155,11 @@ int32_t PositionModule::runOnce()
bool requestReplies = currentGeneration != radioGeneration; bool requestReplies = currentGeneration != radioGeneration;
currentGeneration = radioGeneration; currentGeneration = radioGeneration;
LOG_DEBUG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.timestamp, requestReplies); LOG_INFO("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.timestamp, requestReplies);
sendOurPosition(NODENUM_BROADCAST, requestReplies); sendOurPosition(NODENUM_BROADCAST, requestReplies);
} }
} else { } else {
LOG_DEBUG("Channel utilization is >40 percent. Skipping this opportunity to send.\n"); LOG_WARN("Channel utilization is >40 percent. Skipping this opportunity to send.\n");
} }
} else if (config.position.position_broadcast_smart_enabled) { } else if (config.position.position_broadcast_smart_enabled) {
@@ -194,7 +194,7 @@ int32_t PositionModule::runOnce()
bool requestReplies = currentGeneration != radioGeneration; bool requestReplies = currentGeneration != radioGeneration;
currentGeneration = radioGeneration; currentGeneration = radioGeneration;
LOG_DEBUG("Sending smart pos@%x:6 to mesh (wantReplies=%d, d=%d, dtt=%d, tt=%d)\n", node2->position.timestamp, LOG_INFO("Sending smart pos@%x:6 to mesh (wantReplies=%d, d=%d, dtt=%d, tt=%d)\n", node2->position.timestamp,
requestReplies, distance, distanceTravelThreshold, timeTravel); requestReplies, distance, distanceTravelThreshold, timeTravel);
sendOurPosition(NODENUM_BROADCAST, requestReplies); sendOurPosition(NODENUM_BROADCAST, requestReplies);
@@ -209,7 +209,7 @@ int32_t PositionModule::runOnce()
} }
} }
} else { } else {
LOG_DEBUG("Channel utilization is >25 percent. Skipping this opportunity to send.\n"); LOG_WARN("Channel utilization is >25 percent. Skipping this opportunity to send.\n");
} }
} }
+4 -4
View File
@@ -55,7 +55,7 @@ RemoteHardwareModule::RemoteHardwareModule()
bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, HardwareMessage *pptr) bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, HardwareMessage *pptr)
{ {
auto p = *pptr; auto p = *pptr;
LOG_DEBUG("Received RemoteHardware typ=%d\n", p.type); LOG_INFO("Received RemoteHardware typ=%d\n", p.type);
switch (p.type) { switch (p.type) {
case HardwareMessage_Type_WRITE_GPIOS: case HardwareMessage_Type_WRITE_GPIOS:
@@ -95,7 +95,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar
lastWatchMsec = 0; // Force a new publish soon lastWatchMsec = 0; // Force a new publish soon
previousWatch = ~watchGpios; // generate a 'previous' value which is guaranteed to not match (to force an initial publish) previousWatch = ~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 enabled = true; // Let our thread run at least once
LOG_DEBUG("Now watching GPIOs 0x%llx\n", watchGpios); LOG_INFO("Now watching GPIOs 0x%llx\n", watchGpios);
break; break;
} }
@@ -104,7 +104,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar
break; // Ignore - we might see our own replies break; // Ignore - we might see our own replies
default: default:
LOG_DEBUG("Hardware operation %d not yet implemented! FIXME\n", p.type); LOG_ERROR("Hardware operation %d not yet implemented! FIXME\n", p.type);
break; break;
} }
@@ -121,7 +121,7 @@ int32_t RemoteHardwareModule::runOnce()
if (curVal != previousWatch) { if (curVal != previousWatch) {
previousWatch = curVal; previousWatch = curVal;
LOG_DEBUG("Broadcasting GPIOS 0x%llx changed!\n", curVal); LOG_INFO("Broadcasting GPIOS 0x%llx changed!\n", curVal);
// Something changed! Tell the world with a broadcast message // Something changed! Tell the world with a broadcast message
HardwareMessage r = HardwareMessage_init_default; HardwareMessage r = HardwareMessage_init_default;
+1 -1
View File
@@ -11,7 +11,7 @@ MeshPacket *ReplyModule::allocReply()
auto req = *currentRequest; auto req = *currentRequest;
auto &p = req.decoded; auto &p = req.decoded;
// The incoming message is in p.payload // The incoming message is in p.payload
LOG_DEBUG("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\n", req.from, req.id, p.payload.size, p.payload.bytes);
screen->print("Sending reply\n"); screen->print("Sending reply\n");
+4 -4
View File
@@ -109,7 +109,7 @@ int32_t SerialModule::runOnce()
if (firstTime) { if (firstTime) {
// Interface with the serial peripheral from in here. // Interface with the serial peripheral from in here.
LOG_DEBUG("Initializing serial peripheral interface\n"); LOG_INFO("Initializing serial peripheral interface\n");
uint32_t baud = 0; uint32_t baud = 0;
@@ -213,14 +213,14 @@ int32_t SerialModule::runOnce()
serialModuleRadio->sendPayload(); serialModuleRadio->sendPayload();
LOG_DEBUG("Received: %s\n", serialStringChar); LOG_INFO("Received: %s\n", serialStringChar);
} }
} }
} }
return (10); return (10);
} else { } else {
LOG_DEBUG("Serial Module Disabled\n"); LOG_INFO("Serial Module Disabled\n");
return INT32_MAX; return INT32_MAX;
} }
@@ -305,7 +305,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
} }
} else { } else {
LOG_DEBUG("Serial Module Disabled\n"); LOG_INFO("Serial Module Disabled\n");
} }
return ProcessMessage::CONTINUE; // Let others look at this message also if they want return ProcessMessage::CONTINUE; // Let others look at this message also if they want
} }
+4 -4
View File
@@ -34,7 +34,7 @@ bool DeviceTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemet
if (t->which_variant == Telemetry_device_metrics_tag) { if (t->which_variant == Telemetry_device_metrics_tag) {
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
LOG_DEBUG("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n", LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n",
sender, sender,
t->variant.device_metrics.air_util_tx, t->variant.device_metrics.air_util_tx,
t->variant.device_metrics.channel_utilization, t->variant.device_metrics.channel_utilization,
@@ -60,7 +60,7 @@ bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
t.variant.device_metrics.channel_utilization = myNodeInfo.channel_utilization; t.variant.device_metrics.channel_utilization = myNodeInfo.channel_utilization;
t.variant.device_metrics.voltage = powerStatus->getBatteryVoltageMv() / 1000.0; t.variant.device_metrics.voltage = powerStatus->getBatteryVoltageMv() / 1000.0;
LOG_DEBUG("(Sending): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n", LOG_INFO("(Sending): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n",
t.variant.device_metrics.air_util_tx, t.variant.device_metrics.air_util_tx,
t.variant.device_metrics.channel_utilization, t.variant.device_metrics.channel_utilization,
t.variant.device_metrics.battery_level, t.variant.device_metrics.battery_level,
@@ -74,10 +74,10 @@ bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
lastMeasurementPacket = packetPool.allocCopy(*p); lastMeasurementPacket = packetPool.allocCopy(*p);
nodeDB.updateTelemetry(nodeDB.getNodeNum(), t, RX_SRC_LOCAL); nodeDB.updateTelemetry(nodeDB.getNodeNum(), t, RX_SRC_LOCAL);
if (phoneOnly) { if (phoneOnly) {
LOG_DEBUG("Sending packet to phone\n"); LOG_INFO("Sending packet to phone\n");
service.sendToPhone(p); service.sendToPhone(p);
} else { } else {
LOG_DEBUG("Sending packet to mesh\n"); LOG_INFO("Sending packet to mesh\n");
service.sendToMesh(p, RX_SRC_LOCAL, true); service.sendToMesh(p, RX_SRC_LOCAL, true);
} }
return true; return true;
@@ -75,7 +75,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
firstTime = 0; firstTime = 0;
if (moduleConfig.telemetry.environment_measurement_enabled) { if (moduleConfig.telemetry.environment_measurement_enabled) {
LOG_DEBUG("Environment Telemetry: Initializing\n"); LOG_INFO("Environment Telemetry: Initializing\n");
// it's possible to have this module enabled, only for displaying values on the screen. // 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 // therefore, we should only enable the sensor loop if measurement is also enabled
if (bmp280Sensor.hasSensor()) if (bmp280Sensor.hasSensor())
@@ -162,7 +162,7 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt
if (!pb_decode_from_bytes(p.payload.bytes, p.payload.size, &Telemetry_msg, &lastMeasurement)) { if (!pb_decode_from_bytes(p.payload.bytes, p.payload.size, &Telemetry_msg, &lastMeasurement)) {
display->setFont(FONT_SMALL); display->setFont(FONT_SMALL);
display->drawString(x, y += fontHeight(FONT_MEDIUM), "Measurement Error"); display->drawString(x, y += fontHeight(FONT_MEDIUM), "Measurement Error");
LOG_DEBUG("Unable to decode last packet"); LOG_ERROR("Unable to decode last packet");
return; return;
} }
@@ -187,7 +187,7 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Te
if (t->which_variant == Telemetry_environment_metrics_tag) { if (t->which_variant == Telemetry_environment_metrics_tag) {
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
LOG_DEBUG("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, voltage=%f\n", LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, voltage=%f\n",
sender, sender,
t->variant.environment_metrics.barometric_pressure, t->variant.environment_metrics.barometric_pressure,
t->variant.environment_metrics.current, t->variant.environment_metrics.current,
@@ -234,7 +234,7 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
if (ina260Sensor.hasSensor()) if (ina260Sensor.hasSensor())
ina260Sensor.getMetrics(&m); ina260Sensor.getMetrics(&m);
LOG_DEBUG("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, voltage=%f\n", LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f, voltage=%f\n",
m.variant.environment_metrics.barometric_pressure, m.variant.environment_metrics.barometric_pressure,
m.variant.environment_metrics.current, m.variant.environment_metrics.current,
m.variant.environment_metrics.gas_resistance, m.variant.environment_metrics.gas_resistance,
@@ -251,10 +251,10 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
lastMeasurementPacket = packetPool.allocCopy(*p); lastMeasurementPacket = packetPool.allocCopy(*p);
if (phoneOnly) { if (phoneOnly) {
LOG_DEBUG("Sending packet to phone\n"); LOG_INFO("Sending packet to phone\n");
service.sendToPhone(p); service.sendToPhone(p);
} else { } else {
LOG_DEBUG("Sending packet to mesh\n"); LOG_INFO("Sending packet to mesh\n");
service.sendToMesh(p, RX_SRC_LOCAL, true); service.sendToMesh(p, RX_SRC_LOCAL, true);
} }
return true; return true;
@@ -11,7 +11,7 @@ BME280Sensor::BME280Sensor() :
} }
int32_t BME280Sensor::runOnce() { int32_t BME280Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
@@ -10,7 +10,7 @@ BME680Sensor::BME680Sensor() :
} }
int32_t BME680Sensor::runOnce() { int32_t BME680Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
@@ -11,7 +11,7 @@ BMP280Sensor::BMP280Sensor() :
} }
int32_t BMP280Sensor::runOnce() { int32_t BMP280Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
@@ -10,7 +10,7 @@ INA219Sensor::INA219Sensor() :
} }
int32_t INA219Sensor::runOnce() { int32_t INA219Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
@@ -10,7 +10,7 @@ INA260Sensor::INA260Sensor() :
} }
int32_t INA260Sensor::runOnce() { int32_t INA260Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
@@ -11,7 +11,7 @@ LPS22HBSensor::LPS22HBSensor() :
} }
int32_t LPS22HBSensor::runOnce() { int32_t LPS22HBSensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
@@ -10,7 +10,7 @@ MCP9808Sensor::MCP9808Sensor() :
} }
int32_t MCP9808Sensor::runOnce() { int32_t MCP9808Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
+1 -1
View File
@@ -10,7 +10,7 @@ SHT31Sensor::SHT31Sensor() :
} }
int32_t SHT31Sensor::runOnce() { int32_t SHT31Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
+1 -1
View File
@@ -10,7 +10,7 @@ SHTC3Sensor::SHTC3Sensor() :
} }
int32_t SHTC3Sensor::runOnce() { int32_t SHTC3Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName); LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) { if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
} }
@@ -21,10 +21,10 @@ class TelemetrySensor
int32_t initI2CSensor() { int32_t initI2CSensor() {
if (!status) { if (!status) {
LOG_DEBUG("Could not connect to detected %s sensor.\n Removing from nodeTelemetrySensorsMap.\n", sensorName); LOG_WARN("Could not connect to detected %s sensor.\n Removing from nodeTelemetrySensorsMap.\n", sensorName);
nodeTelemetrySensorsMap[sensorType] = 0; nodeTelemetrySensorsMap[sensorType] = 0;
} else { } else {
LOG_DEBUG("Opened %s sensor on default i2c bus\n", sensorName); LOG_INFO("Opened %s sensor on default i2c bus\n", sensorName);
setup(); setup();
} }
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
+1 -1
View File
@@ -8,7 +8,7 @@ TextMessageModule *textMessageModule;
ProcessMessage TextMessageModule::handleReceived(const MeshPacket &mp) ProcessMessage TextMessageModule::handleReceived(const MeshPacket &mp)
{ {
auto &p = mp.decoded; auto &p = mp.decoded;
LOG_DEBUG("Received text msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes); LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes);
// We only store/display messages destined for us. // We only store/display messages destined for us.
// Keep a copy of the most recent text message. // Keep a copy of the most recent text message.
+4 -4
View File
@@ -50,12 +50,12 @@ void TraceRouteModule::appendMyID(RouteDiscovery* updated)
void TraceRouteModule::printRoute(RouteDiscovery* r, uint32_t origin, uint32_t dest) void TraceRouteModule::printRoute(RouteDiscovery* r, uint32_t origin, uint32_t dest)
{ {
LOG_DEBUG("Route traced:\n"); LOG_INFO("Route traced:\n");
LOG_DEBUG("0x%x --> ", origin); LOG_INFO("0x%x --> ", origin);
for (uint8_t i=0; i<r->route_count; i++) { for (uint8_t i=0; i<r->route_count; i++) {
LOG_DEBUG("0x%x --> ", r->route[i]); LOG_INFO("0x%x --> ", r->route[i]);
} }
if (dest != NODENUM_BROADCAST) LOG_DEBUG("0x%x\n", dest); else LOG_DEBUG("...\n"); if (dest != NODENUM_BROADCAST) LOG_INFO("0x%x\n", dest); else LOG_INFO("...\n");
} }
+1 -1
View File
@@ -8,7 +8,7 @@ WaypointModule *waypointModule;
ProcessMessage WaypointModule::handleReceived(const MeshPacket &mp) ProcessMessage WaypointModule::handleReceived(const MeshPacket &mp)
{ {
auto &p = mp.decoded; auto &p = mp.decoded;
LOG_DEBUG("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes); LOG_INFO("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes);
notifyObservers(&mp); notifyObservers(&mp);
+14 -14
View File
@@ -71,7 +71,7 @@ void run_codec2(void* parameter)
// 4 bytes of header in each frame hex c0 de c2 plus the bitrate // 4 bytes of header in each frame hex c0 de c2 plus the bitrate
memcpy(audioModule->tx_encode_frame,&audioModule->tx_header,sizeof(audioModule->tx_header)); memcpy(audioModule->tx_encode_frame,&audioModule->tx_header,sizeof(audioModule->tx_header));
LOG_DEBUG("Starting codec2 task\n"); LOG_INFO("Starting codec2 task\n");
while (true) { while (true) {
uint32_t tcount = ulTaskNotifyTake(pdFALSE, pdMS_TO_TICKS(10000)); uint32_t tcount = ulTaskNotifyTake(pdFALSE, pdMS_TO_TICKS(10000));
@@ -86,7 +86,7 @@ void run_codec2(void* parameter)
if (audioModule->tx_encode_frame_index == (audioModule->encode_frame_size + sizeof(audioModule->tx_header))) if (audioModule->tx_encode_frame_index == (audioModule->encode_frame_size + sizeof(audioModule->tx_header)))
{ {
LOG_DEBUG("Sending %d codec2 bytes\n", audioModule->encode_frame_size); LOG_INFO("Sending %d codec2 bytes\n", audioModule->encode_frame_size);
audioModule->sendPayload(); audioModule->sendPayload();
audioModule->tx_encode_frame_index = sizeof(audioModule->tx_header); audioModule->tx_encode_frame_index = sizeof(audioModule->tx_header);
} }
@@ -127,7 +127,7 @@ AudioModule::AudioModule() : SinglePortModule("AudioModule", PortNum_AUDIO_APP),
// moduleConfig.audio.ptt_pin = 39; // moduleConfig.audio.ptt_pin = 39;
if ((moduleConfig.audio.codec2_enabled) && (myRegion->audioPermitted)) { if ((moduleConfig.audio.codec2_enabled) && (myRegion->audioPermitted)) {
LOG_DEBUG("Setting up codec2 in mode %u", (moduleConfig.audio.bitrate ? moduleConfig.audio.bitrate : AUDIO_MODULE_MODE) - 1); LOG_INFO("Setting up codec2 in mode %u", (moduleConfig.audio.bitrate ? moduleConfig.audio.bitrate : AUDIO_MODULE_MODE) - 1);
codec2 = codec2_create((moduleConfig.audio.bitrate ? moduleConfig.audio.bitrate : AUDIO_MODULE_MODE) - 1); codec2 = codec2_create((moduleConfig.audio.bitrate ? moduleConfig.audio.bitrate : AUDIO_MODULE_MODE) - 1);
memcpy(tx_header.magic,c2_magic,sizeof(c2_magic)); memcpy(tx_header.magic,c2_magic,sizeof(c2_magic));
tx_header.mode = (moduleConfig.audio.bitrate ? moduleConfig.audio.bitrate : AUDIO_MODULE_MODE) - 1; tx_header.mode = (moduleConfig.audio.bitrate ? moduleConfig.audio.bitrate : AUDIO_MODULE_MODE) - 1;
@@ -136,10 +136,10 @@ AudioModule::AudioModule() : SinglePortModule("AudioModule", PortNum_AUDIO_APP),
encode_frame_num = (Constants_DATA_PAYLOAD_LEN - sizeof(tx_header)) / encode_codec_size; encode_frame_num = (Constants_DATA_PAYLOAD_LEN - sizeof(tx_header)) / encode_codec_size;
encode_frame_size = encode_frame_num * encode_codec_size; // max 233 bytes + 4 header bytes encode_frame_size = encode_frame_num * encode_codec_size; // max 233 bytes + 4 header bytes
adc_buffer_size = codec2_samples_per_frame(codec2); adc_buffer_size = codec2_samples_per_frame(codec2);
LOG_DEBUG(" using %d frames of %d bytes for a total payload length of %d bytes\n", encode_frame_num, encode_codec_size, encode_frame_size); LOG_INFO(" using %d frames of %d bytes for a total payload length of %d bytes\n", encode_frame_num, encode_codec_size, encode_frame_size);
xTaskCreate(&run_codec2, "codec2_task", 30000, NULL, 5, &codec2HandlerTask); xTaskCreate(&run_codec2, "codec2_task", 30000, NULL, 5, &codec2HandlerTask);
} else { } else {
LOG_DEBUG("Codec2 disabled (AudioModule %d, Region %s, permitted %d)\n", moduleConfig.audio.codec2_enabled, myRegion->name, myRegion->audioPermitted); LOG_INFO("Codec2 disabled (AudioModule %d, Region %s, permitted %d)\n", moduleConfig.audio.codec2_enabled, myRegion->name, myRegion->audioPermitted);
} }
} }
@@ -173,7 +173,7 @@ int32_t AudioModule::runOnce()
esp_err_t res; esp_err_t res;
if (firstTime) { if (firstTime) {
// Set up I2S Processor configuration. This will produce 16bit samples at 8 kHz instead of 12 from the ADC // Set up I2S Processor configuration. This will produce 16bit samples at 8 kHz instead of 12 from the ADC
LOG_DEBUG("Initializing I2S SD: %d DIN: %d WS: %d SCK: %d\n", moduleConfig.audio.i2s_sd, moduleConfig.audio.i2s_din, moduleConfig.audio.i2s_ws, moduleConfig.audio.i2s_sck); LOG_INFO("Initializing I2S SD: %d DIN: %d WS: %d SCK: %d\n", moduleConfig.audio.i2s_sd, moduleConfig.audio.i2s_din, moduleConfig.audio.i2s_ws, moduleConfig.audio.i2s_sck);
i2s_config_t i2s_config = { i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | (moduleConfig.audio.i2s_sd ? I2S_MODE_RX : 0) | (moduleConfig.audio.i2s_din ? I2S_MODE_TX : 0)), .mode = (i2s_mode_t)(I2S_MODE_MASTER | (moduleConfig.audio.i2s_sd ? I2S_MODE_RX : 0) | (moduleConfig.audio.i2s_din ? I2S_MODE_TX : 0)),
.sample_rate = 8000, .sample_rate = 8000,
@@ -189,7 +189,7 @@ int32_t AudioModule::runOnce()
}; };
res = i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL); res = i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
if(res != ESP_OK) if(res != ESP_OK)
LOG_DEBUG("Failed to install I2S driver: %d\n", res); LOG_ERROR("Failed to install I2S driver: %d\n", res);
const i2s_pin_config_t pin_config = { const i2s_pin_config_t pin_config = {
.bck_io_num = moduleConfig.audio.i2s_sck, .bck_io_num = moduleConfig.audio.i2s_sck,
@@ -199,16 +199,16 @@ int32_t AudioModule::runOnce()
}; };
res = i2s_set_pin(I2S_PORT, &pin_config); res = i2s_set_pin(I2S_PORT, &pin_config);
if(res != ESP_OK) if(res != ESP_OK)
LOG_DEBUG("Failed to set I2S pin config: %d\n", res); LOG_ERROR("Failed to set I2S pin config: %d\n", res);
res = i2s_start(I2S_PORT); res = i2s_start(I2S_PORT);
if(res != ESP_OK) if(res != ESP_OK)
LOG_DEBUG("Failed to start I2S: %d\n", res); LOG_ERROR("Failed to start I2S: %d\n", res);
radio_state = RadioState::rx; radio_state = RadioState::rx;
// Configure PTT input // Configure PTT input
LOG_DEBUG("Initializing PTT on Pin %u\n", moduleConfig.audio.ptt_pin ? moduleConfig.audio.ptt_pin : PTT_PIN); LOG_INFO("Initializing PTT on Pin %u\n", moduleConfig.audio.ptt_pin ? moduleConfig.audio.ptt_pin : PTT_PIN);
pinMode(moduleConfig.audio.ptt_pin ? moduleConfig.audio.ptt_pin : PTT_PIN, INPUT); pinMode(moduleConfig.audio.ptt_pin ? moduleConfig.audio.ptt_pin : PTT_PIN, INPUT);
firstTime = false; firstTime = false;
@@ -217,17 +217,17 @@ int32_t AudioModule::runOnce()
// Check if PTT is pressed. TODO hook that into Onebutton/Interrupt drive. // Check if PTT is pressed. TODO hook that into Onebutton/Interrupt drive.
if (digitalRead(moduleConfig.audio.ptt_pin ? moduleConfig.audio.ptt_pin : PTT_PIN) == HIGH) { if (digitalRead(moduleConfig.audio.ptt_pin ? moduleConfig.audio.ptt_pin : PTT_PIN) == HIGH) {
if (radio_state == RadioState::rx) { if (radio_state == RadioState::rx) {
LOG_DEBUG("PTT pressed, switching to TX\n"); LOG_INFO("PTT pressed, switching to TX\n");
radio_state = RadioState::tx; radio_state = RadioState::tx;
e.frameChanged = true; e.frameChanged = true;
this->notifyObservers(&e); this->notifyObservers(&e);
} }
} else { } else {
if (radio_state == RadioState::tx) { if (radio_state == RadioState::tx) {
LOG_DEBUG("PTT released, switching to RX\n"); LOG_INFO("PTT released, switching to RX\n");
if (tx_encode_frame_index > sizeof(tx_header)) { if (tx_encode_frame_index > sizeof(tx_header)) {
// Send the incomplete frame // Send the incomplete frame
LOG_DEBUG("Sending %d codec2 bytes (incomplete)\n", tx_encode_frame_index); LOG_INFO("Sending %d codec2 bytes (incomplete)\n", tx_encode_frame_index);
sendPayload(); sendPayload();
} }
tx_encode_frame_index = sizeof(tx_header); tx_encode_frame_index = sizeof(tx_header);
@@ -258,7 +258,7 @@ int32_t AudioModule::runOnce()
} }
return 100; return 100;
} else { } else {
LOG_DEBUG("Audio Module Disabled\n"); LOG_INFO("Audio Module Disabled\n");
return INT32_MAX; return INT32_MAX;
} }
+16 -17
View File
@@ -53,10 +53,10 @@ int32_t RangeTestModule::runOnce()
firstTime = 0; firstTime = 0;
if (moduleConfig.range_test.sender) { if (moduleConfig.range_test.sender) {
LOG_DEBUG("Initializing Range Test Module -- Sender\n"); LOG_INFO("Initializing Range Test Module -- Sender\n");
return (5000); // Sending first message 5 seconds after initilization. return (5000); // Sending first message 5 seconds after initilization.
} else { } else {
LOG_DEBUG("Initializing Range Test Module -- Receiver\n"); LOG_INFO("Initializing Range Test Module -- Receiver\n");
return (INT32_MAX); return (INT32_MAX);
// This thread does not need to run as a receiver // This thread does not need to run as a receiver
} }
@@ -65,19 +65,19 @@ int32_t RangeTestModule::runOnce()
if (moduleConfig.range_test.sender) { if (moduleConfig.range_test.sender) {
// If sender // If sender
LOG_DEBUG("Range Test Module - Sending heartbeat every %d ms\n", (senderHeartbeat)); LOG_INFO("Range Test Module - Sending heartbeat every %d ms\n", (senderHeartbeat));
LOG_DEBUG("gpsStatus->getLatitude() %d\n", gpsStatus->getLatitude()); LOG_INFO("gpsStatus->getLatitude() %d\n", gpsStatus->getLatitude());
LOG_DEBUG("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude()); LOG_INFO("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude());
LOG_DEBUG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock()); LOG_INFO("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
LOG_DEBUG("gpsStatus->getDOP() %d\n", gpsStatus->getDOP()); LOG_INFO("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
LOG_DEBUG("fixed_position() %d\n", config.position.fixed_position); LOG_INFO("fixed_position() %d\n", config.position.fixed_position);
// Only send packets if the channel is less than 25% utilized. // Only send packets if the channel is less than 25% utilized.
if (airTime->channelUtilizationPercent() < 25) { if (airTime->channelUtilizationPercent() < 25) {
rangeTestModuleRadio->sendPayload(); rangeTestModuleRadio->sendPayload();
} else { } else {
LOG_DEBUG("rangeTest - Channel utilization is >25 percent. Skipping this opportunity to send.\n"); LOG_WARN("RangeTest - Channel utilization is >25 percent. Skipping this opportunity to send.\n");
} }
return (senderHeartbeat); return (senderHeartbeat);
@@ -88,9 +88,8 @@ int32_t RangeTestModule::runOnce()
} }
} else { } else {
LOG_DEBUG("Range Test Module - Disabled\n"); LOG_INFO("Range Test Module - Disabled\n");
} }
#endif #endif
@@ -136,7 +135,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp)
/* /*
auto &p = mp.decoded; 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\n",
nodeDB.getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes); LOG_INFO.getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
*/ */
if (getFrom(&mp) != nodeDB.getNodeNum()) { if (getFrom(&mp) != nodeDB.getNodeNum()) {
@@ -174,7 +173,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp)
} }
} else { } else {
LOG_DEBUG("Range Test Module Disabled\n"); LOG_INFO("Range Test Module Disabled\n");
} }
#endif #endif
@@ -229,16 +228,16 @@ bool RangeTestModuleRadio::appendFile(const MeshPacket &mp)
File fileToWrite = FSCom.open("/static/rangetest.csv", FILE_WRITE); File fileToWrite = FSCom.open("/static/rangetest.csv", FILE_WRITE);
if (!fileToWrite) { if (!fileToWrite) {
LOG_DEBUG("There was an error opening the file for writing\n"); LOG_ERROR("There was an error opening the file for writing\n");
return 0; return 0;
} }
// Print the CSV header // Print the CSV header
if (fileToWrite.println( if (fileToWrite.println(
"time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload")) { "time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload")) {
LOG_DEBUG("File was written\n"); LOG_INFO("File was written\n");
} else { } else {
LOG_DEBUG("File write failed\n"); LOG_ERROR("File write failed\n");
} }
fileToWrite.close(); fileToWrite.close();
@@ -248,7 +247,7 @@ bool RangeTestModuleRadio::appendFile(const MeshPacket &mp)
File fileToAppend = FSCom.open("/static/rangetest.csv", FILE_APPEND); File fileToAppend = FSCom.open("/static/rangetest.csv", FILE_APPEND);
if (!fileToAppend) { if (!fileToAppend) {
LOG_DEBUG("There was an error opening the file for appending\n"); LOG_ERROR("There was an error opening the file for appending\n");
return 0; return 0;
} }
+23 -23
View File
@@ -28,20 +28,20 @@ int32_t StoreForwardModule::runOnce()
StoreAndForward sf = StoreAndForward_init_zero; StoreAndForward sf = StoreAndForward_init_zero;
sf.rr = StoreAndForward_RequestResponse_ROUTER_PING; sf.rr = StoreAndForward_RequestResponse_ROUTER_PING;
storeForwardModule->sendMessage(this->busyTo, sf); storeForwardModule->sendMessage(this->busyTo, sf);
LOG_DEBUG("*** S&F - Done. (ROUTER_PING)\n"); LOG_INFO("*** S&F - Done. (ROUTER_PING)\n");
this->packetHistoryTXQueue_index = 0; this->packetHistoryTXQueue_index = 0;
this->busy = false; this->busy = false;
} else { } else {
this->packetHistoryTXQueue_index++; this->packetHistoryTXQueue_index++;
} }
} else { } else {
LOG_DEBUG("*** Channel utilization is too high. Retrying later.\n"); LOG_WARN("*** Channel utilization is too high. Retrying later.\n");
} }
LOG_DEBUG("*** SF bitrate = %f bytes / sec\n", myNodeInfo.bitrate); LOG_DEBUG("*** SF bitrate = %f bytes / sec\n", myNodeInfo.bitrate);
} else if ((millis() - lastHeartbeat > (heartbeatInterval * 1000)) && (airTime->channelUtilizationPercent() < polite_channel_util_percent)) { } else if ((millis() - lastHeartbeat > (heartbeatInterval * 1000)) && (airTime->channelUtilizationPercent() < polite_channel_util_percent)) {
lastHeartbeat = millis(); lastHeartbeat = millis();
LOG_DEBUG("*** Sending heartbeat\n"); LOG_INFO("*** Sending heartbeat\n");
StoreAndForward sf = StoreAndForward_init_zero; StoreAndForward sf = StoreAndForward_init_zero;
sf.rr = StoreAndForward_RequestResponse_ROUTER_HEARTBEAT; sf.rr = StoreAndForward_RequestResponse_ROUTER_HEARTBEAT;
sf.which_variant = StoreAndForward_heartbeat_tag; sf.which_variant = StoreAndForward_heartbeat_tag;
@@ -87,11 +87,11 @@ void StoreForwardModule::historySend(uint32_t msAgo, uint32_t to)
uint32_t queueSize = storeForwardModule->historyQueueCreate(msAgo, to); uint32_t queueSize = storeForwardModule->historyQueueCreate(msAgo, to);
if (queueSize) { if (queueSize) {
LOG_DEBUG ("*** S&F - Sending %u message(s)\n", queueSize); LOG_INFO("*** S&F - Sending %u message(s)\n", queueSize);
this->busy = true; // runOnce() will pickup the next steps once busy = true. this->busy = true; // runOnce() will pickup the next steps once busy = true.
this->busyTo = to; this->busyTo = to;
} else { } else {
LOG_DEBUG ("*** S&F - No history to send\n"); LOG_INFO("*** S&F - No history to send\n");
} }
StoreAndForward sf = StoreAndForward_init_zero; StoreAndForward sf = StoreAndForward_init_zero;
sf.rr = StoreAndForward_RequestResponse_ROUTER_HISTORY; sf.rr = StoreAndForward_RequestResponse_ROUTER_HISTORY;
@@ -164,7 +164,7 @@ MeshPacket *StoreForwardModule::allocReply()
void StoreForwardModule::sendPayload(NodeNum dest, uint32_t packetHistory_index) void StoreForwardModule::sendPayload(NodeNum dest, uint32_t packetHistory_index)
{ {
LOG_DEBUG("*** Sending S&F Payload\n"); LOG_INFO("*** Sending S&F Payload\n");
MeshPacket *p = allocReply(); MeshPacket *p = allocReply();
p->to = dest; p->to = dest;
@@ -241,7 +241,7 @@ ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp)
if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) { if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) {
storeForwardModule->historyAdd(mp); storeForwardModule->historyAdd(mp);
LOG_DEBUG("*** S&F stored. Message history contains %u records now.\n", this->packetHistoryCurrent); LOG_INFO("*** S&F stored. Message history contains %u records now.\n", this->packetHistoryCurrent);
} else if (mp.decoded.portnum == PortNum_STORE_FORWARD_APP) { } else if (mp.decoded.portnum == PortNum_STORE_FORWARD_APP) {
auto &p = mp.decoded; auto &p = mp.decoded;
@@ -251,7 +251,7 @@ ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp)
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &StoreAndForward_msg, &scratch)) { if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &StoreAndForward_msg, &scratch)) {
decoded = &scratch; decoded = &scratch;
} else { } else {
LOG_DEBUG("Error decoding protobuf module!\n"); LOG_ERROR("Error decoding protobuf module!\n");
// if we can't decode it, nobody can process it! // if we can't decode it, nobody can process it!
return ProcessMessage::STOP; return ProcessMessage::STOP;
} }
@@ -281,7 +281,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
if(is_server) { if(is_server) {
// stop sending stuff, the client wants to abort or has another error // stop sending stuff, the client wants to abort or has another error
if ((this->busy) && (this->busyTo == getFrom(&mp))) { if ((this->busy) && (this->busyTo == getFrom(&mp))) {
LOG_DEBUG("*** Client in ERROR or ABORT requested\n"); LOG_ERROR("*** Client in ERROR or ABORT requested\n");
this->packetHistoryTXQueue_index = 0; this->packetHistoryTXQueue_index = 0;
this->busy = false; this->busy = false;
} }
@@ -291,11 +291,11 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
case StoreAndForward_RequestResponse_CLIENT_HISTORY: case StoreAndForward_RequestResponse_CLIENT_HISTORY:
if(is_server) { if(is_server) {
requests_history++; requests_history++;
LOG_DEBUG("*** Client Request to send HISTORY\n"); LOG_INFO("*** Client Request to send HISTORY\n");
// Send the last 60 minutes of messages. // Send the last 60 minutes of messages.
if (this->busy) { if (this->busy) {
storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY); storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY);
LOG_DEBUG("*** S&F - Busy. Try again shortly.\n"); LOG_INFO("*** S&F - Busy. Try again shortly.\n");
} else { } else {
if ((p->which_variant == StoreAndForward_history_tag) && (p->variant.history.window > 0)){ if ((p->which_variant == StoreAndForward_history_tag) && (p->variant.history.window > 0)){
storeForwardModule->historySend(p->variant.history.window * 60000, getFrom(&mp)); // window is in minutes storeForwardModule->historySend(p->variant.history.window * 60000, getFrom(&mp)); // window is in minutes
@@ -308,7 +308,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
case StoreAndForward_RequestResponse_CLIENT_PING: case StoreAndForward_RequestResponse_CLIENT_PING:
if(is_server) { if(is_server) {
LOG_DEBUG("*** StoreAndForward_RequestResponse_CLIENT_PING\n"); LOG_INFO("*** StoreAndForward_RequestResponse_CLIENT_PING\n");
// respond with a ROUTER PONG // respond with a ROUTER PONG
storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_PONG); storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_PONG);
} }
@@ -316,7 +316,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
case StoreAndForward_RequestResponse_CLIENT_PONG: case StoreAndForward_RequestResponse_CLIENT_PONG:
if(is_server) { if(is_server) {
LOG_DEBUG("*** StoreAndForward_RequestResponse_CLIENT_PONG\n"); LOG_INFO("*** StoreAndForward_RequestResponse_CLIENT_PONG\n");
// The Client is alive, update NodeDB // The Client is alive, update NodeDB
nodeDB.updateFrom(mp); nodeDB.updateFrom(mp);
} }
@@ -324,10 +324,10 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
case StoreAndForward_RequestResponse_CLIENT_STATS: case StoreAndForward_RequestResponse_CLIENT_STATS:
if(is_server) { if(is_server) {
LOG_DEBUG("*** Client Request to send STATS\n"); LOG_INFO("*** Client Request to send STATS\n");
if (this->busy) { if (this->busy) {
storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY); storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY);
LOG_DEBUG("*** S&F - Busy. Try again shortly.\n"); LOG_INFO("*** S&F - Busy. Try again shortly.\n");
} else { } else {
storeForwardModule->statsSend(getFrom(&mp)); storeForwardModule->statsSend(getFrom(&mp));
} }
@@ -352,7 +352,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
heartbeatInterval = p->variant.heartbeat.period; heartbeatInterval = p->variant.heartbeat.period;
} }
lastHeartbeat = millis(); lastHeartbeat = millis();
LOG_DEBUG("*** StoreAndForward Heartbeat received\n"); LOG_INFO("*** StoreAndForward Heartbeat received\n");
} }
break; break;
@@ -386,7 +386,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
// These fields only have informational purpose on a client. Fill them to consume later. // These fields only have informational purpose on a client. Fill them to consume later.
if (p->which_variant == StoreAndForward_history_tag) { if (p->which_variant == StoreAndForward_history_tag) {
this->historyReturnWindow = p->variant.history.window / 60000; this->historyReturnWindow = p->variant.history.window / 60000;
LOG_DEBUG("*** Router Response HISTORY - Sending %d messages from last %d minutes\n", p->variant.history.history_messages, this->historyReturnWindow); LOG_INFO("*** Router Response HISTORY - Sending %d messages from last %d minutes\n", p->variant.history.history_messages, this->historyReturnWindow);
} }
} }
break; break;
@@ -418,7 +418,7 @@ StoreForwardModule::StoreForwardModule()
// Router // Router
if ((config.device.role == Config_DeviceConfig_Role_ROUTER) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) { if ((config.device.role == Config_DeviceConfig_Role_ROUTER) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
LOG_DEBUG("*** Initializing Store & Forward Module in Router mode\n"); LOG_INFO("*** Initializing Store & Forward Module in Router mode\n");
if (ESP.getPsramSize() > 0) { if (ESP.getPsramSize() > 0) {
if (ESP.getFreePsram() >= 1024 * 1024) { if (ESP.getFreePsram() >= 1024 * 1024) {
@@ -444,19 +444,19 @@ StoreForwardModule::StoreForwardModule()
this->populatePSRAM(); this->populatePSRAM();
is_server = true; is_server = true;
} else { } else {
LOG_DEBUG("*** Device has less than 1M of PSRAM free.\n"); LOG_INFO("*** Device has less than 1M of PSRAM free.\n");
LOG_DEBUG("*** Store & Forward Module - disabling server.\n"); LOG_INFO("*** Store & Forward Module - disabling server.\n");
} }
} else { } else {
LOG_DEBUG("*** Device doesn't have PSRAM.\n"); LOG_INFO("*** Device doesn't have PSRAM.\n");
LOG_DEBUG("*** Store & Forward Module - disabling server.\n"); LOG_INFO("*** Store & Forward Module - disabling server.\n");
} }
// Client // Client
} }
if ((config.device.role == Config_DeviceConfig_Role_CLIENT) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) { if ((config.device.role == Config_DeviceConfig_Role_CLIENT) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
is_client = true; is_client = true;
LOG_DEBUG("*** Initializing Store & Forward Module in Client mode\n"); LOG_INFO("*** Initializing Store & Forward Module in Client mode\n");
} }
} }
#endif #endif
+27 -27
View File
@@ -42,7 +42,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
payloadStr[length] = 0; // null terminated string payloadStr[length] = 0; // null terminated string
JSONValue *json_value = JSON::Parse(payloadStr); JSONValue *json_value = JSON::Parse(payloadStr);
if (json_value != NULL) { if (json_value != NULL) {
LOG_DEBUG("JSON Received on MQTT, parsing..\n"); LOG_INFO("JSON Received on MQTT, parsing..\n");
// check if it is a valid envelope // check if it is a valid envelope
JSONObject json; JSONObject json;
json = json_value->AsObject(); json = json_value->AsObject();
@@ -50,7 +50,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
// this is a valid envelope // this is a valid envelope
if (json["payload"]->IsString() && json["type"]->IsString() && (json["sender"]->AsString().compare(owner.id) != 0)) { if (json["payload"]->IsString() && json["type"]->IsString() && (json["sender"]->AsString().compare(owner.id) != 0)) {
std::string jsonPayloadStr = json["payload"]->AsString(); std::string jsonPayloadStr = json["payload"]->AsString();
LOG_DEBUG("JSON payload %s, length %u\n", jsonPayloadStr.c_str(), jsonPayloadStr.length()); LOG_INFO("JSON payload %s, length %u\n", jsonPayloadStr.c_str(), jsonPayloadStr.length());
// construct protobuf data packet using TEXT_MESSAGE, send it to the mesh // construct protobuf data packet using TEXT_MESSAGE, send it to the mesh
MeshPacket *p = router->allocForSending(); MeshPacket *p = router->allocForSending();
@@ -61,7 +61,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
MeshPacket *packet = packetPool.allocCopy(*p); MeshPacket *packet = packetPool.allocCopy(*p);
service.sendToMesh(packet, RX_SRC_LOCAL); service.sendToMesh(packet, RX_SRC_LOCAL);
} else { } else {
LOG_DEBUG("Received MQTT json payload too long, dropping\n"); LOG_WARN("Received MQTT json payload too long, dropping\n");
} }
} else { } else {
LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n"); LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n");
@@ -87,23 +87,23 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n"); LOG_DEBUG("JSON Ignoring downlink message we originally sent.\n");
} }
} else{ } else{
LOG_DEBUG("JSON Received payload on MQTT but not a valid envelope\n"); LOG_ERROR("JSON Received payload on MQTT but not a valid envelope\n");
} }
} else { } else {
// no json, this is an invalid payload // no json, this is an invalid payload
LOG_DEBUG("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length); LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length);
} }
delete json_value; delete json_value;
} else { } else {
if (!pb_decode_from_bytes(payload, length, &ServiceEnvelope_msg, &e)) { if (!pb_decode_from_bytes(payload, length, &ServiceEnvelope_msg, &e)) {
LOG_DEBUG("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length); LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length);
return; return;
}else { }else {
if (strcmp(e.gateway_id, owner.id) == 0) if (strcmp(e.gateway_id, owner.id) == 0)
LOG_DEBUG("Ignoring downlink message we originally sent.\n"); LOG_INFO("Ignoring downlink message we originally sent.\n");
else { else {
if (e.packet) { if (e.packet) {
LOG_DEBUG("Received MQTT topic %s, len=%u\n", topic, length); LOG_INFO("Received MQTT topic %s, len=%u\n", topic, length);
MeshPacket *p = packetPool.allocCopy(*e.packet); MeshPacket *p = packetPool.allocCopy(*e.packet);
// ignore messages sent by us or if we don't have the channel key // ignore messages sent by us or if we don't have the channel key
@@ -166,22 +166,22 @@ void MQTT::reconnect()
} }
pubSub.setServer(serverAddr, serverPort); pubSub.setServer(serverAddr, serverPort);
LOG_DEBUG("Connecting to MQTT server %s, port: %d, username: %s, password: %s\n", serverAddr, serverPort, mqttUsername, mqttPassword); LOG_INFO("Connecting to MQTT server %s, port: %d, username: %s, password: %s\n", serverAddr, serverPort, mqttUsername, mqttPassword);
auto myStatus = (statusTopic + owner.id); auto myStatus = (statusTopic + owner.id);
bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword, myStatus.c_str(), 1, true, "offline"); bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword, myStatus.c_str(), 1, true, "offline");
if (connected) { if (connected) {
LOG_DEBUG("MQTT connected\n"); LOG_INFO("MQTT connected\n");
enabled = true; // Start running background process again enabled = true; // Start running background process again
runASAP = true; runASAP = true;
reconnectCount = 0; reconnectCount = 0;
/// FIXME, include more information in the status text /// FIXME, include more information in the status text
bool ok = pubSub.publish(myStatus.c_str(), "online", true); bool ok = pubSub.publish(myStatus.c_str(), "online", true);
LOG_DEBUG("published %d\n", ok); LOG_INFO("published %d\n", ok);
sendSubscriptions(); sendSubscriptions();
} else { } else {
LOG_DEBUG("Failed to contact MQTT server (%d/10)...\n",reconnectCount); LOG_ERROR("Failed to contact MQTT server (%d/10)...\n",reconnectCount);
#if HAS_WIFI && !defined(ARCH_PORTDUINO) #if HAS_WIFI && !defined(ARCH_PORTDUINO)
if (reconnectCount > 9) { if (reconnectCount > 9) {
needReconnect = true; needReconnect = true;
@@ -200,11 +200,11 @@ void MQTT::sendSubscriptions()
auto &ch = channels.getByIndex(i); auto &ch = channels.getByIndex(i);
if (ch.settings.downlink_enabled) { if (ch.settings.downlink_enabled) {
String topic = cryptTopic + channels.getGlobalId(i) + "/#"; String topic = cryptTopic + channels.getGlobalId(i) + "/#";
LOG_DEBUG("Subscribing to %s\n", topic.c_str()); LOG_INFO("Subscribing to %s\n", topic.c_str());
pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right? pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right?
if (moduleConfig.mqtt.json_enabled == true) { if (moduleConfig.mqtt.json_enabled == true) {
String topicDecoded = jsonTopic + channels.getGlobalId(i) + "/#"; String topicDecoded = jsonTopic + channels.getGlobalId(i) + "/#";
LOG_DEBUG("Subscribing to %s\n", topicDecoded.c_str()); LOG_INFO("Subscribing to %s\n", topicDecoded.c_str());
pubSub.subscribe(topicDecoded.c_str(), 1); // FIXME, is QOS 1 right? pubSub.subscribe(topicDecoded.c_str(), 1); // FIXME, is QOS 1 right?
} }
} }
@@ -254,7 +254,7 @@ int32_t MQTT::runOnce()
size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &ServiceEnvelope_msg, env); size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &ServiceEnvelope_msg, env);
String topic = cryptTopic + env->channel_id + "/" + owner.id; String topic = cryptTopic + env->channel_id + "/" + owner.id;
LOG_DEBUG("publish %s, %u bytes from queue\n", topic.c_str(), numBytes); LOG_INFO("publish %s, %u bytes from queue\n", topic.c_str(), numBytes);
pubSub.publish(topic.c_str(), bytes, numBytes, false); pubSub.publish(topic.c_str(), bytes, numBytes, false);
@@ -264,7 +264,7 @@ int32_t MQTT::runOnce()
auto jsonString = this->downstreamPacketToJson(env->packet); auto jsonString = this->downstreamPacketToJson(env->packet);
if (jsonString.length() != 0) { if (jsonString.length() != 0) {
String topicJson = jsonTopic + env->channel_id + "/" + owner.id; String topicJson = jsonTopic + env->channel_id + "/" + owner.id;
LOG_DEBUG("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(), jsonString.c_str()); LOG_INFO("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(), jsonString.c_str());
pubSub.publish(topicJson.c_str(), jsonString.c_str(), false); pubSub.publish(topicJson.c_str(), jsonString.c_str(), false);
} }
} }
@@ -279,7 +279,7 @@ int32_t MQTT::runOnce()
} else { } else {
// we are connected to server, check often for new requests on the TCP port // we are connected to server, check often for new requests on the TCP port
if (!wantConnection) { if (!wantConnection) {
LOG_DEBUG("MQTT link not needed, dropping\n"); LOG_INFO("MQTT link not needed, dropping\n");
pubSub.disconnect(); pubSub.disconnect();
} }
@@ -317,14 +317,14 @@ void MQTT::onSend(const MeshPacket &mp, ChannelIndex chIndex)
auto jsonString = this->downstreamPacketToJson((MeshPacket *)&mp); auto jsonString = this->downstreamPacketToJson((MeshPacket *)&mp);
if (jsonString.length() != 0) { if (jsonString.length() != 0) {
String topicJson = jsonTopic + channelId + "/" + owner.id; String topicJson = jsonTopic + channelId + "/" + owner.id;
LOG_DEBUG("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(), jsonString.c_str()); LOG_INFO("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(), jsonString.c_str());
pubSub.publish(topicJson.c_str(), jsonString.c_str(), false); pubSub.publish(topicJson.c_str(), jsonString.c_str(), false);
} }
} }
} else { } else {
LOG_DEBUG("MQTT not connected, queueing packet\n"); LOG_INFO("MQTT not connected, queueing packet\n");
if (mqttQueue.numFree() == 0) { if (mqttQueue.numFree() == 0) {
LOG_DEBUG("NOTE: MQTT queue is full, discarding oldest\n"); LOG_WARN("NOTE: MQTT queue is full, discarding oldest\n");
ServiceEnvelope *d = mqttQueue.dequeuePtr(0); ServiceEnvelope *d = mqttQueue.dequeuePtr(0);
if (d) if (d)
mqttPool.release(d); mqttPool.release(d);
@@ -357,13 +357,13 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
// check if this is a JSON payload // check if this is a JSON payload
JSONValue *json_value = JSON::Parse(payloadStr); JSONValue *json_value = JSON::Parse(payloadStr);
if (json_value != NULL) { if (json_value != NULL) {
LOG_DEBUG("text message payload is of type json\n"); LOG_INFO("text message payload is of type json\n");
// if it is, then we can just use the json object // if it is, then we can just use the json object
jsonObj["payload"] = json_value; jsonObj["payload"] = json_value;
} else { } else {
// if it isn't, then we need to create a json object // if it isn't, then we need to create a json object
// with the string as the value // with the string as the value
LOG_DEBUG("text message payload is of type plaintext\n"); LOG_INFO("text message payload is of type plaintext\n");
msgPayload["text"] = new JSONValue(payloadStr); msgPayload["text"] = new JSONValue(payloadStr);
jsonObj["payload"] = new JSONValue(msgPayload); jsonObj["payload"] = new JSONValue(msgPayload);
} }
@@ -392,7 +392,7 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
} }
jsonObj["payload"] = new JSONValue(msgPayload); jsonObj["payload"] = new JSONValue(msgPayload);
} else } else
LOG_DEBUG("Error decoding protobuf for telemetry message!\n"); LOG_ERROR("Error decoding protobuf for telemetry message!\n");
}; };
break; break;
} }
@@ -410,7 +410,7 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
msgPayload["hardware"] = new JSONValue(decoded->hw_model); msgPayload["hardware"] = new JSONValue(decoded->hw_model);
jsonObj["payload"] = new JSONValue(msgPayload); jsonObj["payload"] = new JSONValue(msgPayload);
} else } else
LOG_DEBUG("Error decoding protobuf for nodeinfo message!\n"); LOG_ERROR("Error decoding protobuf for nodeinfo message!\n");
}; };
break; break;
} }
@@ -429,7 +429,7 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
if((int)decoded->altitude){msgPayload["altitude"] = new JSONValue((int)decoded->altitude);} if((int)decoded->altitude){msgPayload["altitude"] = new JSONValue((int)decoded->altitude);}
jsonObj["payload"] = new JSONValue(msgPayload); jsonObj["payload"] = new JSONValue(msgPayload);
} else { } else {
LOG_DEBUG("Error decoding protobuf for position message!\n"); LOG_ERROR("Error decoding protobuf for position message!\n");
} }
}; };
break; break;
@@ -452,7 +452,7 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
msgPayload["longitude_i"] = new JSONValue((int)decoded->longitude_i); msgPayload["longitude_i"] = new JSONValue((int)decoded->longitude_i);
jsonObj["payload"] = new JSONValue(msgPayload); jsonObj["payload"] = new JSONValue(msgPayload);
} else { } else {
LOG_DEBUG("Error decoding protobuf for position message!\n"); LOG_ERROR("Error decoding protobuf for position message!\n");
} }
}; };
break; break;
@@ -474,7 +474,7 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
JSONValue *value = new JSONValue(jsonObj); JSONValue *value = new JSONValue(jsonObj);
std::string jsonStr = value->Stringify(); std::string jsonStr = value->Stringify();
LOG_DEBUG("serialized json message: %s\n", jsonStr.c_str()); LOG_INFO("serialized json message: %s\n", jsonStr.c_str());
delete value; delete value;
return jsonStr; return jsonStr;
+10 -10
View File
@@ -22,7 +22,7 @@ class BluetoothPhoneAPI : public PhoneAPI
{ {
PhoneAPI::onNowHasData(fromRadioNum); PhoneAPI::onNowHasData(fromRadioNum);
LOG_DEBUG("BLE notify fromNum\n"); LOG_INFO("BLE notify fromNum\n");
uint8_t val[4]; uint8_t val[4];
put_le32(val, fromRadioNum); put_le32(val, fromRadioNum);
@@ -46,7 +46,7 @@ static BluetoothPhoneAPI *bluetoothPhoneAPI;
class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks
{ {
virtual void onWrite(NimBLECharacteristic *pCharacteristic) { virtual void onWrite(NimBLECharacteristic *pCharacteristic) {
LOG_DEBUG("To Radio onwrite\n"); LOG_INFO("To Radio onwrite\n");
auto val = pCharacteristic->getValue(); auto val = pCharacteristic->getValue();
bluetoothPhoneAPI->handleToRadio(val.data(), val.length()); bluetoothPhoneAPI->handleToRadio(val.data(), val.length());
@@ -56,7 +56,7 @@ class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks
class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks
{ {
virtual void onRead(NimBLECharacteristic *pCharacteristic) { virtual void onRead(NimBLECharacteristic *pCharacteristic) {
LOG_DEBUG("From Radio onread\n"); LOG_INFO("From Radio onread\n");
uint8_t fromRadioBytes[FromRadio_size]; uint8_t fromRadioBytes[FromRadio_size];
size_t numBytes = bluetoothPhoneAPI->getFromRadio(fromRadioBytes); size_t numBytes = bluetoothPhoneAPI->getFromRadio(fromRadioBytes);
@@ -72,11 +72,11 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
uint32_t passkey = config.bluetooth.fixed_pin; uint32_t passkey = config.bluetooth.fixed_pin;
if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_RANDOM_PIN) { if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_RANDOM_PIN) {
LOG_DEBUG("Using random passkey\n"); LOG_INFO("Using random passkey\n");
// This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits // This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits
passkey = random(100000, 999999); passkey = random(100000, 999999);
} }
LOG_DEBUG("*** Enter passkey %d on the peer side ***\n", passkey); LOG_INFO("*** Enter passkey %d on the peer side ***\n", passkey);
powerFSM.trigger(EVENT_BLUETOOTH_PAIR); powerFSM.trigger(EVENT_BLUETOOTH_PAIR);
screen->startBluetoothPinScreen(passkey); screen->startBluetoothPinScreen(passkey);
@@ -87,7 +87,7 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
virtual void onAuthenticationComplete(ble_gap_conn_desc *desc) virtual void onAuthenticationComplete(ble_gap_conn_desc *desc)
{ {
LOG_DEBUG("BLE authentication complete\n"); LOG_INFO("BLE authentication complete\n");
if (passkeyShowing) { if (passkeyShowing) {
passkeyShowing = false; passkeyShowing = false;
@@ -98,7 +98,7 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc *desc) virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc *desc)
{ {
LOG_DEBUG("BLE disconnect\n"); LOG_INFO("BLE disconnect\n");
} }
}; };
@@ -108,7 +108,7 @@ static NimbleBluetoothFromRadioCallback *fromRadioCallbacks;
void NimbleBluetooth::shutdown() void NimbleBluetooth::shutdown()
{ {
// Shutdown bluetooth for minimum power draw // Shutdown bluetooth for minimum power draw
LOG_DEBUG("Disable bluetooth\n"); LOG_INFO("Disable bluetooth\n");
//Bluefruit.Advertising.stop(); //Bluefruit.Advertising.stop();
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
pAdvertising->reset(); pAdvertising->reset();
@@ -125,7 +125,7 @@ void NimbleBluetooth::setup()
// Uncomment for testing // Uncomment for testing
// NimbleBluetooth::clearBonds(); // NimbleBluetooth::clearBonds();
LOG_DEBUG("Initialise the NimBLE bluetooth module\n"); LOG_INFO("Initialise the NimBLE bluetooth module\n");
NimBLEDevice::init(getDeviceName()); NimBLEDevice::init(getDeviceName());
NimBLEDevice::setPower(ESP_PWR_LVL_P9); NimBLEDevice::setPower(ESP_PWR_LVL_P9);
@@ -186,7 +186,7 @@ void updateBatteryLevel(uint8_t level)
void NimbleBluetooth::clearBonds() void NimbleBluetooth::clearBonds()
{ {
LOG_DEBUG("Clearing bluetooth bonds!\n"); LOG_INFO("Clearing bluetooth bonds!\n");
NimBLEDevice::deleteAllBonds(); NimBLEDevice::deleteAllBonds();
} }
+2 -2
View File
@@ -9,7 +9,7 @@ void *SimpleAllocator::alloc(size_t size)
assert(nextFree + size <= sizeof(bytes)); assert(nextFree + size <= sizeof(bytes));
void *res = &bytes[nextFree]; void *res = &bytes[nextFree];
nextFree += size; nextFree += size;
Serial.printf("Total simple allocs %u\n", nextFree); LOG_DEBUG("Total simple allocs %u\n", nextFree);
return res; return res;
} }
@@ -52,7 +52,7 @@ void *operator new(size_t sz) throw(std::bad_alloc)
void operator delete(void *ptr) throw() void operator delete(void *ptr) throw()
{ {
if (activeAllocator) if (activeAllocator)
Serial.println("Warning: leaking an active allocator object"); // We don't properly handle this yet LOG_DEBUG("Warning: leaking an active allocator object\n"); // We don't properly handle this yet
else else
free(ptr); free(ptr);
} }
+23 -23
View File
@@ -33,7 +33,7 @@ class BluetoothPhoneAPI : public PhoneAPI
{ {
PhoneAPI::onNowHasData(fromRadioNum); PhoneAPI::onNowHasData(fromRadioNum);
LOG_DEBUG("BLE notify fromNum\n"); LOG_INFO("BLE notify fromNum\n");
fromNum.notify32(fromRadioNum); fromNum.notify32(fromRadioNum);
} }
@@ -55,7 +55,7 @@ void onConnect(uint16_t conn_handle)
char central_name[32] = {0}; char central_name[32] = {0};
connection->getPeerName(central_name, sizeof(central_name)); connection->getPeerName(central_name, sizeof(central_name));
LOG_DEBUG("BLE Connected to %s\n", central_name); LOG_INFO("BLE Connected to %s\n", central_name);
} }
/** /**
@@ -66,21 +66,21 @@ void onConnect(uint16_t conn_handle)
void onDisconnect(uint16_t conn_handle, uint8_t reason) void onDisconnect(uint16_t conn_handle, uint8_t reason)
{ {
// FIXME - we currently assume only one active connection // FIXME - we currently assume only one active connection
LOG_DEBUG("BLE Disconnected, reason = 0x%x\n", reason); LOG_INFO("BLE Disconnected, reason = 0x%x\n", reason);
} }
void onCccd(uint16_t conn_hdl, BLECharacteristic *chr, uint16_t cccd_value) void onCccd(uint16_t conn_hdl, BLECharacteristic *chr, uint16_t cccd_value)
{ {
// Display the raw request packet // Display the raw request packet
LOG_DEBUG("CCCD Updated: %u\n", cccd_value); LOG_INFO("CCCD Updated: %u\n", cccd_value);
// Check the characteristic this CCCD update is associated with in case // Check the characteristic this CCCD update is associated with in case
// this handler is used for multiple CCCD records. // this handler is used for multiple CCCD records.
if (chr->uuid == fromNum.uuid) { if (chr->uuid == fromNum.uuid) {
if (chr->notifyEnabled(conn_hdl)) { if (chr->notifyEnabled(conn_hdl)) {
LOG_DEBUG("fromNum 'Notify' enabled\n"); LOG_INFO("fromNum 'Notify' enabled\n");
} else { } else {
LOG_DEBUG("fromNum 'Notify' disabled\n"); LOG_INFO("fromNum 'Notify' disabled\n");
} }
} }
} }
@@ -135,14 +135,14 @@ void onFromRadioAuthorize(uint16_t conn_hdl, BLECharacteristic *chr, ble_gatts_e
// or make empty if the queue is empty // or make empty if the queue is empty
fromRadio.write(fromRadioBytes, numBytes); fromRadio.write(fromRadioBytes, numBytes);
} else { } else {
// LOG_DEBUG("Ignoring successor read\n"); // LOG_INFO("Ignoring successor read\n");
} }
authorizeRead(conn_hdl); authorizeRead(conn_hdl);
} }
void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len) void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len)
{ {
LOG_DEBUG("toRadioWriteCb data %p, len %u\n", data, len); LOG_INFO("toRadioWriteCb data %p, len %u\n", data, len);
bluetoothPhoneAPI->handleToRadio(data, len); bluetoothPhoneAPI->handleToRadio(data, len);
} }
@@ -152,7 +152,7 @@ void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, ui
*/ */
void onFromNumAuthorize(uint16_t conn_hdl, BLECharacteristic *chr, ble_gatts_evt_read_t *request) void onFromNumAuthorize(uint16_t conn_hdl, BLECharacteristic *chr, ble_gatts_evt_read_t *request)
{ {
LOG_DEBUG("fromNumAuthorizeCb\n"); LOG_INFO("fromNumAuthorizeCb\n");
authorizeRead(conn_hdl); authorizeRead(conn_hdl);
} }
@@ -204,14 +204,14 @@ static uint32_t configuredPasskey;
void NRF52Bluetooth::shutdown() void NRF52Bluetooth::shutdown()
{ {
// Shutdown bluetooth for minimum power draw // Shutdown bluetooth for minimum power draw
LOG_DEBUG("Disable NRF52 bluetooth\n"); LOG_INFO("Disable NRF52 bluetooth\n");
Bluefruit.Advertising.stop(); Bluefruit.Advertising.stop();
} }
void NRF52Bluetooth::setup() void NRF52Bluetooth::setup()
{ {
// Initialise the Bluefruit module // Initialise the Bluefruit module
LOG_DEBUG("Initialize the Bluefruit nRF52 module\n"); LOG_INFO("Initialize the Bluefruit nRF52 module\n");
Bluefruit.autoConnLed(false); Bluefruit.autoConnLed(false);
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX); Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.begin(); Bluefruit.begin();
@@ -225,7 +225,7 @@ void NRF52Bluetooth::setup()
configuredPasskey = config.bluetooth.mode == Config_BluetoothConfig_PairingMode_FIXED_PIN ? configuredPasskey = config.bluetooth.mode == Config_BluetoothConfig_PairingMode_FIXED_PIN ?
config.bluetooth.fixed_pin : random(100000, 999999); config.bluetooth.fixed_pin : random(100000, 999999);
auto pinString = std::to_string(configuredPasskey); auto pinString = std::to_string(configuredPasskey);
LOG_DEBUG("Bluetooth pin set to '%i'\n", configuredPasskey); LOG_INFO("Bluetooth pin set to '%i'\n", configuredPasskey);
Bluefruit.Security.setPIN(pinString.c_str()); Bluefruit.Security.setPIN(pinString.c_str());
Bluefruit.Security.setIOCaps(true, false, false); Bluefruit.Security.setIOCaps(true, false, false);
Bluefruit.Security.setPairPasskeyCallback(NRF52Bluetooth::onPairingPasskey); Bluefruit.Security.setPairPasskeyCallback(NRF52Bluetooth::onPairingPasskey);
@@ -248,30 +248,30 @@ void NRF52Bluetooth::setup()
bledfu.begin(); // Install the DFU helper bledfu.begin(); // Install the DFU helper
// Configure and Start the Device Information Service // Configure and Start the Device Information Service
LOG_DEBUG("Configuring the Device Information Service\n"); LOG_INFO("Configuring the Device Information Service\n");
bledis.setModel(optstr(HW_VERSION)); bledis.setModel(optstr(HW_VERSION));
bledis.setFirmwareRev(optstr(APP_VERSION)); bledis.setFirmwareRev(optstr(APP_VERSION));
bledis.begin(); bledis.begin();
// Start the BLE Battery Service and set it to 100% // Start the BLE Battery Service and set it to 100%
LOG_DEBUG("Configuring the Battery Service\n"); LOG_INFO("Configuring the Battery Service\n");
blebas.begin(); blebas.begin();
blebas.write(0); // Unknown battery level for now blebas.write(0); // Unknown battery level for now
// Setup the Heart Rate Monitor service using // Setup the Heart Rate Monitor service using
// BLEService and BLECharacteristic classes // BLEService and BLECharacteristic classes
LOG_DEBUG("Configuring the Mesh bluetooth service\n"); LOG_INFO("Configuring the Mesh bluetooth service\n");
setupMeshService(); setupMeshService();
// Supposedly debugging works with soft device if you disable advertising // Supposedly debugging works with soft device if you disable advertising
if (isSoftDeviceAllowed) if (isSoftDeviceAllowed)
{ {
// Setup the advertising packet(s) // Setup the advertising packet(s)
LOG_DEBUG("Setting up the advertising payload(s)\n"); LOG_INFO("Setting up the advertising payload(s)\n");
startAdv(); startAdv();
LOG_DEBUG("Advertising\n"); LOG_INFO("Advertising\n");
} }
} }
@@ -283,7 +283,7 @@ void updateBatteryLevel(uint8_t level)
void NRF52Bluetooth::clearBonds() void NRF52Bluetooth::clearBonds()
{ {
LOG_DEBUG("Clearing bluetooth bonds!\n"); LOG_INFO("Clearing bluetooth bonds!\n");
bond_print_list(BLE_GAP_ROLE_PERIPH); bond_print_list(BLE_GAP_ROLE_PERIPH);
bond_print_list(BLE_GAP_ROLE_CENTRAL); bond_print_list(BLE_GAP_ROLE_CENTRAL);
@@ -293,12 +293,12 @@ void NRF52Bluetooth::clearBonds()
void NRF52Bluetooth::onConnectionSecured(uint16_t conn_handle) void NRF52Bluetooth::onConnectionSecured(uint16_t conn_handle)
{ {
LOG_DEBUG("BLE connection secured\n"); LOG_INFO("BLE connection secured\n");
} }
bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request) bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request)
{ {
LOG_DEBUG("BLE pairing process started with passkey %.3s %.3s\n", passkey, passkey+3); LOG_INFO("BLE pairing process started with passkey %.3s %.3s\n", passkey, passkey+3);
screen->startBluetoothPinScreen(configuredPasskey); screen->startBluetoothPinScreen(configuredPasskey);
if (match_request) if (match_request)
@@ -309,16 +309,16 @@ bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passke
if (!Bluefruit.connected(conn_handle)) break; if (!Bluefruit.connected(conn_handle)) break;
} }
} }
LOG_DEBUG("BLE passkey pairing: match_request=%i\n", match_request); LOG_INFO("BLE passkey pairing: match_request=%i\n", match_request);
return true; return true;
} }
void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_status) void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_status)
{ {
if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS) if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS)
LOG_DEBUG("BLE pairing success\n"); LOG_INFO("BLE pairing success\n");
else else
LOG_DEBUG("BLE pairing failed\n"); LOG_INFO("BLE pairing failed\n");
screen->stopBluetoothPinScreen(); screen->stopBluetoothPinScreen();
} }
+4 -5
View File
@@ -32,7 +32,7 @@ bool loopCanSleep() {
// handle standard gcc assert failures // handle standard gcc assert failures
void __attribute__((noreturn)) __assert_func(const char *file, int line, const char *func, const char *failedexpr) void __attribute__((noreturn)) __assert_func(const char *file, int line, const char *func, const char *failedexpr)
{ {
LOG_DEBUG("assert failed %s: %d, %s, test=%s\n", file, line, func, failedexpr); LOG_ERROR("assert failed %s: %d, %s, test=%s\n", file, line, func, failedexpr);
// debugger_break(); FIXME doesn't work, possibly not for segger // debugger_break(); FIXME doesn't work, possibly not for segger
// Reboot cpu // Reboot cpu
NVIC_SystemReset(); NVIC_SystemReset();
@@ -73,7 +73,7 @@ void setBluetoothEnable(bool on)
if (on) { if (on) {
if (!nrf52Bluetooth) { if (!nrf52Bluetooth) {
if (!useSoftDevice) if (!useSoftDevice)
LOG_DEBUG("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING\n"); LOG_INFO("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING\n");
else { else {
nrf52Bluetooth = new NRF52Bluetooth(); nrf52Bluetooth = new NRF52Bluetooth();
nrf52Bluetooth->setup(); nrf52Bluetooth->setup();
@@ -142,7 +142,7 @@ void nrf52Setup()
#ifdef BQ25703A_ADDR #ifdef BQ25703A_ADDR
auto *bq = new BQ25713(); auto *bq = new BQ25713();
if (!bq->setup()) if (!bq->setup())
LOG_DEBUG("ERROR! Charge controller init failed\n"); LOG_ERROR("ERROR! Charge controller init failed\n");
#endif #endif
// Init random seed // Init random seed
@@ -178,8 +178,7 @@ void cpuDeepSleep(uint64_t msecToWake)
auto ok = sd_power_system_off(); auto ok = sd_power_system_off();
if (ok != NRF_SUCCESS) { if (ok != NRF_SUCCESS) {
LOG_DEBUG("FIXME: Ignoring soft device (EasyDMA pending?) and forcing " LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!\n");
"system-off!\n");
NRF_POWER->SYSTEMOFF = 1; NRF_POWER->SYSTEMOFF = 1;
} }
+3 -3
View File
@@ -108,9 +108,9 @@ bool SimRadio::canSendImmediately()
if (busyTx || busyRx) { if (busyTx || busyRx) {
if (busyTx) if (busyTx)
LOG_DEBUG("Can not send yet, busyTx\n"); LOG_WARN("Can not send yet, busyTx\n");
if (busyRx) if (busyRx)
LOG_DEBUG("Can not send yet, busyRx\n"); LOG_WARN("Can not send yet, busyRx\n");
return false; return false;
} else } else
return true; return true;
@@ -199,7 +199,7 @@ void SimRadio::startSend(MeshPacket * txp)
memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size); memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size);
c.data.size = p->decoded.payload.size; c.data.size = p->decoded.payload.size;
} else { } else {
LOG_DEBUG("Payload size is larger than compressed message allows! Sending empty payload.\n"); LOG_WARN("Payload size is larger than compressed message allows! Sending empty payload.\n");
} }
p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &Compressed_msg, &c); p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &Compressed_msg, &c);
p->decoded.portnum = PortNum_SIMULATOR_APP; p->decoded.portnum = PortNum_SIMULATOR_APP;
+4 -4
View File
@@ -7,14 +7,14 @@
void powerCommandsCheck() void powerCommandsCheck()
{ {
if (rebootAtMsec && millis() > rebootAtMsec) { if (rebootAtMsec && millis() > rebootAtMsec) {
LOG_DEBUG("Rebooting\n"); LOG_INFO("Rebooting\n");
#if defined(ARCH_ESP32) #if defined(ARCH_ESP32)
ESP.restart(); ESP.restart();
#elif defined(ARCH_NRF52) #elif defined(ARCH_NRF52)
NVIC_SystemReset(); NVIC_SystemReset();
#else #else
rebootAtMsec = -1; rebootAtMsec = -1;
LOG_DEBUG("FIXME implement reboot for this platform. Skipping for now.\n"); LOG_WARN("FIXME implement reboot for this platform. Skipping for now.\n");
#endif #endif
} }
@@ -35,7 +35,7 @@ void powerCommandsCheck()
#endif #endif
if (shutdownAtMsec && millis() > shutdownAtMsec) { if (shutdownAtMsec && millis() > shutdownAtMsec) {
LOG_DEBUG("Shutting down from admin command\n"); LOG_INFO("Shutting down from admin command\n");
#ifdef HAS_PMU #ifdef HAS_PMU
if (pmu_found == true) { if (pmu_found == true) {
playShutdownMelody(); playShutdownMelody();
@@ -45,7 +45,7 @@ void powerCommandsCheck()
playShutdownMelody(); playShutdownMelody();
power->shutdown(); power->shutdown();
#else #else
LOG_DEBUG("FIXME implement shutdown for this platform"); LOG_WARN("FIXME implement shutdown for this platform");
#endif #endif
} }
} }
+8 -8
View File
@@ -90,7 +90,7 @@ void setLed(bool ledOn)
void setGPSPower(bool on) void setGPSPower(bool on)
{ {
LOG_DEBUG("Setting GPS power=%d\n", on); LOG_INFO("Setting GPS power=%d\n", on);
#ifdef HAS_PMU #ifdef HAS_PMU
if (pmu_found && PMU){ if (pmu_found && PMU){
@@ -136,7 +136,7 @@ void initDeepSleep()
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER) if (wakeCause == ESP_SLEEP_WAKEUP_TIMER)
reason = "timeout"; reason = "timeout";
LOG_DEBUG("booted, wake cause %d (boot count %d), reset_reason=%s\n", wakeCause, bootCount, reason); LOG_INFO("Booted, wake cause %d (boot count %d), reset_reason=%s\n", wakeCause, bootCount, reason);
#endif #endif
} }
@@ -174,13 +174,13 @@ void doGPSpowersave(bool on)
#ifdef HAS_PMU #ifdef HAS_PMU
if (on) if (on)
{ {
LOG_DEBUG("Turning GPS back on\n"); LOG_INFO("Turning GPS back on\n");
gps->forceWake(1); gps->forceWake(1);
setGPSPower(1); setGPSPower(1);
} }
else else
{ {
LOG_DEBUG("Turning off GPS chip\n"); LOG_INFO("Turning off GPS chip\n");
notifyGPSSleep.notifyObservers(NULL); notifyGPSSleep.notifyObservers(NULL);
setGPSPower(0); setGPSPower(0);
} }
@@ -188,12 +188,12 @@ void doGPSpowersave(bool on)
#ifdef PIN_GPS_WAKE #ifdef PIN_GPS_WAKE
if (on) if (on)
{ {
LOG_DEBUG("Waking GPS"); LOG_INFO("Waking GPS");
gps->forceWake(1); gps->forceWake(1);
} }
else else
{ {
LOG_DEBUG("GPS entering sleep"); LOG_INFO("GPS entering sleep");
notifyGPSSleep.notifyObservers(NULL); notifyGPSSleep.notifyObservers(NULL);
} }
#endif #endif
@@ -201,7 +201,7 @@ void doGPSpowersave(bool on)
void doDeepSleep(uint64_t msecToWake) void doDeepSleep(uint64_t msecToWake)
{ {
LOG_DEBUG("Entering deep sleep for %lu seconds\n", msecToWake / 1000); LOG_INFO("Entering deep sleep for %lu seconds\n", msecToWake / 1000);
// not using wifi yet, but once we are this is needed to shutoff the radio hw // not using wifi yet, but once we are this is needed to shutoff the radio hw
// esp_wifi_stop(); // esp_wifi_stop();
@@ -310,7 +310,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause(); esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause();
#ifdef BUTTON_PIN #ifdef BUTTON_PIN
if (cause == ESP_SLEEP_WAKEUP_GPIO) if (cause == ESP_SLEEP_WAKEUP_GPIO)
LOG_DEBUG("Exit light sleep gpio: btn=%d\n", !digitalRead(BUTTON_PIN)); LOG_INFO("Exit light sleep gpio: btn=%d\n", !digitalRead(BUTTON_PIN));
#endif #endif
return cause; return cause;