FMMT666 / launchpad.py

Novation Launchpad (and Midi Fighter) control suite for Python
Other
355 stars 63 forks source link

How to reset before / after LedCtrlRawRapid? #38

Closed afandian closed 5 years ago

afandian commented 5 years ago

Thanks again for this library!

I am trying to work out how to use LedCtrlRawRapid. First time it's fine, but I need to resync send the next frame.

The user guide says this about Rapid LED update:

To leave the mode, send a standard messsage beginning with 80h, 90h, or B0h. Sending another kind of message and then re-sending 92h will reset the cursor to the top left of the grid.

Your library's Reset (0xB0 0x00 0x00) works, but it blanks the whole frame, which looks bad. I can't find a better "empty" command that starts with 0x80 0x90 or 0xb0.

lp.LedCtrlXY(0, 0, 0,0) works, but it makes one pixel flash. Any better ideas?

afandian commented 5 years ago

I just picked a random controller value of 1 (just so I can send an empty 0xB message) and it seems to work! I don't know if this is compatible with other LaunchPads, but it works on my Mini.

This will give a smooth clear ready for the LedCtrlRawRapid.

e.g.

    lp.midi.RawWrite( 176, 1, 0 )
    lp.LedCtrlRawRapid(buf)

I don't know whether this is worth putting another function in the library or note in README? I'm happy to make a pull request.

FMMT666 commented 5 years ago

I see a lot of colours and bits are dancing around in my head, but I am not completely sure if I understand that correctly.

"Reset", as in "aborting the current [...]Rapid() data transfer, not turning off anything, but restart at the 1st LED" or the like?

afandian commented 5 years ago

Yes, exactly that. Maybe I missed out how to do that with this library? But without the reset I can't find out how to use LedCtrlRawRapid more than once without blanking the whole pad.

FMMT666 commented 5 years ago

Sorry for the delay. Indeed, nice solution and one of the few that does not seem to brick any other functionality. Thanks!

Now built-in as "LedCtrlRawRapidHome()".

You are now part of the readme. Let me know if you think that's inappropriate :)