mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 06:00:33 +00:00
More reduction (#5256)
* Now with even fewer ings * Ye * Mo * QMA6100PSensor
This commit is contained in:
@@ -74,7 +74,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
// Could tighten this up further by tracking the last public_key we went an AdminMessage request to
|
||||
// and only allowing responses from that remote.
|
||||
if (messageIsResponse(r)) {
|
||||
LOG_DEBUG("Allowing admin response message");
|
||||
LOG_DEBUG("Allow admin response message");
|
||||
} else if (mp.from == 0) {
|
||||
if (config.security.is_managed) {
|
||||
LOG_INFO("Ignore local admin payload because is_managed");
|
||||
@@ -82,7 +82,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
}
|
||||
} else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) {
|
||||
if (!config.security.admin_channel_enabled) {
|
||||
LOG_INFO("Ignore admin channel, as legacy admin is disabled");
|
||||
LOG_INFO("Ignore admin channel, legacy admin is disabled");
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
|
||||
return handled;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
return handled;
|
||||
}
|
||||
|
||||
LOG_INFO("Handling admin payload %i", r->which_payload_variant);
|
||||
LOG_INFO("Handle admin payload %i", r->which_payload_variant);
|
||||
|
||||
// all of the get and set messages, including those for other modules, flow through here first.
|
||||
// any message that changes state, we want to check the passkey for
|
||||
@@ -122,23 +122,23 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
* Getters
|
||||
*/
|
||||
case meshtastic_AdminMessage_get_owner_request_tag:
|
||||
LOG_INFO("Client is getting owner");
|
||||
LOG_INFO("Client got owner");
|
||||
handleGetOwner(mp);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_get_config_request_tag:
|
||||
LOG_INFO("Client is getting config");
|
||||
LOG_INFO("Client got config");
|
||||
handleGetConfig(mp, r->get_config_request);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_get_module_config_request_tag:
|
||||
LOG_INFO("Client is getting module config");
|
||||
LOG_INFO("Client got module config");
|
||||
handleGetModuleConfig(mp, r->get_module_config_request);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_get_channel_request_tag: {
|
||||
uint32_t i = r->get_channel_request - 1;
|
||||
LOG_INFO("Client is getting channel %u", i);
|
||||
LOG_INFO("Client got channel %u", i);
|
||||
if (i >= MAX_NUM_CHANNELS)
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
else
|
||||
@@ -150,29 +150,29 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
* Setters
|
||||
*/
|
||||
case meshtastic_AdminMessage_set_owner_tag:
|
||||
LOG_INFO("Client is setting owner");
|
||||
LOG_INFO("Client set owner");
|
||||
handleSetOwner(r->set_owner);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_config_tag:
|
||||
LOG_INFO("Client is setting the config");
|
||||
LOG_INFO("Client set config");
|
||||
handleSetConfig(r->set_config);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_module_config_tag:
|
||||
LOG_INFO("Client is setting the module config");
|
||||
LOG_INFO("Client set module config");
|
||||
handleSetModuleConfig(r->set_module_config);
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_channel_tag:
|
||||
LOG_INFO("Client is setting channel %d", r->set_channel.index);
|
||||
LOG_INFO("Client set channel %d", r->set_channel.index);
|
||||
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
|
||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||
else
|
||||
handleSetChannel(r->set_channel);
|
||||
break;
|
||||
case meshtastic_AdminMessage_set_ham_mode_tag:
|
||||
LOG_INFO("Client is setting ham mode");
|
||||
LOG_INFO("Client set ham mode");
|
||||
handleSetHamMode(r->set_ham_mode);
|
||||
break;
|
||||
|
||||
@@ -208,13 +208,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_device_metadata_request_tag: {
|
||||
LOG_INFO("Client is getting device metadata");
|
||||
LOG_INFO("Client got device metadata");
|
||||
handleGetDeviceMetadata(mp);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_factory_reset_config_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiating factory config reset");
|
||||
LOG_INFO("Initiate factory config reset");
|
||||
nodeDB->factoryReset();
|
||||
LOG_INFO("Factory config reset finished, rebooting soon");
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
@@ -222,37 +222,37 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
}
|
||||
case meshtastic_AdminMessage_factory_reset_device_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiating full factory reset");
|
||||
LOG_INFO("Initiate full factory reset");
|
||||
nodeDB->factoryReset(true);
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiating node-db reset");
|
||||
LOG_INFO("Initiate node-db reset");
|
||||
nodeDB->resetNodes();
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_begin_edit_settings_tag: {
|
||||
LOG_INFO("Beginning transaction for editing settings");
|
||||
LOG_INFO("Begin transaction for editing settings");
|
||||
hasOpenEditTransaction = true;
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_commit_edit_settings_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Committing transaction for edited settings");
|
||||
LOG_INFO("Commit transaction for edited settings");
|
||||
hasOpenEditTransaction = false;
|
||||
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_device_connection_status_request_tag: {
|
||||
LOG_INFO("Client is getting device connection status");
|
||||
LOG_INFO("Client got device connection status");
|
||||
handleGetDeviceConnectionStatus(mp);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_module_config_response_tag: {
|
||||
LOG_INFO("Client is receiving a get_module_config response");
|
||||
LOG_INFO("Client received a get_module_config response");
|
||||
if (fromOthers && r->get_module_config_response.which_payload_variant ==
|
||||
meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) {
|
||||
handleGetModuleConfigResponse(mp, r);
|
||||
@@ -260,13 +260,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_by_nodenum_tag: {
|
||||
LOG_INFO("Client is receiving a remove_nodenum command");
|
||||
LOG_INFO("Client received remove_nodenum command");
|
||||
nodeDB->removeNodeByNum(r->remove_by_nodenum);
|
||||
this->notifyObservers(r); // Observed by screen
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_favorite_node_tag: {
|
||||
LOG_INFO("Client is receiving a set_favorite_node command");
|
||||
LOG_INFO("Client received set_favorite_node command");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
|
||||
if (node != NULL) {
|
||||
node->is_favorite = true;
|
||||
@@ -275,7 +275,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_favorite_node_tag: {
|
||||
LOG_INFO("Client is receiving a remove_favorite_node command");
|
||||
LOG_INFO("Client received remove_favorite_node command");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
|
||||
if (node != NULL) {
|
||||
node->is_favorite = false;
|
||||
@@ -284,7 +284,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_fixed_position_tag: {
|
||||
LOG_INFO("Client is receiving a set_fixed_position command");
|
||||
LOG_INFO("Client received set_fixed_position command");
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
node->has_position = true;
|
||||
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
|
||||
@@ -300,14 +300,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_remove_fixed_position_tag: {
|
||||
LOG_INFO("Client is receiving a remove_fixed_position command");
|
||||
LOG_INFO("Client received remove_fixed_position command");
|
||||
nodeDB->clearLocalPosition();
|
||||
config.position.fixed_position = false;
|
||||
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_set_time_only_tag: {
|
||||
LOG_INFO("Client is receiving a set_time_only command");
|
||||
LOG_INFO("Client received set_time_only command");
|
||||
struct timeval tv;
|
||||
tv.tv_sec = r->set_time_only;
|
||||
tv.tv_usec = 0;
|
||||
@@ -316,14 +316,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_enter_dfu_mode_request_tag: {
|
||||
LOG_INFO("Client is requesting to enter DFU mode");
|
||||
LOG_INFO("Client requesting to enter DFU mode");
|
||||
#if defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
||||
enterDfuMode();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_delete_file_request_tag: {
|
||||
LOG_DEBUG("Client is requesting to delete file: %s", r->delete_file_request);
|
||||
LOG_DEBUG("Client requesting to delete file: %s", r->delete_file_request);
|
||||
#ifdef FSCom
|
||||
if (FSCom.remove(r->delete_file_request)) {
|
||||
LOG_DEBUG("Successfully deleted file");
|
||||
@@ -348,10 +348,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
setPassKey(&res);
|
||||
myReply = allocDataProtobuf(res);
|
||||
} else if (mp.decoded.want_response) {
|
||||
LOG_DEBUG("We did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant);
|
||||
LOG_DEBUG("Did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant);
|
||||
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
|
||||
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
||||
LOG_INFO("Ignore nonrelevant admin %d", r->which_payload_variant);
|
||||
LOG_INFO("Ignore irrelevant admin %d", r->which_payload_variant);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ void AdminModule::handleGetModuleConfigResponse(const meshtastic_MeshPacket &mp,
|
||||
// Skip if it's disabled or no pins are exposed
|
||||
if (!r->get_module_config_response.payload_variant.remote_hardware.enabled ||
|
||||
r->get_module_config_response.payload_variant.remote_hardware.available_pins_count == 0) {
|
||||
LOG_DEBUG("Remote hardware module disabled or no available_pins. Skipping...");
|
||||
LOG_DEBUG("Remote hardware module disabled or no available_pins. Skip...");
|
||||
return;
|
||||
}
|
||||
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {
|
||||
@@ -711,49 +711,49 @@ void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32
|
||||
if (req.decoded.want_response) {
|
||||
switch (configType) {
|
||||
case meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG:
|
||||
LOG_INFO("Getting config: Device");
|
||||
LOG_INFO("Get config: Device");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_device_tag;
|
||||
res.get_config_response.payload_variant.device = config.device;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_POSITION_CONFIG:
|
||||
LOG_INFO("Getting config: Position");
|
||||
LOG_INFO("Get config: Position");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_position_tag;
|
||||
res.get_config_response.payload_variant.position = config.position;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_POWER_CONFIG:
|
||||
LOG_INFO("Getting config: Power");
|
||||
LOG_INFO("Get config: Power");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_power_tag;
|
||||
res.get_config_response.payload_variant.power = config.power;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG:
|
||||
LOG_INFO("Getting config: Network");
|
||||
LOG_INFO("Get config: Network");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_network_tag;
|
||||
res.get_config_response.payload_variant.network = config.network;
|
||||
writeSecret(res.get_config_response.payload_variant.network.wifi_psk,
|
||||
sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||
LOG_INFO("Getting config: Display");
|
||||
LOG_INFO("Get config: Display");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_display_tag;
|
||||
res.get_config_response.payload_variant.display = config.display;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_LORA_CONFIG:
|
||||
LOG_INFO("Getting config: LoRa");
|
||||
LOG_INFO("Get config: LoRa");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_lora_tag;
|
||||
res.get_config_response.payload_variant.lora = config.lora;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG:
|
||||
LOG_INFO("Getting config: Bluetooth");
|
||||
LOG_INFO("Get config: Bluetooth");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_bluetooth_tag;
|
||||
res.get_config_response.payload_variant.bluetooth = config.bluetooth;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_SECURITY_CONFIG:
|
||||
LOG_INFO("Getting config: Security");
|
||||
LOG_INFO("Get config: Security");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_security_tag;
|
||||
res.get_config_response.payload_variant.security = config.security;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG:
|
||||
LOG_INFO("Getting config: Sessionkey");
|
||||
LOG_INFO("Get config: Sessionkey");
|
||||
res.get_config_response.which_payload_variant = meshtastic_Config_sessionkey_tag;
|
||||
break;
|
||||
}
|
||||
@@ -777,67 +777,67 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
|
||||
if (req.decoded.want_response) {
|
||||
switch (configType) {
|
||||
case meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG:
|
||||
LOG_INFO("Getting module config: MQTT");
|
||||
LOG_INFO("Get module config: MQTT");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag;
|
||||
res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG:
|
||||
LOG_INFO("Getting module config: Serial");
|
||||
LOG_INFO("Get module config: Serial");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_serial_tag;
|
||||
res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
||||
LOG_INFO("Getting module config: External Notification");
|
||||
LOG_INFO("Get module config: External Notification");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
|
||||
res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
||||
LOG_INFO("Getting module config: Store & Forward");
|
||||
LOG_INFO("Get module config: Store & Forward");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
|
||||
res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
|
||||
LOG_INFO("Getting module config: Range Test");
|
||||
LOG_INFO("Get module config: Range Test");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
|
||||
res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
|
||||
LOG_INFO("Getting module config: Telemetry");
|
||||
LOG_INFO("Get module config: Telemetry");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
|
||||
res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
|
||||
LOG_INFO("Getting module config: Canned Message");
|
||||
LOG_INFO("Get module config: Canned Message");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag;
|
||||
res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG:
|
||||
LOG_INFO("Getting module config: Audio");
|
||||
LOG_INFO("Get module config: Audio");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
|
||||
res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
|
||||
LOG_INFO("Getting module config: Remote Hardware");
|
||||
LOG_INFO("Get module config: Remote Hardware");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag;
|
||||
res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_NEIGHBORINFO_CONFIG:
|
||||
LOG_INFO("Getting module config: Neighbor Info");
|
||||
LOG_INFO("Get module config: Neighbor Info");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_neighbor_info_tag;
|
||||
res.get_module_config_response.payload_variant.neighbor_info = moduleConfig.neighbor_info;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG:
|
||||
LOG_INFO("Getting module config: Detection Sensor");
|
||||
LOG_INFO("Get module config: Detection Sensor");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_detection_sensor_tag;
|
||||
res.get_module_config_response.payload_variant.detection_sensor = moduleConfig.detection_sensor;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_AMBIENTLIGHTING_CONFIG:
|
||||
LOG_INFO("Getting module config: Ambient Lighting");
|
||||
LOG_INFO("Get module config: Ambient Lighting");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag;
|
||||
res.get_module_config_response.payload_variant.ambient_lighting = moduleConfig.ambient_lighting;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG:
|
||||
LOG_INFO("Getting module config: Paxcounter");
|
||||
LOG_INFO("Get module config: Paxcounter");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
|
||||
res.get_module_config_response.payload_variant.paxcounter = moduleConfig.paxcounter;
|
||||
break;
|
||||
@@ -978,10 +978,10 @@ void AdminModule::reboot(int32_t seconds)
|
||||
void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
|
||||
{
|
||||
if (!hasOpenEditTransaction) {
|
||||
LOG_INFO("Saving changes to disk");
|
||||
LOG_INFO("Save changes to disk");
|
||||
service->reloadConfig(saveWhat); // Calls saveToDisk among other things
|
||||
} else {
|
||||
LOG_INFO("Delaying save of changes to disk until the open transaction is committed");
|
||||
LOG_INFO("Delay save of changes to disk until the open transaction is committed");
|
||||
}
|
||||
if (shouldReboot && !hasOpenEditTransaction) {
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
|
||||
@@ -126,7 +126,7 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast
|
||||
} else {
|
||||
if (!t->is_compressed) {
|
||||
// Not compressed. Something is wrong
|
||||
LOG_WARN("Received uncompressed TAKPacket over radio! Skipping");
|
||||
LOG_WARN("Received uncompressed TAKPacket over radio! Skip");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,12 +227,12 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
||||
case INPUT_BROKER_MSG_BRIGHTNESS_UP: // make screen brighter
|
||||
if (screen)
|
||||
screen->increaseBrightness();
|
||||
LOG_DEBUG("increasing Screen Brightness");
|
||||
LOG_DEBUG("Increase Screen Brightness");
|
||||
break;
|
||||
case INPUT_BROKER_MSG_BRIGHTNESS_DOWN: // make screen dimmer
|
||||
if (screen)
|
||||
screen->decreaseBrightness();
|
||||
LOG_DEBUG("Decreasing Screen Brightness");
|
||||
LOG_DEBUG("Decrease Screen Brightness");
|
||||
break;
|
||||
case INPUT_BROKER_MSG_FN_SYMBOL_ON: // draw modifier (function) symbal
|
||||
if (screen)
|
||||
@@ -977,7 +977,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st
|
||||
|
||||
if (temporaryMessage.length() != 0) {
|
||||
requestFocus(); // Tell Screen::setFrames to move to our module's frame
|
||||
LOG_DEBUG("Drawing temporary message: %s", temporaryMessage.c_str());
|
||||
LOG_DEBUG("Draw temporary message: %s", temporaryMessage.c_str());
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display->setFont(FONT_MEDIUM);
|
||||
display->drawString(display->getWidth() / 2 + x, 0 + y + 12, temporaryMessage);
|
||||
@@ -1206,13 +1206,13 @@ AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const
|
||||
|
||||
switch (request->which_payload_variant) {
|
||||
case meshtastic_AdminMessage_get_canned_message_module_messages_request_tag:
|
||||
LOG_DEBUG("Client is getting radio canned messages");
|
||||
LOG_DEBUG("Client getting radio canned messages");
|
||||
this->handleGetCannedMessageModuleMessages(mp, response);
|
||||
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_canned_message_module_messages_tag:
|
||||
LOG_DEBUG("Client is setting radio canned messages");
|
||||
LOG_DEBUG("Client getting radio canned messages");
|
||||
this->handleSetCannedMessageModuleMessages(request->set_canned_message_module_messages);
|
||||
result = AdminMessageHandleResult::HANDLED;
|
||||
break;
|
||||
|
||||
@@ -76,7 +76,7 @@ int32_t DetectionSensorModule::runOnce()
|
||||
if (moduleConfig.detection_sensor.monitor_pin > 0) {
|
||||
pinMode(moduleConfig.detection_sensor.monitor_pin, moduleConfig.detection_sensor.use_pullup ? INPUT_PULLUP : INPUT);
|
||||
} else {
|
||||
LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disabling module...");
|
||||
LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disable module...");
|
||||
return disable();
|
||||
}
|
||||
LOG_INFO("Detection Sensor Module: init");
|
||||
@@ -118,7 +118,7 @@ int32_t DetectionSensorModule::runOnce()
|
||||
|
||||
void DetectionSensorModule::sendDetectionMessage()
|
||||
{
|
||||
LOG_DEBUG("Detected event observed. Sending message");
|
||||
LOG_DEBUG("Detected event observed. Send message");
|
||||
char *message = new char[40];
|
||||
sprintf(message, "%s detected", moduleConfig.detection_sensor.name);
|
||||
meshtastic_MeshPacket *p = allocDataPacket();
|
||||
|
||||
@@ -518,13 +518,13 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule
|
||||
|
||||
switch (request->which_payload_variant) {
|
||||
case meshtastic_AdminMessage_get_ringtone_request_tag:
|
||||
LOG_INFO("Client is getting ringtone");
|
||||
LOG_INFO("Client getting ringtone");
|
||||
this->handleGetRingtone(mp, response);
|
||||
result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE;
|
||||
break;
|
||||
|
||||
case meshtastic_AdminMessage_set_ringtone_message_tag:
|
||||
LOG_INFO("Client is setting ringtone");
|
||||
LOG_INFO("Client setting ringtone");
|
||||
this->handleSetRingtone(request->set_canned_message_module_messages);
|
||||
result = AdminMessageHandleResult::HANDLED;
|
||||
break;
|
||||
|
||||
@@ -91,7 +91,7 @@ void NeighborInfoModule::cleanUpNeighbors()
|
||||
// We will remove a neighbor if we haven't heard from them in twice the broadcast interval
|
||||
// cannot use isWithinTimespanMs() as it->last_rx_time is seconds since 1970
|
||||
if ((now - it->last_rx_time > it->node_broadcast_interval_secs * 2) && (it->node_id != my_node_id)) {
|
||||
LOG_DEBUG("Removing neighbor with node ID 0x%x", it->node_id);
|
||||
LOG_DEBUG("Remove neighbor with node ID 0x%x", it->node_id);
|
||||
it = std::vector<meshtastic_Neighbor>::reverse_iterator(
|
||||
neighbors.erase(std::next(it).base())); // Erase the element and update the iterator
|
||||
} else {
|
||||
@@ -203,7 +203,7 @@ meshtastic_Neighbor *NeighborInfoModule::getOrCreateNeighbor(NodeNum originalSen
|
||||
neighbors.push_back(new_nbr);
|
||||
} else {
|
||||
// If we have too many neighbors, replace the oldest one
|
||||
LOG_WARN("Neighbor DB is full, replacing oldest neighbor");
|
||||
LOG_WARN("Neighbor DB is full, replace oldest neighbor");
|
||||
neighbors.erase(neighbors.begin());
|
||||
neighbors.push_back(new_nbr);
|
||||
}
|
||||
|
||||
@@ -65,16 +65,16 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply()
|
||||
{
|
||||
if (!airTime->isTxAllowedChannelUtil(false)) {
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
LOG_DEBUG("Skip sending NodeInfo > 40%% ch. util");
|
||||
LOG_DEBUG("Skip send NodeInfo > 40%% ch. util");
|
||||
return NULL;
|
||||
}
|
||||
// If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway.
|
||||
if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) {
|
||||
LOG_DEBUG("Skip sending NodeInfo since we sent it <5 mins ago.");
|
||||
LOG_DEBUG("Skip send NodeInfo since we sent it <5 mins ago.");
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
return NULL;
|
||||
} else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) {
|
||||
LOG_DEBUG("Skip sending requested NodeInfo since we sent it <60s ago.");
|
||||
LOG_DEBUG("Skip send requested NodeInfo since we sent it <60s ago.");
|
||||
ignoreRequest = true; // Mark it as ignored for MeshModule
|
||||
return NULL;
|
||||
} else {
|
||||
|
||||
@@ -38,7 +38,7 @@ PositionModule::PositionModule()
|
||||
if ((config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
|
||||
config.power.is_power_saving) {
|
||||
LOG_DEBUG("Clearing position on startup for sleepy tracker (ー。ー) zzz");
|
||||
LOG_DEBUG("Clear position on startup for sleepy tracker (ー。ー) zzz");
|
||||
nodeDB->clearLocalPosition();
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void PositionModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic
|
||||
{
|
||||
// Phone position packets need to be truncated to the channel precision
|
||||
if (isFromUs(&mp) && (precision < 32 && precision > 0)) {
|
||||
LOG_DEBUG("Truncating phone position to channel precision %i", precision);
|
||||
LOG_DEBUG("Truncate phone position to channel precision %i", precision);
|
||||
p->latitude_i = p->latitude_i & (UINT32_MAX << (32 - precision));
|
||||
p->longitude_i = p->longitude_i & (UINT32_MAX << (32 - precision));
|
||||
|
||||
@@ -157,7 +157,7 @@ bool PositionModule::hasQualityTimesource()
|
||||
meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
{
|
||||
if (precision == 0) {
|
||||
LOG_DEBUG("Skipping location send because precision is set to 0!");
|
||||
LOG_DEBUG("Skip location send because precision is set to 0!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
localPosition.seq_number++;
|
||||
|
||||
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) {
|
||||
LOG_WARN("Skipping position send because lat/lon are zero!");
|
||||
LOG_WARN("Skip position send because lat/lon are zero!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -249,11 +249,11 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices
|
||||
// without can get time.
|
||||
if (getRTCQuality() < RTCQualityNTP) {
|
||||
LOG_INFO("Stripping time %u from position send", p.time);
|
||||
LOG_INFO("Strip time %u from position send", p.time);
|
||||
p.time = 0;
|
||||
} else {
|
||||
p.time = getValidTime(RTCQualityNTP);
|
||||
LOG_INFO("Providing time to mesh %u", p.time);
|
||||
LOG_INFO("Provide time to mesh %u", p.time);
|
||||
}
|
||||
|
||||
LOG_INFO("Position reply: time=%i lat=%i lon=%i", p.time, p.latitude_i, p.longitude_i);
|
||||
@@ -350,7 +350,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
|
||||
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
|
||||
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
|
||||
config.power.is_power_saving) {
|
||||
LOG_DEBUG("Start next execution in 5s, then going to sleep");
|
||||
LOG_DEBUG("Start next execution in 5s, then sleep");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
@@ -363,7 +363,7 @@ int32_t PositionModule::runOnce()
|
||||
if (sleepOnNextExecution == true) {
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then awaking to send position again", nightyNightMs);
|
||||
LOG_DEBUG("Sleep for %ims, then awaking to send position again", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, false);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ int32_t PositionModule::runOnce()
|
||||
if (smartPosition.hasTraveledOverThreshold &&
|
||||
Throttle::execute(
|
||||
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
|
||||
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling"); })) {
|
||||
[]() { LOG_DEBUG("Skip send smart broadcast due to time throttling"); })) {
|
||||
|
||||
LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, "
|
||||
"minTimeInterval=%ims)",
|
||||
@@ -464,7 +464,7 @@ void PositionModule::handleNewPosition()
|
||||
if (smartPosition.hasTraveledOverThreshold &&
|
||||
Throttle::execute(
|
||||
&lastGpsSend, minimumTimeThreshold, []() { positionModule->sendOurPosition(); },
|
||||
[]() { LOG_DEBUG("Skipping send smart broadcast due to time throttling"); })) {
|
||||
[]() { LOG_DEBUG("Skip send smart broadcast due to time throttling"); })) {
|
||||
LOG_DEBUG("Sent smart pos@%x:6 to mesh (distanceTraveled=%fm, minDistanceThreshold=%im, timeElapsed=%ims, "
|
||||
"minTimeInterval=%ims)",
|
||||
localPosition.timestamp, smartPosition.distanceTraveled, smartPosition.distanceThreshold, msSinceLastSend,
|
||||
|
||||
@@ -81,7 +81,7 @@ int32_t RangeTestModule::runOnce()
|
||||
|
||||
// If we have been running for more than 8 hours, turn module back off
|
||||
if (!Throttle::isWithinTimespanMs(started, 28800000)) {
|
||||
LOG_INFO("Range Test Module - Disabling after 8 hours");
|
||||
LOG_INFO("Range Test Module - Disable after 8 hours");
|
||||
return disable();
|
||||
} else {
|
||||
return (senderHeartbeat);
|
||||
|
||||
@@ -149,7 +149,7 @@ int32_t RemoteHardwareModule::runOnce()
|
||||
|
||||
if (curVal != previousWatch) {
|
||||
previousWatch = curVal;
|
||||
LOG_INFO("Broadcasting GPIOS 0x%llx changed!", curVal);
|
||||
LOG_INFO("Broadcast GPIOS 0x%llx changed!", curVal);
|
||||
|
||||
// Something changed! Tell the world with a broadcast message
|
||||
meshtastic_HardwareMessage r = meshtastic_HardwareMessage_init_default;
|
||||
|
||||
@@ -105,7 +105,7 @@ void StoreForwardModule::historySend(uint32_t secAgo, uint32_t to)
|
||||
queueSize = this->historyReturnMax;
|
||||
|
||||
if (queueSize) {
|
||||
LOG_INFO("S&F - Sending %u message(s)", queueSize);
|
||||
LOG_INFO("S&F - Send %u message(s)", queueSize);
|
||||
this->busy = true; // runOnce() will pickup the next steps once busy = true.
|
||||
this->busyTo = to;
|
||||
} else {
|
||||
@@ -403,7 +403,7 @@ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &m
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_StoreAndForward_msg, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_ERROR("Error decoding protobuf module!");
|
||||
LOG_ERROR("Error decoding proto module!");
|
||||
// if we can't decode it, nobody can process it!
|
||||
return ProcessMessage::STOP;
|
||||
}
|
||||
@@ -602,10 +602,10 @@ StoreForwardModule::StoreForwardModule()
|
||||
is_server = true;
|
||||
} else {
|
||||
LOG_INFO(".");
|
||||
LOG_INFO("S&F: not enough PSRAM free, disabling");
|
||||
LOG_INFO("S&F: not enough PSRAM free, Disable");
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("S&F: device doesn't have PSRAM, disabling");
|
||||
LOG_INFO("S&F: device doesn't have PSRAM, Disable");
|
||||
}
|
||||
|
||||
// Client
|
||||
|
||||
@@ -36,7 +36,7 @@ int32_t AirQualityTelemetryModule::runOnce()
|
||||
LOG_INFO("Air quality Telemetry: init");
|
||||
if (!aqi.begin_I2C()) {
|
||||
#ifndef I2C_NO_RESCAN
|
||||
LOG_WARN("Could not establish i2c connection to AQI sensor. Rescanning...");
|
||||
LOG_WARN("Could not establish i2c connection to AQI sensor. Rescan");
|
||||
// rescan for late arriving sensors. AQI Module starts about 10 seconds into the boot so this is plenty.
|
||||
uint8_t i2caddr_scan[] = {PMSA0031_ADDR};
|
||||
uint8_t i2caddr_asize = 1;
|
||||
@@ -107,7 +107,7 @@ bool AirQualityTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPack
|
||||
bool AirQualityTelemetryModule::getAirQualityTelemetry(meshtastic_Telemetry *m)
|
||||
{
|
||||
if (!aqi.read(&data)) {
|
||||
LOG_WARN("Skipping send measurements. Could not read AQIn");
|
||||
LOG_WARN("Skip send measurements. Could not read AQIn");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -121,9 +121,8 @@ bool AirQualityTelemetryModule::getAirQualityTelemetry(meshtastic_Telemetry *m)
|
||||
m->variant.air_quality_metrics.pm25_environmental = data.pm25_env;
|
||||
m->variant.air_quality_metrics.pm100_environmental = data.pm100_env;
|
||||
|
||||
LOG_INFO("(Sending): PM1.0(Standard)=%i, PM2.5(Standard)=%i, PM10.0(Standard)=%i",
|
||||
m->variant.air_quality_metrics.pm10_standard, m->variant.air_quality_metrics.pm25_standard,
|
||||
m->variant.air_quality_metrics.pm100_standard);
|
||||
LOG_INFO("Send: PM1.0(Standard)=%i, PM2.5(Standard)=%i, PM10.0(Standard)=%i", m->variant.air_quality_metrics.pm10_standard,
|
||||
m->variant.air_quality_metrics.pm25_standard, m->variant.air_quality_metrics.pm100_standard);
|
||||
|
||||
LOG_INFO(" | PM1.0(Environmental)=%i, PM2.5(Environmental)=%i, PM10.0(Environmental)=%i",
|
||||
m->variant.air_quality_metrics.pm10_environmental, m->variant.air_quality_metrics.pm25_environmental,
|
||||
@@ -150,7 +149,7 @@ meshtastic_MeshPacket *AirQualityTelemetryModule::allocReply()
|
||||
if (decoded->which_variant == meshtastic_Telemetry_air_quality_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getAirQualityTelemetry(&m)) {
|
||||
LOG_INFO("Air quality telemetry replying to request");
|
||||
LOG_INFO("Air quality telemetry reply to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
|
||||
@@ -76,7 +76,7 @@ meshtastic_MeshPacket *DeviceTelemetryModule::allocReply()
|
||||
}
|
||||
// Check for a request for device metrics
|
||||
if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) {
|
||||
LOG_INFO("Device telemetry replying to request");
|
||||
LOG_INFO("Device telemetry reply to request");
|
||||
|
||||
meshtastic_Telemetry telemetry = getDeviceTelemetry();
|
||||
return allocDataProtobuf(telemetry);
|
||||
@@ -134,7 +134,7 @@ void DeviceTelemetryModule::sendLocalStatsToPhone()
|
||||
telemetry.variant.local_stats.num_tx_relay_canceled = router->txRelayCanceled;
|
||||
}
|
||||
|
||||
LOG_INFO("(Sending local stats): uptime=%i, channel_utilization=%f, air_util_tx=%f, num_online_nodes=%i, num_total_nodes=%i",
|
||||
LOG_INFO("Sending local stats: uptime=%i, channel_utilization=%f, air_util_tx=%f, num_online_nodes=%i, num_total_nodes=%i",
|
||||
telemetry.variant.local_stats.uptime_seconds, telemetry.variant.local_stats.channel_utilization,
|
||||
telemetry.variant.local_stats.air_util_tx, telemetry.variant.local_stats.num_online_nodes,
|
||||
telemetry.variant.local_stats.num_total_nodes);
|
||||
@@ -153,7 +153,7 @@ void DeviceTelemetryModule::sendLocalStatsToPhone()
|
||||
bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
{
|
||||
meshtastic_Telemetry telemetry = getDeviceTelemetry();
|
||||
LOG_INFO("(Sending): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f, uptime=%i",
|
||||
LOG_INFO("Send: air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f, uptime=%i",
|
||||
telemetry.variant.device_metrics.air_util_tx, telemetry.variant.device_metrics.channel_utilization,
|
||||
telemetry.variant.device_metrics.battery_level, telemetry.variant.device_metrics.voltage,
|
||||
telemetry.variant.device_metrics.uptime_seconds);
|
||||
|
||||
@@ -73,7 +73,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs);
|
||||
LOG_DEBUG("Sleep for %ims, then awake to send metrics again", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true);
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ meshtastic_MeshPacket *EnvironmentTelemetryModule::allocReply()
|
||||
if (decoded->which_variant == meshtastic_Telemetry_environment_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getEnvironmentTelemetry(&m)) {
|
||||
LOG_INFO("Environment telemetry replying to request");
|
||||
LOG_INFO("Environment telemetry reply to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -431,14 +431,14 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
#else
|
||||
if (getEnvironmentTelemetry(&m)) {
|
||||
#endif
|
||||
LOG_INFO("(Sending): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f",
|
||||
LOG_INFO("Send: barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, temperature=%f",
|
||||
m.variant.environment_metrics.barometric_pressure, m.variant.environment_metrics.current,
|
||||
m.variant.environment_metrics.gas_resistance, m.variant.environment_metrics.relative_humidity,
|
||||
m.variant.environment_metrics.temperature);
|
||||
LOG_INFO("(Sending): voltage=%f, IAQ=%d, distance=%f, lux=%f", m.variant.environment_metrics.voltage,
|
||||
LOG_INFO("Send: voltage=%f, IAQ=%d, distance=%f, lux=%f", m.variant.environment_metrics.voltage,
|
||||
m.variant.environment_metrics.iaq, m.variant.environment_metrics.distance, m.variant.environment_metrics.lux);
|
||||
|
||||
LOG_INFO("(Sending): wind speed=%fm/s, direction=%d degrees, weight=%fkg", m.variant.environment_metrics.wind_speed,
|
||||
LOG_INFO("Send: wind speed=%fm/s, direction=%d degrees, weight=%fkg", m.variant.environment_metrics.wind_speed,
|
||||
m.variant.environment_metrics.wind_direction, m.variant.environment_metrics.weight);
|
||||
|
||||
sensor_read_error_count = 0;
|
||||
@@ -463,7 +463,7 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
||||
LOG_DEBUG("Start next execution in 5s, then going to sleep");
|
||||
LOG_DEBUG("Start next execution in 5s, then sleep");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ int32_t HealthTelemetryModule::runOnce()
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.health_update_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs);
|
||||
LOG_DEBUG("Sleep for %ims, then awake to send metrics again", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ meshtastic_MeshPacket *HealthTelemetryModule::allocReply()
|
||||
if (decoded->which_variant == meshtastic_Telemetry_health_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getHealthTelemetry(&m)) {
|
||||
LOG_INFO("Health telemetry replying to request");
|
||||
LOG_INFO("Health telemetry reply to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -211,7 +211,7 @@ bool HealthTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
m.which_variant = meshtastic_Telemetry_health_metrics_tag;
|
||||
m.time = getTime();
|
||||
if (getHealthTelemetry(&m)) {
|
||||
LOG_INFO("(Sending): temperature=%f, heart_bpm=%d, spO2=%d", m.variant.health_metrics.temperature,
|
||||
LOG_INFO("Send: temperature=%f, heart_bpm=%d, spO2=%d", m.variant.health_metrics.temperature,
|
||||
m.variant.health_metrics.heart_bpm, m.variant.health_metrics.spO2);
|
||||
|
||||
sensor_read_error_count = 0;
|
||||
@@ -236,7 +236,7 @@ bool HealthTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
||||
LOG_DEBUG("Start next execution in 5s, then going to sleep");
|
||||
LOG_DEBUG("Start next execution in 5s, then sleep");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ int32_t PowerTelemetryModule::runOnce()
|
||||
sleepOnNextExecution = false;
|
||||
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.power_update_interval,
|
||||
default_telemetry_broadcast_interval_secs);
|
||||
LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs);
|
||||
LOG_DEBUG("Sleep for %ims, then awake to send metrics again", nightyNightMs);
|
||||
doDeepSleep(nightyNightMs, true);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ meshtastic_MeshPacket *PowerTelemetryModule::allocReply()
|
||||
if (decoded->which_variant == meshtastic_Telemetry_power_metrics_tag) {
|
||||
meshtastic_Telemetry m = meshtastic_Telemetry_init_zero;
|
||||
if (getPowerTelemetry(&m)) {
|
||||
LOG_INFO("Power telemetry replying to request");
|
||||
LOG_INFO("Power telemetry reply to request");
|
||||
return allocDataProtobuf(m);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -216,7 +216,7 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
m.which_variant = meshtastic_Telemetry_power_metrics_tag;
|
||||
m.time = getTime();
|
||||
if (getPowerTelemetry(&m)) {
|
||||
LOG_INFO("(Sending): ch1_voltage=%f, ch1_current=%f, ch2_voltage=%f, ch2_current=%f, "
|
||||
LOG_INFO("Send: ch1_voltage=%f, ch1_current=%f, ch2_voltage=%f, ch2_current=%f, "
|
||||
"ch3_voltage=%f, ch3_current=%f",
|
||||
m.variant.power_metrics.ch1_voltage, m.variant.power_metrics.ch1_current, m.variant.power_metrics.ch2_voltage,
|
||||
m.variant.power_metrics.ch2_current, m.variant.power_metrics.ch3_voltage, m.variant.power_metrics.ch3_current);
|
||||
@@ -243,7 +243,7 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
||||
LOG_DEBUG("Start next execution in 5s then going to sleep");
|
||||
LOG_DEBUG("Start next execution in 5s then sleep");
|
||||
sleepOnNextExecution = true;
|
||||
setIntervalFromNow(5000);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ void AHT10Sensor::setup() {}
|
||||
|
||||
bool AHT10Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
LOG_DEBUG("AHT10Sensor::getMetrics");
|
||||
LOG_DEBUG("AHT10 getMetrics");
|
||||
|
||||
sensors_event_t humidity, temp;
|
||||
aht10.getEvent(&humidity, &temp);
|
||||
|
||||
@@ -35,7 +35,7 @@ bool BME280Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
measurement->variant.environment_metrics.has_relative_humidity = true;
|
||||
measurement->variant.environment_metrics.has_barometric_pressure = true;
|
||||
|
||||
LOG_DEBUG("BME280Sensor::getMetrics");
|
||||
LOG_DEBUG("BME280 getMetrics");
|
||||
bme280.takeForcedMeasurement();
|
||||
measurement->variant.environment_metrics.temperature = bme280.readTemperature();
|
||||
measurement->variant.environment_metrics.relative_humidity = bme280.readHumidity();
|
||||
|
||||
@@ -29,7 +29,7 @@ bool BMP085Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
measurement->variant.environment_metrics.has_temperature = true;
|
||||
measurement->variant.environment_metrics.has_barometric_pressure = true;
|
||||
|
||||
LOG_DEBUG("BMP085Sensor::getMetrics");
|
||||
LOG_DEBUG("BMP085 getMetrics");
|
||||
measurement->variant.environment_metrics.temperature = bmp085.readTemperature();
|
||||
measurement->variant.environment_metrics.barometric_pressure = bmp085.readPressure() / 100.0F;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ bool BMP280Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
measurement->variant.environment_metrics.has_temperature = true;
|
||||
measurement->variant.environment_metrics.has_barometric_pressure = true;
|
||||
|
||||
LOG_DEBUG("BMP280Sensor::getMetrics");
|
||||
LOG_DEBUG("BMP280 getMetrics");
|
||||
bmp280.takeForcedMeasurement();
|
||||
measurement->variant.environment_metrics.temperature = bmp280.readTemperature();
|
||||
measurement->variant.environment_metrics.barometric_pressure = bmp280.readPressure() / 100.0F;
|
||||
|
||||
@@ -50,11 +50,11 @@ bool BMP3XXSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
measurement->variant.environment_metrics.barometric_pressure = static_cast<float>(bmp3xx->pressure) / 100.0F;
|
||||
measurement->variant.environment_metrics.relative_humidity = 0.0f;
|
||||
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i temp: %.1f press %.1f", measurement->which_variant,
|
||||
LOG_DEBUG("BMP3XX getMetrics id: %i temp: %.1f press %.1f", measurement->which_variant,
|
||||
measurement->variant.environment_metrics.temperature,
|
||||
measurement->variant.environment_metrics.barometric_pressure);
|
||||
} else {
|
||||
LOG_DEBUG("BMP3XXSensor::getMetrics id: %i", measurement->which_variant);
|
||||
LOG_DEBUG("BMP3XX getMetrics id: %i", measurement->which_variant);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ bool MAX17048Singleton::isBatteryCharging()
|
||||
{
|
||||
float volts = cellVoltage();
|
||||
if (isnan(volts)) {
|
||||
LOG_DEBUG("%s::isBatteryCharging is not connected", sensorStr);
|
||||
LOG_DEBUG("%s::isBatteryCharging not connected", sensorStr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ void MAX17048Sensor::setup() {}
|
||||
|
||||
bool MAX17048Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics id: %i", measurement->which_variant);
|
||||
LOG_DEBUG("MAX17048 getMetrics id: %i", measurement->which_variant);
|
||||
|
||||
float volts = max17048->cellVoltage();
|
||||
if (isnan(volts)) {
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics battery is not connected");
|
||||
LOG_DEBUG("MAX17048 getMetrics battery is not connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ bool MAX17048Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
soc = clamp(soc, 0.0f, 100.0f); // clamp soc between 0 and 100%
|
||||
float ttg = (100.0f - soc) / rate; // calculate hours to charge/discharge
|
||||
|
||||
LOG_DEBUG("MAX17048Sensor::getMetrics volts: %.3fV soc: %.1f%% ttg: %.1f hours", volts, soc, ttg);
|
||||
LOG_DEBUG("MAX17048 getMetrics volts: %.3fV soc: %.1f%% ttg: %.1f hours", volts, soc, ttg);
|
||||
if ((int)measurement->which_variant == meshtastic_Telemetry_power_metrics_tag) {
|
||||
measurement->variant.power_metrics.has_ch1_voltage = true;
|
||||
measurement->variant.power_metrics.ch1_voltage = volts;
|
||||
|
||||
@@ -28,7 +28,7 @@ bool MCP9808Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
measurement->variant.environment_metrics.has_temperature = true;
|
||||
|
||||
LOG_DEBUG("MCP9808Sensor::getMetrics");
|
||||
LOG_DEBUG("MCP9808 getMetrics");
|
||||
measurement->variant.environment_metrics.temperature = mcp9808.readTempC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void NAU7802Sensor::setup() {}
|
||||
|
||||
bool NAU7802Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
LOG_DEBUG("NAU7802Sensor::getMetrics");
|
||||
LOG_DEBUG("NAU7802 getMetrics");
|
||||
nau7802.powerUp();
|
||||
// Wait for the sensor to become ready for one second max
|
||||
uint32_t start = millis();
|
||||
|
||||
@@ -24,7 +24,7 @@ void RCWL9620Sensor::setup() {}
|
||||
bool RCWL9620Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
measurement->variant.environment_metrics.has_distance = true;
|
||||
LOG_DEBUG("RCWL9620Sensor::getMetrics");
|
||||
LOG_DEBUG("RCWL9620 getMetrics");
|
||||
measurement->variant.environment_metrics.distance = getDistance();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class TelemetrySensor
|
||||
int32_t initI2CSensor()
|
||||
{
|
||||
if (!status) {
|
||||
LOG_WARN("Could not connect to detected %s sensor. Removing from nodeTelemetrySensorsMap.", sensorName);
|
||||
LOG_WARN("Could not connect to detected %s sensor. Remove from nodeTelemetrySensorsMap.", sensorName);
|
||||
nodeTelemetrySensorsMap[sensorType].first = 0;
|
||||
} else {
|
||||
LOG_INFO("Opened %s sensor on i2c bus", sensorName);
|
||||
|
||||
@@ -39,7 +39,7 @@ bool PaxcounterModule::sendInfo(NodeNum dest)
|
||||
if (paxcounterModule->reportedDataSent)
|
||||
return false;
|
||||
|
||||
LOG_INFO("PaxcounterModule: sending pax info wifi=%d; ble=%d; uptime=%lu", count_from_libpax.wifi_count,
|
||||
LOG_INFO("PaxcounterModule: send pax info wifi=%d; ble=%d; uptime=%lu", count_from_libpax.wifi_count,
|
||||
count_from_libpax.ble_count, millis() / 1000);
|
||||
|
||||
meshtastic_Paxcount pl = meshtastic_Paxcount_init_default;
|
||||
|
||||
Reference in New Issue
Block a user