10-21-2020, 02:00 AM
(10-20-2020, 03:18 PM)purlupar Wrote: Now, I can't succeed to get it running on the simulator or the watch, which is why I originally posted here (2 or 3 posts above this). This happens in the simulator:
Code:>>> from apps.chrono import ChronoApp
>>> wasp.system.register(ChronoApp())
>>> wasp.system.run()
Watch is running, use Ctrl-C to stop
PWM.__init__(0, <machine.Pin object at 0x7fafe8eae160>) {'freq': 'FREQ_16MHZ', 'duty': 25, 'period': 16000}
PWM.init() {}
PWM.deinit() {}
MOTOR: set on
Traceback (most recent call last):
File "/home/david/PineTime/wasp-os/wasp/wasp.py", line 389, in run
self._tick()
File "/home/david/PineTime/wasp-os/wasp/wasp.py", line 349, in _tick
self._handle_touch(event)
File "/home/david/PineTime/wasp-os/wasp/wasp.py", line 319, in _handle_touch
self.app.touch(event)
File "/home/david/PineTime/wasp-os/wasp/apps/launcher.py", line 58, in touch
wasp.system.switch(app)
File "/home/david/PineTime/wasp-os/wasp/wasp.py", line 174, in switch
app.foreground()
File "/home/david/PineTime/wasp-os/wasp/apps/chrono.py", line 65, in foreground
self.draw(effect)
File "/home/david/PineTime/wasp-os/wasp/apps/chrono.py", line 166, in draw
self.ringM()
File "/home/david/PineTime/wasp-os/wasp/apps/chrono.py", line 130, in ringM
self.mark((120, 120), gry, 50, 112, 1, 120, 5, 0, 600)
File "/home/david/PineTime/wasp-os/wasp/apps/chrono.py", line 88, in mark
d.fill(c, int(z[0]+co*p-w//2), int(z[1]+si*p-w//2), int(w), int(w))
File "/home/david/PineTime/wasp-os/wasp/draw565.py", line 138, in fill
display.set_window(x, y, w, h)
File "/home/david/PineTime/wasp-os/wasp/drivers/st7789.py", line 131, in set_window
self.write_data(bytearray([y >> 8, y & 0xff, yp >> 8, yp & 0xff]))
ValueError: byte must be in range(0, 256)
I suspect that int(z[1]+si*p-w//2) has evaluated to a negative number (resulting in one of the four expressions on the last line being out of range). When running on the simulator it should be easy to print them: perhaps modify the set_window() method to print out all its arguments.
It will be a slow but it should be fairly clear.