mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-16 18:12:07 +00:00
Fix default stance in position_precision
This commit is contained in:
parent
730429fc9b
commit
c2085c2c88
@ -88,6 +88,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
|
|||||||
channelSettings.psk.size = 1;
|
channelSettings.psk.size = 1;
|
||||||
strncpy(channelSettings.name, "", sizeof(channelSettings.name));
|
strncpy(channelSettings.name, "", sizeof(channelSettings.name));
|
||||||
channelSettings.module_settings.position_precision = 32; // default to sending location on the primary channel
|
channelSettings.module_settings.position_precision = 32; // default to sending location on the primary channel
|
||||||
|
channelSettings.has_module_settings = true;
|
||||||
|
|
||||||
ch.has_settings = true;
|
ch.has_settings = true;
|
||||||
ch.role = meshtastic_Channel_Role_PRIMARY;
|
ch.role = meshtastic_Channel_Role_PRIMARY;
|
||||||
|
@ -83,7 +83,13 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
|
|||||||
}
|
}
|
||||||
|
|
||||||
nodeDB.updatePosition(getFrom(&mp), p);
|
nodeDB.updatePosition(getFrom(&mp), p);
|
||||||
|
if (channels.getByIndex(mp.channel).settings.has_module_settings) {
|
||||||
precision = channels.getByIndex(mp.channel).settings.module_settings.position_precision;
|
precision = channels.getByIndex(mp.channel).settings.module_settings.position_precision;
|
||||||
|
} else if (channels.getByIndex(mp.channel).role == meshtastic_Channel_Role_PRIMARY) {
|
||||||
|
precision = 32;
|
||||||
|
} else {
|
||||||
|
precision = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return false; // Let others look at this message also if they want
|
return false; // Let others look at this message also if they want
|
||||||
}
|
}
|
||||||
@ -117,8 +123,8 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
|||||||
|
|
||||||
// We want the imprecise position to be the middle of the possible location, not
|
// We want the imprecise position to be the middle of the possible location, not
|
||||||
if (precision < 31 && precision > 1) {
|
if (precision < 31 && precision > 1) {
|
||||||
p.latitude_i += (1 << 31 - precision);
|
p.latitude_i += (1 << (31 - precision));
|
||||||
p.longitude_i += (1 << 31 - precision);
|
p.longitude_i += (1 << (31 - precision));
|
||||||
}
|
}
|
||||||
p.precision_bits = precision;
|
p.precision_bits = precision;
|
||||||
p.time = localPosition.time;
|
p.time = localPosition.time;
|
||||||
@ -217,7 +223,13 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
|
|||||||
service.cancelSending(prevPacketId);
|
service.cancelSending(prevPacketId);
|
||||||
|
|
||||||
// Set's the class precision value for this particular packet
|
// Set's the class precision value for this particular packet
|
||||||
|
if (channels.getByIndex(channel).settings.has_module_settings) {
|
||||||
precision = channels.getByIndex(channel).settings.module_settings.position_precision;
|
precision = channels.getByIndex(channel).settings.module_settings.position_precision;
|
||||||
|
} else if (channels.getByIndex(channel).role == meshtastic_Channel_Role_PRIMARY) {
|
||||||
|
precision = 32;
|
||||||
|
} else {
|
||||||
|
precision = 0;
|
||||||
|
}
|
||||||
|
|
||||||
meshtastic_MeshPacket *p = allocReply();
|
meshtastic_MeshPacket *p = allocReply();
|
||||||
if (p == nullptr) {
|
if (p == nullptr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user