Module_rotation() always returns 0

I have a BU16 plugged into my laptop. To the left, I attached an EN16.

During Setup on the EN16, I call:

rotation = module_rotation()
print(rotation)

No-matter how it’s rotated, the output is always 0.


module_position_x() and module_position_y() appear to work as expected.

Testing this out, this works for me perfectly. The only thing I changed about your code that the print is triggered by a different button and doesn’t happen during setup.

Hm okay, looking into this more it appears to be a specific issue within the module’s Setup function. I’m getting inconsistent behaviour; on boot, modules very rarely (but still sometimes) get their rotation correct. On a page change, they get rotation correct most (but not all) of the time. And when attaching a new module to an existing layout, it’s maybe about 50/50 :sweat_smile:

For now, I can work around this with another Timer hack like I did for immediate_send. But it does complicate the code, and makes it harder to share rotation-aware Snippets.

Probably the same race condition here as in the other case for immediate.

When modules boot up, they discover each other during boot. If one boots up before it knows it’s rotated, it will just default to not being rotated.