master
unicod 3 years ago
parent 98423ac38a
commit 6e41a5154f

@ -59,24 +59,21 @@ const uint8_t pinGndChOn1 = A3;
const uint8_t pinLedChOn1 = A2;
const uint8_t pinBtnChOn1 = A1;
const uint8_t pinGndChOn2 = 10;
const uint8_t pinGndChOn2 = 12;
const uint8_t pinLedChOn2 = 11;
const uint8_t pinBtnChOn2 = 12;
const uint8_t pinBtnChOn2 = 10;
/***************************************************************************//**
* @brief Relay
*******************************************************************************/
const uint8_t pinRelay1 = 13;
const uint8_t pinRelay2 = A7;
//TimedPin RelayMute(pinRelay2);
TimedPin RelayMute(LED_BUILTIN);
const uint8_t pinRelay = A0;
TimedPin RelayMute(pinRelay);
/***************************************************************************//**
* @brief LED
*******************************************************************************/
//TimedPin LedBoard(LED_BUILTIN);
TimedPin LedBoard(pinRelay2);
TimedPin LedBoard(LED_BUILTIN);
TimedPin LedChOn1(pinLedChOn1);
TimedPin LedChOn2(pinLedChOn2);
TimedPin LedInc1(pinLedInc1);
@ -89,8 +86,9 @@ TimedPin LedDec2(pinLedDec2);
bool MidiCfgTxOnly; /// duplex or only tx configuration (without MIDI rx line)
MixerMuteState AirMutes[2] = {
MixerMuteState(22, &LedChOn1, &RelayMute, BTN_CH_ON1, EV_UI_RX_MUTE_CH1_ON, EV_UI_RX_MUTE_CH1_OFF),
MixerMuteState(23, &LedChOn2, BTN_CH_ON2, EV_UI_RX_MUTE_CH2_ON, EV_UI_RX_MUTE_CH2_OFF)
// No LED Relay init button
MixerMuteState(22, &LedChOn1, &RelayMute, 0, BTN_CH_ON1, EV_UI_RX_MUTE_CH1_ON, EV_UI_RX_MUTE_CH1_OFF),
MixerMuteState( 4, &LedChOn2, 1, BTN_CH_ON2, EV_UI_RX_MUTE_CH2_ON, EV_UI_RX_MUTE_CH2_OFF)
};
MixerFaderState AirFaders[2] = {
@ -141,16 +139,14 @@ void setup() {
pinMode(pinBtnChOn1, INPUT_PULLUP);
pinMode(pinBtnChOn2, INPUT_PULLUP);
pinMode(pinRelay1, OUTPUT);
pinMode(pinRelay2, OUTPUT);
pinMode(pinRelay, OUTPUT);
pinMode(pinGndDec1, OUTPUT);
pinMode(pinGndInc2, OUTPUT);
pinMode(pinGndDec2, OUTPUT);
pinMode(pinGndChOn1, OUTPUT);
pinMode(pinGndChOn2, OUTPUT);
digitalWrite(pinRelay1, LOW);
digitalWrite(pinRelay2, LOW);
digitalWrite(pinRelay, LOW);
digitalWrite(pinGndDec1, LOW);
digitalWrite(pinGndInc2, LOW);
digitalWrite(pinGndDec2, LOW);

@ -168,9 +168,11 @@ void UiSt_Home(UI_SM* const me, uint16_t event) {
// initialize mixer
for (uint_fast8_t i=0; i<ELEMCNT(AirMutes); i++) {
MixerMuteState& mute = AirMutes[i];
mute.MuteLocal = false; // init value: not muted (channel enabled)
MIDI.sendControlChange(mute.MidiCtrlNr, mute.MuteLocal ? 127 : 0, 2);
mute.LedUpdate();
if (mute.MuteInit <= 1) { // init needed
mute.MuteLocal = mute.MuteInit;
MIDI.sendControlChange(mute.MidiCtrlNr, mute.MuteLocal ? 127 : 0, 2);
mute.LedUpdate();
}
}
for (uint_fast8_t i=0; i<ELEMCNT(AirFaders); i++) {
MixerFaderState& fader = AirFaders[i];

17
ui.h

@ -54,6 +54,7 @@ extern TimedPin DummyRelay;
struct MixerMuteState {
bool MuteMixer; /// state received from mixer
bool MuteLocal; /// local state (sent to mixer)
uint8_t MuteInit; /// state after startup 0=not muted, 1=muted, 0xFF=no init
uint8_t MidiCtrlNr; /// assign MIDI CC number to MUTE switch of Air mixer
BTN_CODES UiButton; /// assigned button
uint16_t UiEventOn; /// event to send to UI statemachine
@ -61,10 +62,10 @@ struct MixerMuteState {
TimedPin* Led;
TimedPin* Relay;
MixerMuteState(uint8_t ctrl_nr, TimedPin* led, BTN_CODES button = BTN_MAX, uint16_t uieventon = EV_NO_EVENT, uint16_t uieventoff = EV_NO_EVENT) :
MuteMixer(false), MuteLocal(false), MidiCtrlNr(ctrl_nr), UiButton(button), UiEventOn(uieventon), UiEventOff(uieventoff), Led(led), Relay(&DummyRelay) { }
MixerMuteState(uint8_t ctrl_nr, TimedPin* led, TimedPin* relay, BTN_CODES button = BTN_MAX, uint16_t uieventon = EV_NO_EVENT, uint16_t uieventoff = EV_NO_EVENT) :
MuteMixer(false), MuteLocal(false), MidiCtrlNr(ctrl_nr), UiButton(button), UiEventOn(uieventon), UiEventOff(uieventoff), Led(led), Relay(relay) { }
MixerMuteState(uint8_t ctrl_nr, TimedPin* led, uint8_t muteinit, BTN_CODES button = BTN_MAX, uint16_t uieventon = EV_NO_EVENT, uint16_t uieventoff = EV_NO_EVENT) :
MuteMixer(false), MuteLocal(false), MidiCtrlNr(ctrl_nr), MuteInit(muteinit), UiButton(button), UiEventOn(uieventon), UiEventOff(uieventoff), Led(led), Relay(&DummyRelay) { }
MixerMuteState(uint8_t ctrl_nr, TimedPin* led, TimedPin* relay, uint8_t muteinit, BTN_CODES button = BTN_MAX, uint16_t uieventon = EV_NO_EVENT, uint16_t uieventoff = EV_NO_EVENT) :
MuteMixer(false), MuteLocal(false), MidiCtrlNr(ctrl_nr), MuteInit(muteinit), UiButton(button), UiEventOn(uieventon), UiEventOff(uieventoff), Led(led), Relay(relay) { }
void ToggleState() {
MuteLocal = !MuteLocal;
@ -117,17 +118,17 @@ struct MixerFaderState {
{ }
void LedUpdateVolSent() {
uint16_t t_on = 50;
uint16_t t_off = 950;
uint16_t t_off = 1950;
if (FaderLocal > FaderStd) {
t_on = 950;
t_on = 1950;
t_off = 50;
}
LedInc->Blink(t_on, t_off);
t_on = 50;
t_off = 950;
t_off = 1950;
if (FaderLocal < FaderStd) {
t_on = 950;
t_on = 1950;
t_off = 50;
}
LedDec->Blink(t_on, t_off);

Loading…
Cancel
Save