feat: enable remote admin to set/clear fixed positions (#4713)

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Andre K 2024-09-17 08:50:49 -03:00 committed by GitHub
parent be306cc384
commit db4dc88d6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -257,9 +257,6 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_set_fixed_position_tag: { case meshtastic_AdminMessage_set_fixed_position_tag: {
if (fromOthers) {
LOG_INFO("Ignoring set_fixed_position command from another node.\n");
} else {
LOG_INFO("Client is receiving a set_fixed_position command.\n"); LOG_INFO("Client is receiving a set_fixed_position command.\n");
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
node->has_position = true; node->has_position = true;
@ -273,18 +270,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
// Send our new fixed position to the mesh for good measure // Send our new fixed position to the mesh for good measure
positionModule->sendOurPosition(); positionModule->sendOurPosition();
#endif #endif
}
break; break;
} }
case meshtastic_AdminMessage_remove_fixed_position_tag: { case meshtastic_AdminMessage_remove_fixed_position_tag: {
if (fromOthers) {
LOG_INFO("Ignoring remove_fixed_position command from another node.\n");
} else {
LOG_INFO("Client is receiving a remove_fixed_position command.\n"); LOG_INFO("Client is receiving a remove_fixed_position command.\n");
nodeDB->clearLocalPosition(); nodeDB->clearLocalPosition();
config.position.fixed_position = false; config.position.fixed_position = false;
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false); saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
}
break; break;
} }
case meshtastic_AdminMessage_set_time_only_tag: { case meshtastic_AdminMessage_set_time_only_tag: {