Skip to content

Commit 5f4fe33

Browse files
committed
lots of updates for the Pro Mk3
1 parent 0a5d13f commit 5f4fe33

File tree

8 files changed

+351
-26
lines changed

8 files changed

+351
-26
lines changed

README.md

Lines changed: 112 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ What's hot, what's not?
4242

4343
Launchpad Pro - class "LaunchpadPro()" LEDs and buttons (digitally only (yet))
4444

45-
Launchpad Pro - class "LaunchpadProMk3()" EXPERIMENTAL
45+
Launchpad Pro - class "LaunchpadProMk3()" EXPERIMENTAL++ as in "some issues, but ok"
4646

4747
Launchpad Mini Mk3 - class "LaunchpadMiniMk3()" LEDs and buttons *** RENAMED 5/2020 ***
4848

@@ -89,7 +89,7 @@ Successfully tested with Ubuntu 18.04-LTS+. Requires compiling your own PyGame t
8989
## NEWS
9090

9191
### CHANGES 2020/08/XX:
92-
- added support for pressure events via ButtonStateRaw() for the Pro
92+
- added support for pressure events via ButtonStateRaw() for the Pro and Pro Mk3
9393
- added support for pressure events via ButtonStateRaw() for the X
9494
- added demo file "launchpad_pressure.py" for pressure sensitivity
9595
- updated pressure demo to work with the X too
@@ -101,7 +101,12 @@ Successfully tested with Ubuntu 18.04-LTS+. Requires compiling your own PyGame t
101101
- added MF64 LedCtrlRaw(), ButtonStateXY(), LedAllOn()
102102
- added MF64 LedCtrlXY()
103103
- added support for the Launchpad Pro Mk3
104-
- updated some demos to work with the Pro
104+
- updated some demos to work with the Pro Mk3
105+
- updated even some demos to work with the Pro Mk3
106+
- updated yet some more demos and eliminated some bug
107+
- updated pressure event handling in the Pro, Pro Mk3 and X's ButtonStateXY() methods
108+
- added a Pro Mk3 "reset to Live mode" demo file
109+
- updated ButtonStateXY() for the Pro Mk3, incl "classic" and "Pro" mode
105110

106111

107112
### CHANGES 2020/05/XX:
@@ -289,9 +294,10 @@ Successfully tested with Ubuntu 18.04-LTS+. Requires compiling your own PyGame t
289294
## Upcoming attractions, notes and thoughts
290295

291296
- "PK3": the Pro Mk3 has some issues; needs to be fixed
297+
- "All": optionally pressure events also for ButtonStateXY(); Pro, Pro Mk3, X
298+
- "All": optionally avoid resetting the X and Pro Mk3 to Live mode in Close(); (bc LEDs turn on)
292299
- "All": New, officially recommended device selection code in all demo files
293-
- "M64": RGB to color code mapping
294-
- "M64": Add character and string methods for the Midi Fighter (requires RGB)
300+
- "M64": Add character and string methods for the Midi Fighter
295301
- "All": RGB to color code approximation (for flash/pulse and color code methods)
296302
- "Pro": Finally add the Mk3Pro (has problems!)
297303
- "All": either remove or add the (non-) optional \<colorcode\> argument to all methods
@@ -313,6 +319,9 @@ Successfully tested with Ubuntu 18.04-LTS+. Requires compiling your own PyGame t
313319
- "All": [r,g,b] lists for colors, instead of single args (might affect compatibility)
314320
- ...
315321

322+
## cancelled:
323+
324+
- "M64": RGB to color code mapping *NOPE* This does not work.
316325

317326
---
318327
## Installation/Usage
@@ -737,7 +746,7 @@ name it once shipped the first red/green LED with!
737746

738747
![RGB color palette](/images/promk3_transmit.png)
739748

740-
Otherwise you will be spammed by pressure events!
749+
Otherwise the receive buffer will be spammed with messages.
741750

742751
### For Launchpad Mk2 users
743752

@@ -1900,11 +1909,11 @@ There is no possibility to control the RGB LEDs individually.yle.
19001909
Notice that this is not directly compatible with the "Mk1" ButtonStateRaw()
19011910
method, which returns [ <button>, <True/False> ].
19021911

1903-
Only the Pro, X and (future) Mk3-Pro support pressure events.
1912+
Only the Pro, X and Pro Mk3 support pressure events.
19041913
They can be enables by passing "returnPressure=True" to the method call.
19051914
Notice that the Pro and X behave differently:
19061915

1907-
Pro:
1916+
Pro and Pro Mk3:
19081917
There is only one pressure value for all buttons together. If multiple buttons
19091918
are pressed, the biggest value is returned. There is no possibility to determine
19101919
which button caused it. To distinguish the pressure events from button events,
@@ -2568,7 +2577,100 @@ There is no possibility to control the RGB LEDs individually.yle.
25682577
---
25692578
## Button and LED codes, Launchpad "Pro Mk3" (RGB LEDs)
25702579

2571-
TODO TODO TODO TODO
2580+
### LED and and button numbers in RAW mode
2581+
2582+
+---+ +---+---+---+---+---+---+---+---+ +---+
2583+
| 90| | 91| | | | | | | 98| | 99|
2584+
+---+ +---+---+---+---+---+---+---+---+ +---+
2585+
2586+
+---+ +---+---+---+---+---+---+---+---+ +---+
2587+
| 80| | 81| | | | | | | | | 89|
2588+
+---+ +---+---+---+---+---+---+---+---+ +---+
2589+
| 70| | | | | | | | | | | 79|
2590+
+---+ +---+---+---+---+---+---+---+---+ +---+
2591+
| 60| | | | | | | | 67| | | 69|
2592+
+---+ +---+---+---+---+---+---+---+---+ +---+
2593+
| 50| | | | | | | | | | | 59|
2594+
+---+ +---+---+---+---+---+---+---+---+ +---+
2595+
| 40| | | | | | | | | | | 49|
2596+
+---+ +---+---+---+---+---+---+---+---+ +---+
2597+
| 30| | | | | | | | | | | 39|
2598+
+---+ +---+---+---+---+---+---+---+---+ +---+
2599+
| 20| | | | 23| | | | | | | 29|
2600+
+---+ +---+---+---+---+---+---+---+---+ +---+
2601+
| 10| | | | | | | | | | | 19|
2602+
+---+ +---+---+---+---+---+---+---+---+ +---+
2603+
2604+
+---+---+---+---+---+---+---+---+
2605+
|101|102| | | | | |108|
2606+
+---+---+---+---+---+---+---+---+
2607+
+---+---+---+---+---+---+---+---+
2608+
| 1| 2| | | | | | 8|
2609+
+---+---+---+---+---+---+---+---+
2610+
2611+
2612+
### LED and and button numbers in X/Y (classic) mode
2613+
2614+
9 0 1 2 3 4 5 6 7 8
2615+
+---+---+---+---+---+---+---+---+
2616+
|0/0| |2/0| | | | | | 0
2617+
+---+---+---+---+---+---+---+---+
2618+
2619+
+---+ +---+---+---+---+---+---+---+---+ +---+
2620+
| | |0/1| | | | | | | | | | 1
2621+
+---+ +---+---+---+---+---+---+---+---+ +---+
2622+
|9/2| | | | | | | | | | | | 2
2623+
+---+ +---+---+---+---+---+---+---+---+ +---+
2624+
| | | | | | | |5/3| | | | | 3
2625+
+---+ +---+---+---+---+---+---+---+---+ +---+
2626+
| | | | | | | | | | | | | 4
2627+
+---+ +---+---+---+---+---+---+---+---+ +---+
2628+
| | | | | | | | | | | | | 5
2629+
+---+ +---+---+---+---+---+---+---+---+ +---+
2630+
| | | | | | |4/6| | | | | | 6
2631+
+---+ +---+---+---+---+---+---+---+---+ +---+
2632+
| | | | | | | | | | | | | 7
2633+
+---+ +---+---+---+---+---+---+---+---+ +---+
2634+
|9/8| | | | | | | | | | |8/8| 8
2635+
+---+ +---+---+---+---+---+---+---+---+ +---+
2636+
2637+
+---+---+---+---+---+---+---+---+
2638+
| |1/9| | | | | | | 9
2639+
+---+---+---+---+---+---+---+---+
2640+
|/10| | | | | | | | 10
2641+
+---+---+---+---+---+---+---+---+
2642+
2643+
### LED and and button numbers in X/Y (pro) mode
2644+
2645+
0 1 2 3 4 5 6 7 8 9
2646+
+---+---+---+---+---+---+---+---+
2647+
|1/0| |3/0| | | | | | 0
2648+
+---+---+---+---+---+---+---+---+
2649+
2650+
+---+ +---+---+---+---+---+---+---+---+ +---+
2651+
| | |1/1| | | | | | | | | | 1
2652+
+---+ +---+---+---+---+---+---+---+---+ +---+
2653+
|0/2| | | | | | | | | | | | 2
2654+
+---+ +---+---+---+---+---+---+---+---+ +---+
2655+
| | | | | | | |6/3| | | | | 3
2656+
+---+ +---+---+---+---+---+---+---+---+ +---+
2657+
| | | | | | | | | | | | | 4
2658+
+---+ +---+---+---+---+---+---+---+---+ +---+
2659+
| | | | | | | | | | | | | 5
2660+
+---+ +---+---+---+---+---+---+---+---+ +---+
2661+
| | | | | | |5/6| | | | | | 6
2662+
+---+ +---+---+---+---+---+---+---+---+ +---+
2663+
| | | | | | | | | | | | | 7
2664+
+---+ +---+---+---+---+---+---+---+---+ +---+
2665+
|0/8| | | | | | | | | | |9/8| 8
2666+
+---+ +---+---+---+---+---+---+---+---+ +---+
2667+
2668+
+---+---+---+---+---+---+---+---+
2669+
| |2/9| | | | | |8/9| 9
2670+
+---+---+---+---+---+---+---+---+
2671+
| | | | | | | |/10| 10
2672+
+---+---+---+---+---+---+---+---+
2673+
25722674

25732675

25742676
---
@@ -2846,4 +2948,4 @@ FMMT666(ASkr)
28462948
[21]: https://twitter.com/FMMT666/status/1242950069923520519
28472949
[22]: https://twitter.com/FMMT666/status/1242978460454326272
28482950
[23]: https://twitter.com/FMMT666/status/1298372859383906305
2849-
[24]: https://twitter.com/i/status/1299478117497688073
2951+
[24]: https://twitter.com/FMMT666/status/1299478117497688073

examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
!launchpad_rgb.py
99
!launchpad_rgb-pulse.py
1010
!launchpad_pressure.py
11+
!launchpad_pro_mk3_reset.py
1112
!midi_events.py
1213
!buttons_raw.py
1314
!buttons_xy.py

examples/buttons_xy.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ def main():
4242
lp = launchpad.LaunchpadMiniMk3()
4343
if lp.Open( 1 ):
4444
print("Launchpad Mini Mk3")
45-
mode = "Pro"
45+
mode = "MiniMk3"
4646

4747
elif launchpad.LaunchpadLPX().Check( 1 ):
4848
lp = launchpad.LaunchpadLPX()
4949
if lp.Open( 1 ):
5050
print("Launchpad X")
51-
mode = "Pro"
51+
mode = "LPX"
5252

5353
elif launchpad.LaunchpadMk2().Check( 0 ):
5454
lp = launchpad.LaunchpadMk2()
@@ -95,7 +95,11 @@ def main():
9595
lastBut = (-99,-99)
9696
tStart = time.time()
9797
while True:
98-
buts = lp.ButtonStateXY()
98+
if mode == 'Pro' or mode == 'ProMk3':
99+
buts = lp.ButtonStateXY( mode = 'pro')
100+
else:
101+
buts = lp.ButtonStateXY()
102+
99103
if buts != []:
100104
print( buts[0], buts[1], buts[2] )
101105

examples/hello.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env python
22
#
33
# Quick usage of "launchpad.py", LEDs and buttons.
4-
# Works with all Launchpads: Mk1, Mk2, Mini Mk3, S/Mini, Pro, XL and LaunchKey
4+
# Works with all Launchpads: Mk1, Mk2, Mini Mk3, S/Mini, Pro, Pro Mk3, XL and LaunchKey
55
#
66
#
7-
# FMMT666(ASkr) 7/2013..5/2020
7+
# FMMT666(ASkr) 7/2013..8/2020
88
# www.askrprojects.net
99
#
1010

@@ -36,6 +36,12 @@ def main():
3636
print("Launchpad Pro")
3737
mode = "Pro"
3838

39+
elif lp.Check( 0, "promk3" ):
40+
lp = launchpad.LaunchpadProMk3()
41+
if lp.Open( 0 ):
42+
print("Launchpad Pro Mk3")
43+
mode = "ProMk3"
44+
3945
# experimental MK3 implementation
4046
# The MK3 has two MIDI instances per device; we need the 2nd one.
4147
# If you have two MK3s attached, its "1" for the first and "3" for the 2nd device

examples/launchpad_pressure.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
#
33
# Quick demo of the new, optional "pressure events" for supported Launchpads.
4-
# Works with: Pro, X
4+
# Works with: Pro, Pro Mk3, X
55
#
66
#
77
# FMMT666(ASkr) 7/2013..8/2020
@@ -27,11 +27,14 @@ def main():
2727
if lp.Check( 0 ):
2828
if lp.Open( 0 ):
2929
mode = "pro"
30-
else:
30+
elif launchpad.LaunchpadProMk3().Check( 0 ):
31+
lp = launchpad.LaunchpadProMk3()
32+
if lp.Open( 0 ):
33+
mode = "promk3"
34+
elif launchpad.LaunchpadLPX().Check ( 1 ):
3135
lp = launchpad.LaunchpadLPX()
32-
if lp.Check( 1 ):
33-
if lp.Open( 1 ):
34-
mode = "lpx"
36+
if lp.Open( 1 ):
37+
mode = "lpx"
3538

3639
if mode is None:
3740
print("no compatible Launchpad found ...")
@@ -53,7 +56,7 @@ def main():
5356
# LPX:
5457
# Returns a per-button pressure event.
5558
# To distinguish pressure events from button events, "255" is added to the button number.
56-
if mode == "pro":
59+
if mode == "pro" or mode == "promk3":
5760
print(" PRESSURE: " + str(events[1]) )
5861
else:
5962
print(" PRESSURE: " + str(events[0]-255) + " " + str(events[1]) )
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python
2+
#
3+
# Resets the Pro Mk3 (into Live mode)
4+
#
5+
#
6+
# FMMT666(ASkr) 7/2013..8/2020
7+
# www.askrprojects.net
8+
#
9+
10+
import sys
11+
12+
13+
try:
14+
import launchpad_py as launchpad
15+
except ImportError:
16+
try:
17+
import launchpad
18+
except ImportError:
19+
sys.exit("error loading launchpad.py")
20+
21+
22+
def main():
23+
24+
if launchpad.LaunchpadProMk3().Check( 0 ):
25+
lp = launchpad.LaunchpadProMk3()
26+
if lp.Open( 0 ):
27+
print("Launchpad Pro Mk3 found")
28+
lp.Close()
29+
else:
30+
print("Meh, did not find a Launchpad Pro Mk3")
31+
32+
33+
34+
if __name__ == '__main__':
35+
main()
36+

examples/launchpad_rgb-fire.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def __init__( self ):
362362
#-------------------------------------------------------------------------------------
363363
#--
364364
#-------------------------------------------------------------------------------------
365-
def Close( self ):
365+
def LiveMode( self ):
366366
if self.mode == "promk3":
367367
self.lp.LedSetMode( 0 )
368368

@@ -373,6 +373,14 @@ def Close( self ):
373373
def Clear( self ):
374374
self.lp.Reset()
375375

376+
377+
#-------------------------------------------------------------------------------------
378+
#--
379+
#-------------------------------------------------------------------------------------
380+
def Close( self ):
381+
self.lp.Close()
382+
383+
376384
#-------------------------------------------------------------------------------------
377385
#--
378386
#-------------------------------------------------------------------------------------
@@ -484,5 +492,6 @@ def ButtonFlush( self ):
484492
break
485493

486494
lpDis.Clear()
495+
lpDis.LiveMode()
487496
lpDis.Close()
488497

0 commit comments

Comments
 (0)