RuntimeError: maximum recursion depth exceeded

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: RuntimeError: maximum recursion depth exceeded

Post by pythoncoder » Thu Jan 19, 2017 3:52 pm

Lornioiz wrote:...It is 2400 rgb tuples (XXX,YYY,ZZZ) each file...
On the face of it, that is a lot. However RGB values are usually 8 bits. If you can constrain them to bytes the RAM requirement is 2400 * 3 files * 3 bytes = 21600 bytes which is manageable if you load the data at the start of your program. An option might therefore be to store the data in a bytearray object. An individual RGB value could be accessed by

Code: Select all

a = 1900 # tuple no. 0 to 2399
fileno = 1 # 0 to 2
index = fileno * 2400 + a
r, g, b = mybytearray[index: index+3]
Or is there a way with your existing scheme for your main loop to read the data necessary for the ISR from the files, which is then accessed from RAM?
I do think reliability will be improved if you can find a way to avoid file operations in an ISR.
Peter Hinch
Index to my micropython libraries.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: RuntimeError: maximum recursion depth exceeded

Post by Roberthh » Thu Jan 19, 2017 4:26 pm

that means that once one operation (like writing a file) is interrupted by, let's say, a read operation, it cannot be resumed and therefore the filesistem gets corrupted?
Yes, that's what I have seen. If one call changes global data of the FAT file system, it will be efective also for the interruted task. Just think of a simple example, that the interrupting code changes the working directory. That will be effective from that clock cycle on.

Post Reply