Hi all,
I’m coming to Nerves with considerable Elixir experience but very little hardware experience. I’m trying to use Scenic to display a UI on my Raspberry Pi 3 Model B v1.2 using the original 7" touch display, connected via ribbon cable and powered via the GPIO pins.
I’m able to build firmware and push it to the device, and the IEx console displays on the touch display and works great. I’m also able to run mix scenic.run
with MIX_TARGET=host
to preview my Scenic UI on my development machine with no problem. However, I can’t get anything to display on the touch display other than the IEx console.
My configuration is as follows (truncated for brevity):
# mix.exs
defmodule HelloNerves.MixProject do
# ...
def project do
[
app: @app,
version: @version,
elixir: "~> 1.18",
archives: [nerves_bootstrap: "~> 1.13"],
start_permanent: Mix.env() == :prod,
deps: deps(),
releases: [{@app, release()}],
preferred_cli_target: [run: :host, test: :host]
]
end
def application do
[
extra_applications: [:logger, :runtime_tools, :scenic],
mod: {HelloNerves.Application, []}
]
end
defp deps do
[
# Dependencies for all targets
{:nerves, "~> 1.10", runtime: false},
{:shoehorn, "~> 0.9.1"},
{:ring_logger, "~> 0.11.0"},
{:toolshed, "~> 0.4.0"},
# Allow Nerves.Runtime on host to support development, testing and CI.
# See config/host.exs for usage.
{:nerves_runtime, "~> 0.13.0"},
# Dependencies for all targets except :host
{:nerves_pack, "~> 0.7.1", targets: @all_targets},
{:vintage_net_wifi, "~> 0.12", targets: @all_targets},
# ...
{:nerves_system_rpi3, "~> 1.24", runtime: false, targets: :rpi3},
# ...
{:scenic, "~> 0.11.2", override: true},
# For local development
{:scenic_driver_local, "~> 0.11.0-beta.0", targets: :host},
# For Raspberry Pi rendering
{:scenic_driver_nerves_rpi,
git: "git@github.com:boydm/scenic_driver_nerves_rpi.git",
branch: "v0.11",
targets: @all_targets},
# For Raspberry Pi touch input
{:scenic_driver_nerves_touch,
git: "git@github.com:boydm/scenic_driver_nerves_touch.git",
branch: "v0.11",
targets: @all_targets}
]
end
def release do
[
overwrite: true,
# Erlang distribution is not started automatically.
# See https://hexdocs.pm/nerves_pack/readme.html#erlang-distribution
cookie: "#{@app}_cookie",
include_erts: &Nerves.Release.erts/0,
steps: [&Nerves.Release.init/1, :assemble],
strip_beams: Mix.env() == :prod or [keep: ["Docs"]]
]
end
end
# target.exs
config :hello_nerves, :viewport, %{
size: {800, 480},
theme: :dark,
default_scene: HelloNerves.Scene.Home,
drivers: [
[
module: Scenic.Driver.Nerves.Rpi,
name: :rpi_driver,
debug: true
],
[
module: Scenic.Driver.Nerves.Touch,
name: :touch_driver,
device: "raspberrypi-ts",
calibration: {{1, 0, 0}, {0, 1, 0}}
]
]
}
# application.ex
defmodule HelloNerves.Application do
use Application
require Logger
@impl true
def start(_type, _args) do
Logger.info("Waiting for 1 second to allow touch device to be ready")
Process.sleep(1000)
Logger.info("Starting HelloNerves application")
viewport_config = Application.get_env(:hello_nerves, :viewport)
children =
[
HelloNerves.PubSub.Supervisor,
{Scenic, [viewport_config]}
]
opts = [strategy: :one_for_one, name: HelloNerves.Supervisor]
Supervisor.start_link(children, opts)
end
end
If useful, here are the logs: ringlogger_next.txt · GitHub
I also have some Logger.info
calls in my HelloNerves.Scene.Home.init
function, and I can see that they’re being called, and I can verify that the Scenic application is running — I just don’t get any UI on the device other than the IEx console.
I’m hoping there’s something simple I’m missing, and any help is very much appreciated!