mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-13 08:32:08 +00:00
feat: enable remote admin to set/clear fixed positions (#4713)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
parent
be306cc384
commit
db4dc88d6f
@ -257,34 +257,26 @@ 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("Client is receiving a set_fixed_position command.\n");
|
||||||
LOG_INFO("Ignoring set_fixed_position command from another node.\n");
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||||
} else {
|
node->has_position = true;
|
||||||
LOG_INFO("Client is receiving a set_fixed_position command.\n");
|
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
|
||||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
nodeDB->setLocalPosition(r->set_fixed_position);
|
||||||
node->has_position = true;
|
config.position.fixed_position = true;
|
||||||
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
|
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
||||||
nodeDB->setLocalPosition(r->set_fixed_position);
|
|
||||||
config.position.fixed_position = true;
|
|
||||||
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
|
||||||
#if !MESHTASTIC_EXCLUDE_GPS
|
#if !MESHTASTIC_EXCLUDE_GPS
|
||||||
if (gps != nullptr)
|
if (gps != nullptr)
|
||||||
gps->enable();
|
gps->enable();
|
||||||
// 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("Client is receiving a remove_fixed_position command.\n");
|
||||||
LOG_INFO("Ignoring remove_fixed_position command from another node.\n");
|
nodeDB->clearLocalPosition();
|
||||||
} else {
|
config.position.fixed_position = false;
|
||||||
LOG_INFO("Client is receiving a remove_fixed_position command.\n");
|
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
||||||
nodeDB->clearLocalPosition();
|
|
||||||
config.position.fixed_position = false;
|
|
||||||
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case meshtastic_AdminMessage_set_time_only_tag: {
|
case meshtastic_AdminMessage_set_time_only_tag: {
|
||||||
|
Loading…
Reference in New Issue
Block a user