Remove global var for wireless power, add wl channel menu

This commit is contained in:
John Stäck 2019-07-23 10:32:33 +02:00
parent 33bfc9ea08
commit def0dcacd0
5 changed files with 37 additions and 10 deletions

View file

@ -95,8 +95,6 @@ uint16_t gateOpenEnable = 0;
uint16_t specialKeyEnable = 0;
uint16_t wlPower = 0;
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)
@ -726,7 +724,7 @@ void loop() {
}
analogWrite(dacPin,constrain(cvPitch+map(pitchBend,0,16383,-84,84),0,4095));
analogWrite(pwmDacPin,breathCurve(map(constrain(pressureSensor,breathThrVal,breathMaxVal),breathThrVal,breathMaxVal,500,4095))); //starting at 0.6V to match use of cv from sensor, so recalibration of cv offset/scaler is not needed
else if(dacMode == DAC_MODE_BREATH) { // else breath CV on DAC pin, directly to unused pin of MIDI DIN jack
} else if(dacMode == DAC_MODE_BREATH) { // else breath CV on DAC pin, directly to unused pin of MIDI DIN jack
analogWrite(dacPin,breathCurve(map(constrain(pressureSensor,breathThrVal,breathMaxVal),breathThrVal,breathMaxVal,0,4095)));
}

View file

@ -78,7 +78,6 @@ extern uint16_t trill3_interval;
extern uint16_t fastBoot;
extern uint16_t dacMode;
extern uint16_t wlPower;
extern int touch_Thr;

View file

@ -530,15 +530,29 @@ const MenuEntrySub fastBootMenu = {
, nullptr
};
static uint16_t wireless_power=0;
static uint16_t wireless_channel=4;
const MenuEntrySub wlPowerMenu = {
MenuType::ESub, "WL POWER", "WL POWER", &wlPower, 0, 3, MenuEntryFlags::ENone,
MenuType::ESub, "WL POWER", "WL POWER", &wireless_power, 0, 3, MenuEntryFlags::ENone,
[](SubMenuRef __unused, char* out, const char** __unused unit) {
numToString(-6*wlPower, out, true);
numToString(-6*wireless_power, out, true);
},
[](SubMenuRef __unused) { sendWLPower(wlPower); }
[](SubMenuRef __unused) { sendWLPower(wireless_power); }
, nullptr
};
const MenuEntrySub wlChannelMenu = {
MenuType::ESub, "WL CHAN", "WL CHAN", &wireless_channel, 4, 80, MenuEntryFlags::ENone,
[](SubMenuRef __unused, char* out, const char** __unused unit) {
numToString(wireless_channel, out, false);
},
[](SubMenuRef __unused) { sendWLChannel(wireless_channel); }
, nullptr
};
const MenuEntry* extrasMenuEntries[] = {
(MenuEntry*)&legacyPBMenu,
(MenuEntry*)&legacyBRMenu,
@ -549,6 +563,7 @@ const MenuEntry* extrasMenuEntries[] = {
(MenuEntry*)&dacModeMenu,
(MenuEntry*)&fastBootMenu,
(MenuEntry*)&wlPowerMenu,
(MenuEntry*)&wlChannelMenu,
};
const MenuPage extrasMenuPage = {

View file

@ -164,3 +164,19 @@ void sendWLPower(const uint8_t level) {
dinMIDIsendSysex(buf, 6);
}
void sendWLChannel(const uint8_t channel) {
uint8_t buf[6] = {
0x00, 0x21, 0x11, //Manufacturer id
0x02, //TX02
0x05, //Set channel
0x04 //Channel value (4-80)
};
if(channel<4 || channel>80) return; //Don't send invalid values
buf[5] = channel;
dinMIDIsendSysex(buf, 6);
}

View file

@ -30,8 +30,7 @@ void dinMIDIsendProgramChange(uint8_t value, 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);
void sendWLChannel(const uint8_t channel);
#endif