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

View File

@@ -50,23 +50,23 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
* Getters
*/
case AdminMessage_get_owner_request_tag:
LOG_DEBUG("Client is getting owner\n");
LOG_INFO("Client is getting owner\n");
handleGetOwner(mp);
break;
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);
break;
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);
break;
case AdminMessage_get_channel_request_tag: {
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)
myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp);
else
@@ -78,22 +78,22 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
* Setters
*/
case AdminMessage_set_owner_tag:
LOG_DEBUG("Client is setting owner\n");
LOG_INFO("Client is setting owner\n");
handleSetOwner(r->set_owner);
break;
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);
break;
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);
break;
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)
myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp);
else
@@ -111,15 +111,15 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
int32_t s = r->reboot_ota_seconds;
#ifdef ARCH_ESP32
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();
}else{
screen->startFirmwareUpdateScreen();
BleOta::switchToOtaApp();
LOG_DEBUG("Rebooting to OTA in %d seconds\n", s);
LOG_INFO("Rebooting to OTA in %d seconds\n", s);
}
#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();
#endif
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
@@ -127,40 +127,40 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
}
case AdminMessage_shutdown_seconds_tag: {
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);
break;
}
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);
break;
}
case AdminMessage_factory_reset_tag: {
LOG_DEBUG("Initiating factory reset\n");
LOG_INFO("Initiating factory reset\n");
nodeDB.factoryReset();
reboot(DEFAULT_REBOOT_SECONDS);
break;
} case AdminMessage_nodedb_reset_tag: {
LOG_DEBUG("Initiating node-db reset\n");
LOG_INFO("Initiating node-db reset\n");
nodeDB.resetNodes();
reboot(DEFAULT_REBOOT_SECONDS);
break;
}
case AdminMessage_begin_edit_settings_tag: {
LOG_DEBUG("Beginning transaction for editing settings\n");
LOG_INFO("Beginning transaction for editing settings\n");
hasOpenEditTransaction = true;
break;
}
case AdminMessage_commit_edit_settings_tag: {
LOG_DEBUG("Committing transaction for edited settings\n");
LOG_INFO("Committing transaction for edited settings\n");
hasOpenEditTransaction = false;
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
break;
}
#ifdef ARCH_PORTDUINO
case AdminMessage_exit_simulator_tag:
LOG_DEBUG("Exiting simulator\n");
LOG_INFO("Exiting simulator\n");
_exit(0);
break;
#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);
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
LOG_DEBUG("Ignoring nonrelevant admin %d\n", r->which_payload_variant);
LOG_INFO("Ignoring nonrelevant admin %d\n", r->which_payload_variant);
}
break;
}
@@ -229,7 +229,7 @@ void AdminModule::handleSetConfig(const Config &c)
switch (c.which_payload_variant) {
case Config_device_tag:
LOG_DEBUG("Setting config: Device\n");
LOG_INFO("Setting config: Device\n");
config.has_device = true;
config.device = c.payload_variant.device;
// If we're setting router role for the first time, install its intervals
@@ -240,29 +240,29 @@ void AdminModule::handleSetConfig(const Config &c)
}
break;
case Config_position_tag:
LOG_DEBUG("Setting config: Position\n");
LOG_INFO("Setting config: Position\n");
config.has_position = true;
config.position = c.payload_variant.position;
// Save nodedb as well in case we got a fixed position packet
saveChanges(SEGMENT_DEVICESTATE, false);
break;
case Config_power_tag:
LOG_DEBUG("Setting config: Power\n");
LOG_INFO("Setting config: Power\n");
config.has_power = true;
config.power = c.payload_variant.power;
break;
case Config_network_tag:
LOG_DEBUG("Setting config: WiFi\n");
LOG_INFO("Setting config: WiFi\n");
config.has_network = true;
config.network = c.payload_variant.network;
break;
case Config_display_tag:
LOG_DEBUG("Setting config: Display\n");
LOG_INFO("Setting config: Display\n");
config.has_display = true;
config.display = c.payload_variant.display;
break;
case Config_lora_tag:
LOG_DEBUG("Setting config: LoRa\n");
LOG_INFO("Setting config: LoRa\n");
config.has_lora = true;
config.lora = c.payload_variant.lora;
if (isRegionUnset &&
@@ -271,7 +271,7 @@ void AdminModule::handleSetConfig(const Config &c)
}
break;
case Config_bluetooth_tag:
LOG_DEBUG("Setting config: Bluetooth\n");
LOG_INFO("Setting config: Bluetooth\n");
config.has_bluetooth = true;
config.bluetooth = c.payload_variant.bluetooth;
break;
@@ -284,47 +284,47 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
{
switch (c.which_payload_variant) {
case ModuleConfig_mqtt_tag:
LOG_DEBUG("Setting module config: MQTT\n");
LOG_INFO("Setting module config: MQTT\n");
moduleConfig.has_mqtt = true;
moduleConfig.mqtt = c.payload_variant.mqtt;
break;
case ModuleConfig_serial_tag:
LOG_DEBUG("Setting module config: Serial\n");
LOG_INFO("Setting module config: Serial\n");
moduleConfig.has_serial = true;
moduleConfig.serial = c.payload_variant.serial;
break;
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.external_notification = c.payload_variant.external_notification;
break;
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.store_forward = c.payload_variant.store_forward;
break;
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.range_test = c.payload_variant.range_test;
break;
case ModuleConfig_telemetry_tag:
LOG_DEBUG("Setting module config: Telemetry\n");
LOG_INFO("Setting module config: Telemetry\n");
moduleConfig.has_telemetry = true;
moduleConfig.telemetry = c.payload_variant.telemetry;
break;
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.canned_message = c.payload_variant.canned_message;
break;
case ModuleConfig_audio_tag:
LOG_DEBUG("Setting module config: Audio\n");
LOG_INFO("Setting module config: Audio\n");
moduleConfig.has_audio = true;
moduleConfig.audio = c.payload_variant.audio;
break;
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.remote_hardware = c.payload_variant.remote_hardware;
break;
@@ -363,38 +363,38 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
if (req.decoded.want_response) {
switch (configType) {
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.payload_variant.device = config.device;
break;
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.payload_variant.position = config.position;
break;
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.payload_variant.power = config.power;
break;
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.payload_variant.network = config.network;
writeSecret(res.get_config_response.payload_variant.network.wifi_psk, config.network.wifi_psk);
break;
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.payload_variant.display = config.display;
break;
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.payload_variant.lora = config.lora;
break;
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.payload_variant.bluetooth = config.bluetooth;
break;
@@ -418,48 +418,48 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
if (req.decoded.want_response) {
switch (configType) {
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.payload_variant.mqtt = moduleConfig.mqtt;
break;
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.payload_variant.serial = moduleConfig.serial;
break;
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.payload_variant.external_notification =
moduleConfig.external_notification;
break;
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.payload_variant.store_forward = moduleConfig.store_forward;
break;
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.payload_variant.range_test = moduleConfig.range_test;
break;
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.payload_variant.telemetry = moduleConfig.telemetry;
break;
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.payload_variant.canned_message = moduleConfig.canned_message;
break;
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.payload_variant.audio = moduleConfig.audio;
break;
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.payload_variant.remote_hardware = moduleConfig.remote_hardware;
break;
@@ -506,7 +506,7 @@ void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
void AdminModule::reboot(int32_t seconds)
{
LOG_DEBUG("Rebooting in %d seconds\n", seconds);
LOG_INFO("Rebooting in %d seconds\n", seconds);
screen->startRebootScreen();
rebootAtMsec = (seconds < 0) ? 0 : (millis() + seconds * 1000);
}
@@ -514,10 +514,10 @@ void AdminModule::reboot(int32_t seconds)
void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
{
if (!hasOpenEditTransaction) {
LOG_DEBUG("Saving changes to disk\n");
LOG_INFO("Saving changes to disk\n");
service.reloadConfig(saveWhat); // Calls saveToDisk among other things
} 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)
{

View File

@@ -49,10 +49,10 @@ CannedMessageModule::CannedMessageModule()
if (moduleConfig.canned_message.enabled) {
this->loadProtoForModule();
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;
} else {
LOG_DEBUG("CannedMessageModule is enabled\n");
LOG_INFO("CannedMessageModule is enabled\n");
this->inputObserver.observe(inputBroker);
}
}
@@ -198,7 +198,7 @@ void CannedMessageModule::sendText(NodeNum dest, const char *message, bool wantR
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);
}

View File

@@ -48,15 +48,15 @@ int32_t ExternalNotificationModule::runOnce()
if (nagCycleCutoff < millis()) {
#endif
nagCycleCutoff = UINT32_MAX;
LOG_DEBUG("Turning off external notification: ");
LOG_INFO("Turning off external notification: ");
for (int i = 0; i < 2; i++) {
if (getExternal(i)) {
setExternalOff(i);
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
}
@@ -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));
}
LOG_DEBUG("Initializing External Notification Module\n");
LOG_INFO("Initializing External Notification Module\n");
output = moduleConfig.external_notification.output
? moduleConfig.external_notification.output
: EXT_NOTIFICATION_MODULE_OUTPUT;
// 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);
setExternalOff(0);
externalTurnedOn[0] = 0;
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);
setExternalOff(1);
externalTurnedOn[1] = 0;
}
if(moduleConfig.external_notification.output_buzzer) {
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);
setExternalOff(2);
externalTurnedOn[2] = 0;
@@ -203,11 +203,11 @@ ExternalNotificationModule::ExternalNotificationModule()
? config.device.buzzer_gpio
: PIN_BUZZER;
// 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 {
LOG_DEBUG("External Notification Module Disabled\n");
LOG_INFO("External Notification Module Disabled\n");
enabled = false;
}
}
@@ -229,7 +229,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
if (moduleConfig.external_notification.alert_bell) {
if (containsBell) {
LOG_DEBUG("externalNotificationModule - Notification Bell\n");
LOG_INFO("externalNotificationModule - Notification Bell\n");
setExternalOn(0);
if (moduleConfig.external_notification.nag_timeout) {
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 (containsBell) {
LOG_DEBUG("externalNotificationModule - Notification Bell (Vibra)\n");
LOG_INFO("externalNotificationModule - Notification Bell (Vibra)\n");
setExternalOn(1);
if (moduleConfig.external_notification.nag_timeout) {
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 (containsBell) {
LOG_DEBUG("externalNotificationModule - Notification Bell (Buzzer)\n");
LOG_INFO("externalNotificationModule - Notification Bell (Buzzer)\n");
if (!moduleConfig.external_notification.use_pwm) {
setExternalOn(2);
} else {
@@ -270,7 +270,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
}
if (moduleConfig.external_notification.alert_message) {
LOG_DEBUG("externalNotificationModule - Notification Module\n");
LOG_INFO("externalNotificationModule - Notification Module\n");
setExternalOn(0);
if (moduleConfig.external_notification.nag_timeout) {
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.alert_message_vibra) {
LOG_DEBUG("externalNotificationModule - Notification Module (Vibra)\n");
LOG_INFO("externalNotificationModule - Notification Module (Vibra)\n");
setExternalOn(1);
if (moduleConfig.external_notification.nag_timeout) {
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) {
LOG_DEBUG("externalNotificationModule - Notification Module (Buzzer)\n");
LOG_INFO("externalNotificationModule - Notification Module (Buzzer)\n");
if (!moduleConfig.external_notification.use_pwm) {
setExternalOn(2);
} else {
@@ -310,7 +310,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
}
} 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
@@ -331,13 +331,13 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
switch (request->which_payload_variant) {
case AdminMessage_get_ringtone_request_tag:
LOG_DEBUG("Client is getting ringtone\n");
LOG_INFO("Client is getting ringtone\n");
this->handleGetRingtone(mp, response);
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
break;
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);
result = AdminMessageHandleResult::HANDLED;
break;
@@ -351,7 +351,7 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
void ExternalNotificationModule::handleGetRingtone(const MeshPacket &req, AdminMessage *response)
{
LOG_DEBUG("*** handleGetRingtone\n");
LOG_INFO("*** handleGetRingtone\n");
assert(req.decoded.want_response);
response->which_payload_variant = AdminMessage_get_ringtone_response_tag;
@@ -366,7 +366,7 @@ void ExternalNotificationModule::handleSetRingtone(const char *from_msg)
if (*from_msg) {
changed |= strcmp(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) {

View File

@@ -46,7 +46,7 @@ MeshPacket *NodeInfoModule::allocReply()
{
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);
}
@@ -65,7 +65,7 @@ int32_t NodeInfoModule::runOnce()
bool requestReplies = 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)
return default_broadcast_interval_secs * 1000;

View File

@@ -32,7 +32,7 @@ bool PositionModule::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr
}
// 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.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 " : "",
@@ -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
// devices can get time.
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;
} 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);
}
@@ -155,11 +155,11 @@ int32_t PositionModule::runOnce()
bool requestReplies = 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);
}
} 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) {
@@ -194,7 +194,7 @@ int32_t PositionModule::runOnce()
bool requestReplies = 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);
sendOurPosition(NODENUM_BROADCAST, requestReplies);
@@ -209,7 +209,7 @@ int32_t PositionModule::runOnce()
}
}
} 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");
}
}

View File

@@ -55,7 +55,7 @@ RemoteHardwareModule::RemoteHardwareModule()
bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, HardwareMessage *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) {
case HardwareMessage_Type_WRITE_GPIOS:
@@ -95,7 +95,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar
lastWatchMsec = 0; // Force a new publish soon
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
LOG_DEBUG("Now watching GPIOs 0x%llx\n", watchGpios);
LOG_INFO("Now watching GPIOs 0x%llx\n", watchGpios);
break;
}
@@ -104,7 +104,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar
break; // Ignore - we might see our own replies
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;
}
@@ -121,7 +121,7 @@ int32_t RemoteHardwareModule::runOnce()
if (curVal != previousWatch) {
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
HardwareMessage r = HardwareMessage_init_default;

View File

@@ -11,7 +11,7 @@ MeshPacket *ReplyModule::allocReply()
auto req = *currentRequest;
auto &p = req.decoded;
// 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");

View File

@@ -109,7 +109,7 @@ int32_t SerialModule::runOnce()
if (firstTime) {
// 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;
@@ -213,14 +213,14 @@ int32_t SerialModule::runOnce()
serialModuleRadio->sendPayload();
LOG_DEBUG("Received: %s\n", serialStringChar);
LOG_INFO("Received: %s\n", serialStringChar);
}
}
}
return (10);
} else {
LOG_DEBUG("Serial Module Disabled\n");
LOG_INFO("Serial Module Disabled\n");
return INT32_MAX;
}
@@ -305,7 +305,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
}
} 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
}

View File

@@ -34,7 +34,7 @@ bool DeviceTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemet
if (t->which_variant == Telemetry_device_metrics_tag) {
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,
t->variant.device_metrics.air_util_tx,
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.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.channel_utilization,
t.variant.device_metrics.battery_level,
@@ -74,10 +74,10 @@ bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
lastMeasurementPacket = packetPool.allocCopy(*p);
nodeDB.updateTelemetry(nodeDB.getNodeNum(), t, RX_SRC_LOCAL);
if (phoneOnly) {
LOG_DEBUG("Sending packet to phone\n");
LOG_INFO("Sending packet to phone\n");
service.sendToPhone(p);
} else {
LOG_DEBUG("Sending packet to mesh\n");
LOG_INFO("Sending packet to mesh\n");
service.sendToMesh(p, RX_SRC_LOCAL, true);
}
return true;

View File

@@ -75,7 +75,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
firstTime = 0;
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.
// therefore, we should only enable the sensor loop if measurement is also enabled
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)) {
display->setFont(FONT_SMALL);
display->drawString(x, y += fontHeight(FONT_MEDIUM), "Measurement Error");
LOG_DEBUG("Unable to decode last packet");
LOG_ERROR("Unable to decode last packet");
return;
}
@@ -187,7 +187,7 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Te
if (t->which_variant == Telemetry_environment_metrics_tag) {
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,
t->variant.environment_metrics.barometric_pressure,
t->variant.environment_metrics.current,
@@ -234,7 +234,7 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
if (ina260Sensor.hasSensor())
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.current,
m.variant.environment_metrics.gas_resistance,
@@ -251,10 +251,10 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
lastMeasurementPacket = packetPool.allocCopy(*p);
if (phoneOnly) {
LOG_DEBUG("Sending packet to phone\n");
LOG_INFO("Sending packet to phone\n");
service.sendToPhone(p);
} else {
LOG_DEBUG("Sending packet to mesh\n");
LOG_INFO("Sending packet to mesh\n");
service.sendToMesh(p, RX_SRC_LOCAL, true);
}
return true;

View File

@@ -11,7 +11,7 @@ BME280Sensor::BME280Sensor() :
}
int32_t BME280Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -10,7 +10,7 @@ BME680Sensor::BME680Sensor() :
}
int32_t BME680Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -11,7 +11,7 @@ BMP280Sensor::BMP280Sensor() :
}
int32_t BMP280Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -10,7 +10,7 @@ INA219Sensor::INA219Sensor() :
}
int32_t INA219Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -10,7 +10,7 @@ INA260Sensor::INA260Sensor() :
}
int32_t INA260Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -11,7 +11,7 @@ LPS22HBSensor::LPS22HBSensor() :
}
int32_t LPS22HBSensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -10,7 +10,7 @@ MCP9808Sensor::MCP9808Sensor() :
}
int32_t MCP9808Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -10,7 +10,7 @@ SHT31Sensor::SHT31Sensor() :
}
int32_t SHT31Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -10,7 +10,7 @@ SHTC3Sensor::SHTC3Sensor() :
}
int32_t SHTC3Sensor::runOnce() {
LOG_DEBUG("Init sensor: %s\n", sensorName);
LOG_INFO("Init sensor: %s\n", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}

View File

@@ -21,10 +21,10 @@ class TelemetrySensor
int32_t initI2CSensor() {
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;
} else {
LOG_DEBUG("Opened %s sensor on default i2c bus\n", sensorName);
LOG_INFO("Opened %s sensor on default i2c bus\n", sensorName);
setup();
}
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;

View File

@@ -8,7 +8,7 @@ TextMessageModule *textMessageModule;
ProcessMessage TextMessageModule::handleReceived(const MeshPacket &mp)
{
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.
// Keep a copy of the most recent text message.

View File

@@ -50,12 +50,12 @@ void TraceRouteModule::appendMyID(RouteDiscovery* updated)
void TraceRouteModule::printRoute(RouteDiscovery* r, uint32_t origin, uint32_t dest)
{
LOG_DEBUG("Route traced:\n");
LOG_DEBUG("0x%x --> ", origin);
LOG_INFO("Route traced:\n");
LOG_INFO("0x%x --> ", origin);
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");
}

View File

@@ -8,7 +8,7 @@ WaypointModule *waypointModule;
ProcessMessage WaypointModule::handleReceived(const MeshPacket &mp)
{
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);

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
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) {
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)))
{
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->tx_encode_frame_index = sizeof(audioModule->tx_header);
}
@@ -127,7 +127,7 @@ AudioModule::AudioModule() : SinglePortModule("AudioModule", PortNum_AUDIO_APP),
// moduleConfig.audio.ptt_pin = 39;
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);
memcpy(tx_header.magic,c2_magic,sizeof(c2_magic));
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_size = encode_frame_num * encode_codec_size; // max 233 bytes + 4 header bytes
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);
} 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;
if (firstTime) {
// 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 = {
.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,
@@ -189,7 +189,7 @@ int32_t AudioModule::runOnce()
};
res = i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
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 = {
.bck_io_num = moduleConfig.audio.i2s_sck,
@@ -199,16 +199,16 @@ int32_t AudioModule::runOnce()
};
res = i2s_set_pin(I2S_PORT, &pin_config);
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);
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;
// 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);
firstTime = false;
@@ -217,17 +217,17 @@ int32_t AudioModule::runOnce()
// 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 (radio_state == RadioState::rx) {
LOG_DEBUG("PTT pressed, switching to TX\n");
LOG_INFO("PTT pressed, switching to TX\n");
radio_state = RadioState::tx;
e.frameChanged = true;
this->notifyObservers(&e);
}
} else {
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)) {
// 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();
}
tx_encode_frame_index = sizeof(tx_header);
@@ -258,7 +258,7 @@ int32_t AudioModule::runOnce()
}
return 100;
} else {
LOG_DEBUG("Audio Module Disabled\n");
LOG_INFO("Audio Module Disabled\n");
return INT32_MAX;
}

View File

@@ -53,10 +53,10 @@ int32_t RangeTestModule::runOnce()
firstTime = 0;
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.
} else {
LOG_DEBUG("Initializing Range Test Module -- Receiver\n");
LOG_INFO("Initializing Range Test Module -- Receiver\n");
return (INT32_MAX);
// This thread does not need to run as a receiver
}
@@ -65,19 +65,19 @@ int32_t RangeTestModule::runOnce()
if (moduleConfig.range_test.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_DEBUG("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude());
LOG_DEBUG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
LOG_DEBUG("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
LOG_DEBUG("fixed_position() %d\n", config.position.fixed_position);
LOG_INFO("gpsStatus->getLatitude() %d\n", gpsStatus->getLatitude());
LOG_INFO("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude());
LOG_INFO("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
LOG_INFO("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
LOG_INFO("fixed_position() %d\n", config.position.fixed_position);
// Only send packets if the channel is less than 25% utilized.
if (airTime->channelUtilizationPercent() < 25) {
rangeTestModuleRadio->sendPayload();
} 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);
@@ -88,9 +88,8 @@ int32_t RangeTestModule::runOnce()
}
} else {
LOG_DEBUG("Range Test Module - Disabled\n");
LOG_INFO("Range Test Module - Disabled\n");
}
#endif
@@ -136,7 +135,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp)
/*
auto &p = mp.decoded;
LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n",
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()) {
@@ -174,7 +173,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp)
}
} else {
LOG_DEBUG("Range Test Module Disabled\n");
LOG_INFO("Range Test Module Disabled\n");
}
#endif
@@ -229,16 +228,16 @@ bool RangeTestModuleRadio::appendFile(const MeshPacket &mp)
File fileToWrite = FSCom.open("/static/rangetest.csv", FILE_WRITE);
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;
}
// Print the CSV header
if (fileToWrite.println(
"time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload")) {
LOG_DEBUG("File was written\n");
LOG_INFO("File was written\n");
} else {
LOG_DEBUG("File write failed\n");
LOG_ERROR("File write failed\n");
}
fileToWrite.close();
@@ -248,7 +247,7 @@ bool RangeTestModuleRadio::appendFile(const MeshPacket &mp)
File fileToAppend = FSCom.open("/static/rangetest.csv", FILE_APPEND);
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;
}

View File

@@ -28,20 +28,20 @@ int32_t StoreForwardModule::runOnce()
StoreAndForward sf = StoreAndForward_init_zero;
sf.rr = StoreAndForward_RequestResponse_ROUTER_PING;
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->busy = false;
} else {
this->packetHistoryTXQueue_index++;
}
} 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);
} else if ((millis() - lastHeartbeat > (heartbeatInterval * 1000)) && (airTime->channelUtilizationPercent() < polite_channel_util_percent)) {
lastHeartbeat = millis();
LOG_DEBUG("*** Sending heartbeat\n");
LOG_INFO("*** Sending heartbeat\n");
StoreAndForward sf = StoreAndForward_init_zero;
sf.rr = StoreAndForward_RequestResponse_ROUTER_HEARTBEAT;
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);
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->busyTo = to;
} else {
LOG_DEBUG ("*** S&F - No history to send\n");
LOG_INFO("*** S&F - No history to send\n");
}
StoreAndForward sf = StoreAndForward_init_zero;
sf.rr = StoreAndForward_RequestResponse_ROUTER_HISTORY;
@@ -164,7 +164,7 @@ MeshPacket *StoreForwardModule::allocReply()
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();
p->to = dest;
@@ -241,7 +241,7 @@ ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp)
if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) {
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) {
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)) {
decoded = &scratch;
} 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!
return ProcessMessage::STOP;
}
@@ -281,7 +281,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
if(is_server) {
// stop sending stuff, the client wants to abort or has another error
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->busy = false;
}
@@ -291,11 +291,11 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
case StoreAndForward_RequestResponse_CLIENT_HISTORY:
if(is_server) {
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.
if (this->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 {
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
@@ -308,7 +308,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
case StoreAndForward_RequestResponse_CLIENT_PING:
if(is_server) {
LOG_DEBUG("*** StoreAndForward_RequestResponse_CLIENT_PING\n");
LOG_INFO("*** StoreAndForward_RequestResponse_CLIENT_PING\n");
// respond with a 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:
if(is_server) {
LOG_DEBUG("*** StoreAndForward_RequestResponse_CLIENT_PONG\n");
LOG_INFO("*** StoreAndForward_RequestResponse_CLIENT_PONG\n");
// The Client is alive, update NodeDB
nodeDB.updateFrom(mp);
}
@@ -324,10 +324,10 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
case StoreAndForward_RequestResponse_CLIENT_STATS:
if(is_server) {
LOG_DEBUG("*** Client Request to send STATS\n");
LOG_INFO("*** Client Request to send STATS\n");
if (this->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 {
storeForwardModule->statsSend(getFrom(&mp));
}
@@ -352,7 +352,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo
heartbeatInterval = p->variant.heartbeat.period;
}
lastHeartbeat = millis();
LOG_DEBUG("*** StoreAndForward Heartbeat received\n");
LOG_INFO("*** StoreAndForward Heartbeat received\n");
}
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.
if (p->which_variant == StoreAndForward_history_tag) {
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;
@@ -418,7 +418,7 @@ StoreForwardModule::StoreForwardModule()
// Router
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.getFreePsram() >= 1024 * 1024) {
@@ -444,19 +444,19 @@ StoreForwardModule::StoreForwardModule()
this->populatePSRAM();
is_server = true;
} else {
LOG_DEBUG("*** Device has less than 1M of PSRAM free.\n");
LOG_DEBUG("*** Store & Forward Module - disabling server.\n");
LOG_INFO("*** Device has less than 1M of PSRAM free.\n");
LOG_INFO("*** Store & Forward Module - disabling server.\n");
}
} else {
LOG_DEBUG("*** Device doesn't have PSRAM.\n");
LOG_DEBUG("*** Store & Forward Module - disabling server.\n");
LOG_INFO("*** Device doesn't have PSRAM.\n");
LOG_INFO("*** Store & Forward Module - disabling server.\n");
}
// Client
}
if ((config.device.role == Config_DeviceConfig_Role_CLIENT) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
is_client = true;
LOG_DEBUG("*** Initializing Store & Forward Module in Client mode\n");
LOG_INFO("*** Initializing Store & Forward Module in Client mode\n");
}
}
#endif