peterhinch / micropython-touch

A GUI for touch panel displays.
MIT License
17 stars 2 forks source link

Difficulty getting setup display test to run on Raspberry Pi Pico #7

Closed bianc104 closed 2 weeks ago

bianc104 commented 1 month ago

Hello! I've been attempting to utilize this library on a raspberry Pi Pico with ST7789 (Pico-ResTouch-LCD-2.8). After installing micropython on the pico, I've been following the instructions provided in SETUP.md until I encountered an issue at section 2.3 - Test the display.

After running mpremote mount . and attempting to paste the given code as provided, I encounter this error:

Traceback (most recent call last):
  File "<stdin>", line 1
SyntaxError: invalid syntax

After a fair amount of experimentation, I haven't been able to get it to work. Attempting to run a file with said code in it, placed in the micropython-touch directory, using the Visual Studio Code extension "MicroPico Device Controller" (Here) resulted in:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'hardware_setup'

I am fairly new to working with a Pico and micropython, so it is possible I'm missing something fairly basic. Any help would be greatly appreciated!

peterhinch commented 1 month ago

I suggest you stick to mpremote mount . because mpremote is the official tool and because that is how the GUI was developed.

Ensure you're in the micropython-touch directory. Copy the file setup_examples/st7789_ws_pico_res_touch_pico.py to hardware_setup.py (overwriting the existing file). You should now be able to follow the instructions at the REPL.

bianc104 commented 2 weeks ago

Thank you for your assistance!

I attempted a reinstall from scratch on a different machine (also running a different version of Linux) following what you have stated here and found myself running into the same issue. I did discover after enough experimentation, however, that I was able to submit each line of the script provided in Setup 2.3 individually and it ultimately worked - something I then tested and found to work on the original system and setup, as well. On each system I attempted to perform setup on, the ctrl-e, ctrl-v, ctrl-d combo resulted in failure (three different terminals across two different Linux distributions). What's strange about that is that multi-line paste in that fashion seems like it works (it enters paste mode and seems to accept the lines) but presumably the input is getting malformed somewhere along the line. That may be a bug with using mpremote on these systems, but I'm not really sure.

I found an easier way to run the test code from Setup 2.3 was to create a Python file in the same folder as hardware_setup.py and run that by importing it instead of trying to paste the code in "on the fly".

As for the Visual Studio Code extension I had mentioned, that does seem to function correctly with this library as well, however to get it working I found that I needed to run the extension's command to "Upload project to Pico" before running an individual script.

All of that being said, it appears as though everything is working for me now. Thank you again for your help!