BinaryMuse

BinaryMuse

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!

Showing Posts 1 to 1

axelson

axelson

Scenic Core Team

Hi there! :waving_hand:

I see a couple things that could cause issues with your setup. You can remove scenic_driver_nerves_rpi from your mix.exs since scenic_driver local supplants the RPI-specific driver entirely.

And similarly you can remove the two drivers you have in your config, and instead just include scenic_driver_local:

  drivers: [
    [
      module: Scenic.Driver.Local
    ]
  ]

I think that’s likely the problem, i.e. scenic_driver_local isn’t running at all, hence nothing is displaying.

I haven’t tested it recently, but GitHub - ScenicFramework/scenic_nerves_starter · GitHub should serve as a good starting point for combining Scenic and Nerves. Although I’d really like to create an Igniter-based installer at some point.

I hope that helps you get started!

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews