DEV: [PLUGIN] MPD_OLED for x86 based systems

@Wheaten £40 direct to my front door. Looking forward to it…
@gkkpch I did consider your often though! I think I would have been hit with an import tax thanks to Brex*t! :sleepy:

Nope he ships from Germany…

Yas and to receive anything from Germany to UK there’s import tax. :worried:

@supercrab, agree, that’s why I prefer shipping within/from eu to avoid disappointments because of customs issues.

O, then it would be export (Swizz) and import tax (UK) :slight_smile:

1 Like

No, always shipping from Germany, I’m just over the border, in Germany 3-4 times a week.

1 Like

It’s a total shitshow now :frowning: Anyway, will hopefully joining the x86 club next week! :sunglasses: It still feels a bit weird to not use a raspberry pi to run Volumio, it’s gonna take some time to get my head around it

Well, I get the impression that the x86 runs more stable than the rPi, especially with webradio. Where the rpi has regular interrupts, the x86 has way less.
With the CH341A, I have i2c and GPIO working. Only some plugin’s are not available for x86.

ow and using a switch to switch between full Cava and track information is not going to work, as I can’t keep an active while true; do when the MPS parameters are called, the loop stalls.
Can’t have it all.

It’s working when I reboot, :slightly_frowning_face:

1 Like

Ah that’s a shame. I don’t know much about Linux so I can’t really offer any pointers :sleepy:

Why does the loop stall? Is there a runtime error or a design issue?

The mpd_oled package is running in a loop, so If i call it , the calling script waits for a response. Even if I pipe the output to /dev/null. If I manual kill the MPD_OLED pid’s, the calling script is still stalled.

Also tried to call the bash command for MPD via python, same results.

So you want mpd_oled to do something in the main loop? Can’t you change mpd_oled to detect the change in the main loop?

Maybe get mpd_oled to read file and check the contents and then do action based on that? Or can you get mpd_oled to read a file frin the local web server i.e. http://localhost/some file

Yeah will look at it later.
Also found some issues when the player has paused/stoppped for a period of time. The display switch between stop and play, but CAVA won’t start.

Need to set it aside for a couple of days to reset my brain, otherwise I will get stuck in the same train of thoughts.
In the mean time I am going to add <prev> <play> <next> <randomizer> buttons.

I am not sure if the while loop is in a script or is the one inside mpd_oled, but perhaps you could handle the GPIO stuff in a separate process or thread, and simply communicate the state back, e.g. by setting a variable for the while loop to check.

in pseudo:
Started script through service

while true; do
if status != prev_status  #(Current GPIO0 != Previous GPIO0)
  kill pid MPD
  if GPIO == 1 then 
     ./scriptb #(starts original MPD)
  elif GPIO == 0 then 
   ./scriptc #(starts only CAVA MPD)  
  fi
else
  do nothing
fi
done

But then the while will get stuck at calling ./scriptb or /scriptc.
So going to research (handling GPIO with C, no clue yet :slight_smile: ) handling the GPIO value within MPD_OLED.
And trying to find out why CAVA won’t start after a pause.

What is the contents of the scripts, e.g. scriptb?

scripta:

sudo -u volumio /usr/local/bin/mpd_oled -b 20 -g 2 -P s -L t -o SSD1306,128X64,I2C,bus_number=$(dmesg | grep -iE "ch341_i2c_probe: created i2c device" | sed 's/^.*[/]//' | sed 's/.*-//') -f 50

scriptb:

sudo -u volumio /usr/local/bin/mpd_oled -b 20 -g 2 -P s -L n -o SSD1306,128X64,I2C,bus_number=$(dmesg | grep -iE "ch341_i2c_probe: created i2c device" | sed 's/^.*[/]//' | sed 's/.*-//') -f 50

added extra arg -L
t = trackinfo (original and default)
n = no trackinfo, only CAVA

So I need to add/handle the GPIO detection in
void draw_spect_display(U8G2 &u8g2, const display_info &disp_info)

Ok. mpd_oled will run until it is killed, and scriptb will not return until mpd_oled terminates. There is nothing external to kill mpd_oled, and so your while loop hangs at the script.

What you could do instead is run mpd_oled as a service, and then have your scripts call mpd_oled_service_edit. mpd_oled_service_edit will restart the mpd_oled service with the new parameters and then exit. and your script will return to the main loop. There is no need to kill/stop the service in the while loop.

You could do it there, if you are simply checking a variable. Whaterever you do there should always complete quickly, otherwise you will wait to draw the frame.