mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-18 01:11:42 +10:00
logging: audit log strings for terseness, reclaiming ~6.8 KB of string data (#11374)
* logging: strip redundant punctuation, level prefixes, and 'successfully' from log strings The logger already appends a newline and prints the level tag, so trailing '.', '!', '...', literal \n, and 'Error:'/'Warning:' prefixes inside format strings are wasted flash bytes. Same for 'successfully' (the affirmative form already implies it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: tighten verbose log strings in modules, radio, platform, and system code Rewrite wordy log messages to terser equivalents - drop filler words (articles, 'attempting', 'due to', 'please'), use 'Can't X'/'X failed' phrasing, and abbreviate where the codebase already does (config, init, msg, BT). Format specifiers and argument lists are unchanged; distinctive greppable tokens are preserved. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: tighten verbose log strings in telemetry sensors and GPS Same terseness pass: drop filler, 'Can't X'/'X failed' phrasing, common abbreviations (temp, msg). Specifiers, arguments, and sensor-name prefixes unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: tighten verbose log strings in mesh core Same terseness pass over NodeDB, Router, MeshService, PhoneAPI, RadioInterface, NextHopRouter, and PacketHistory: 'X failed'/'Can't X' phrasing, imperative verbs, dropped filler. Specifiers and arguments unchanged; duplicate literals kept identical to preserve linker string dedup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: 'Unable to/Could not/Cannot' -> "Can't" in log strings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: clang-format rewrap after string shortening Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * logging: restore boot-logo trailing newline and progress-dot strings The terseness pass over-trimmed: the Meshtastic ASCII boot logo kept its blank line via a trailing \n, and three bare "." progress ticks were reduced to empty strings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1 * Update src/mesh/wifi/WiFiAPClient.cpp Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * logging: address review feedback on the terseness audit - Node/packet IDs use the repo's 0x%08x convention in NextHopRouter, NodeDB, AdminModule and CannedMessageModule. The sibling log in each if/else pair is converted too, so a pair isn't split across two formats. next_hop stays 0x%x - it's the last-byte relay hint, not a NodeNum. - RTC: the read-path and set-path "not found" warnings were byte-identical, so the linker deduped them and the log couldn't say which one fired. Split into "RTC read:" / "RTC set:". (The four sites live in mutually exclusive #ifdef branches, so the RTC family was never ambiguous.) - SCD4X getAmbientPressure()/setAmbientPressure() logged "altitude", and SCD30 getASC() logged "Can't send command" for a read. Both now name the operation they actually perform. - LOG_ERROR already carries the level: ". Error: %u" -> ", rc=%u" (matching the existing rc=%d house style) and "Error executing X()" -> "X() failed". - Typos and wording: "OTA partiton. (Reason" -> "OTA partition (reason", "CST3530 not response ~" -> "CST3530 no response", "Packet received with to: of 0" -> "to=0", HostMetrics "Error decoding" -> "Can't decode", and the dangling ": " on the NextHopRouter retransmission line. Printf specifier sequences are byte-identical on all 37 touched lines apart from the 6 deliberate %x/%u -> %08x node-ID widenings, all on uint32_t args. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
co-authored by
Claude Opus 5
coderabbitai[bot]
Ben Meadors
parent
5692518306
commit
cd716fe384
+50
-50
@@ -170,13 +170,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
// apply: refuse all plain local admin and require PKC instead.
|
||||
#ifndef MESHTASTIC_PHONEAPI_ACCESS_CONTROL
|
||||
if (config.security.is_managed) {
|
||||
LOG_INFO("Ignore local admin payload because is_managed");
|
||||
LOG_INFO("Ignore local admin payload: is_managed");
|
||||
return handled;
|
||||
}
|
||||
#endif
|
||||
} else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) {
|
||||
if (!config.security.admin_channel_enabled) {
|
||||
LOG_INFO("Ignore admin channel, legacy admin is disabled");
|
||||
LOG_INFO("Ignore admin channel, legacy admin disabled");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
|
||||
return handled;
|
||||
}
|
||||
@@ -206,10 +206,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_CLIENT_BASE) {
|
||||
// Special case for CLIENT_BASE: is_favorite has special meaning, and we don't want to automatically set it
|
||||
// without the user doing so deliberately.
|
||||
LOG_INFO("PKC admin valid, but not auto-favoriting node %x because role==CLIENT_BASE", mp.from);
|
||||
LOG_INFO("PKC admin valid, not auto-favoriting node 0x%08x: role==CLIENT_BASE", mp.from);
|
||||
} else {
|
||||
if (nodeDB->setProtectedFlag(remoteNode, NODEINFO_BITFIELD_IS_FAVORITE_MASK, true)) {
|
||||
LOG_INFO("PKC admin valid. Auto-favoriting node %x", mp.from);
|
||||
LOG_INFO("PKC admin valid. Auto-favoriting node 0x%08x", mp.from);
|
||||
} else {
|
||||
LOG_WARN("PKC admin valid, but auto-favorite refused for node %x (protected-node cap)", mp.from);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
}
|
||||
} else {
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_PUBLIC_KEY_UNAUTHORIZED, &mp);
|
||||
LOG_INFO("Received PKC admin payload, but the sender public key does not match the admin authorized key!");
|
||||
LOG_INFO("PKC admin payload: sender public key doesn't match admin authorized key");
|
||||
return handled;
|
||||
}
|
||||
} else {
|
||||
@@ -232,7 +232,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
// any message that changes state, we want to check the passkey for
|
||||
if (mp.from != 0 && !messageIsRequest(r) && !messageIsResponse(r)) {
|
||||
if (!checkPassKey(r)) {
|
||||
LOG_WARN("Admin message without session_key!");
|
||||
LOG_WARN("Admin message without session_key");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_BAD_SESSION_KEY, &mp);
|
||||
return handled;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
// but if it ever does (e.g. injected via a non-PhoneAPI path), drop
|
||||
// it silently rather than leaking a partial response.
|
||||
case meshtastic_AdminMessage_lockdown_auth_tag:
|
||||
LOG_WARN("AdminModule: lockdown_auth reached Router/AdminModule path; ignoring (should be handled in PhoneAPI)");
|
||||
LOG_WARN("AdminModule: lockdown_auth reached Router/AdminModule path; ignoring (PhoneAPI handles)");
|
||||
return handled;
|
||||
#endif // MESHTASTIC_ENCRYPTED_STORAGE
|
||||
|
||||
@@ -293,7 +293,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
while (*start && isspace((unsigned char)*start))
|
||||
start++;
|
||||
if (*start == '\0') {
|
||||
LOG_WARN("Rejected long_name: must contain at least 1 non-whitespace character");
|
||||
LOG_WARN("Rejected long_name: needs 1+ non-whitespace char");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
break;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
while (*start && isspace((unsigned char)*start))
|
||||
start++;
|
||||
if (*start == '\0') {
|
||||
LOG_WARN("Rejected short_name: must contain at least 1 non-whitespace character");
|
||||
LOG_WARN("Rejected short_name: needs 1+ non-whitespace char");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
break;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_WARN("Radio hardware does not support 2.4 GHz; rejecting LORA_24 region");
|
||||
LOG_WARN("No 2.4 GHz radio support; rejecting LORA_24 region");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
break;
|
||||
}
|
||||
@@ -479,14 +479,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_begin_edit_settings_tag: {
|
||||
LOG_INFO("Begin transaction for editing settings");
|
||||
LOG_INFO("Begin settings edit transaction");
|
||||
hasOpenEditTransaction = true;
|
||||
editTransactionActivityMs = millis();
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_commit_edit_settings_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Commit transaction for edited settings");
|
||||
LOG_INFO("Commit settings edit transaction");
|
||||
hasOpenEditTransaction = false;
|
||||
deferredEditSegments = 0;
|
||||
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS | SEGMENT_NODEDATABASE);
|
||||
@@ -499,7 +499,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_module_config_response_tag: {
|
||||
LOG_INFO("Client received a get_module_config response");
|
||||
LOG_INFO("Client got get_module_config response");
|
||||
// which_payload_variant is the ModuleConfig oneof tag, so compare against that tag, not the
|
||||
// AdminMessage ModuleConfigType enum (whose REMOTEHARDWARE value is a different number).
|
||||
if (fromOthers && r->get_module_config_response.which_payload_variant == meshtastic_ModuleConfig_remote_hardware_tag) {
|
||||
@@ -508,17 +508,17 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_by_nodenum_tag: {
|
||||
LOG_INFO("Client received remove_nodenum command");
|
||||
LOG_INFO("Client got remove_nodenum");
|
||||
nodeDB->removeNodeByNum(r->remove_by_nodenum);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_add_contact_tag: {
|
||||
LOG_INFO("Client received add_contact command");
|
||||
LOG_INFO("Client got add_contact");
|
||||
nodeDB->addFromContact(r->add_contact);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_favorite_node_tag: {
|
||||
LOG_INFO("Client received set_favorite_node command");
|
||||
LOG_INFO("Client got set_favorite_node");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
|
||||
if (node != NULL) {
|
||||
if (nodeDB->setProtectedFlag(node, NODEINFO_BITFIELD_IS_FAVORITE_MASK, true)) {
|
||||
@@ -534,7 +534,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_favorite_node_tag: {
|
||||
LOG_INFO("Client received remove_favorite_node command");
|
||||
LOG_INFO("Client got remove_favorite_node");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
|
||||
if (node != NULL) {
|
||||
nodeInfoLiteSetBit(node, NODEINFO_BITFIELD_IS_FAVORITE_MASK, false);
|
||||
@@ -545,7 +545,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_ignored_node_tag: {
|
||||
LOG_INFO("Client received set_ignored_node command");
|
||||
LOG_INFO("Client got set_ignored_node");
|
||||
// Unlike the sibling node-targeted admin commands, create the entry if
|
||||
// it's absent so the block sticks for a node we've not heard from yet
|
||||
// (e.g. one a remote admin asks us to block) with no NodeInfo or key.
|
||||
@@ -570,7 +570,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_ignored_node_tag: {
|
||||
LOG_INFO("Client received remove_ignored_node command");
|
||||
LOG_INFO("Client got remove_ignored_node");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_ignored_node);
|
||||
if (node != NULL) {
|
||||
nodeInfoLiteSetBit(node, NODEINFO_BITFIELD_IS_IGNORED_MASK, false);
|
||||
@@ -579,7 +579,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_toggle_muted_node_tag: {
|
||||
LOG_INFO("Client received toggle_muted_node command");
|
||||
LOG_INFO("Client got toggle_muted_node");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->toggle_muted_node);
|
||||
if (node != NULL) {
|
||||
nodeInfoLiteSetBit(node, NODEINFO_BITFIELD_IS_MUTED_MASK, !nodeInfoLiteIsMuted(node));
|
||||
@@ -589,7 +589,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
}
|
||||
|
||||
case meshtastic_AdminMessage_set_fixed_position_tag: {
|
||||
LOG_INFO("Client received set_fixed_position command");
|
||||
LOG_INFO("Client got set_fixed_position");
|
||||
const meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
// Route the fixed position through updatePosition so it lands in the
|
||||
// satellite map (or, on builds with PositionDB excluded, just sets
|
||||
@@ -607,14 +607,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_fixed_position_tag: {
|
||||
LOG_INFO("Client received remove_fixed_position command");
|
||||
LOG_INFO("Client got remove_fixed_position");
|
||||
nodeDB->clearLocalPosition();
|
||||
config.position.fixed_position = false;
|
||||
saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_time_only_tag: {
|
||||
LOG_INFO("Client received set_time_only command");
|
||||
LOG_INFO("Client got set_time_only");
|
||||
struct timeval tv;
|
||||
tv.tv_sec = r->set_time_only;
|
||||
tv.tv_usec = 0;
|
||||
@@ -623,7 +623,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_enter_dfu_mode_request_tag: {
|
||||
LOG_INFO("Client requesting to enter DFU mode");
|
||||
LOG_INFO("Client requests DFU mode");
|
||||
#if HAS_SCREEN
|
||||
IF_SCREEN(screen->showSimpleBanner("Device is rebooting\ninto DFU mode.", 0));
|
||||
#endif
|
||||
@@ -633,21 +633,21 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_delete_file_request_tag: {
|
||||
LOG_DEBUG("Client requesting to delete file: %s", r->delete_file_request);
|
||||
LOG_DEBUG("Client requests delete file: %s", r->delete_file_request);
|
||||
|
||||
#ifdef FSCom
|
||||
spiLock->lock();
|
||||
if (FSCom.remove(r->delete_file_request)) {
|
||||
LOG_DEBUG("Successfully deleted file");
|
||||
LOG_DEBUG("Deleted file");
|
||||
} else {
|
||||
LOG_DEBUG("Failed to delete file");
|
||||
LOG_DEBUG("File delete failed");
|
||||
}
|
||||
spiLock->unlock();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_backup_preferences_tag: {
|
||||
LOG_INFO("Client requesting to backup preferences");
|
||||
LOG_INFO("Client requests preferences backup");
|
||||
if (nodeDB->backupPreferences(r->backup_preferences)) {
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
||||
} else {
|
||||
@@ -656,11 +656,11 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_restore_preferences_tag: {
|
||||
LOG_INFO("Client requesting to restore preferences");
|
||||
LOG_INFO("Client requests preferences restore");
|
||||
if (nodeDB->restorePreferences(r->backup_preferences,
|
||||
SEGMENT_DEVICESTATE | SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_CHANNELS)) {
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
||||
LOG_DEBUG("Rebooting after successful restore of preferences");
|
||||
LOG_DEBUG("Rebooting after preferences restore");
|
||||
reboot(1000);
|
||||
disableBluetooth();
|
||||
} else {
|
||||
@@ -669,7 +669,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_backup_preferences_tag: {
|
||||
LOG_INFO("Client requesting to remove backup preferences");
|
||||
LOG_INFO("Client requests preferences backup removal");
|
||||
#ifdef FSCom
|
||||
if (r->remove_backup_preferences == meshtastic_AdminMessage_BackupLocation_FLASH) {
|
||||
spiLock->lock();
|
||||
@@ -683,7 +683,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_send_input_event_tag: {
|
||||
LOG_INFO("Client requesting to send input event");
|
||||
LOG_INFO("Client requests send input event");
|
||||
handleSendInputEvent(r->send_input_event);
|
||||
break;
|
||||
}
|
||||
@@ -721,10 +721,10 @@ void AdminModule::handleViaModuleApi(const meshtastic_MeshPacket &mp, meshtastic
|
||||
setPassKey(&res);
|
||||
myReply = allocDataProtobuf(res);
|
||||
} else if (mp.decoded.want_response) {
|
||||
LOG_DEBUG("Module API did not respond to admin message. req.variant=%d", r->which_payload_variant);
|
||||
LOG_DEBUG("Module API didn't respond to admin msg. req.variant=%d", r->which_payload_variant);
|
||||
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
|
||||
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
||||
LOG_DEBUG("Module API did not handle admin message %d", r->which_payload_variant);
|
||||
LOG_DEBUG("Module API didn't handle admin msg %d", r->which_payload_variant);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,7 +912,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
changes |= SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE; // Some role defaults affect owner
|
||||
}
|
||||
if (config.device.node_info_broadcast_secs < min_node_info_broadcast_secs) {
|
||||
LOG_DEBUG("Tried to set node_info_broadcast_secs too low, setting to %d", min_node_info_broadcast_secs);
|
||||
LOG_DEBUG("node_info_broadcast_secs too low, set to %d", min_node_info_broadcast_secs);
|
||||
config.device.node_info_broadcast_secs = min_node_info_broadcast_secs;
|
||||
}
|
||||
// Router Client and Repeater deprecated; Set it to client
|
||||
@@ -965,7 +965,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
config.power = c.payload_variant.power;
|
||||
if (c.payload_variant.power.on_battery_shutdown_after_secs > 0 &&
|
||||
c.payload_variant.power.on_battery_shutdown_after_secs < 30) {
|
||||
LOG_WARN("Tried to set on_battery_shutdown_after_secs too low, set to min 30 seconds");
|
||||
LOG_WARN("on_battery_shutdown_after_secs too low, set to min 30 sec");
|
||||
config.power.on_battery_shutdown_after_secs = 30;
|
||||
}
|
||||
break;
|
||||
@@ -1007,12 +1007,12 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
config.has_lora = true;
|
||||
|
||||
if (validatedLora.coding_rate != clampCodingRate(validatedLora.coding_rate)) {
|
||||
LOG_WARN("Invalid coding_rate %d, setting to %d", validatedLora.coding_rate, LORA_CR_DEFAULT);
|
||||
LOG_WARN("Invalid coding_rate %d, set to %d", validatedLora.coding_rate, LORA_CR_DEFAULT);
|
||||
validatedLora.coding_rate = LORA_CR_DEFAULT;
|
||||
}
|
||||
|
||||
if (validatedLora.spread_factor != clampSpreadFactor(validatedLora.spread_factor)) {
|
||||
LOG_WARN("Invalid spread_factor %d, setting to %d", validatedLora.spread_factor, LORA_SF_DEFAULT);
|
||||
LOG_WARN("Invalid spread_factor %d, set to %d", validatedLora.spread_factor, LORA_SF_DEFAULT);
|
||||
validatedLora.spread_factor = LORA_SF_DEFAULT;
|
||||
}
|
||||
|
||||
@@ -1023,7 +1023,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
// preset mode bandwidth 0 is expected (the preset supplies it), so leave it untouched.
|
||||
const uint16_t clampedBandwidth = clampBandwidthCode(validatedLora.bandwidth);
|
||||
if (!validatedLora.use_preset && validatedLora.bandwidth != clampedBandwidth) {
|
||||
LOG_WARN("Invalid bandwidth %d, setting to %d", validatedLora.bandwidth, clampedBandwidth);
|
||||
LOG_WARN("Invalid bandwidth %d, set to %d", validatedLora.bandwidth, clampedBandwidth);
|
||||
validatedLora.bandwidth = clampedBandwidth;
|
||||
}
|
||||
|
||||
@@ -1085,13 +1085,13 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
validatedLora.region = swapRegion->code;
|
||||
}
|
||||
if (!swapRegion || !RadioInterface::validateConfigLora(validatedLora)) {
|
||||
LOG_WARN("Invalid LoRa config received from another node, rejecting changes");
|
||||
LOG_WARN("Invalid LoRa config from another node, rejecting changes");
|
||||
// Rejecting means rejecting everything: a partial restore of region/preset
|
||||
// could still apply other fields the validation already deemed invalid.
|
||||
validatedLora = oldLoraConfig;
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("Invalid LoRa config received from client, using corrected values");
|
||||
LOG_WARN("Invalid LoRa config from client, using corrected values");
|
||||
RadioInterface::clampConfigLora(validatedLora);
|
||||
}
|
||||
// A preset locked to a sibling EU region swaps the region during the clamp;
|
||||
@@ -1138,7 +1138,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
loraFEMInterface.setLNAEnable(validatedLora.fem_lna_mode != meshtastic_Config_LoRaConfig_FEM_LNA_Mode_DISABLED);
|
||||
} else if (validatedLora.fem_lna_mode != meshtastic_Config_LoRaConfig_FEM_LNA_Mode_NOT_PRESENT) {
|
||||
// Hardware FEM does not support LNA control; normalize stored config to match actual capability
|
||||
LOG_WARN("FEM LNA mode configured but current FEM does not support LNA control; normalizing to NOT_PRESENT");
|
||||
LOG_WARN("FEM LNA mode set but FEM lacks LNA control; normalizing to NOT_PRESENT");
|
||||
validatedLora.fem_lna_mode = meshtastic_Config_LoRaConfig_FEM_LNA_Mode_NOT_PRESENT;
|
||||
}
|
||||
#endif
|
||||
@@ -1173,7 +1173,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
// partial/legacy client, not an identity reset (that goes through factory_reset). Done outside the
|
||||
// PKI guard so non-PKI builds keep their key bytes too.
|
||||
if (incoming.private_key.size != 32 && config.security.private_key.size == 32) {
|
||||
LOG_WARN("Security set omitted private key; preserving existing identity keypair");
|
||||
LOG_WARN("Security set omitted private key; keeping identity keypair");
|
||||
incoming.private_key = config.security.private_key;
|
||||
incoming.public_key = config.security.public_key;
|
||||
}
|
||||
@@ -1181,7 +1181,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
|
||||
// recourse but a physical connection. Clearing admin keys still works via a SET that leaves the private
|
||||
// key alone and sends an empty list.
|
||||
if (isBareKeypairRotation(incoming, config.security)) {
|
||||
LOG_INFO("Security set is a bare keypair rotation; preserving remaining security config");
|
||||
LOG_INFO("Security set is bare keypair rotation; keeping other security config");
|
||||
meshtastic_Config_SecurityConfig rotated = config.security;
|
||||
rotated.public_key = incoming.public_key; // usually empty; derived from the private key below
|
||||
rotated.private_key = incoming.private_key;
|
||||
@@ -1249,7 +1249,7 @@ bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
||||
switch (c.which_payload_variant) {
|
||||
case meshtastic_ModuleConfig_mqtt_tag:
|
||||
#if MESHTASTIC_EXCLUDE_MQTT
|
||||
LOG_WARN("Set module config: MESHTASTIC_EXCLUDE_MQTT is defined. Not setting MQTT config");
|
||||
LOG_WARN("Set module config: MESHTASTIC_EXCLUDE_MQTT defined, skip MQTT config");
|
||||
return false;
|
||||
#else
|
||||
LOG_INFO("Set module config: MQTT");
|
||||
@@ -1319,7 +1319,7 @@ bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
||||
moduleConfig.has_neighbor_info = true;
|
||||
moduleConfig.neighbor_info = c.payload_variant.neighbor_info;
|
||||
if (moduleConfig.neighbor_info.update_interval < min_neighbor_info_broadcast_secs) {
|
||||
LOG_DEBUG("Tried to set update_interval too low, setting to %d", default_neighbor_info_broadcast_secs);
|
||||
LOG_DEBUG("update_interval too low, set to %d", default_neighbor_info_broadcast_secs);
|
||||
moduleConfig.neighbor_info.update_interval = default_neighbor_info_broadcast_secs;
|
||||
}
|
||||
break;
|
||||
@@ -1902,7 +1902,7 @@ void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
|
||||
LOG_INFO("Save changes to disk");
|
||||
service->reloadConfig(saveWhat); // Calls saveToDisk among other things
|
||||
} else {
|
||||
LOG_INFO("Delay save of changes to disk until the open transaction is committed");
|
||||
LOG_INFO("Delay disk save until open transaction commits");
|
||||
editTransactionActivityMs = millis(); // still in use, so not the abandoned kind we time out
|
||||
deferredEditSegments |= saveWhat;
|
||||
}
|
||||
@@ -1929,7 +1929,7 @@ void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p)
|
||||
while (*start && isspace((unsigned char)*start))
|
||||
start++;
|
||||
if (*start == '\0') {
|
||||
LOG_WARN("Rejected ham %s: must contain at least 1 non-whitespace character", fieldNames[i]);
|
||||
LOG_WARN("Rejected ham %s: needs 1+ non-whitespace char", fieldNames[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2116,7 +2116,7 @@ void AdminModule::noteOutgoingAdminRequest(const meshtastic_MeshPacket &p)
|
||||
memcpy(slot->key, destKey.bytes, 32);
|
||||
else
|
||||
memset(slot->key, 0, 32);
|
||||
LOG_DEBUG("Admin request sent to 0x%08x, expecting its response", p.to);
|
||||
LOG_DEBUG("Admin request sent to 0x%08x, expect response", p.to);
|
||||
}
|
||||
|
||||
bool AdminModule::responseIsSolicited(const meshtastic_MeshPacket &mp, pb_size_t responseVariant, pb_size_t moduleConfigTag)
|
||||
@@ -2195,7 +2195,7 @@ void AdminModule::handleSendInputEvent(const meshtastic_AdminMessage_InputEvent
|
||||
if (inputBroker) {
|
||||
inputBroker->injectInputEvent(&event);
|
||||
} else {
|
||||
LOG_ERROR("InputBroker not available for event injection");
|
||||
LOG_ERROR("No InputBroker for event injection");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ CannedMessageModule::CannedMessageModule()
|
||||
{
|
||||
this->loadProtoForModule();
|
||||
if ((this->splitConfiguredMessages() <= 0) && (cardkb_found.address == 0x00) && !INPUTBROKER_MATRIX_TYPE) {
|
||||
LOG_INFO("CannedMessageModule: No messages are configured. Module is disabled");
|
||||
LOG_INFO("CannedMessage: none configured, disabled");
|
||||
this->updateState(CANNED_MESSAGE_RUN_STATE_DISABLED);
|
||||
disable();
|
||||
} else {
|
||||
@@ -294,7 +294,7 @@ void CannedMessageModule::updateDestinationSelectionList()
|
||||
scrollIndex = 0; // Show first result at the top
|
||||
destIndex = 0; // Highlight the first entry
|
||||
if (nodesChanged && runState == CANNED_MESSAGE_RUN_STATE_DESTINATION_SELECTION) {
|
||||
LOG_INFO("Nodes changed, forcing UI refresh.");
|
||||
LOG_INFO("Nodes changed, forcing UI refresh");
|
||||
screen->forceDisplay();
|
||||
}
|
||||
}
|
||||
@@ -1108,10 +1108,10 @@ void CannedMessageModule::sendText(NodeNum dest, ChannelIndex channel, const cha
|
||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER &&
|
||||
config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE &&
|
||||
config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_BASE) {
|
||||
LOG_INFO("Proactively adding %x as favorite node", dest);
|
||||
LOG_INFO("Proactively adding 0x%08x as favorite node", dest);
|
||||
nodeDB->set_favorite(true, dest);
|
||||
} else {
|
||||
LOG_DEBUG("Not favoriting node %x because role is router-like", dest);
|
||||
LOG_DEBUG("Not favoriting node 0x%08x: router-like role", dest);
|
||||
}
|
||||
}
|
||||
sm.ackStatus = AckStatus::NONE;
|
||||
@@ -1163,12 +1163,12 @@ int32_t CannedMessageModule::runOnce()
|
||||
if (this->runState == CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE && this->payload == CANNED_MESSAGE_RUN_STATE_FREETEXT) {
|
||||
// Virtual keyboard message sending case - text was not empty
|
||||
if (this->freetext.length() > 0) {
|
||||
LOG_INFO("Processing delayed virtual keyboard send: '%s'", this->freetext.c_str());
|
||||
LOG_INFO("Delayed vkbd send: '%s'", this->freetext.c_str());
|
||||
sendText(this->dest, this->channel, this->freetext.c_str(), true);
|
||||
|
||||
// Clean up virtual keyboard after sending
|
||||
if (graphics::NotificationRenderer::virtualKeyboard) {
|
||||
LOG_INFO("Cleaning up virtual keyboard after message send");
|
||||
LOG_INFO("Vkbd cleanup after send");
|
||||
graphics::OnScreenKeyboardModule::instance().stop(false);
|
||||
graphics::NotificationRenderer::resetBanner();
|
||||
}
|
||||
@@ -1178,7 +1178,7 @@ int32_t CannedMessageModule::runOnce()
|
||||
this->payload = 0;
|
||||
} else {
|
||||
// Empty message, just go inactive
|
||||
LOG_INFO("Empty freetext detected in delayed processing, returning to inactive state");
|
||||
LOG_INFO("Empty freetext, back to inactive");
|
||||
this->updateState(CANNED_MESSAGE_RUN_STATE_INACTIVE);
|
||||
}
|
||||
|
||||
@@ -1221,7 +1221,7 @@ int32_t CannedMessageModule::runOnce()
|
||||
|
||||
// Clean up virtual keyboard if it exists during timeout
|
||||
if (graphics::NotificationRenderer::virtualKeyboard) {
|
||||
LOG_INFO("Cleaning up virtual keyboard due to module timeout");
|
||||
LOG_INFO("Vkbd cleanup on timeout");
|
||||
graphics::OnScreenKeyboardModule::instance().stop(false);
|
||||
graphics::NotificationRenderer::resetBanner();
|
||||
}
|
||||
@@ -1230,7 +1230,7 @@ int32_t CannedMessageModule::runOnce()
|
||||
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_SELECT) {
|
||||
if (this->payload == 0) {
|
||||
// [Exit] button pressed - return to inactive state
|
||||
LOG_INFO("Processing [Exit] action - returning to inactive state");
|
||||
LOG_INFO("Exit action, back to inactive");
|
||||
this->updateState(CANNED_MESSAGE_RUN_STATE_INACTIVE);
|
||||
} else if (this->payload == CANNED_MESSAGE_RUN_STATE_FREETEXT) {
|
||||
if (this->freetext.length() > 0) {
|
||||
|
||||
@@ -476,7 +476,7 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
||||
if (buzzerShouldAlert) {
|
||||
LOG_INFO("externalNotificationModule - Buzzer alert");
|
||||
if (buzzerModeIsDirectOnly && !isDmToUs && !containsBell) {
|
||||
LOG_INFO("Message buzzer was suppressed because buzzer mode DIRECT_MSG_ONLY");
|
||||
LOG_INFO("Buzzer suppressed: mode DIRECT_MSG_ONLY");
|
||||
} else {
|
||||
// Buzz if buzzer mode is not in DIRECT_MSG_ONLY or is DM to us
|
||||
if (moduleConfig.external_notification.use_i2s_as_buzzer) {
|
||||
|
||||
@@ -182,7 +182,7 @@ void HopScalingModule::samplePacketForHistogram(uint32_t nodeId, uint8_t hopCoun
|
||||
this->count++;
|
||||
} else {
|
||||
LOG_WARN("[HOPSCALE] Histogram full at samp=1/%u (DENOM_MAX=%u); dropping node hash=0x%04x; hop recommendation may be "
|
||||
"skewed!!!",
|
||||
"skewed!!",
|
||||
samplingDenominator, DENOM_MAX, hash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ bool KeyVerificationModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
|
||||
memset(message, 0, sizeof(message));
|
||||
sprintf(message, "Verification: \n");
|
||||
generateVerificationCode(message + 15);
|
||||
LOG_INFO("Hash1 matches!");
|
||||
LOG_INFO("Hash1 matches");
|
||||
static const char *optionsArray[] = {"Reject", "Accept"};
|
||||
// Don't try to put the array definition in the macro. Does not work with curly braces.
|
||||
IF_SCREEN(graphics::BannerOverlayOptions options; options.message = message; options.durationMs = 30000;
|
||||
|
||||
@@ -198,7 +198,7 @@ bool MeshBeaconModule::reconfigureForBeaconTX(RadioInterface *iface, meshtastic_
|
||||
// transmit on it; the radio driver drops the packet outright (see RadioLibInterface,
|
||||
// beaconTxConfigInvalid) rather than letting it fall through onto the current config.
|
||||
if (beaconTxConfigInvalid(p)) {
|
||||
LOG_DEBUG("Beacon: target preset %d/region %d invalid (or ham mismatch), not switching", targetPreset, targetRegion);
|
||||
LOG_DEBUG("Beacon: target preset %d/region %d invalid (or ham mismatch), skip", targetPreset, targetRegion);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ bool MeshBeaconModule::reconfigureForBeaconTX(RadioInterface *iface, meshtastic_
|
||||
|
||||
} else if ((!p || !getTargetRadioSettings(p, nullptr, nullptr)) && radioSwitched) {
|
||||
|
||||
LOG_INFO("Beacon: restoring radio config after beacon TX");
|
||||
LOG_INFO("Beacon: restore radio config after TX");
|
||||
config.lora.modem_preset = originalModemPreset;
|
||||
config.lora.channel_num = originalLoraChannel;
|
||||
config.lora.region = originalRegion;
|
||||
@@ -315,7 +315,7 @@ void MeshBeaconBroadcastModule::sendBeacon()
|
||||
(bcfg.broadcast_offer_region != meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
||||
|
||||
if (!hasText && !hasRadioContent) {
|
||||
LOG_DEBUG("Beacon: nothing to send (empty message, no offer), skipping");
|
||||
LOG_DEBUG("Beacon: empty msg, no offer, skip");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ void MeshBeaconBroadcastModule::sendBeacon()
|
||||
offerOnly.offer_region = bcfg.broadcast_offer_region;
|
||||
offerSize = (pb_size_t)pb_encode_to_bytes(offerBuf, sizeof(offerBuf), &meshtastic_MeshBeacon_msg, &offerOnly);
|
||||
if (offerSize == 0)
|
||||
LOG_WARN("Beacon: offer encode failed, skipping offer packet(s)");
|
||||
LOG_WARN("Beacon: offer encode failed, skip");
|
||||
}
|
||||
if (sendCombined && payloadCacheDirty)
|
||||
rebuildCache();
|
||||
@@ -429,8 +429,7 @@ void MeshBeaconBroadcastModule::sendBeacon()
|
||||
tgt.slot = config.lora.channel_num;
|
||||
if (bt.has_channel_index) {
|
||||
if (bt.channel_index >= (uint32_t)channels.getNumChannels()) {
|
||||
LOG_WARN("Beacon: target %d channel_index %u out of range, using default channel for preset", ti,
|
||||
bt.channel_index);
|
||||
LOG_WARN("Beacon: target %d channel_index %u out of range, use preset default", ti, bt.channel_index);
|
||||
} else {
|
||||
const meshtastic_ChannelSettings &cs = channels.getByIndex(bt.channel_index).settings;
|
||||
if (cs.name[0] != '\0' || cs.psk.size > 0) {
|
||||
@@ -438,8 +437,7 @@ void MeshBeaconBroadcastModule::sendBeacon()
|
||||
tgt.channel = cs;
|
||||
tgt.slot = cs.channel_num;
|
||||
} else {
|
||||
LOG_DEBUG("Beacon: target %d channel_index %u is a blank slot, using default channel for preset", ti,
|
||||
bt.channel_index);
|
||||
LOG_DEBUG("Beacon: target %d channel_index %u blank, use preset default", ti, bt.channel_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -463,7 +461,7 @@ void MeshBeaconBroadcastModule::sendBeacon()
|
||||
}
|
||||
}
|
||||
if (duplicate) {
|
||||
LOG_DEBUG("Beacon: target %d duplicates an earlier target's radio config, skipping", ti);
|
||||
LOG_DEBUG("Beacon: target %d dup radio config, skip", ti);
|
||||
continue;
|
||||
}
|
||||
sent[sentCount] = tgt;
|
||||
@@ -487,7 +485,7 @@ void MeshBeaconBroadcastModule::sendBeacon()
|
||||
if (sendOfferOnly && offerSize > 0) {
|
||||
meshtastic_MeshPacket *pA = allocDataPacket();
|
||||
if (!pA) {
|
||||
LOG_WARN("Beacon: failed to allocate split-A packet (target %d)", ti);
|
||||
LOG_WARN("Beacon: split-A alloc failed (target %d)", ti);
|
||||
return;
|
||||
}
|
||||
memcpy(pA->decoded.payload.bytes, offerBuf, offerSize);
|
||||
@@ -501,7 +499,7 @@ void MeshBeaconBroadcastModule::sendBeacon()
|
||||
if (sendTextOnly) {
|
||||
meshtastic_MeshPacket *pB = allocDataPacket();
|
||||
if (!pB) {
|
||||
LOG_WARN("Beacon: failed to allocate split-B packet (target %d)", ti);
|
||||
LOG_WARN("Beacon: split-B alloc failed (target %d)", ti);
|
||||
return;
|
||||
}
|
||||
pb_size_t msgLen = (pb_size_t)strnlen(bcfg.broadcast_message, sizeof(bcfg.broadcast_message) - 1);
|
||||
|
||||
@@ -138,7 +138,7 @@ int32_t NeighborInfoModule::runOnce()
|
||||
|
||||
meshtastic_MeshPacket *NeighborInfoModule::allocReply()
|
||||
{
|
||||
LOG_INFO("NeighborInfoRequested.");
|
||||
LOG_INFO("NeighborInfoRequested");
|
||||
if (lastSentReply && Throttle::isWithinTimespanMs(lastSentReply, 3 * 60 * 1000)) {
|
||||
LOG_DEBUG("Skip Neighbors reply since we sent a reply <3min ago");
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
|
||||
@@ -49,7 +49,7 @@ bool NodeInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
|
||||
}
|
||||
|
||||
if (p.is_licensed != owner.is_licensed) {
|
||||
LOG_WARN("Invalid nodeInfo detected, is_licensed mismatch!");
|
||||
LOG_WARN("Invalid nodeInfo detected, is_licensed mismatch");
|
||||
return true;
|
||||
}
|
||||
NodeNum sourceNum = getFrom(&mp);
|
||||
|
||||
@@ -68,7 +68,7 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
|
||||
if (isFromUs(&mp)) {
|
||||
isLocal = true;
|
||||
if (config.position.fixed_position) {
|
||||
LOG_DEBUG("Ignore incoming position update from myself except for time, because position.fixed_position is true");
|
||||
LOG_DEBUG("Ignore own position update except time: position.fixed_position true");
|
||||
|
||||
#ifdef T_WATCH_S3
|
||||
// Since we return early if position.fixed_position is true, set the T-Watch's RTC to the time received from the
|
||||
@@ -117,7 +117,7 @@ void PositionModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic
|
||||
// Phone position packets need to be truncated to the channel precision
|
||||
if (isFromUs(&mp)) {
|
||||
if (precision == 0)
|
||||
LOG_DEBUG("Strip phone position due to channel precision 0");
|
||||
LOG_DEBUG("Strip phone position: channel precision 0");
|
||||
else if (precision < 32)
|
||||
LOG_DEBUG("Truncate phone position to channel precision %i", precision);
|
||||
applyPositionPrecision(*p, precision);
|
||||
@@ -129,11 +129,11 @@ void PositionModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic
|
||||
void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal, bool forceUpdate)
|
||||
{
|
||||
if (hasQualityTimesource() && !isLocal) {
|
||||
LOG_DEBUG("Ignore time from mesh because we have a GPS, RTC, or Phone/NTP time source in the past day");
|
||||
LOG_DEBUG("Ignore time from mesh: GPS/RTC/Phone/NTP time source in past day");
|
||||
return;
|
||||
}
|
||||
if (!isLocal && p.location_source < meshtastic_Position_LocSource_LOC_INTERNAL) {
|
||||
LOG_DEBUG("Ignore time from mesh because it has a unknown or manual source");
|
||||
LOG_DEBUG("Ignore time from mesh: unknown or manual source");
|
||||
return;
|
||||
}
|
||||
struct timeval tv;
|
||||
@@ -170,7 +170,7 @@ bool PositionModule::hasGPS()
|
||||
meshtastic_MeshPacket *PositionModule::allocPositionPacket(uint32_t atPrecision)
|
||||
{
|
||||
if (atPrecision == 0) {
|
||||
LOG_DEBUG("Skip location send because precision is set to 0!");
|
||||
LOG_DEBUG("Skip location send: precision 0");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ meshtastic_MeshPacket *PositionModule::allocPositionPacket(uint32_t atPrecision)
|
||||
localPosition.seq_number++;
|
||||
|
||||
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) {
|
||||
LOG_WARN("Skip position send because lat/lon are zero!");
|
||||
LOG_WARN("Skip position send: lat/lon zero");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
{
|
||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_LOST_AND_FOUND && lastSentReply &&
|
||||
Throttle::isWithinTimespanMs(lastSentReply, 3 * 60 * 1000)) {
|
||||
LOG_DEBUG("Skip Position reply since we sent a reply <3min ago");
|
||||
LOG_DEBUG("Skip Position reply: sent one <3min ago");
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
return nullptr;
|
||||
}
|
||||
@@ -349,7 +349,7 @@ meshtastic_MeshPacket *PositionModule::allocAtakPli()
|
||||
size_t proto_size = pb_encode_to_bytes(protobuf_bytes, sizeof(protobuf_bytes), &meshtastic_TAKPacketV2_msg, &takPacket);
|
||||
|
||||
if (proto_size == 0) {
|
||||
LOG_ERROR("Failed to encode TAK V2 PLI packet");
|
||||
LOG_ERROR("TAK V2 PLI packet encode failed");
|
||||
packetPool.release(mp);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ void PositionModule::sendOurPosition()
|
||||
return;
|
||||
}
|
||||
}
|
||||
LOG_INFO("Skip pos@%x:6 broadcast; position sharing is opt-in and disabled on all channels", localPosition.timestamp);
|
||||
LOG_INFO("Skip pos@%x:6 broadcast; position sharing disabled on all channels", localPosition.timestamp);
|
||||
}
|
||||
|
||||
// Position broadcasts are opt-in per channel in 2.8, but our own position still plays to the
|
||||
@@ -506,7 +506,7 @@ int32_t PositionModule::runOnce()
|
||||
if (sleepOnNextExecution == true) {
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs);
|
||||
LOG_DEBUG("Sleep for %ims, then awaking to send position again", nightyNightMs);
|
||||
LOG_DEBUG("Sleep %ims, then wake to send position", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, false, false);
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ int32_t PositionModule::runOnce()
|
||||
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
|
||||
[]() {
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("Skip send smart broadcast due to time throttling");
|
||||
LOG_DEBUG("Skip smart broadcast: time throttled");
|
||||
#endif
|
||||
})) {
|
||||
|
||||
@@ -703,7 +703,7 @@ void PositionModule::handleNewPosition()
|
||||
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
|
||||
[]() {
|
||||
#ifdef GPS_DEBUG
|
||||
LOG_DEBUG("Skip send smart broadcast due to time throttling");
|
||||
LOG_DEBUG("Skip smart broadcast: time throttled");
|
||||
#endif
|
||||
})) {
|
||||
LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, "
|
||||
|
||||
@@ -125,7 +125,7 @@ int32_t PowerStressModule::runOnce()
|
||||
// FIXME - implement
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("PowerStress operation %d not yet implemented!", p.cmd);
|
||||
LOG_ERROR("PowerStress operation %d not yet implemented", p.cmd);
|
||||
sleep_msec = 0; // Don't do whatever sleep was requested...
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ int32_t RangeTestModule::runOnce()
|
||||
|
||||
if (moduleConfig.range_test.clear_on_reboot) {
|
||||
// User wants to delete previous range test(s)
|
||||
LOG_INFO("Range Test Module - Clearing out previous test file");
|
||||
LOG_INFO("Range Test Module - Clear previous test file");
|
||||
rangeTestModuleRadio->removeFile();
|
||||
}
|
||||
if (moduleConfig.range_test.sender) {
|
||||
@@ -73,7 +73,7 @@ int32_t RangeTestModule::runOnce()
|
||||
|
||||
if (moduleConfig.range_test.sender) {
|
||||
// If sender
|
||||
LOG_INFO("Range Test Module - Sending heartbeat every %d ms", (senderHeartbeat));
|
||||
LOG_INFO("Range Test Module - Heartbeat every %d ms", (senderHeartbeat));
|
||||
|
||||
LOG_INFO("gpsStatus->getLatitude() %d", gpsStatus->getLatitude());
|
||||
LOG_INFO("gpsStatus->getLongitude() %d", gpsStatus->getLongitude());
|
||||
@@ -216,12 +216,12 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
||||
*/
|
||||
concurrency::LockGuard g(spiLock);
|
||||
if (!FSBegin()) {
|
||||
LOG_DEBUG("An Error has occurred while mounting the filesystem");
|
||||
LOG_DEBUG("Filesystem mount error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
|
||||
LOG_DEBUG("Filesystem doesn't have enough free space. Aborting write");
|
||||
LOG_DEBUG("Filesystem low on free space. Abort write");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -233,14 +233,14 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
||||
File fileToWrite = FSCom.open("/static/rangetest.csv", FILE_WRITE);
|
||||
|
||||
if (!fileToWrite) {
|
||||
LOG_ERROR("There was an error opening the file for writing");
|
||||
LOG_ERROR("Error opening file for writing");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Print the CSV header
|
||||
if (fileToWrite.println("time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx "
|
||||
"snr,distance,hop limit,payload,rx rssi")) {
|
||||
LOG_INFO("File was written");
|
||||
LOG_INFO("File written");
|
||||
} else {
|
||||
LOG_ERROR("File write failed");
|
||||
}
|
||||
@@ -252,7 +252,7 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
||||
File fileToAppend = FSCom.open("/static/rangetest.csv", FILE_APPEND);
|
||||
|
||||
if (!fileToAppend) {
|
||||
LOG_ERROR("There was an error opening the file for appending");
|
||||
LOG_ERROR("Error opening file for appending");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
||||
return 1;
|
||||
|
||||
#else
|
||||
LOG_ERROR("Failed to store range test results - feature only available for ESP32");
|
||||
LOG_ERROR("Can't store range test results - ESP32 only");
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
@@ -329,27 +329,27 @@ bool RangeTestModuleRadio::removeFile()
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
if (!FSBegin()) {
|
||||
LOG_DEBUG("An Error has occurred while mounting the filesystem");
|
||||
LOG_DEBUG("Filesystem mount error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!FSCom.exists("/static/rangetest.csv")) {
|
||||
LOG_DEBUG("No range tests found.");
|
||||
LOG_DEBUG("No range tests found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_INFO("Deleting previous range test.");
|
||||
LOG_INFO("Deleting previous range test");
|
||||
bool result = FSCom.remove("/static/rangetest.csv");
|
||||
|
||||
if (!result) {
|
||||
LOG_ERROR("Failed to delete range test.");
|
||||
LOG_ERROR("Failed to delete range test");
|
||||
return 0;
|
||||
}
|
||||
LOG_INFO("Range test removed.");
|
||||
LOG_INFO("Range test removed");
|
||||
|
||||
return 1;
|
||||
#else
|
||||
LOG_ERROR("Failed to remove range test results - feature only available for ESP32");
|
||||
LOG_ERROR("Can't remove range test results - ESP32 only");
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ int32_t RemoteHardwareModule::runOnce()
|
||||
|
||||
if (curVal != previousWatch) {
|
||||
previousWatch = curVal;
|
||||
LOG_INFO("Broadcast GPIOS 0x%llx changed!", curVal);
|
||||
LOG_INFO("Broadcast GPIOS 0x%llx changed", curVal);
|
||||
|
||||
// Something changed! Tell the world with a broadcast message
|
||||
meshtastic_HardwareMessage r = meshtastic_HardwareMessage_init_default;
|
||||
|
||||
@@ -421,7 +421,7 @@ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &m
|
||||
}
|
||||
} else {
|
||||
storeForwardModule->historyAdd(mp);
|
||||
LOG_INFO("S&F stored. Message history contains %u records now", this->packetHistoryTotalCount);
|
||||
LOG_INFO("S&F stored, history has %u records", this->packetHistoryTotalCount);
|
||||
}
|
||||
} else if (!isFromUs(&mp) && mp.decoded.portnum == meshtastic_PortNum_STORE_FORWARD_APP) {
|
||||
auto &p = mp.decoded;
|
||||
@@ -431,7 +431,7 @@ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &m
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_StoreAndForward_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding proto module!");
|
||||
LOG_ERROR("Error decoding proto module");
|
||||
// if we can't decode it, nobody can process it!
|
||||
return ProcessMessage::STOP;
|
||||
}
|
||||
@@ -567,8 +567,8 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
||||
// These fields only have informational purpose on a client. Fill them to consume later.
|
||||
if (p->which_variant == meshtastic_StoreAndForward_history_tag) {
|
||||
this->historyReturnWindow = p->variant.history.window / 60000;
|
||||
LOG_INFO("Router Response HISTORY - Sending %d messages from last %d minutes",
|
||||
p->variant.history.history_messages, this->historyReturnWindow);
|
||||
LOG_INFO("HISTORY response: %d msgs from last %d min", p->variant.history.history_messages,
|
||||
this->historyReturnWindow);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -46,7 +46,7 @@ void AirQualityTelemetryModule::i2cScanFinished(ScanI2C *i2cScanner)
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("Air Quality Telemetry adding I2C devices...");
|
||||
LOG_INFO("Air Quality Telemetry adding I2C devices");
|
||||
|
||||
/*
|
||||
Uncomment the preferences below if you want to use the module
|
||||
@@ -81,7 +81,7 @@ void AirQualityTelemetryModule::i2cScanFinished(ScanI2C *i2cScanner)
|
||||
|
||||
if (!firstTime) {
|
||||
// Re-scan for late comming sensors
|
||||
LOG_INFO("Re-scanning supported sensors...");
|
||||
LOG_INFO("Re-scanning supported sensors");
|
||||
|
||||
for (const auto &[address, type] : supportedSensors) {
|
||||
|
||||
@@ -130,7 +130,7 @@ int32_t AirQualityTelemetryModule::runOnce()
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.air_quality_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.", nightyNightMs);
|
||||
LOG_DEBUG("Sleep %ims until next send", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true, false);
|
||||
}
|
||||
|
||||
@@ -187,10 +187,10 @@ int32_t AirQualityTelemetryModule::runOnce()
|
||||
// - We can publish the data on the mesh shortly
|
||||
// - Or we can send it to the phone
|
||||
// TODO: This will need to be refurbished once we implement separate intervals
|
||||
LOG_INFO("Waking up sensors...");
|
||||
LOG_INFO("Waking up sensors");
|
||||
for (TelemetrySensor *sensor : sensors) {
|
||||
if (!sensor->canSleep()) {
|
||||
LOG_DEBUG("%s sensor doesn't have sleep feature. Skipping", sensor->sensorName);
|
||||
LOG_DEBUG("%s: no sleep support, skip", sensor->sensorName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ meshtastic_MeshPacket *AirQualityTelemetryModule::allocReply()
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding AirQualityTelemetry module!");
|
||||
LOG_ERROR("Error decoding AirQualityTelemetry module");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for air quality metrics
|
||||
@@ -529,7 +529,7 @@ bool AirQualityTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
// until the next telemetry interval and drains its battery
|
||||
if (!phoneOnly && isPowerSavingSensor()) {
|
||||
if (!validTelemetry)
|
||||
LOG_WARN("Air quality telemetry unavailable this cycle, sleep without sending");
|
||||
LOG_WARN("AQ telemetry unavailable, sleep without send");
|
||||
sleepOnNextExecution = true;
|
||||
preflightSleepDeferrals = 0;
|
||||
LOG_DEBUG("Start next execution in 5s, then sleep");
|
||||
|
||||
@@ -76,7 +76,7 @@ meshtastic_MeshPacket *DeviceTelemetryModule::allocReply()
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding DeviceTelemetry module!");
|
||||
LOG_ERROR("Error decoding DeviceTelemetry module");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for device metrics
|
||||
|
||||
@@ -257,7 +257,7 @@ void EnvironmentTelemetryModule::i2cScanFinished(ScanI2C *i2cScanner)
|
||||
if (!moduleConfig.telemetry.environment_measurement_enabled && !ENVIRONMENTAL_TELEMETRY_MODULE_ENABLE) {
|
||||
return;
|
||||
}
|
||||
LOG_INFO("Environment Telemetry adding I2C devices...");
|
||||
LOG_INFO("Environment Telemetry adding I2C devices");
|
||||
|
||||
/*
|
||||
Uncomment the preferences below if you want to use the module
|
||||
@@ -366,7 +366,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleep for %ims, then awake to send metrics again", nightyNightMs);
|
||||
LOG_DEBUG("Sleep %ims until next send", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true, false);
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ meshtastic_MeshPacket *EnvironmentTelemetryModule::allocReply()
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding EnvironmentTelemetry module!");
|
||||
LOG_ERROR("Error decoding EnvironmentTelemetry module");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for environment metrics
|
||||
@@ -813,7 +813,7 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
// otherwise it stays awake until the next telemetry interval and drains its battery
|
||||
if (!phoneOnly && isPowerSavingSensor()) {
|
||||
if (!validTelemetry)
|
||||
LOG_WARN("Environment telemetry unavailable this cycle, sleep without sending");
|
||||
LOG_WARN("Env telemetry unavailable, sleep without send");
|
||||
sleepOnNextExecution = true;
|
||||
preflightSleepDeferrals = 0;
|
||||
LOG_DEBUG("Start next execution in 5s, then sleep");
|
||||
|
||||
@@ -127,7 +127,7 @@ void HealthTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *
|
||||
const meshtastic_Data &p = lastMeasurementPacket->decoded;
|
||||
if (!pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &lastMeasurement)) {
|
||||
display->drawString(x, y, "Measurement Error");
|
||||
LOG_ERROR("Unable to decode last packet");
|
||||
LOG_ERROR("Can't decode last packet");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ meshtastic_MeshPacket *HealthTelemetryModule::allocReply()
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding HealthTelemetry module!");
|
||||
LOG_ERROR("Error decoding HealthTelemetry module");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for health metrics
|
||||
|
||||
@@ -51,7 +51,7 @@ meshtastic_MeshPacket *HostMetricsModule::allocReply()
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_HostMetrics_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding HostMetrics module!");
|
||||
LOG_ERROR("Can't decode HostMetrics module");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for device metrics
|
||||
|
||||
@@ -149,7 +149,7 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s
|
||||
const meshtastic_Data &p = lastMeasurementPacket->decoded;
|
||||
if (!pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &lastMeasurement)) {
|
||||
display->drawString(x, graphics::getTextPositions(display)[line++], "Measurement Error");
|
||||
LOG_ERROR("Unable to decode last packet");
|
||||
LOG_ERROR("Can't decode last packet");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ meshtastic_MeshPacket *PowerTelemetryModule::allocReply()
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding PowerTelemetry module!");
|
||||
LOG_ERROR("Error decoding PowerTelemetry module");
|
||||
return NULL;
|
||||
}
|
||||
// Check for a request for power metrics
|
||||
|
||||
@@ -142,7 +142,7 @@ void BME680Sensor::loadState()
|
||||
}
|
||||
spiLock->unlock();
|
||||
#else
|
||||
LOG_ERROR("ERROR: Filesystem not implemented");
|
||||
LOG_ERROR("Filesystem not implemented");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ void BME680Sensor::updateState()
|
||||
}
|
||||
spiLock->unlock();
|
||||
#else
|
||||
LOG_ERROR("ERROR: Filesystem not implemented");
|
||||
LOG_ERROR("Filesystem not implemented");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ bool DS248XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
printROM(ds248xData.rom);
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("%s: Could not determine variant (%u/%u)", sensorName, retry, numRetries);
|
||||
LOG_WARN("%s: Can't determine variant (%u/%u)", sensorName, retry, numRetries);
|
||||
initError = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ bool NAU7802Sensor::saveCalibrationData()
|
||||
pb_ostream_t stream = {&writecb, static_cast<Print *>(&file), meshtastic_Nau7802Config_size};
|
||||
|
||||
if (!pb_encode(&stream, &meshtastic_Nau7802Config_msg, &nau7802config)) {
|
||||
LOG_ERROR("Error: can't encode protobuf %s", PB_GET_ERROR(&stream));
|
||||
LOG_ERROR("Can't encode protobuf %s", PB_GET_ERROR(&stream));
|
||||
} else {
|
||||
okay = true;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ bool NAU7802Sensor::loadCalibrationData()
|
||||
LOG_INFO("%s state read from %s", sensorName, nau7802ConfigFileName);
|
||||
pb_istream_t stream = {&readcb, &file, meshtastic_Nau7802Config_size};
|
||||
if (!pb_decode(&stream, &meshtastic_Nau7802Config_msg, &nau7802config)) {
|
||||
LOG_ERROR("Error: can't decode protobuf %s", PB_GET_ERROR(&stream));
|
||||
LOG_ERROR("Can't decode protobuf %s", PB_GET_ERROR(&stream));
|
||||
} else {
|
||||
nau7802.setZeroOffset(nau7802config.zeroOffset);
|
||||
nau7802.setCalibrationFactor(nau7802config.calibrationFactor);
|
||||
|
||||
@@ -63,7 +63,7 @@ static void onewire_evt(const uint8_t pid, const uint8_t sid, const SNHUBAPI_EVT
|
||||
// {
|
||||
// LOG_INFO("%02x,", msg[i]);
|
||||
// }
|
||||
// LOG_INFO("");
|
||||
// LOG_INFO(".");
|
||||
switch (msg[0]) {
|
||||
case RAK_IPSO_CAPACITY:
|
||||
dc_prec = msg[1];
|
||||
@@ -91,7 +91,7 @@ static void onewire_evt(const uint8_t pid, const uint8_t sid, const SNHUBAPI_EVT
|
||||
// {
|
||||
// LOG_INFO("%02x,", msg[i]);
|
||||
// }
|
||||
// LOG_INFO("");
|
||||
// LOG_INFO(".");
|
||||
|
||||
switch (msg[0]) {
|
||||
case RAK_IPSO_CAPACITY:
|
||||
|
||||
@@ -52,7 +52,7 @@ float RCWL9620Sensor::getDistance()
|
||||
_wire->requestFrom(_addr, (uint8_t)3);
|
||||
|
||||
if (_wire->available() < 3) {
|
||||
LOG_DEBUG("[RCWL9620] less than 3 octets !");
|
||||
LOG_DEBUG("[RCWL9620] less than 3 octets ");
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ bool SCD30Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
_port = dev->address.port;
|
||||
reClockI2C.setup(_bus, _port);
|
||||
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
scd30.begin(*_bus, _address);
|
||||
|
||||
if (!startMeasurement()) {
|
||||
LOG_ERROR("%s: Failed to start periodic measurement", sensorName);
|
||||
LOG_ERROR("%s: Periodic measurement start failed", sensorName);
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -35,7 +35,7 @@ bool SCD30Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
}
|
||||
|
||||
if (!getASC(ascActive)) {
|
||||
LOG_WARN("%s: Could not determine ASC state", sensorName);
|
||||
LOG_WARN("%s: Can't determine ASC state", sensorName);
|
||||
}
|
||||
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
@@ -59,12 +59,12 @@ bool SCD30Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
float co2, temperature, humidity;
|
||||
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_DEBUG("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
if (scd30.readMeasurementData(co2, temperature, humidity) != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Failed to read measurement data", sensorName);
|
||||
LOG_ERROR("%s: Measurement read failed", sensorName);
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -102,7 +102,7 @@ bool SCD30Sensor::setMeasurementInterval(uint16_t measInterval)
|
||||
error = scd30.setMeasurementInterval(measInterval);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set measurement interval. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set measurement interval, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ bool SCD30Sensor::getMeasurementInterval(uint16_t &measInterval)
|
||||
error = scd30.getMeasurementInterval(measInterval);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to get measurement interval. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't get measurement interval, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ bool SCD30Sensor::startMeasurement()
|
||||
state = SCD30_MEASUREMENT;
|
||||
return true;
|
||||
} else {
|
||||
LOG_ERROR("%s: Couldn't start measurement mode", sensorName);
|
||||
LOG_ERROR("%s: Can't start measurement mode", sensorName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ bool SCD30Sensor::stopMeasurement()
|
||||
|
||||
error = scd30.stopPeriodicMeasurement();
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to stop measurement", sensorName);
|
||||
LOG_ERROR("%s: Can't stop measurement", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,17 +180,17 @@ bool SCD30Sensor::performFRC(uint16_t targetCO2)
|
||||
{
|
||||
uint16_t error;
|
||||
|
||||
LOG_INFO("%s: Issuing FRC. Ensure device has been working at least 3 minutes in stable target environment", sensorName);
|
||||
LOG_INFO("%s: Issuing FRC. Needs 3+ min in stable target environment", sensorName);
|
||||
|
||||
LOG_INFO("%s: Target CO2: %u ppm", sensorName, targetCO2);
|
||||
error = scd30.forceRecalibration((uint16_t)targetCO2);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to perform forced recalibration.", sensorName);
|
||||
LOG_ERROR("%s: Can't perform FRC", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: FRC Correction successful.", sensorName);
|
||||
LOG_INFO("%s: FRC done", sensorName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -204,12 +204,12 @@ bool SCD30Sensor::setASC(bool ascEnabled)
|
||||
error = scd30.activateAutoCalibration((uint16_t)ascEnabled);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to send command.", sensorName);
|
||||
LOG_ERROR("%s: Can't send command", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getASC(ascActive)) {
|
||||
LOG_ERROR("%s: Unable to check if ASC is enabled", sensorName);
|
||||
LOG_ERROR("%s: Can't check if ASC enabled", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ bool SCD30Sensor::getASC(uint16_t &_ascActive)
|
||||
error = scd30.getAutoCalibrationStatus(_ascActive);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to send command.", sensorName);
|
||||
LOG_ERROR("%s: Can't get ASC status", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -260,23 +260,23 @@ bool SCD30Sensor::setTemperature(float tempReference)
|
||||
|
||||
if (tempReference == 100) {
|
||||
// Requesting the value of 100 will restore the temperature offset
|
||||
LOG_INFO("%s: Setting reference temperature at 0degC", sensorName);
|
||||
LOG_INFO("%s: Setting reference temp at 0degC", sensorName);
|
||||
_tempOffset = 0;
|
||||
} else {
|
||||
|
||||
LOG_INFO("%s: Setting reference temperature at: %.2f", sensorName, tempReference);
|
||||
LOG_INFO("%s: Setting reference temp at: %.2f", sensorName, tempReference);
|
||||
|
||||
error = scd30.readMeasurementData(co2, temperature, humidity);
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to read current temperature. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't read current temp, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: Current sensor temperature: %.2f", sensorName, temperature);
|
||||
LOG_INFO("%s: Current sensor temp: %.2f", sensorName, temperature);
|
||||
|
||||
tempOffset = (temperature - tempReference);
|
||||
if (tempOffset < 0) {
|
||||
LOG_ERROR("%s: temperature offset is only positive", sensorName);
|
||||
LOG_ERROR("%s: temp offset is only positive", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -284,16 +284,16 @@ bool SCD30Sensor::setTemperature(float tempReference)
|
||||
_tempOffset = static_cast<uint16_t>(tempOffset);
|
||||
}
|
||||
|
||||
LOG_INFO("%s: Setting temperature offset: %u (*100)", sensorName, _tempOffset);
|
||||
LOG_INFO("%s: Setting temp offset: %u (*100)", sensorName, _tempOffset);
|
||||
|
||||
error = scd30.setTemperatureOffset(_tempOffset);
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set temperature offset. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set temp offset, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
scd30.getTemperatureOffset(updatedTempOffset);
|
||||
LOG_INFO("%s: Updated sensor temperature offset: %u (*100)", sensorName, updatedTempOffset);
|
||||
LOG_INFO("%s: Updated sensor temp offset: %u (*100)", sensorName, updatedTempOffset);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ bool SCD30Sensor::setAltitude(uint16_t altitude)
|
||||
error = scd30.setAltitudeCompensation(altitude);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set altitude, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ bool SCD30Sensor::getAltitude(uint16_t &altitude)
|
||||
error = scd30.getAltitudeCompensation(altitude);
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to get altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't get altitude, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
LOG_INFO("%s: Sensor altitude: %u", sensorName, altitude);
|
||||
@@ -342,11 +342,11 @@ bool SCD30Sensor::softReset()
|
||||
error = scd30.softReset();
|
||||
|
||||
if (error != SCD30_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to do soft reset. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't soft reset, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: soft reset successful", sensorName);
|
||||
LOG_INFO("%s: soft reset done", sensorName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ bool SCD30Sensor::isActive()
|
||||
uint32_t SCD30Sensor::wakeUp()
|
||||
{
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -387,7 +387,7 @@ uint32_t SCD30Sensor::wakeUp()
|
||||
void SCD30Sensor::sleep()
|
||||
{
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -420,7 +420,7 @@ AdminMessageHandleResult SCD30Sensor::handleAdminMessage(const meshtastic_MeshPa
|
||||
AdminMessageHandleResult result;
|
||||
|
||||
#ifdef SCD30_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD30_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD30_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD30_I2C_CLOCK_SPEED */
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ bool SCD4XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
_port = dev->address.port;
|
||||
reClockI2C.setup(_bus, _port);
|
||||
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD4X_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD4X_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -44,7 +44,7 @@ bool SCD4XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
if (sensorVariant == SCD4X_SENSOR_VARIANT_SCD41) {
|
||||
LOG_INFO("%s: Found SCD41", sensorName);
|
||||
if (!powerUp()) {
|
||||
LOG_ERROR("%s: Error trying to execute powerUp()", sensorName);
|
||||
LOG_ERROR("%s: powerUp() failed", sensorName);
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -54,7 +54,7 @@ bool SCD4XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
}
|
||||
|
||||
if (!getASC(ascActive)) {
|
||||
LOG_ERROR("%s: Unable to check if ASC is enabled", sensorName);
|
||||
LOG_ERROR("%s: Can't check if ASC enabled", sensorName);
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -64,7 +64,7 @@ bool SCD4XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
|
||||
// Start measurement in selected power mode (low power by default)
|
||||
if (!startMeasurement()) {
|
||||
LOG_ERROR("%s: Couldn't start measurement", sensorName);
|
||||
LOG_ERROR("%s: Can't start measurement", sensorName);
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -100,7 +100,7 @@ bool SCD4XSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
float temperature, humidity;
|
||||
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: attempting to reclock speed to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
LOG_DEBUG("%s: reclock to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD4X_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD4X_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -134,9 +134,9 @@ bool SCD4XSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
|
||||
LOG_DEBUG("Got %s readings: co2=%u, co2_temp=%.2f, co2_hum%.2f", sensorName, co2, temperature, humidity);
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_DEBUG("%s: Error while getting measurements: %u", sensorName, error);
|
||||
LOG_DEBUG("%s: Error getting measurements: %u", sensorName, error);
|
||||
if (co2 == 0) {
|
||||
LOG_ERROR("%s: Skipping invalid measurement.", sensorName);
|
||||
LOG_ERROR("%s: Skipping invalid measurement", sensorName);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ bool SCD4XSensor::performFRC(uint32_t targetCO2)
|
||||
{
|
||||
uint16_t error, frcCorr;
|
||||
|
||||
LOG_INFO("%s: Issuing FRC. Ensure device has been working at least 3 minutes in stable target environment", sensorName);
|
||||
LOG_INFO("%s: Issuing FRC. Needs 3+ min in stable target environment", sensorName);
|
||||
|
||||
if (!stopMeasurement()) {
|
||||
return false;
|
||||
@@ -180,16 +180,16 @@ bool SCD4XSensor::performFRC(uint32_t targetCO2)
|
||||
delay(400);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to perform forced recalibration.", sensorName);
|
||||
LOG_ERROR("%s: Can't perform FRC", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (frcCorr == 0xFFFF) {
|
||||
LOG_ERROR("%s: Error while performing forced recalibration.", sensorName);
|
||||
LOG_ERROR("%s: FRC failed", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: FRC Correction successful. Correction output: %u", sensorName, (uint16_t)(frcCorr - 0x8000));
|
||||
LOG_INFO("%s: FRC done. Correction output: %u", sensorName, (uint16_t)(frcCorr - 0x8000));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ bool SCD4XSensor::startMeasurement()
|
||||
state = SCD4X_MEASUREMENT;
|
||||
return true;
|
||||
} else {
|
||||
LOG_ERROR("%s: Unable to start measurement mode", sensorName);
|
||||
LOG_ERROR("%s: Can't start measurement mode", sensorName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ bool SCD4XSensor::stopMeasurement()
|
||||
|
||||
error = scd4x.stopPeriodicMeasurement();
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to stop measurement.", sensorName);
|
||||
LOG_ERROR("%s: Can't stop measurement", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ bool SCD4XSensor::getASC(uint16_t &_ascActive)
|
||||
error = scd4x.getAutomaticSelfCalibrationEnabled(_ascActive);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to send command.", sensorName);
|
||||
LOG_ERROR("%s: Can't send command", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -317,18 +317,18 @@ bool SCD4XSensor::setASC(bool ascEnabled)
|
||||
error = scd4x.setAutomaticSelfCalibrationEnabled((uint16_t)ascEnabled);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to send command.", sensorName);
|
||||
LOG_ERROR("%s: Can't send command", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
error = scd4x.persistSettings();
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to make settings persistent.", sensorName);
|
||||
LOG_ERROR("%s: Can't persist settings", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getASC(ascActive)) {
|
||||
LOG_ERROR("%s: Unable to check if ASC is enabled", sensorName);
|
||||
LOG_ERROR("%s: Can't check if ASC enabled", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ bool SCD4XSensor::setASCBaseline(uint32_t targetCO2)
|
||||
|
||||
getASC(ascActive);
|
||||
if (!ascActive) {
|
||||
LOG_ERROR("%s: Can't set ASC baseline. ASC is not active", sensorName);
|
||||
LOG_ERROR("%s: Can't set ASC baseline, ASC not active", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -367,17 +367,17 @@ bool SCD4XSensor::setASCBaseline(uint32_t targetCO2)
|
||||
error = scd4x.setAutomaticSelfCalibrationTarget((uint16_t)targetCO2);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to send command.", sensorName);
|
||||
LOG_ERROR("%s: Can't send command", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
error = scd4x.persistSettings();
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to make settings persistent.", sensorName);
|
||||
LOG_ERROR("%s: Can't persist settings", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: Setting ASC baseline successful", sensorName);
|
||||
LOG_INFO("%s: ASC baseline set", sensorName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ bool SCD4XSensor::setTemperature(float tempReference)
|
||||
float temperature;
|
||||
float humidity;
|
||||
|
||||
LOG_INFO("%s: Setting reference temperature at: %.2f", sensorName, tempReference);
|
||||
LOG_INFO("%s: Setting reference temp at: %.2f", sensorName, tempReference);
|
||||
|
||||
error = scd4x.getDataReadyStatus(dataReady);
|
||||
if (error != SCD4X_NO_ERROR || !dataReady) {
|
||||
@@ -424,11 +424,11 @@ bool SCD4XSensor::setTemperature(float tempReference)
|
||||
|
||||
error = scd4x.readMeasurement(co2, temperature, humidity);
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to read current temperature. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't read current temp, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: Current sensor temperature: %.2f", sensorName, temperature);
|
||||
LOG_INFO("%s: Current sensor temp: %.2f", sensorName, temperature);
|
||||
|
||||
if (!stopMeasurement()) {
|
||||
return false;
|
||||
@@ -437,28 +437,28 @@ bool SCD4XSensor::setTemperature(float tempReference)
|
||||
error = scd4x.getTemperatureOffset(prevTempOffset);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to get temperature offset. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't get temp offset, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
LOG_INFO("%s: Current sensor temperature offset: %.2f", sensorName, prevTempOffset);
|
||||
LOG_INFO("%s: Current sensor temp offset: %.2f", sensorName, prevTempOffset);
|
||||
|
||||
tempOffset = temperature - tempReference + prevTempOffset;
|
||||
|
||||
LOG_INFO("%s: Setting temperature offset: %.2f", sensorName, tempOffset);
|
||||
LOG_INFO("%s: Setting temp offset: %.2f", sensorName, tempOffset);
|
||||
error = scd4x.setTemperatureOffset(tempOffset);
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set temperature offset. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set temp offset, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
error = scd4x.persistSettings();
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to make settings persistent. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't persist settings, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
scd4x.getTemperatureOffset(updatedTempOffset);
|
||||
LOG_INFO("%s: Updated sensor temperature offset: %.2f", sensorName, updatedTempOffset);
|
||||
LOG_INFO("%s: Updated sensor temp offset: %.2f", sensorName, updatedTempOffset);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -484,7 +484,7 @@ bool SCD4XSensor::getAltitude(uint16_t &altitude)
|
||||
error = scd4x.getSensorAltitude(altitude);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to get altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't get altitude, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
LOG_INFO("%s: Sensor altitude: %u", sensorName, altitude);
|
||||
@@ -508,7 +508,7 @@ bool SCD4XSensor::getAmbientPressure(uint32_t &ambientPressure)
|
||||
error = scd4x.getAmbientPressure(ambientPressure);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to get altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't get ambient pressure, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
LOG_INFO("%s: Sensor ambient pressure: %u", sensorName, ambientPressure);
|
||||
@@ -537,7 +537,7 @@ bool SCD4XSensor::setAltitude(uint32_t altitude)
|
||||
error = scd4x.setSensorAltitude(altitude);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set altitude, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ bool SCD4XSensor::setAltitude(uint32_t altitude)
|
||||
// doesn't indicate it's needed.
|
||||
// error = scd4x.persistSettings();
|
||||
// if (error != SCD4X_NO_ERROR) {
|
||||
// LOG_ERROR("%s: Unable to make settings persistent. Error code: %u", sensorName, error);
|
||||
// LOG_ERROR("%s: Can't make settings persistent. Error code: %u", sensorName, error);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@@ -577,18 +577,18 @@ bool SCD4XSensor::setAmbientPressure(uint32_t ambientPressure)
|
||||
error = scd4x.setAmbientPressure(ambientPressure);
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to set altitude. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't set ambient pressure, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sensirion doesn't indicate if this is necessary. We send it anyway
|
||||
error = scd4x.persistSettings();
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to make settings persistent. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't persist settings, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: ambient pressure set set", sensorName);
|
||||
LOG_INFO("%s: ambient pressure set", sensorName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -615,11 +615,11 @@ bool SCD4XSensor::factoryReset()
|
||||
error = scd4x.performFactoryReset();
|
||||
|
||||
if (error != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Unable to do factory reset. Error code: %u", sensorName, error);
|
||||
LOG_ERROR("%s: Can't factory reset, rc=%u", sensorName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("%s: Factory reset successful", sensorName);
|
||||
LOG_INFO("%s: Factory reset done", sensorName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -636,15 +636,15 @@ bool SCD4XSensor::factoryReset()
|
||||
*/
|
||||
bool SCD4XSensor::powerDown()
|
||||
{
|
||||
LOG_INFO("%s: Trying to send sensor to sleep", sensorName);
|
||||
LOG_INFO("%s: Sending sensor to sleep", sensorName);
|
||||
|
||||
if (sensorVariant != SCD4X_SENSOR_VARIANT_SCD41) {
|
||||
LOG_WARN("SCD4X: Can't send sensor to sleep. Incorrect variant. Ignoring");
|
||||
LOG_WARN("SCD4X: Can't sleep: wrong variant, ignoring");
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD4X_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD4X_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -657,7 +657,7 @@ bool SCD4XSensor::powerDown()
|
||||
}
|
||||
|
||||
if (scd4x.powerDown() != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Error trying to execute sleep()", sensorName);
|
||||
LOG_ERROR("%s: sleep() failed", sensorName);
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -690,7 +690,7 @@ bool SCD4XSensor::powerUp()
|
||||
LOG_INFO("%s: Waking up", sensorName);
|
||||
|
||||
if (scd4x.wakeUp() != SCD4X_NO_ERROR) {
|
||||
LOG_ERROR("%s: Error trying to execute wakeUp()", sensorName);
|
||||
LOG_ERROR("%s: wakeUp() failed", sensorName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -715,7 +715,7 @@ uint32_t SCD4XSensor::wakeUp()
|
||||
{
|
||||
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD4X_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD4X_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -743,7 +743,7 @@ uint32_t SCD4XSensor::wakeUp()
|
||||
void SCD4XSensor::sleep()
|
||||
{
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD4X_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD4X_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -780,7 +780,7 @@ int32_t SCD4XSensor::pendingForReadyMs()
|
||||
LOG_DEBUG("%s: Since measure started: %ums", sensorName, sinceCO2MeasureStarted);
|
||||
|
||||
if (sinceCO2MeasureStarted < SCD4X_WARMUP_MS) {
|
||||
LOG_INFO("%s: not enough time passed since starting measurement", sensorName);
|
||||
LOG_INFO("%s: not enough time since measurement start", sensorName);
|
||||
return SCD4X_WARMUP_MS - sinceCO2MeasureStarted;
|
||||
}
|
||||
return 0;
|
||||
@@ -792,7 +792,7 @@ AdminMessageHandleResult SCD4XSensor::handleAdminMessage(const meshtastic_MeshPa
|
||||
AdminMessageHandleResult result;
|
||||
|
||||
#ifdef SCD4X_I2C_CLOCK_SPEED
|
||||
LOG_INFO("%s: attempting to reclock speed to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
LOG_INFO("%s: reclock to %uHz", sensorName, SCD4X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SCD4X_I2C_CLOCK_SPEED);
|
||||
#endif /* SCD4X_I2C_CLOCK_SPEED */
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ bool SEN5XSensor::sendCommand(uint16_t command, uint8_t *buffer, uint8_t byteNum
|
||||
}
|
||||
|
||||
#ifdef SEN5X_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: Attempting to reclock speed to %uHz", sensorName, SEN5X_I2C_CLOCK_SPEED);
|
||||
LOG_DEBUG("%s: Reclock to %uHz", sensorName, SEN5X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SEN5X_I2C_CLOCK_SPEED);
|
||||
#endif /* SEN5X_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -164,7 +164,7 @@ bool SEN5XSensor::sendCommand(uint16_t command, uint8_t *buffer, uint8_t byteNum
|
||||
uint8_t SEN5XSensor::readBuffer(uint8_t *buffer, uint8_t byteNumber)
|
||||
{
|
||||
#ifdef SEN5X_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: Attempting to reclock speed to %uHz", sensorName, SEN5X_I2C_CLOCK_SPEED);
|
||||
LOG_DEBUG("%s: Reclock to %uHz", sensorName, SEN5X_I2C_CLOCK_SPEED);
|
||||
reClockI2C.setClock(SEN5X_I2C_CLOCK_SPEED);
|
||||
#endif /* SEN5X_I2C_CLOCK_SPEED */
|
||||
|
||||
@@ -186,7 +186,7 @@ uint8_t SEN5XSensor::readBuffer(uint8_t *buffer, uint8_t byteNumber)
|
||||
uint8_t recvCRC = _bus->read();
|
||||
uint8_t calcCRC = sen5xCRC(&buffer[i - 2]);
|
||||
if (recvCRC != calcCRC) {
|
||||
LOG_ERROR("%s: Checksum error while receiving msg", sensorName);
|
||||
LOG_ERROR("%s: Checksum error receiving msg", sensorName);
|
||||
#ifdef SEN5X_I2C_CLOCK_SPEED
|
||||
LOG_DEBUG("%s: restoring clock speed", sensorName);
|
||||
reClockI2C.restoreClock();
|
||||
@@ -259,7 +259,7 @@ bool SEN5XSensor::idle(bool checkState)
|
||||
}
|
||||
|
||||
if (!(vocStateStable() && vocValid)) {
|
||||
LOG_INFO("%s: Not stopping measurement, vocState is not stable yet!", sensorName);
|
||||
LOG_INFO("%s: Not stopping measurement, vocState not stable yet", sensorName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ bool SEN5XSensor::idle(bool checkState)
|
||||
}
|
||||
|
||||
if (!oneShotMode) {
|
||||
LOG_INFO("%s: Not stopping measurement, continuous mode!", sensorName);
|
||||
LOG_INFO("%s: Not stopping measurement, continuous mode", sensorName);
|
||||
return true;
|
||||
} else {
|
||||
LOG_INFO("%s: One shot mode enabled", sensorName);
|
||||
@@ -378,8 +378,8 @@ bool SEN5XSensor::vocStateFromSensor()
|
||||
}
|
||||
|
||||
// Print the state (if debug is on)
|
||||
LOG_DEBUG("%s: VOC state retrieved from sensor: [%u, %u, %u, %u, %u, %u, %u, %u]", sensorName, vocState[0], vocState[1],
|
||||
vocState[2], vocState[3], vocState[4], vocState[5], vocState[6], vocState[7]);
|
||||
LOG_DEBUG("%s: VOC state from sensor: [%u, %u, %u, %u, %u, %u, %u, %u]", sensorName, vocState[0], vocState[1], vocState[2],
|
||||
vocState[3], vocState[4], vocState[5], vocState[6], vocState[7]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ bool SEN5XSensor::saveState()
|
||||
okay &= file.close();
|
||||
|
||||
if (okay)
|
||||
LOG_INFO("%s: state write to %s successful", sensorName, sen5XStateFileName);
|
||||
LOG_INFO("%s: state write to %s OK", sensorName, sen5XStateFileName);
|
||||
|
||||
return okay;
|
||||
#else
|
||||
@@ -537,7 +537,7 @@ bool SEN5XSensor::startCleaning()
|
||||
delay(20); // From Sensirion Datasheet
|
||||
|
||||
// This message will be always printed so the user knows the device it's not hung
|
||||
LOG_INFO("%s: Started fan cleaning it will take 10 seconds...", sensorName);
|
||||
LOG_INFO("%s: Started fan cleaning (10 sec)", sensorName);
|
||||
|
||||
uint16_t started = millis();
|
||||
while (millis() - started < 10500) {
|
||||
@@ -586,7 +586,7 @@ bool SEN5XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
if (!getVersion())
|
||||
return false;
|
||||
if (firmwareVer < 2) {
|
||||
LOG_ERROR("%s: firmware is too old and will not work with this implementation", sensorName);
|
||||
LOG_ERROR("%s: firmware too old, unsupported", sensorName);
|
||||
return false;
|
||||
}
|
||||
delay(200); // From Sensirion Datasheet
|
||||
@@ -611,12 +611,10 @@ bool SEN5XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
|
||||
if (passed > ONE_WEEK_IN_SECONDS && (now > SEN5X_VOC_VALID_DATE)) {
|
||||
// If current date greater than 01/01/2018 (validity check)
|
||||
LOG_INFO("%s: More than a week (%us) since last cleaning in epoch (%us). Trigger, cleaning...", sensorName,
|
||||
passed, lastCleaning);
|
||||
LOG_INFO("%s: Over a week (%us) since last cleaning (%us), trigger cleaning", sensorName, passed, lastCleaning);
|
||||
startCleaning();
|
||||
} else {
|
||||
LOG_INFO("%s: Cleaning not needed (%ds passed). Last cleaning date (in epoch): %us", sensorName, passed,
|
||||
lastCleaning);
|
||||
LOG_INFO("%s: Cleaning not needed (%ds passed), last cleaning: %us", sensorName, passed, lastCleaning);
|
||||
}
|
||||
} else {
|
||||
// We assume the device has just been updated or it is new,
|
||||
@@ -625,7 +623,7 @@ bool SEN5XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
// Otherwise, we will never trigger cleaning in some cases
|
||||
lastCleaning = now;
|
||||
lastCleaningValid = true;
|
||||
LOG_INFO("%s: No valid last cleaning date found, saving it now: %us", sensorName, lastCleaning);
|
||||
LOG_INFO("%s: No valid last cleaning date, saving now: %us", sensorName, lastCleaning);
|
||||
saveState();
|
||||
}
|
||||
|
||||
@@ -640,7 +638,7 @@ bool SEN5XSensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
|
||||
LOG_INFO("%s: VOC state is valid and recent", sensorName);
|
||||
vocStateToSensor();
|
||||
} else {
|
||||
LOG_INFO("%s: VOC state is too old or date is invalid", sensorName);
|
||||
LOG_INFO("%s: VOC state too old or date invalid", sensorName);
|
||||
LOG_DEBUG("%s: vocTime %u, Passed %u, and now %u", sensorName, vocTime, passed, now);
|
||||
}
|
||||
}
|
||||
@@ -821,7 +819,7 @@ int32_t SEN5XSensor::pendingForReadyMs()
|
||||
case SEN5X_MEASUREMENT: {
|
||||
|
||||
if (sincePmMeasureStarted < SEN5X_WARMUP_MS_1) {
|
||||
LOG_INFO("%s: not enough time passed since starting measurement", sensorName);
|
||||
LOG_INFO("%s: not enough time since measurement start", sensorName);
|
||||
return SEN5X_WARMUP_MS_1 - sincePmMeasureStarted;
|
||||
}
|
||||
|
||||
@@ -835,7 +833,7 @@ int32_t SEN5XSensor::pendingForReadyMs()
|
||||
|
||||
// If the reading is low (the tyhreshold is in #/cm3) and second warmUp hasn't passed we return to come back later
|
||||
if ((sen5xmeasurement.pN4p0 / 100) < SEN5X_PN4P0_CONC_THD && sincePmMeasureStarted < SEN5X_WARMUP_MS_2) {
|
||||
LOG_INFO("%s: Concentration is low, we will ask again in the second warm up period", sensorName);
|
||||
LOG_INFO("%s: Concentration low, will ask again in second warm up period", sensorName);
|
||||
state = SEN5X_MEASUREMENT_2;
|
||||
// Report how many seconds are pending to cover the first warm up period
|
||||
return SEN5X_WARMUP_MS_2 - sincePmMeasureStarted;
|
||||
@@ -857,7 +855,7 @@ int32_t SEN5XSensor::pendingForReadyMs()
|
||||
|
||||
bool SEN5XSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
LOG_INFO("%s: Attempting to get metrics", sensorName);
|
||||
LOG_INFO("%s: Get metrics", sensorName);
|
||||
if (!isActive()) {
|
||||
LOG_INFO("%s: not in measurement mode", sensorName);
|
||||
return false;
|
||||
@@ -949,9 +947,9 @@ void SEN5XSensor::setMode(bool setOneShot)
|
||||
{
|
||||
oneShotMode = setOneShot;
|
||||
if (oneShotMode) {
|
||||
LOG_INFO("%s: setting mode to one shot mode", sensorName);
|
||||
LOG_INFO("%s: set one shot mode", sensorName);
|
||||
} else {
|
||||
LOG_INFO("%s: setting mode to continuous mode", sensorName);
|
||||
LOG_INFO("%s: set continuous mode", sensorName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ void TraceRouteModule::updateNextHops(const meshtastic_MeshPacket &p, meshtastic
|
||||
// point any node's next_hop anywhere. relay_node is 0 for MQTT-sourced packets, which cannot
|
||||
// corroborate an RF route either.
|
||||
if (p.relay_node == NO_RELAY_NODE || nextHopByte != p.relay_node) {
|
||||
LOG_DEBUG("Ignore traceroute next-hop 0x%02x, packet was relayed by 0x%02x", nextHopByte, p.relay_node);
|
||||
LOG_DEBUG("Ignore traceroute next-hop 0x%02x, relayed by 0x%02x", nextHopByte, p.relay_node);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ void TraceRouteModule::maybeSetNextHop(NodeNum target, uint8_t nextHopByte)
|
||||
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(target);
|
||||
if (node && node->next_hop != nextHopByte) {
|
||||
LOG_INFO("Updating next-hop for 0x%08x to 0x%02x based on traceroute", target, nextHopByte);
|
||||
LOG_INFO("Update next-hop for 0x%08x to 0x%02x via traceroute", target, nextHopByte);
|
||||
node->next_hop = nextHopByte;
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ void TraceRouteModule::appendMyIDandSNR(meshtastic_RouteDiscovery *updated, floa
|
||||
route[*route_count] = myNodeInfo.my_node_num;
|
||||
*route_count += 1;
|
||||
} else {
|
||||
LOG_WARN("Route exceeded maximum hop limit!"); // Are you bridging networks?
|
||||
LOG_WARN("Route exceeded max hop limit"); // Are you bridging networks?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,11 +533,11 @@ const char *TraceRouteModule::getNodeName(NodeNum node)
|
||||
|
||||
bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
{
|
||||
LOG_INFO("=== TraceRoute startTraceRoute CALLED: node=0x%08x ===", node);
|
||||
LOG_INFO("TraceRoute startTraceRoute: node=0x%08x", node);
|
||||
unsigned long now = millis();
|
||||
|
||||
if (node == 0 || node == NODENUM_BROADCAST) {
|
||||
LOG_ERROR("Invalid node number for trace route: 0x%08x", node);
|
||||
LOG_ERROR("Invalid trace route node: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Invalid node");
|
||||
resultShowTime = millis();
|
||||
@@ -551,7 +551,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
}
|
||||
|
||||
if (node == nodeDB->getNodeNum()) {
|
||||
LOG_ERROR("Cannot trace route to self: 0x%08x", node);
|
||||
LOG_ERROR("Can't trace route to self: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Cannot trace self");
|
||||
resultShowTime = millis();
|
||||
@@ -567,7 +567,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
if (!initialized) {
|
||||
lastTraceRouteTime = 0;
|
||||
initialized = true;
|
||||
LOG_INFO("TraceRoute initialized for first time");
|
||||
LOG_INFO("TraceRoute first init");
|
||||
}
|
||||
|
||||
if (runState == TRACEROUTE_STATE_TRACKING) {
|
||||
@@ -587,7 +587,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
UIFrameEvent e;
|
||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
||||
notifyObservers(&e);
|
||||
LOG_INFO("Cooldown active, please wait %lu seconds before starting a new trace route.", wait);
|
||||
LOG_INFO("Cooldown active, wait %lu sec before new trace route", wait);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
clearResultLines();
|
||||
bannerText = String("Tracing ") + getNodeName(node);
|
||||
|
||||
LOG_INFO("TraceRoute UI: Starting trace route to node 0x%08x, requesting focus", node);
|
||||
LOG_INFO("TraceRoute UI: Start trace to 0x%08x, request focus", node);
|
||||
|
||||
// 请求焦点,然后触发UI更新事件
|
||||
requestFocus();
|
||||
@@ -610,7 +610,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
setIntervalFromNow(1000); // 每秒检查一次状态
|
||||
|
||||
meshtastic_RouteDiscovery req = meshtastic_RouteDiscovery_init_zero;
|
||||
LOG_INFO("Creating RouteDiscovery protobuf...");
|
||||
LOG_INFO("Creating RouteDiscovery protobuf");
|
||||
|
||||
// Allocate a packet directly from router like the reference code
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
@@ -627,16 +627,16 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_RouteDiscovery_msg, &req);
|
||||
|
||||
LOG_INFO("Packet allocated successfully: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to,
|
||||
p->decoded.portnum, p->decoded.want_response, p->decoded.payload.size);
|
||||
LOG_INFO("About to call service->sendToMesh...");
|
||||
LOG_INFO("Packet allocated: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to, p->decoded.portnum,
|
||||
p->decoded.want_response, p->decoded.payload.size);
|
||||
LOG_INFO("Calling service->sendToMesh");
|
||||
|
||||
if (service) {
|
||||
LOG_INFO("MeshService is available, sending packet...");
|
||||
LOG_INFO("MeshService is available, sending packet");
|
||||
service->sendToMesh(p, RX_SRC_USER);
|
||||
LOG_INFO("sendToMesh called successfully for trace route to node 0x%08x", node);
|
||||
LOG_INFO("sendToMesh called for trace route to node 0x%08x", node);
|
||||
} else {
|
||||
LOG_ERROR("MeshService is NULL!");
|
||||
LOG_ERROR("MeshService is NULL");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Service unavailable");
|
||||
resultShowTime = millis();
|
||||
@@ -649,7 +649,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR("Failed to allocate TraceRoute packet from router");
|
||||
LOG_ERROR("TraceRoute packet alloc from router failed");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Failed to send");
|
||||
resultShowTime = millis();
|
||||
@@ -667,7 +667,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
void TraceRouteModule::launch(NodeNum node)
|
||||
{
|
||||
if (node == 0 || node == NODENUM_BROADCAST) {
|
||||
LOG_ERROR("Invalid node number for trace route: 0x%08x", node);
|
||||
LOG_ERROR("Invalid trace route node: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Invalid node");
|
||||
resultShowTime = millis();
|
||||
@@ -681,7 +681,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
}
|
||||
|
||||
if (node == nodeDB->getNodeNum()) {
|
||||
LOG_ERROR("Cannot trace route to self: 0x%08x", node);
|
||||
LOG_ERROR("Can't trace route to self: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Cannot trace self");
|
||||
resultShowTime = millis();
|
||||
@@ -697,7 +697,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
if (!initialized) {
|
||||
lastTraceRouteTime = 0;
|
||||
initialized = true;
|
||||
LOG_INFO("TraceRoute initialized for first time");
|
||||
LOG_INFO("TraceRoute first init");
|
||||
}
|
||||
|
||||
unsigned long now = millis();
|
||||
@@ -712,7 +712,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
UIFrameEvent e;
|
||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
||||
notifyObservers(&e);
|
||||
LOG_INFO("Cooldown active, please wait %lu seconds before starting a new trace route.", wait);
|
||||
LOG_INFO("Cooldown active, wait %lu sec before new trace route", wait);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
setIntervalFromNow(1000);
|
||||
|
||||
meshtastic_RouteDiscovery req = meshtastic_RouteDiscovery_init_zero;
|
||||
LOG_INFO("Creating RouteDiscovery protobuf...");
|
||||
LOG_INFO("Creating RouteDiscovery protobuf");
|
||||
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
if (p) {
|
||||
@@ -746,21 +746,21 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_RouteDiscovery_msg, &req);
|
||||
|
||||
LOG_INFO("Packet allocated successfully: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to,
|
||||
p->decoded.portnum, p->decoded.want_response, p->decoded.payload.size);
|
||||
LOG_INFO("Packet allocated: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to, p->decoded.portnum,
|
||||
p->decoded.want_response, p->decoded.payload.size);
|
||||
|
||||
if (service) {
|
||||
service->sendToMesh(p, RX_SRC_USER);
|
||||
LOG_INFO("sendToMesh called successfully for trace route to node 0x%08x", node);
|
||||
LOG_INFO("sendToMesh called for trace route to node 0x%08x", node);
|
||||
} else {
|
||||
LOG_ERROR("MeshService is NULL!");
|
||||
LOG_ERROR("MeshService is NULL");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Service unavailable");
|
||||
resultShowTime = millis();
|
||||
tracingNode = 0;
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR("Failed to allocate TraceRoute packet from router");
|
||||
LOG_ERROR("TraceRoute packet alloc from router failed");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Failed to send");
|
||||
resultShowTime = millis();
|
||||
@@ -775,7 +775,7 @@ void TraceRouteModule::handleTraceRouteResult(const String &result)
|
||||
resultShowTime = millis();
|
||||
tracingNode = 0;
|
||||
|
||||
LOG_INFO("TraceRoute result ready, requesting focus. Result: %s", result.c_str());
|
||||
LOG_INFO("TraceRoute result ready, request focus: %s", result.c_str());
|
||||
|
||||
setIntervalFromNow(1000);
|
||||
|
||||
@@ -784,7 +784,7 @@ void TraceRouteModule::handleTraceRouteResult(const String &result)
|
||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
||||
notifyObservers(&e);
|
||||
|
||||
LOG_INFO("=== TraceRoute handleTraceRouteResult END ===");
|
||||
LOG_INFO("TraceRoute handleTraceRouteResult END");
|
||||
}
|
||||
|
||||
bool TraceRouteModule::shouldDraw()
|
||||
@@ -850,7 +850,7 @@ int32_t TraceRouteModule::runOnce()
|
||||
|
||||
// Check for tracking timeout
|
||||
if (runState == TRACEROUTE_STATE_TRACKING && now - lastTraceRouteTime > trackingTimeoutMs) {
|
||||
LOG_INFO("TraceRoute timeout, no response received");
|
||||
LOG_INFO("TraceRoute timeout, no response");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("No response received");
|
||||
resultShowTime = now;
|
||||
@@ -886,7 +886,7 @@ int32_t TraceRouteModule::runOnce()
|
||||
return 1000;
|
||||
} else {
|
||||
// Cooldown finished
|
||||
LOG_INFO("TraceRoute cooldown finished, returning to IDLE");
|
||||
LOG_INFO("TraceRoute cooldown done, return to IDLE");
|
||||
runState = TRACEROUTE_STATE_IDLE;
|
||||
resultText = "";
|
||||
clearResultLines();
|
||||
|
||||
@@ -148,7 +148,7 @@ TrafficManagementModule::TrafficManagementModule() : MeshModule("TrafficManageme
|
||||
if (cache) {
|
||||
cacheFromPsram = true;
|
||||
} else {
|
||||
TM_LOG_WARN("PSRAM allocation failed, falling back to heap");
|
||||
TM_LOG_WARN("PSRAM alloc failed, fall back to heap");
|
||||
cache = new UnifiedCacheEntry[allocSize]();
|
||||
}
|
||||
#else
|
||||
@@ -171,7 +171,7 @@ TrafficManagementModule::TrafficManagementModule() : MeshModule("TrafficManageme
|
||||
nodeInfoPayloadFromPsram = true;
|
||||
TM_LOG_INFO("NodeInfo PSRAM cache ready");
|
||||
} else {
|
||||
TM_LOG_WARN("NodeInfo PSRAM payload allocation failed; direct responses will fall back to NodeDB");
|
||||
TM_LOG_WARN("NodeInfo PSRAM payload alloc failed; direct responses fall back to NodeDB");
|
||||
}
|
||||
#else
|
||||
// Native unit-test build (see TMM_HAS_NODEINFO_CACHE): plain heap, so the cache paths
|
||||
@@ -1515,7 +1515,7 @@ bool TrafficManagementModule::shouldRespondToNodeInfo(const meshtastic_MeshPacke
|
||||
// request declined above never spends the budget). false forwards the request instead of consuming
|
||||
// it. Rationale in docs/traffic_management_module.md "Throttling direct responses".
|
||||
if (!directResponseAllowed(getFrom(p), p->to, clockMs())) {
|
||||
TM_LOG_DEBUG("NodeInfo direct response throttled for 0x%08x; forwarding request instead", getFrom(p));
|
||||
TM_LOG_DEBUG("NodeInfo direct response throttled for 0x%08x; forwarding request", getFrom(p));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ static void startWifiChannelTimer(uint16_t wifi_channel_switch_interval)
|
||||
WifiChanTimer =
|
||||
xTimerCreate("WifiChannelTimer", pdMS_TO_TICKS(wifi_channel_switch_interval * 10), pdTRUE, (void *)0, switchWifiChannel);
|
||||
if (!WifiChanTimer) {
|
||||
LOG_WARN("Paxcounter could not create WiFi channel switch timer");
|
||||
LOG_WARN("Paxcounter can't create WiFi channel switch timer");
|
||||
return;
|
||||
}
|
||||
xTimerStart(WifiChanTimer, 0);
|
||||
@@ -34,7 +34,7 @@ static void ensureDefaultEventLoop()
|
||||
{
|
||||
esp_err_t result = esp_event_loop_create_default();
|
||||
if (result != ESP_OK && result != ESP_ERR_INVALID_STATE) {
|
||||
LOG_WARN("Paxcounter could not create ESP event loop: %d", result);
|
||||
LOG_WARN("Paxcounter can't create ESP event loop: %d", result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user