Merge pull request #28 from Trasselfrisyr/wlpower
Menu option to set midibeam power level
This commit is contained in:
commit
6844341d77
5 changed files with 44 additions and 0 deletions
|
@ -90,6 +90,8 @@ uint16_t gateOpenEnable = 0;
|
||||||
|
|
||||||
uint16_t specialKeyEnable = 0;
|
uint16_t specialKeyEnable = 0;
|
||||||
|
|
||||||
|
uint16_t wlPower = 0;
|
||||||
|
|
||||||
int touch_Thr = 1300;
|
int touch_Thr = 1300;
|
||||||
|
|
||||||
byte ccList[11] = {0,1,2,7,11,1,2,7,11,74,20}; // OFF, Modulation, Breath, Volume, Expression (then same sent in hires), CC74 (cutoff/brightness), CC20 (UNO Cutoff)
|
byte ccList[11] = {0,1,2,7,11,1,2,7,11,74,20}; // OFF, Modulation, Breath, Volume, Expression (then same sent in hires), CC74 (cutoff/brightness), CC20 (UNO Cutoff)
|
||||||
|
|
|
@ -73,6 +73,8 @@ extern byte currentRotation;
|
||||||
extern uint16_t rotations[4];
|
extern uint16_t rotations[4];
|
||||||
extern uint16_t parallel; // semitones
|
extern uint16_t parallel; // semitones
|
||||||
|
|
||||||
|
extern uint16_t wlPower;
|
||||||
|
|
||||||
extern int touch_Thr;
|
extern int touch_Thr;
|
||||||
|
|
||||||
extern unsigned long cursorBlinkTime; // the last time the cursor was toggled
|
extern unsigned long cursorBlinkTime; // the last time the cursor was toggled
|
||||||
|
|
|
@ -501,11 +501,22 @@ const MenuEntrySub specialKeyMenu = {
|
||||||
, nullptr
|
, nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const MenuEntrySub wlPowerMenu = {
|
||||||
|
MenuType::ESub, "WL POWER", "WL POWER", &wlPower, 0, 3, MenuEntryFlags::ENone,
|
||||||
|
[](SubMenuRef __unused, char* out, const char** __unused unit) {
|
||||||
|
numToString(-6*wlPower, out, true);
|
||||||
|
},
|
||||||
|
[](SubMenuRef __unused) { sendWLPower(wlPower); }
|
||||||
|
, nullptr
|
||||||
|
};
|
||||||
|
|
||||||
const MenuEntry* extrasMenuEntries[] = {
|
const MenuEntry* extrasMenuEntries[] = {
|
||||||
(MenuEntry*)&legacyPBMenu,
|
(MenuEntry*)&legacyPBMenu,
|
||||||
(MenuEntry*)&legacyBRMenu,
|
(MenuEntry*)&legacyBRMenu,
|
||||||
(MenuEntry*)&gateOpenMenu,
|
(MenuEntry*)&gateOpenMenu,
|
||||||
(MenuEntry*)&specialKeyMenu,
|
(MenuEntry*)&specialKeyMenu,
|
||||||
|
(MenuEntry*)&wlPowerMenu,
|
||||||
};
|
};
|
||||||
|
|
||||||
const MenuPage extrasMenuPage = {
|
const MenuPage extrasMenuPage = {
|
||||||
|
|
|
@ -140,3 +140,27 @@ void dinMIDIsendAfterTouch(uint8_t value, uint8_t ch) {
|
||||||
void dinMIDIsendProgramChange(uint8_t value, uint8_t ch) {
|
void dinMIDIsendProgramChange(uint8_t value, uint8_t ch) {
|
||||||
midiSend2B((0xC0 | ch), value);
|
midiSend2B((0xC0 | ch), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dinMIDIsendSysex(const uint8_t data[], const uint8_t length) {
|
||||||
|
MIDI_SERIAL.write(0xF0); //Sysex command
|
||||||
|
for(int i=0; i<length; ++i) {
|
||||||
|
MIDI_SERIAL.write(data[i]);
|
||||||
|
}
|
||||||
|
MIDI_SERIAL.write(0xF7); //Sysex end
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void sendWLPower(const uint8_t level) {
|
||||||
|
uint8_t buf[6] = {
|
||||||
|
0x00, 0x21, 0x11, //Manufacturer id
|
||||||
|
0x02, //TX02
|
||||||
|
0x02, //Set power level
|
||||||
|
0x00 //Power level value (0-3)
|
||||||
|
};
|
||||||
|
|
||||||
|
if(level>3) return; //Don't send invalid values
|
||||||
|
|
||||||
|
buf[5] = level;
|
||||||
|
dinMIDIsendSysex(buf, 6);
|
||||||
|
|
||||||
|
}
|
|
@ -28,5 +28,10 @@ void dinMIDIsendNoteOff(uint8_t note, uint8_t vel, uint8_t ch);
|
||||||
void dinMIDIsendAfterTouch(uint8_t value, uint8_t ch);
|
void dinMIDIsendAfterTouch(uint8_t value, uint8_t ch);
|
||||||
void dinMIDIsendProgramChange(uint8_t value, uint8_t ch);
|
void dinMIDIsendProgramChange(uint8_t value, uint8_t ch);
|
||||||
void dinMIDIsendPitchBend(uint16_t pb, uint8_t ch);
|
void dinMIDIsendPitchBend(uint16_t pb, uint8_t ch);
|
||||||
|
void dinMIDIsendSysex(const uint8_t data[], const uint8_t length);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void sendWLPower(const uint8_t level);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue