mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-26 22:33:24 +00:00
Adds has_x bools to position packet. (#4540)
This commit is contained in:
parent
ff500bc5a9
commit
601ae29fe9
@ -187,16 +187,23 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
p.longitude_i = localPosition.longitude_i;
|
||||
}
|
||||
p.precision_bits = precision;
|
||||
p.has_latitude_i = true;
|
||||
p.has_longitude_i = true;
|
||||
p.time = getValidTime(RTCQualityNTP) > 0 ? getValidTime(RTCQualityNTP) : localPosition.time;
|
||||
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE) {
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL)
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL) {
|
||||
p.altitude = localPosition.altitude;
|
||||
else
|
||||
p.has_altitude = true;
|
||||
} else {
|
||||
p.altitude_hae = localPosition.altitude_hae;
|
||||
p.has_altitude_hae = true;
|
||||
}
|
||||
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION)
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION) {
|
||||
p.altitude_geoidal_separation = localPosition.altitude_geoidal_separation;
|
||||
p.has_altitude_geoidal_separation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_DOP) {
|
||||
@ -216,11 +223,15 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SEQ_NO)
|
||||
p.seq_number = localPosition.seq_number;
|
||||
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_HEADING)
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_HEADING) {
|
||||
p.ground_track = localPosition.ground_track;
|
||||
p.has_ground_track = true;
|
||||
}
|
||||
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SPEED)
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SPEED) {
|
||||
p.ground_speed = localPosition.ground_speed;
|
||||
p.has_ground_speed = true;
|
||||
}
|
||||
|
||||
// Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other
|
||||
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices
|
||||
@ -471,4 +482,4 @@ void PositionModule::handleNewPosition()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user