Threw hammer away and gave it one final shot and its working…
Updated:
Added a global var prev_number, to avoid errors when the file is being written by the GPIO polling;
void draw_spect_display(U8G2 &u8g2, const display_info &disp_info)
int number;
FILE *file = fopen("/home/volumio/scripts/status.txt", "r"); // read only
if (file == NULL )
{
printf("Error! Could not open file\n");
number = prev_number;
} else {
fscanf(file, "%d", & number );
prev_number = number;
fclose(file);
}
if ( number == 1 ) {
// do stuff
} else {
// do stuff
}
#!/bin/bash
# select pin GND - D0
GPIO=0
# Init Status
STATUS=0;
# Set the GPIO as Input
if [ ! -d /sys/class/gpio/gpio${GPIO} ]; then
echo "${GPIO}" > /sys/class/gpio/export
fi
echo "in" > /sys/class/gpio/gpio"${GPIO}"/direction
#Read the current status
STATUS=$(cat /sys/class/gpio/gpio"${GPIO}"/value)
Ah, a bit like in Windows then. You install the correct driver and that exposes GPIO to the OS! I’ll shall be doing this soon! Thanks I didn’t know that that the Ch341 driver also support GPIO as well as I2C!
So now I have a hp-elitedesk-g1-800-mini-intel-core-i5 Running volumio, with i2c and GPIO, and a solid case for 110 Euro.
And a Dell Wyse 3040 Running volumio, with i2c and GPIO, and a solid case for 60 Euro.
Pretty sure it beats the rPi
I see you found the driver by accident. Good news though! I think you must be the first person in the world to have mpd_oled running on x86 maybe? We can’t keep hanging around waiting for pis to come back in stock - it’s been a good couple of years now. Dell Wyse 3040 for the win!
Thank you for taking the time to put everything into a document. There is no pull request, but I am not currently accepting changes to the repository.
Some notes on the instructions:
The instructions include commands and images that refer to mpd_oled options that are specific to your repository, and this makes the instructions incompatible with the main repository
The instructions include commands (in “Configure a copy of the playing audio”) to install the armhf binary package (!). If you have installed mpd_oled from source then the mpd_oled_volumio_mpd_conf_install script should also be installed, and there is no need to install any binary package.
I didn’t understand “Get headers to perform make (will break ATO)”. Does this refer to Volumio updates (ATO = OTA?). If this is the case, I think it is very useful for users to also have instructions to restore the system to an updateable state. (Even better is to find a solution that does not break updates, for example I would like to replace mpd_oled_volumio_mpd_conf_install with a simple audio copy plugin)
Maybe, Volumio would be open to automatically enabling access to I2C/SPI/GPIO on x86, rather than users having to run commands like sudo addgroup volumio i2c.
Maybe Volumio would be open to including modules for common I2C/SPI/GPIO adapters.
Thanks for your reply.
The instruction are just in Alpha state, As I still need to sort out a couple of things.
Maybe I will make this a stand alone repo, only for x86. Let’s see if people catch up before I spend a lot of time on this. The added option -L is only a change in main.ccp and display_info.h which has no impact on the main branch as it’s not mandatory.
This I need to sort out what armfh is adding that it works “mpd_oled_volumio_install_latest.sh”
Already talked with @gkkpch on this matter. The headers have been left out to reduce disk image size. Since it will touch the core image OTA will be blocked for the same. The kernel headers are needed to perform the make. Haven’t found a way yet to work around this
I’ve asked @gkkpch to include the driver in the next built. Not sure if we should add a latter of modules as we’re talking over a low budget thing. This one is working with acceptable FPS and drivers for linux.