Author Topic: Using the RPi "Official" 7" Touchscreen?  (Read 2627 times)

ElRay70K70H

  • Newbie
  • *
  • Posts: 22
    • View Profile
Using the RPi "Official" 7" Touchscreen?
« on: June 02, 2022, 03:21:13 AM »
Has anybody looked at using the official RPI 7" touchscreen instead of the default LCD hat/shield? Is the code that manages the display easily accessible, so it can be modified to run on a different screen?

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 228
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #1 on: June 03, 2022, 04:59:27 PM »
I haven't.  I'm assuming you mean one like this:
https://www.adafruit.com/product/2718?gclid=Cj0KCQjw4uaUBhC8ARIsANUuDjUZDxhXH0tgXlQYRn1EQCUKkT3u392mCkQDLmW9uPIJsQiC1x9mMHkaAsRlEALw_wcB

that connects to the DSI display port.  I'm 99% sure that would work just fine.  You could use the MOD web UI (via a web browser on the display) to control everything MOD related.

Now would it display the same as the LCD?  No.  An LCD (multiple are supported) connects via SPI (4-wire interface) and is managed by the pi-Stomp code.  There's no "Display App" that you'd need for such things to display on the DSI display.  But, other than a few things like footswitches, analog knobs and system settings, the LCD is basically a mini representation of the MOD UI.  So why not just use the MOD UI?  You would have to do system management via ssh or maybe create a pi-Stomp management app.  Might not be too difficult to create such a thing.




ElRay70K70H

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #2 on: June 04, 2022, 10:49:24 PM »
I'm assuming you mean one like ...
Yup.  That's the one.
... So why not just use the MOD UI? ...
Because it's a (relatively) tiny 7" screen. I can connect via HTTPS with a laptop or desktop to hit the full UI, but I was thinking of a small, self-contained unit (like a Pod Bean) with a minimal (colored boxes = buttons) interface:
  • Current Pedalboard
  • Current Snapshot
  • Next/Previous Pedalboard
  • Next/Previous Snapshot
  • XRUNS
  • %CPU
  • %RAM
You would have to do system management via ssh or maybe create a pi-Stomp management app.  Might not be too difficult to create such a thing.
Right.  The hooks have to be there somewhere. I figure I could write a Python UI, or even a minimal version of the stock UI that is just a <table> with a bunch of rectangles that respond to being tapped.

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 228
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #3 on: June 05, 2022, 12:53:55 AM »
Other than the performance stats, that's less than what the 2.4" LCD shows.  I guess you just want it bigger?

Hooks?  Well kinda.  MOD's API is only partially complete:

https://github.com/moddevices/mod-ui/blob/master/mod/webserver.py#L2146

Their hardware (Mod Dwarf, Mod Duo, etc.) communicates to mod-host/mod-ui via an exclusive web-socket interface.  I could have possibly taken that route, but the software assumes a lot about the hardware and I thus I would have had to fork the code.  I realized I could get most of what I needed from the API, so I just extended it (by appending endpoints) for the extras I needed (plugin parameter get/set, etc.)

From your list, the missing API's are Current Snapshot, XRUNS, %CPU and %RAM.  Current Snapshot has been on my ToDo list for a while, currently, pi-Stomp is able to get the list of Snapshots and change the Snapshot, so when you change pedalboards, it just sets the Snapshot to the first one (index 0).   That works for most situations except when you change the Snapshot via the MOD UI, it doesn't track on the LCD.

Similar to the endpoints I add, it may be possible to add the ones you want (XRUNS, CPU, RAM, etc.).  Realtime polling could become a CPU suck, but if you maybe just polled once/second and got all that data at once, it might not be too bad.

For system management, you could pilfer what is coded here:
https://github.com/TreeFallSound/pi-stomp/blob/master/modalapi/mod.py#L750

FWIW, there is a pi-Stomper that's been working on a re-write of the LCD/Navigation code.  That will make it somewhat easier to support alternative LCD's and add pages, controls, etc.  The existing LCD code and the re-write use the Pillow (PIL fork) module for graphics.  I suppose it's possible that the rendering methods could be altered to render via the DSI port instead of SPI.  In that sense your 7" could be just another LCD subclass.  You probably want touch control though, not encoder.  That wouldn't be a simple subclass since the behavior of touch navigation is very different that encoder (scroll navigation).



ElRay70K70H

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #4 on: June 05, 2022, 10:41:26 PM »
Other than the performance stats, that's less than what the 2.4" LCD shows.  I guess you just want it bigger? ...
It's a combination of using what I have, and not using the pi-Stomp code.  I started with the Blokas MODEP, but they've fallen behind 1xOS and 2xMOD versions behind, so I'm starting with vanilla MOD-Host and MOD-UI code bases.  Somebody on the Blokas Forums pointed me over here.

This:
Code: [Select]
https://github.com/moddevices/mod-ui/blob/master/mod/webserver.py#L2146and this:
Code: [Select]
https://github.com/TreeFallSound/pi-stomp/blob/master/modalapi/mod.py#L750are huge helps.

Thanks.

ElRay70K70H

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #5 on: July 21, 2022, 04:47:54 PM »
Has anybody looked at the mod-app code? It's a pyqt-based interface to the local mod-host install.  That could server as a base for a 7" touchscreen appropriate interface.

ElRay70K70H

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #6 on: October 03, 2022, 12:24:13 AM »
... FWIW, there is a pi-Stomper that's been working on a re-write of the LCD/Navigation code. ...
Is that swill and/or T2Elektroteknik from the hello-world.py thread?

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 228
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #7 on: October 03, 2022, 12:44:56 AM »
No, that was old thread about hardware testing, not a LCD rewrite.

Check your email.  Last night, I sent you information about the rewrite.

ElRay70K70H

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #8 on: October 07, 2022, 12:04:21 PM »
Thanks! Email sent.

doug

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #9 on: February 08, 2023, 08:15:27 AM »
Hi,

I have just started running modep on my custom pedal build, and am very interested in using pi-stomp to manage the hardware peripherals. Specifically, my build has only 6 footswitches and a waveshare touchscreen: https://doug.lon.dev/software/hardware/2020/07/26/guitarix-pedal.html
I am running this up with a Chromium browser in kiosk mode, loading the modep UI. I can just about operate it on the touchscreen, but I think I will use my laptop for non-live pedalboard config. But, I do want to use the footswitches as in interface during performance.

As such, and in the spirit of hacking things together, I have a local copy of pi-stomp which I have abused to comment out all the LCD code and got it to start and mapped to my footswitch GPIOs. So far, almost so good.

Is there any chance that pi-stomp could extend the yml configuration to disable the LCD instead of having to have locally modified code?
Also, I would like two of the footswitches to do next/prev on pedalboards rather than presets. Or, maybe both, using another switch to change board/preset modes ... ?

I'd be happy to help out making these changes if you think these are sensible additions to support hackers using their own hardware?

Regards,
Doug.
« Last Edit: February 08, 2023, 08:18:54 AM by doug »

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 228
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #10 on: February 08, 2023, 03:57:12 PM »
Really cool project you have going there.  Congrats.

There is a mode you can run the pi-stomp software in that initializes much of the hardware without LCD/encoder navigation, and without presumption of using MOD.

Just run:
modalapistomp.py --host generic

You can see how that is implemented here:
https://github.com/TreeFallSound/pi-stomp/blob/master/modalapistomp.py#L103

You could alternatively create your own subclass of Handler similar to GenericHandler to pull in just the pieces you want.

Regarding next/prev for pedalboards, yeah that would be nice, but what would "next" mean?  You have a collection of pedalboards, would it just take you to the next one alphabetically?

MOD Banks, does allow you to create a sub-collection of pedalboards which you can order.  To me, that's where "next" and "prev" make sense.  pi-Stomp doesn't have support for banks yet, but it is high on my list of features to add in the next few months.  The hold up so far has been that we're going to revamp the LCD UI and since Bank support could leverage that, it makes sense to add it after the new UI is complete.

If you want to roll your own bank support, here are the API's which might be useful:
curl localhost/banks  # list of banks and their included/ordered pedalboards with bundlepath

curl localhost/reset
curl -F 'bundlepath=BUNDLEPATH'  localhost/pedalboard/load_bundle/  # change current pedalboard



doug

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #11 on: February 09, 2023, 11:46:35 AM »
Hi,

Thanks for the info - I'll probably just wait a few months for your next updates, sounds very interesting. If I need anything else in the meantime, I'll look into the APIs, thanks for the info.


ElRay70K70H

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #12 on: February 16, 2023, 10:34:40 AM »
@Randall:Wow! thanks again for all the work you put in to this.  Is there a documented API list? Is this API from MOD Devices, or things you've exposed/wrapped, or a combination of both?

@doug: Nice work!

Regarding the original post, I ran into some issues with connector heights/cable-lengths, the intended enclosure and a power supply hat, so I stuck the RPi4 and SSD card into another enclosure and use it with a USB audio interface. I've been happy enough, that I haven't come back to the touch screen version.  I'll likely revisit this after the UI re-write.

Thanks again, Randall

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 228
    • View Profile
Re: Using the RPi "Official" 7" Touchscreen?
« Reply #13 on: February 20, 2023, 11:42:46 AM »
Regarding a "documented API"... No, I wish.  The endpoints in the mod-ui code are as good as it gets:
https://github.com/moddevices/mod-ui/blob/master/mod/webserver.py#L2212

Yeah, I spent many days digging into their code, trying to decipher the format of the data that many of those endpoints expect.  Those endpoints provide most things pi-Stomp needed.  I did need to create two additional ones for getting/setting plugin parameters.  Those get bolted on by the setup scripts.

Much of their API is used by their own hardware.  Those ("hmi") endpoints have additional handshaking that I've not been able to mimic.  And frankly, I'm not sure MOD would be cool about us reverse engineering that.  But such access would be required to have pi-Stomp react to changes made in the MOD-UI.  Currently, all the interaction between pi-Stomp and MOD-UI is initiated by pi-Stomp.  Thus, Pedalboard tweaks you do in the MOD-UI, will be heard but they don't get reflected on the LCD.  The exception is changing a pedalboard via the MOD-UI - there is a file on disk that gets modified so pi-Stomp can poll that and change it's display when you change the pedalboard.