Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plasma - problems with v1.19.12 #637

Closed
helgibbons opened this issue Jan 18, 2023 · 4 comments · Fixed by #640
Closed

Plasma - problems with v1.19.12 #637

helgibbons opened this issue Jan 18, 2023 · 4 comments · Fixed by #640
Labels
bug Something isn't working

Comments

@helgibbons
Copy link
Contributor

helgibbons commented Jan 18, 2023

See https://forums.pimoroni.com/t/wireless-plasma-kit-issues/21274

I'm getting no lights and hard locks in Thonny when trying to init the LEDs with a Plasma Stick running v1.19.12 MicroPython firmware.

Works fine if I flash the board with v1.19.11.

@helgibbons helgibbons added the bug Something isn't working label Jan 18, 2023
@helgibbons helgibbons changed the title Plasma Stick - problems with v1.19.12 Plasma - problems with v1.19.12 Jan 19, 2023
@helgibbons
Copy link
Contributor Author

helgibbons commented Jan 19, 2023

Just tried v1.19.12 on a Plasma 2040 (and a different computer, to rule out Thonny shenanigans!) and that's also exhibiting the same problem.

@Gadgetoid
Copy link
Member

Gadgetoid commented Jan 19, 2023

I expected something would break, since we moved through a few months of MicroPython updates in a single point release 😬

Frustratingly Plasma had already been optimized to the nth degree for similar problems before, so none of the usual suspects are the problem here.

It doesn't seem to be related to the PIO or State Machine choices, since it freezes with any configuration for me.

And, even weirder, if I supply a buffer that's under-sized it still freezes.

It should be bailing with a ValueError:

mp_raise_ValueError("Supplied buffer is too small for LED count!");

At this point it hasn't done anything particularly onerous!

Edit: For posterity here is my test code:

import plasma

print("Here we go!")

buf = bytearray(2)
led_strip = plasma.WS2812(10, 1, 1, 25, color_order=plasma.COLOR_ORDER_RGB, buffer=buf)

print("Hello World")

10 LEDs is 10 * sizeof(WS2812::RGB) or 40 bytes, so a bytearray(2) should definitely cause this class constructor to bail super early.

@Gadgetoid
Copy link
Member

Even stranger, this hard-locks:

>>> import plasma
>>> plasma.WS2812()

The first four args are required so this should bail in argument parsing. Something must be wrong with the linkage into the C module

IE: The new MP_DEFINE_CONST_OBJ_TYPE macro must have the wrong function set for the class constructor.

@Gadgetoid
Copy link
Member

I don't know whether to laugh or cry:

MP_DEFINE_CONST_OBJ_TYPE(
    PlasmaWS2812_type,
    MP_QSTR_plasma_ws2812,
    MP_TYPE_FLAG_NONE,
    make_new, PlasmaWS2812_print,
    print, PlasmaWS2812_make_new,
    locals_dict, (mp_obj_dict_t*)&PlasmaWS2812_locals_dict
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants