
State of PewPew for 2020-03-11 ****************************** News ==== * CircuitPython 5.0.0 has been released https://circuitpython.org You can update your PewPews by following https://pewpew.readthedocs.io/en/latest/pewpew10/hardware.html#updating-the-... * PewPew M4 is on sale now. You can get it at https://makerfabs.com/circuitpython-pewpew-m4.html * Christian Walther got the PewPew Lite to work with the Giant Board https://twitter.com/isziaui/status/1236261673960423424 -- Radomir Dopieralski

* Christian Walther got the PewPew Lite to work with the Giant Board https://twitter.com/isziaui/status/1236261673960423424
And in case anyone is wondering what I meant by "almost" unmodified, here is the diff: - Blinka's neopixel_write module raises NotImplementedError, so that must be caught in the initialization of the pew module. - Apparently CPython does not insert a module into sys.modules when its import terminates with an exception (e.g. pew.GameOver), so the menu must be prepared for it not to be there. All the I2C stuff just worked without modification, as did all the games I tried. diff --git a/pew.py b/pew.py index e8f5893..8fb7c27 100644 --- a/pew.py +++ b/pew.py @@ -4,7 +4,7 @@ import busio import digitalio try: import neopixel_write -except ImportError: +except (ImportError, NotImplementedError): pass import time diff --git a/main.py b/main.py index eb231f7..137d9c7 100644 --- a/main.py +++ b/main.py @@ -130,5 +130,7 @@ if __name__ == '__main__': __import__(game) except pew.GameOver: pass - del sys.modules[game] - + try: + del sys.modules[game] + except KeyError: + pass -Christian

* Christian Walther got the PewPew Lite to work with the Giant Board https://twitter.com/isziaui/status/1236261673960423424
And in case anyone is wondering what I meant by "almost" unmodified, here is the diff: - Blinka's neopixel_write module raises NotImplementedError, so that must be caught in the initialization of the pew module. - Apparently CPython does not insert a module into sys.modules when its import terminates with an exception (e.g. pew.GameOver), so the menu must be prepared for it not to be there. All the I2C stuff just worked without modification, as did all the games I tried. diff --git a/pew.py b/pew.py index e8f5893..8fb7c27 100644 --- a/pew.py +++ b/pew.py @@ -4,7 +4,7 @@ import busio import digitalio try: import neopixel_write -except ImportError: +except (ImportError, NotImplementedError): pass import time diff --git a/main.py b/main.py index eb231f7..137d9c7 100644 --- a/main.py +++ b/main.py @@ -130,5 +130,7 @@ if __name__ == '__main__': __import__(game) except pew.GameOver: pass - del sys.modules[game] - + try: + del sys.modules[game] + except KeyError: + pass -Christian
participants (2)
-
Christian Walther
-
Radomir Dopieralski