Skip to content

Commit

Permalink
feat: support audio readouts on Bus E-ink
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalcora committed Oct 22, 2024
1 parent 1a2f097 commit 3a5b203
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions assets/src/components/admin/inspector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const SCREEN_TYPES = new Set([
]);

const AUDIO_SCREEN_TYPES = new Set([
"bus_eink_v2",
"bus_shelter_v2",
"busway_v2",
"gl_eink_v2",
Expand Down
1 change: 1 addition & 0 deletions lib/screens/v2/screen_data/parameters.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule Screens.V2.ScreenData.Parameters do

@static_params %{
bus_eink_v2: %Static{
audio_active_time: @all_times,
candidate_generator: CandidateGenerator.BusEink,
refresh_rate: 30
},
Expand Down
5 changes: 4 additions & 1 deletion lib/screens/v2/widget_instance/alert.ex
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ defmodule Screens.V2.WidgetInstance.Alert do
end
end

def audio_valid_candidate?(%__MODULE__{screen: %Screen{app_id: :gl_eink_v2}}), do: true
def audio_valid_candidate?(%__MODULE__{screen: %Screen{app_id: app_id}})
when app_id in ~w[bus_eink_v2 gl_eink_v2]a,
do: true

def audio_valid_candidate?(_instance), do: false

def audio_view(_instance), do: ScreensWeb.V2.Audio.AlertView
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/v2/widget_instance/subway_status.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule Screens.V2.WidgetInstance.SubwayStatus do
alias Screens.Stops.Stop
alias Screens.V2.WidgetInstance.SubwayStatus
alias ScreensConfig.Screen
alias ScreensConfig.V2.{Footer, GlEink, PreFare}
alias ScreensConfig.V2.{BusEink, Footer, GlEink, PreFare}

defmodule SubwayStatusAlert do
@moduledoc false
Expand Down Expand Up @@ -135,7 +135,7 @@ defmodule Screens.V2.WidgetInstance.SubwayStatus do
def audio_sort_key(_instance), do: [2]

def audio_valid_candidate?(%{screen: %Screen{app_params: %app{}}})
when app in [PreFare, GlEink],
when app in [BusEink, GlEink, PreFare],
do: true

def audio_valid_candidate?(_instance), do: false
Expand Down

0 comments on commit 3a5b203

Please sign in to comment.