This definitely fixes a problem, but I'm still experiencing instability.
Testing was done on an SF2W with all modules frozen. The
draw_glyph method is Native and calls a Viper function. If the module containing the method (
driver.py) is not frozen, everything works. If it is cross compiled and put in the filesystem, everything works.
The oddest symptom is that I can paste lines one at a time at the REPL and the code runs, but if I paste multiple lines it crashes. For example this crashes. The
draw_glyph method runs once correctly but crashes: no print data appears:
Code: Select all
from time import sleep_ms
import micropython_ra8875.support.font14 as font14
from micropython_ra8875.tft_local import setup
tft = setup(True, True)
x = 0
y = 100
fmv, rows, cols = font14.get_ch('A')
sleep_ms(500) # Just being conservative here
tft.draw_glyph(fmv, x, y, rows, cols, (0, 255, 0), (0, 0, 0))
print('gh1')
x += cols
sleep_ms(500)
tft.draw_glyph(fmv, x, y, rows, cols, (0, 255, 0), (0, 0, 0))
print('gh2')
By contrast if I paste
Code: Select all
from time import sleep_ms
import micropython_ra8875.support.font14 as font14
from micropython_ra8875.tft_local import setup
tft = setup(True, True)
x = 0
y = 100
fmv, rows, cols = font14.get_ch('A')
I can then do this until the cows come home:
Code: Select all
>>> tft.draw_glyph(fmv, x, y, rows, cols, (0, 255, 0), (0, 0, 0))
>>> x += cols
I've not previously encountered a case where pasting at the >>> prompt produces different behaviour from pasting at ===.
To add to the confusion three programs call the
draw_glyph method in very similar ways. One (the actual big application) works. Two simple test programs crash (at the same point as above).
Code lurks
here.