Skip to content

Commit

Permalink
Add Seq # to position packets
Browse files Browse the repository at this point in the history
  • Loading branch information
jurriaan committed Jun 9, 2024
1 parent e58b09d commit 8850f54
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/dto/position_select_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ pub struct PositionSelectResult {
pub altitude: i64,
pub sats_in_view: i64,
pub precision_bits: i64,
pub ground_speed: i64
pub ground_speed: i64,
pub seq_number: i64,
}
5 changes: 3 additions & 2 deletions src/web_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ fn mesh_packet_stream(
let compute_positions = || {
async {
let query = format!(
r#"SELECT mesh_packet_id, latitude, longitude, altitude, sats_in_view, precision_bits, ground_speed FROM positions WHERE mesh_packet_id IN ({})"#,
r#"SELECT mesh_packet_id, latitude, longitude, altitude, sats_in_view, precision_bits, ground_speed, seq_number FROM positions WHERE mesh_packet_id IN ({})"#,
packet_ids_string
);
sqlx::query_as::<_, PositionSelectResult>(&query)
Expand Down Expand Up @@ -579,7 +579,8 @@ async fn node_positions_geojson(
positions.altitude,
positions.sats_in_view,
positions.precision_bits,
positions.ground_speed
positions.ground_speed,
positions.seq_number
FROM positions
JOIN mesh_packets ON positions.mesh_packet_id = mesh_packets.id
WHERE node_id = ? AND created_at > ?
Expand Down
4 changes: 4 additions & 0 deletions templates/_packet_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
<dd><span class="node-name fetch" data-node-id="{{ locked_to|hex }}">!{{ locked_to|hex }}</span></dd>
{% endif %}
{% when Payload::Position with (position) %}
{% if position.seq_number != 0 %}
<dt>Seq #</dt>
<dd>{{position.seq_number}}</dd>
{% endif %}
<dt>Location</dt>
<dd>{{self::format_mesh_gps(position.latitude, position.longitude)}}</dd>
{% if position.altitude != 0 %}
Expand Down
4 changes: 4 additions & 0 deletions templates/_position_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<dd>{% if packet.want_ack %}want ack{% endif %} {% if packet.want_response %}want response{% endif %}</dd>
{% endif %}
{% if let Payload::Position(position) = packet.payload %}
{% if position.seq_number != 0 %}
<dt>Seq #</dt>
<dd>{{position.seq_number}}</dd>
{% endif %}
<dt>Location</dt>
<dd>{{self::format_mesh_gps(position.latitude, position.longitude)}}</dd>
{% if position.altitude != 0 %}
Expand Down

0 comments on commit 8850f54

Please sign in to comment.