handle raw feed and fix errors

This commit is contained in:
Graham McIntire 2025-06-24 11:15:34 -05:00
parent 54b3bbf522
commit 5b50d98036
No known key found for this signature in database
2 changed files with 43 additions and 15 deletions

View file

@ -45,7 +45,7 @@ config :aprs,
config :aprs,
ecto_repos: [Aprs.Repo],
aprs_is_server: System.get_env("APRS_SERVER", "dallas.aprs2.net"),
aprs_is_port: 14_580,
aprs_is_port: 10_152,
aprs_is_default_filter: System.get_env("APRS_FILTER"),
aprs_is_login_id: System.get_env("APRS_CALLSIGN"),
aprs_is_password: System.get_env("APRS_PASSCODE"),

View file

@ -56,14 +56,28 @@
else: nil
) ||
case Map.get(packet, :data_extended) do
%{} = data_ext -> Map.get(data_ext, :latitude) || Map.get(data_ext, "latitude")
_ -> nil
%{} = data_ext ->
case Map.get(data_ext, :latitude) || Map.get(data_ext, "latitude") do
{:ok, value} -> value
value -> value
end
_ ->
nil
end %>
{if not is_nil(lat),
do:
(is_float(lat) and :io_lib.format("~.6f", [lat]) |> List.to_string()) or
(is_binary(lat) and Regex.replace(~r/(\d+\.\d{1,6})\d*/, lat, "\\1")) or lat,
else: ""}
<%= if not is_nil(lat) do %>
<%= if is_float(lat) do %>
{:io_lib.format("~.6f", [lat]) |> List.to_string()}
<% else %>
<%= if is_binary(lat) do %>
{Regex.replace(~r/(\d+\.\d{1,6})\d*/, lat, "\\1")}
<% else %>
{lat}
<% end %>
<% end %>
<% else %>
""
<% end %>
</span>
</:col>
<:col :let={packet} label="Longitude">
@ -77,14 +91,28 @@
else: nil
) ||
case Map.get(packet, :data_extended) do
%{} = data_ext -> Map.get(data_ext, :longitude) || Map.get(data_ext, "longitude")
_ -> nil
%{} = data_ext ->
case Map.get(data_ext, :longitude) || Map.get(data_ext, "longitude") do
{:ok, value} -> value
value -> value
end
_ ->
nil
end %>
{if not is_nil(lon),
do:
(is_float(lon) and :io_lib.format("~.6f", [lon]) |> List.to_string()) or
(is_binary(lon) and Regex.replace(~r/(\d+\.\d{1,6})\d*/, lon, "\\1")) or lon,
else: ""}
<%= if not is_nil(lon) do %>
<%= if is_float(lon) do %>
{:io_lib.format("~.6f", [lon]) |> List.to_string()}
<% else %>
<%= if is_binary(lon) do %>
{Regex.replace(~r/(\d+\.\d{1,6})\d*/, lon, "\\1")}
<% else %>
{lon}
<% end %>
<% end %>
<% else %>
""
<% end %>
</span>
</:col>
<:col :let={packet} label="Device">