andyclymer / minikbd

120 stars 9 forks source link

Getting memory allocation error #1

Closed kglasnapp closed 6 years ago

kglasnapp commented 6 years ago

I got two of your boards and set one of them up as a 6 key. I tried putting the software on the trinket and I get the output below:

Press any key to enter the REPL. Use CTRL-D to reload. soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. main.py output: Traceback (most recent call last): File "main.py", line 8, in MemoryError: memory allocation failed, allocating %u bytes

I tried it both on Circuit Python 2 and 3.0.3 and they both had the same problem. I am attaching a zip of the circuitpy directory that I used with 3.0.3 to help understand what may be wrong. pack.zip

Note: The boards are beautiful

Thanks for your support Keith Glasnapp

andyclymer commented 6 years ago

Hi Keith, thanks for building the MiniKbd! I'm sorry you had this problem...

The memory error happens when main.py tries to import my ButtonMatrix library.

I've built a good number of the six key variety without this problem but I have a thought — is there any chance you're using the device on Windows? I've only tested this configuration on the Mac where it doesn't use the additional Windows driver that comes on the Trinket, so there's a chance that it just exceeds the amount of memory available on the Trinket when it also has to load the additional driver.

My ButtonMatrix library is a little bit over-engineered, it's really built to work with any number of buttons that are set up in a matrix of rows and columns, but this is a little bit overkill for the MiniKbd which will always only be configured with two or six buttons. I'm going to slim the library down just for the MiniKbd to keep its memory usage in line. My six-key build is at my studio space, so I'll update the code tonight and test it when I'm at the studio in the morning. I'll follow back up here once it's all set.

andyclymer commented 6 years ago

Hi @kglasnapp , I have some updated code that I think should solve this problem. When you have a moment, would you try the new "Six Key" sample code?

The old example used my ButtonMatrix library which is built to work with any number of buttons, this new sample code instead uses a miniKbdButtons library which has been pared down by quite a lot. It will use less storage and memory on the Trinket M0, and I hope that this will resolve the problem of the MemoryError you were having.

It's working for me over here, please let me know if it works for you!

Andy

kglasnapp commented 6 years ago

Thanks – I will give it a try in the morning.

Keith

From: Andy Clymer [mailto:notifications@github.com] Sent: Monday, October 29, 2018 10:37 PM To: andyclymer/minikbd Cc: kglasnapp; Mention Subject: Re: [andyclymer/minikbd] Getting memory allocation error (#1)

Hi @kglasnapp https://github.com/kglasnapp , I have some updated code that I think should solve this problem. When you have a moment, would you try the new https://github.com/andyclymer/minikbd/tree/master/Software/SixKeys-Template "Six Key" sample code?

The old example used my ButtonMatrix library which is built to work with any number of buttons, this new sample code instead uses a miniKbdButtons library which has been pared down by quite a lot. It will use less storage and memory on the Trinket M0, and I hope that this will resolve the problem of the MemoryError you were having.

It's working for me over here, please let me know if it works for you!

Andy

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/andyclymer/minikbd/issues/1#issuecomment-434150399 , or mute the thread https://github.com/notifications/unsubscribe-auth/AD5B8oI4p-3nsGAl7gZvn4KbTBadXdEeks5up7tAgaJpZM4X9_b0 . https://github.com/notifications/beacon/AD5B8sBbdN2SXyvF50tyDFCk7ig-kYZ9ks5up7tAgaJpZM4X9_b0.gif

kglasnapp commented 6 years ago

Thanks so much it worked.

Keith

From: Andy Clymer [mailto:notifications@github.com] Sent: Monday, October 29, 2018 10:37 PM To: andyclymer/minikbd Cc: kglasnapp; Mention Subject: Re: [andyclymer/minikbd] Getting memory allocation error (#1)

Hi @kglasnapp https://github.com/kglasnapp , I have some updated code that I think should solve this problem. When you have a moment, would you try the new https://github.com/andyclymer/minikbd/tree/master/Software/SixKeys-Template "Six Key" sample code?

The old example used my ButtonMatrix library which is built to work with any number of buttons, this new sample code instead uses a miniKbdButtons library which has been pared down by quite a lot. It will use less storage and memory on the Trinket M0, and I hope that this will resolve the problem of the MemoryError you were having.

It's working for me over here, please let me know if it works for you!

Andy

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/andyclymer/minikbd/issues/1#issuecomment-434150399 , or mute the thread https://github.com/notifications/unsubscribe-auth/AD5B8oI4p-3nsGAl7gZvn4KbTBadXdEeks5up7tAgaJpZM4X9_b0 . https://github.com/notifications/beacon/AD5B8sBbdN2SXyvF50tyDFCk7ig-kYZ9ks5up7tAgaJpZM4X9_b0.gif

andyclymer commented 6 years ago

@kglasnapp Great, let me know if you have any other problems or questions!