Closed PaulskPt closed 3 years ago
I tried to replicate this issue but was unable to. I tested the latest versions of all used libraries from the bundle, and I tried CircuitPython 6.1. 0, 6.2.0, 6.3.0, and 7.0.0 alpha5. All seemed to run the simpletest script successfully for me.
@PaulskPt can you post what version of CircuitPython is on your MagTag? You can find it by checking inside of the boot_out.txt
file. You can paste the entire contents of that file in a comment here.
Aside from letting us know what version of CircuitPython have my other recomendation is to update all of your libraries, especially adafruit_magtag
and neopixel
(but doing all libraries can be helpful) you can delete the files from these from your lib
folder and then paste in new ones from a fresh copy of the bundle downloaded from here: https://circuitpython.org/libraries
One other question as well, did you modify the neopixel library file? I noticed in your screenshot that the parameters inside of the __init__()
function are commented out and there is an extra line next to the commented one that is missing the *
parameter. Looking at the current version of the neopixel library code on Github it seems that the line commented out in your screenshot is the one that is present in the released version of the library. If you edited that, I would recommend putting it back to how it was (or deleting your copy and getting a fresh one from the bundle as noted above).
@FoamyGuy. Thank you very much for your extensive investigation. To answer one of your questions: below a screenshot of the contents of boot_out.txt.
Earlier in the day I had a problem with a code.py that caused the MAGTAG to reset constantly, making it unable to connect with whatever device and/or app. I learned from @danh how to wipe out the entire flash memory using esptool from cli (I did this in a Ubuntu Linux session) (later on I discovered that I also could do this successfully using the Adafruit webbased Esptool. So I cleaned the flash. Then I flashed combined.bin (of Tinyuf2 (?)), then I flashed CP. Next I copied all the necessary libraries and files I wanted to be in the CIRCUITPY drive. All files from the latest edition of CP (see screenshot above in the issue opening text).
Regarding your last question. You did see very well (very attentive!) that - in an attempt to find a clue/solution to the reported error, I modified the '*' (3rd param) in the neopixel init() call) - this didn't work out so I 'repaired' my mod, and then I used the .mpy version (as I did from the start - if I can I use .mpy files only), so the modded file was not used. I put it with some other .py versions in a separated folder within the /lib folder. I copied those .py versions only for reason of the investigation.
Btw. the earlier problem of the MAGTAG resetting every second or so caused problems in my MS Windows 10 desktop, in fact the File Explorer became damaged and behaving strange. Fortunately I was able to tackle that side-problem.
About noon yesterday (Z+1) I soldered a 2-pin strip onto the TX and RX holes on the back of the MAGTAG aside of the ESP32-S2 chip. See the images. After this I successfully monitored the output of the ESP32-S2 with KiTTY. I did the soldering with a light solder iron and carefully, using a magnifying loupe to see my actions more clearly. See the three images at the end.
Yesterday evening, Initially I posted my question in Discord but then I saw that there was a recent commit of the Peripheral.py file, I deleted the (2) posts. Then I created this issue here in GitHub.
Thank you again for trying to help me to solve this. I will now (again) go to download a fresh copy of all the files in question.´
I think the problem is solved. After downloading, extracting and copying all the libraries and individual .mpy files, suddenly appeared a white screen with "Hello World" centered (see image). I copied one after one - I didn't see/check at each move the result - I copied the fonts lib as last. I think (but have no prove) that the problem was the folder with adafruit_bitmap_fonts. I also deleted some .py files I had there for a Google OAuth2 test.
To finish I have one more question: How can I 'catch' events of constant resets to not loosing control. Yes, the obvious answer would be: write an error-free script! I have a habit to build-in try - except blocks at crucial locations in the scripts. I have quite some years of experience with python. I built scripts for receiving/decoding/presenting gps messages broadcasted by an addon for various flightsimulators, most recent: MSFS2020, and displaying the results on a 4x20 LCD (I2C) . I program since I had my 1st Apple ][ in 1978. But I am relatively new to uPython and CircuitPython. B4 I received my 1st RPi Pico I experimented a year with an ESP32-S2 Saloa-1R and an ESP32-S2 Kaluga-1 building apps using ESP-IDF toolchain.
Afterburner: I just discovered/remembered that, yesterday, I copied adafruit-circuitpython-bundle-7.x-mpy-20210729 's neopixel.mpy from the /lib/seesaw folder instead from the /lib folder. Maybe that caused the error. Time to close this issue which happened not to be an 'issue'.
Ah! yes I have just confirmed on my device that using the neopixel.mpy
file from inside of the adaruit_seesaw
library instead of the "standard" neopixel library file does cause the error that you saw.
With regards to the restarts and reconnecting to the host PC I am probably not the most well suited to answer that. I don't recall ever encountering an issue like that before and my host OS is Linux based so it may react or behave differently than windows would in a situation like that.
You can use try/except
in your code though to catch errors instead of crashing your code i.e:
try:
# some code
# here that might cause
# a crash
except:
print("The code caused an Error")
If you know the specific exception types that might be raised you can also specify those in the except line and handle different types of errors in different ways by including multiple except lines, one for each type of error that can be raised.
Glad you were able to figure it out and thank you @FoamyGuy for helping.
Suddenly getting TypeError in Peripherals.py, line 46: 'function missing required positional argument #3' called from a standard example script.![Code_py](https://user-images.githubusercontent.com/9107950/127579252-54125ad9-47b6-41b5-9304-91a76f9b402e.png)