Toggle is the front end software used to slice, dice and print the stuff you want made. It's in its infancy, but if you want to contribute, here is the repository: https://github.com/intelligent-agent/toggle Toggle has been created to run well on embedded systems, such as Recore and Replicape/BeagleBone.
On BeagleBone, Toggle does not depend on any window system, but instead renders directly to the framebuffer. This keeps the overhead low and keeps the necessary graphics packages to a minimum. On Recore (Armbian), Toggle runs on top of Weston/Wayland.
For building the UI, Clutter is used which relies on Cogl as a backend for communicating with EGL and GLES2. For standard widgets (buttons etc) either GTK+3 is used or mx . Gobject introspection is used for making bindings to Python.
Debian on BeagleBone
Toggle now comes wrapped up in a tight little package for Debian. It is also included in the Kamikaze image for use with Replicape. For the latest development version, have a look at the [Toggle repository]. the package is called toggle, but you also need libtoggle to make it work:
sudo apt-get install libtoggle toggle
Armbian on Recore
apt install weston
To test running Weston from an SSH shell:
weston --tty 2
On Manga Screen 2, you can set Weston to start with the screen rotated:
mkdir -p /etc/xdg/weston nano /etc/xdg/weston/weston.ini
[core] idle-time=0 [shell] locking=false [output] name=HDMI-A-1 transform=90 # in debian 11/bullseye this is rotate-90
Weston systemd service
[Unit] Description=Weston Wayland Compositor Afterfirstname.lastname@example.org Requiresemail@example.com [Service] Environment="XDG_RUNTIME_DIR=/run/user/0" ExecStart=/usr/bin/weston --tty 2 [Install] WantedBy=multi-user.target
[System] # CRITICAL=50, # ERROR=40, # WARNING=30, INFO=20, DEBUG=10, NOTSET=0 loglevel = 20 stylesheet = /etc/toggle/style/style.css ui = /etc/toggle/style/ui.json plate = /etc/toggle/platforms/prusa.stl model_folder = /usr/share/models message_fd = /dev/toggle_1 rotation = 90 angle_min = -50 angle_max = 50 scale_min = 0.5 scale_max = 3.0 filter_events = false [Geometry] width = 0.2 height = 0.2 depth = 0.2 [Preheat_start] 0 = M117 Heating... 1 = M106 P1 S255 2 = M190 S65 3 = M109 S220 [Preheat_stop] 0 = M117 Stopping heating 1 = M190 S0 2 = M109 S0 [Rest] api_key = 934A6B7A51B34445A6A5A51DA96713A3
Toggle Systemd file:
[Unit] Description=3D-printer user interface After=weston.service [Service] Environment="XDG_RUNTIME_DIR=/run/user/0" Environment=MX_RC_FILE=/etc/toggle/styles/Plain/style.css Environment=CLUTTER_BACKEND=wayland ExecStart=/usr/local/bin/toggle [Install] WantedBy=multi-user.target
Software stack overview
Toggle builds on Clutter as the main software toolkit, with help from Mx for making the buttons and layout and Mash for importing the STL models. Clutter in turns relies on Cogl for interfacing with the actual 3D-engine in the BeagleBone Black. The interface to the 3D engine is copyrighted by Imagination Technologies and so it is one of the very few components that are not open source in this image. Texas Instruments is the only ones that have access to this code, so we are reliant on them making the drivers for various window managers. So far, none are available, neither X nor Wayland, so we are stuck with the null window system. That is not really a problem, since it makes stuff go fast, but it does require compilation of each of the packages marked in blue in the figure below to be compiled in a non-standard (from the Debian distro) way. Having a null window system adds a lot of restrictions on which toolkit can be used when wanting a mixed 2D/3D app. Clutter is one of them, and I think Qt is an alternative. The main Toggle user application is written in Python using G-object Introspection for interfacing with the lower level libraries. The engine in the BeagleBone Black is the SGX530, and you can do some pretty cool stuff with it. Spec-wise it is similar to what sits in the iPhone 4 (SGX535), but without the OpenGL (only OpenGL ES2.0) capabilities.
Compiling on BBB
In order to compile Cluttter projects directly on the BBB instead of on the host, you need to install the dev packages. There are some quirks due to a file conflict between g-ir-host-dev (which should not be installed at all) and libgirepository-1.0-dev.
opkg install libclutter-1.0-dev --force-overwrite opkg install systemd-dev opkg install libmx-2.0-dev opkg install libmash-0.2-dev
Clone the toggle repo:
cd /usr/src git clone https://firstname.lastname@example.org/intelligentagent/toggle.git cd toggle export CC=arm-angstrom-linux-gnueabi-gcc make
Introspecting on BBB:
cd /usr/src/toggle/toggle-plate make make install python from gi.repository import Toggle, Clutter Clutter.init() Toggle.Plate()
systemctl status -n 100 toggle
Stopping Toggle to drop to shell
systemctl stop toggle
Toggle relies on a few libraries and tool kits, but since it is designed for embedded platforms, the dependencies are kept fairly low in comparison with X-based or Wayland-based applications. Here is a quick overview of the dependencies of Toggle. These libraries have now got debian based (.deb packages) and Angstrom based (.opkg packages) available.
Contributions are highly welcome! Here's what you do:
- Fork the repository (on your host machine): https://github.com/intelligent-agent/toggle
- Make changes
- Upload the file from your host to your BeagleBone to verify that it works.
- Push the changes to your local repository
- Make a pull-request.
- If the request goes through, the software is updated and a new package is made.
- (optional) Blog about it so other users can upgrade and get your changes : )