Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two-encoder multimode not working due to missing lib files. How do I reset cirtcuitpy? #5

Open
thundernixon opened this issue Dec 28, 2018 · 5 comments

Comments

@thundernixon
Copy link

I've successfully set up a 6-key MiniKbd and I'm now working on the two-encoder version.

I am able to get this working with the main.py of the Two-Encoder Keyboard configuration, but when I upload the main.py of the Two Encoder Multimode configuration, input is no longer registering.

I am trying to detect input with the suggested terminal serial console

Actually, I'm now seeing that the input is triggered by print statements like print("enc-1-up") in the main.py. However, this has led into another error when I refresh the serial console:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
ImportError: no module named 'adafruit_hid.consumer_control'

I see that there are lib files available such as consumer_control_code. I took the step (which I now see wasn't the best idea) of trying to reset my trinket m0, thinking that it must need the newer version. This has led me down a bit of a rabbithole.

I've tried to reset the trinket with the Adafruit instructions here. However, I'm now unable to copy over the basic files.

image

image

I suspect that this may be due to my inability to delete the .trashes folder.

image

I'll keep troubleshooting this and update here when I solve it. However, if anyone knows of any easy way to solve this, I'd appreciate some pointers!

(As a sidenote, it may be useful to include something in the files or in the readme of the multimode software about adding the necessary extra lib files).

@thundernixon
Copy link
Author

I have found that it's simple to delete hidden files if I open CIRCUITPY in VS Code.

However, I am now trying to add in the correct .mpy files, but I get a "Not enough disk space" error:

image

@andyclymer
Copy link
Owner

First, you're on the right track.

The default configuration of a Trinket M0 doesn't have all of the Python packages installed because of (as you've noticed) the very limited amount of storage space on the device. The consumer_control library is one of those.

After updating to the latest version of Circuit Python, you'll want to also grab the latest release of the library (which it sounds like you've done) here:
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases

Since there's such limited storage space on the device, try to remove any .mpy files that you don't need — for instance if you code no longer needs the mouse library or the neopixel library. And then empty your trash to completely remove the files.

Adafruit also has some good advice here on keeping a drive space free with the Mac, try to see if any of this helps:
https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#running-out-of-file-space-on-non-express-boards-18-36

Give those a shot, and let me know if it helps!

@thundernixon
Copy link
Author

thundernixon commented Dec 29, 2018

Wow, that space really is limited! The adafruit troubleshooting link you provided is very helpful, however. Thanks!

I was able to successfully delete everything via the terminal commands and start again, adding from files from the working other MiniKbd, plus some from the 4.x circuitpy release. However, I was getting an error:

Traceback (most recent call last):
  File "main.py", line 6, in <module>
ValueError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.

I was able to solve this by really replacing all the lib files with files from the 4.x download, rather than just some of them.

After bringing in the two-encoder py files, it's working like a charm to control volume in one mode, and brackets/zx in the other mode.

Thanks for the help!

@andyclymer
Copy link
Owner

Yeah, the space is super limited. I think my next project will use the Adafruit ItsyBitsy or Feather which have a extra 265k of storage, which is massive in comparison :)

You're learning some good lessons with this project! And I'm learning what I need to update in the docs. If you upgraded to CircuitPython 4 on your Trinket, then as you found you do need to update all of the mpy files for version 4. I keep that Adafruit_CircuitPython_Bundle folder handy on my computer and only copy over the mpy files that I need at the moment.

Glad to see that it worked after you made that switch! I'll leave this issue open until I update the docs with a recommendation (but it will be pretty much exactly what you've done)

@thundernixon
Copy link
Author

Ran into this again today, and https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#running-out-of-file-space-on-non-express-boards-18-36 really helped, particularly the steps shown on using the terminal to prevent metadata files and to copy over files without making new metadata files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants