Skip to content

Commit

Permalink
always use some non-black frame on live view mount
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Van Volkinburg committed Jul 29, 2020
1 parent 73dfd4a commit 7f5d16c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions lib/xebow_web/live/matrix_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,23 @@ defmodule XebowWeb.MatrixLive do
alias RGBMatrix.Engine

@layout Xebow.layout()
@black Chameleon.HSV.new(0, 0, 0)
@black_frame @layout
|> Layout.leds()
|> Map.new(fn led ->
{led.id, @black}
end)

@impl Phoenix.LiveView
def mount(_params, _session, socket) do
{config, config_schema} = Xebow.get_animation_config()
{paint_fn, config_fn, frame} = register_with_engine!()

initial_assigns = [
leds: make_view_leds(@black_frame),
leds: make_view_leds(frame),
config: config,
config_schema: config_schema
]

initial_assigns =
if connected?(socket) do
{paint_fn, config_fn, frame} = register_with_engine!()

Keyword.merge(initial_assigns,
paint_fn: paint_fn,
config_fn: config_fn,
leds: make_view_leds(frame)
config_fn: config_fn
)
else
initial_assigns
Expand Down

0 comments on commit 7f5d16c

Please sign in to comment.