For developers - terba/slimmer GitHub Wiki
Slimmer was only tested on Linux based operating systems. The main goal of the project is to run it on the piCore (Tiny Core) based piCorePlayer image.
The source code contains parts from the following libraries: JsonCpp, libjson-rpc-cpp, libev, tclap.
Dependencies
- LCDProc's LCDd (runtime dependency)
- lcdapi library
- ICU library
- curl library
- Optional: pikeyd
Resource requirements
The size of the executable is under 300k if compiled with size optimization for armv6. CPU usage is under 1% on a RPi A+. The memory consumption is a bit high: it's ~40MB, but more than half of that space takes ICU's shared library, which is used to translate LMS provided strings to the configurable single-byte encoding (to match your LCD's encoding). It can be lowered significantly by building a minimal ICU library.
It works flawlessly on a piCorePlayer image on a RPi A+, and there is plenty of room and power to run anything else beside squeezelite, slimmer, pikeyd and LCDd.
Development environment
You can easily develop or test Slimmer on any kind of Linux operating system. On a desktop you can configure LCDProc's LCDd to use its curses driver. If you run LCDd in the foreground, you can see the emulated LCD output in the terminal window.
You even do not need a player (ex. Squeezelite) installed on your development machine. You can control any of the Squeezeboxes found in your network by specifying its ID (MAC address) on the command line with the --mac
option.
You can use your hw keyboard to control Slimmer. Just specify its device file on the command line with the --input
option. Make sure, that the OS user running Slimmer has read permission on that device file.
Of course controlling with a normal keyboard is a bit frustrating. Slimmer was designed with a rotary encoder in mind, to behave like the Squeezebox Boom. So you have to hit KEY_LEFT and KEY_RIGHT many times to have the same effect as rotating the encoder. Key repeats are also handled for these two keys.
You can find a script and an LCDd.conf I'm using on my development machine here: https://github.com/terba/slimmer/tree/master/scripts
Packaging for PiCorePlayer
I build Slimmer directly on PiCorePlayer. I mount my working folder over NFS to save the SD card in the Pi. I use the following shell script to set up the packaging environment when required:
#!/bin/sh
mkdir /home/tc/work
sudo mount -o addr=[IPADDRESSOFNFSSERVER],nolock -t nfs [NFSSERVERHOSTNAME]:/path/to/work/dir /home/tc/work || exit 1
tce-load -i compile-essentials
tce-load -i binutils
tce-load -i ncurses-dev
tce-load -i mc
tce-load -i findutils
tce-load -i squashfs-tools
tce-load -i libusb-dev
tce-load -i libusb-compat-dev
tce-load -i cmake
tce-load -i git
tce-load -i icu-dev
tce-load -i curl-dev
tce-load -i libidn-dev
tce-load -i libssh2-dev
tce-load -i libgcrypt-dev
tce-load -i libgpg-error-dev
tce-load -i openssl-dev
tce-load -i liblcdapi-dev
You have to download the packages with tce -w
before starting the script. That way those packages will not be mounted at boot, but by the script.
I use tcz-pack
to create the Slimmer packages.
Pikeyd
I modified Pikeyd found at https://github.com/dozencrows/pikeyd/tree/rotary. I made some code clean up and modified the timing of the main cycle reading GPIO. It eats a bit more CPU (~1.3% on a RPi A+) than the original code, but it does not misses fast rotary encoder events (when you rotate it fast). I will publish that code too later on.
I also made an udev rule file for pikeyd to seamlessly integrate it into the OS.