packet replay fix
This commit is contained in:
parent
f7adc2ea14
commit
4bdffeda88
1 changed files with 15 additions and 7 deletions
|
|
@ -66,8 +66,8 @@ defmodule AprsWeb.MapLive.CallsignView do
|
||||||
|
|
||||||
# Schedule regular cleanup of old packets from the map
|
# Schedule regular cleanup of old packets from the map
|
||||||
Process.send_after(self(), :cleanup_old_packets, 60_000)
|
Process.send_after(self(), :cleanup_old_packets, 60_000)
|
||||||
# Auto-start replay after a short delay - TEMPORARILY DISABLED FOR DEBUGGING
|
# Auto-start replay after a short delay
|
||||||
# Process.send_after(self(), :auto_start_replay, 2000)
|
Process.send_after(self(), :auto_start_replay, 2000)
|
||||||
|
|
||||||
{:ok, socket}
|
{:ok, socket}
|
||||||
else
|
else
|
||||||
|
|
@ -141,14 +141,13 @@ defmodule AprsWeb.MapLive.CallsignView do
|
||||||
def handle_event("map_ready", _params, socket) do
|
def handle_event("map_ready", _params, socket) do
|
||||||
socket = assign(socket, map_ready: true)
|
socket = assign(socket, map_ready: true)
|
||||||
|
|
||||||
# Auto-start replay if it hasn't been started yet - TEMPORARILY DISABLED FOR DEBUGGING
|
# Auto-start replay if it hasn't been started yet
|
||||||
socket =
|
socket =
|
||||||
if socket.assigns.replay_started do
|
if socket.assigns.replay_started do
|
||||||
socket
|
socket
|
||||||
else
|
else
|
||||||
# socket = start_historical_replay(socket)
|
socket = start_historical_replay(socket)
|
||||||
# assign(socket, replay_started: true, replay_active: true)
|
assign(socket, replay_started: true, replay_active: true)
|
||||||
socket
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# If we have a pending geolocation, zoom to it after a delay
|
# If we have a pending geolocation, zoom to it after a delay
|
||||||
|
|
@ -871,6 +870,15 @@ defmodule AprsWeb.MapLive.CallsignView do
|
||||||
|> Stream.filter(&(&1 != nil))
|
|> Stream.filter(&(&1 != nil))
|
||||||
|> Enum.to_list()
|
|> Enum.to_list()
|
||||||
|
|
||||||
|
# Build visible_packets map from the loaded packets
|
||||||
|
visible_packets =
|
||||||
|
recent_packets
|
||||||
|
|> Stream.filter(&has_position_data?/1)
|
||||||
|
|> Map.new(fn packet ->
|
||||||
|
callsign_key = "#{packet.base_callsign}#{if packet.ssid, do: "-#{packet.ssid}", else: ""}"
|
||||||
|
{callsign_key, packet}
|
||||||
|
end)
|
||||||
|
|
||||||
# Send packets to map if any exist
|
# Send packets to map if any exist
|
||||||
socket =
|
socket =
|
||||||
if length(packet_data_list) > 0 do
|
if length(packet_data_list) > 0 do
|
||||||
|
|
@ -879,7 +887,7 @@ defmodule AprsWeb.MapLive.CallsignView do
|
||||||
socket
|
socket
|
||||||
end
|
end
|
||||||
|
|
||||||
assign(socket, last_known_position: last_known_position)
|
assign(socket, last_known_position: last_known_position, visible_packets: visible_packets)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp map_empty?(socket) do
|
defp map_empty?(socket) do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue