Difference between revisions of "Toggle"
(→Software stack overview) |
(→Software stack overview) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
[[File:Toggle.png|center]] | [[File:Toggle.png|center]] | ||
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 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, [https://developer.gnome.org/clutter/stable/ Clutter] is used which relies on [https://developer.gnome.org/cogl/stable/ Cogl] as a backend for communicating with EGL and GLES2. For standard widgets (buttons etc) either GTK+3 is used or [https://github.com/clutter-project/mx mx] . [https://wiki.gnome.org/action/show/Projects/GObjectIntrospection?action=show&redirect=GObjectIntrospection Gobject introspection] is used for making bindings to Python. | |
== Software installation == | == Software installation == | ||
− | === Debian === | + | === 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 [[https://bitbucket.org/intelligentagent/toggle Toggle repository]]. the package is called toggle, but you also need libtoggle to make it work: | 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 [[https://bitbucket.org/intelligentagent/toggle Toggle repository]]. the package is called toggle, but you also need libtoggle to make it work: | ||
sudo apt-get install libtoggle toggle | sudo apt-get install libtoggle toggle | ||
− | === | + | === Armbian on Recore === |
− | Toggle | + | Toggle can run on Recore with quirks. It has been tested to run on [https://wayland.freedesktop.org/ Wayland] with the [https://wiki.debian.org/PanfrostLima Lima] Open Source Driver. |
− | + | This is a work in progress. | |
− | + | To install Weston: | |
− | + | <pre> | |
− | + | apt install weston | |
− | + | </pre> | |
+ | |||
+ | To test running Weston from an SSH shell: | ||
+ | <pre> | ||
+ | weston --tty 2 | ||
+ | </pre> | ||
+ | |||
+ | On Manga Screen 2, you can set Weston to start with the screen rotated: | ||
+ | <pre> | ||
+ | mkdir -p /etc/xdg/weston | ||
+ | nano /etc/xdg/weston/weston.ini | ||
+ | </pre> | ||
+ | <pre> | ||
+ | [core] | ||
+ | idle-time=0 | ||
+ | |||
+ | [shell] | ||
+ | locking=false | ||
+ | |||
+ | [output] | ||
+ | name=HDMI-A-1 | ||
+ | transform=90 | ||
+ | # in debian 11/bullseye this is rotate-90 | ||
+ | </pre> | ||
+ | |||
+ | Weston systemd service | ||
+ | <pre> | ||
+ | nano /etc/systemd/system/weston.service | ||
+ | </pre> | ||
+ | <pre> | ||
+ | [Unit] | ||
+ | Description=Weston Wayland Compositor | ||
+ | After=user@0.service | ||
+ | Requires=user@0.service | ||
+ | |||
+ | [Service] | ||
+ | Environment="XDG_RUNTIME_DIR=/run/user/0" | ||
+ | ExecStart=/usr/bin/weston --tty 2 | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </pre> | ||
===Configuration=== | ===Configuration=== | ||
Line 57: | Line 100: | ||
[Rest] | [Rest] | ||
api_key = 934A6B7A51B34445A6A5A51DA96713A3 | api_key = 934A6B7A51B34445A6A5A51DA96713A3 | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | Toggle Systemd file: | ||
+ | <pre> | ||
+ | [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 | ||
</pre> | </pre> | ||
Line 92: | Line 152: | ||
=== Debug output === | === Debug output === | ||
systemctl status -n 100 toggle | systemctl status -n 100 toggle | ||
+ | |||
+ | === Stopping Toggle to drop to shell === | ||
+ | systemctl stop toggle | ||
==Overview== | ==Overview== | ||
Line 98: | Line 161: | ||
== Contributing == | == Contributing == | ||
Contributions are highly welcome! Here's what you do: | Contributions are highly welcome! Here's what you do: | ||
− | # Fork the repository (on your host machine): https:// | + | # Fork the repository (on your host machine): https://github.com/intelligent-agent/toggle |
# Make changes | # Make changes | ||
# Upload the file from your host to your BeagleBone to verify that it works. | # Upload the file from your host to your BeagleBone to verify that it works. |
Latest revision as of 20:04, 4 May 2021
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.
Contents
Software installation
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
Toggle can run on Recore with quirks. It has been tested to run on Wayland with the Lima Open Source Driver. This is a work in progress. To install Weston:
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
nano /etc/systemd/system/weston.service
[Unit] Description=Weston Wayland Compositor After=user@0.service Requires=user@0.service [Service] Environment="XDG_RUNTIME_DIR=/run/user/0" ExecStart=/usr/bin/weston --tty 2 [Install] WantedBy=multi-user.target
Configuration
Default configuration
[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://intelligentagent@bitbucket.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()
Debug output
systemctl status -n 100 toggle
Stopping Toggle to drop to shell
systemctl stop toggle
Overview
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.
Contributing
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 : )