adafruit / PyLeap-iOS

MIT License
13 stars 1 forks source link

not working for "larger" demos #13

Closed jerryneedell closed 2 years ago

jerryneedell commented 2 years ago

I tried the updated PyLeap and while it works fine for "Blink" -- I can't load the larger demos... Sound Meter or Light Meter for example. they start to load, then hang -- the CPB flashes Red (2 blinks every 5 or so seconds) -- when I look with File Glider, I can see that the new code.py file is there, but none of the additional library files have been transferred. I am using the latest build of CP.

kattni commented 2 years ago

I was able to replicate the issue with 7.1.0-beta.1. The larger demos are working in 7.0.0.

TrevKnows commented 2 years ago

@jerryneedell Howdy! Thanks for the heads up. We're in the process of figuring out what went wrong here.

jerryneedell commented 2 years ago

FYI -- I reverted to 7.0.0 and I still cannot get it to work Following Scott's suggestion , I disabled the USB drive and connected to my computer The Blink demo still works, but when I try to load the Sound Meter - it hangs and If I reboot I get

Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit Circuit Playground Bluefruit with nRF52840
>>> 
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 10, in <module>
ImportError: no module named 'adafruit_circuitplayground'

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.
tannewt commented 2 years ago

I added some prints for writes and mkdirs and get:

staring write to /code.py
write ok
staring write to /lib/adafruit_bus_device/__init__.py
f_open error
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 9, in <module>
ImportError: no module named 'adafruit_circuitplayground'

Based on Glider, I have a lib directory already but not /lib/adafruit_bus_device/.

I think there are two things to do here:

My branch with logging is here: https://github.com/tannewt/circuitpython/tree/test_ble

TrevKnows commented 2 years ago

@tannewt Within PyLeap, if a lib directory exists on the device, it then creates a new directory /lib/adafruit_bus_device/, creates a lib/adafruit_circuitplayground directory, then continues to write to the device.

I wonder if there's an issue with the make directory command. (BTW - I've not been able to recreate this issue while using CircuitPython 7.1 beta1)

tannewt commented 2 years ago

@TrevKnows where is that done? I didn't see any mkdir commands come into the device.

TrevKnows commented 2 years ago

@tannewt it's done within the ProjectViewModel.swift module. - I've found the problem. I'm missing the function that checks the lib directory for lib/adafruit_circuitplayground directory & /lib/adafruit_bus_device/. Fixing that now.

tannewt commented 2 years ago

Ok, this code will need to be refactored. We shouldn't need to hard code the transfer of each file. Instead, we should have a generic function that can transfer all of the contents from a zip file.

I'm looking here: https://github.com/adafruit/PyLeap-iOS/blob/f5650f47300fac6395eda1c03fdaf9c78bd37257/PyLeap/Views/Project%20Views/ProjectViewModel.swift#L3616

Do you want me to review https://github.com/adafruit/PyLeap-iOS/pull/12 or just merge it?

jerryneedell commented 2 years ago

FYI -- the MACOS version of PyLeap is working OK loading the "larger" projects.