Skip to content

Commit

Permalink
remove redundant code, perf_encoder_temp was causing crash on MixerPage
Browse files Browse the repository at this point in the history
  • Loading branch information
jmamma committed Oct 28, 2024
1 parent 0f1b138 commit 0d6a9f1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
1 change: 0 additions & 1 deletion avr/cores/megacommand/MCL/GridPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ void GridPage::loop() {
} else {
if (mcl_cfg.grid_page_mode == PERF_ENC) {
if (encoders[0]->hasChanged() || encoders[1]->hasChanged() || encoders[2]->hasChanged() || encoders[3]->hasChanged()) {
// mixer_page.encoder_entry_page = GRID_PAGE;
//mcl.setPage(MIXER_PAGE);
draw_encoders_lastclock = slowclock;
draw_encoders = true;
Expand Down
24 changes: 2 additions & 22 deletions avr/cores/megacommand/MCL/MixerPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ void MixerPage::set_display_mode(uint8_t param) {
}

void MixerPage::oled_draw_mutes() {
if (encoder_entry_page != NULL_PAGE) { return; }

bool is_md_device = (midi_device == &MD);

Expand Down Expand Up @@ -77,7 +76,6 @@ void MixerPage::init() {
redraw_mask = -1;
seq_step_page.mute_mask++;
show_mixer_menu = 0;
memset(perf_locks_temp, 255, sizeof(perf_locks_temp));
// populate_mute_set();
draw_encoders = false;
redraw_mutes = true;
Expand All @@ -93,7 +91,6 @@ void MixerPage::cleanup() {
trig_interface.off();
ext_key_down = 0;
mute_toggle = 0;
encoder_entry_page = NULL_PAGE;
}

void MixerPage::set_level(int curtrack, int value) {
Expand Down Expand Up @@ -154,10 +151,6 @@ void MixerPage::loop() {
}
if (draw_encoders != old_draw_encoders) {
if (!draw_encoders) {
if (encoder_entry_page != NULL_PAGE) {
mcl.setPage(encoder_entry_page);
return;
}
redraw();
}
}
Expand Down Expand Up @@ -694,17 +687,12 @@ bool MixerPage::handleEvent(gui_event_t *event) {
case MDX_KEY_UP:
case MDX_KEY_RIGHT:
case MDX_KEY_DOWN: {
if (trig_interface.is_key_down(MDX_KEY_NO)) { return true; }
uint8_t set = get_mute_set(key);
if (trig_interface.is_key_down(MDX_KEY_YES)) {
switch_mute_set(set,true,load_types[set]);
} else {
preview_mute_set = set;
for (uint8_t n = 0; n < 4; n++) {
if (perf_locks_temp[n] == 255 && (trig_interface.is_key_down(MDX_KEY_NO))) {
perf_locks_temp[n] = encoders[n]->cur;
encoders[n]->old = encoders[n]->cur;
}
}
preview_mute_set = set;
// force redraw in display()
seq_step_page.mute_mask++;
}
Expand Down Expand Up @@ -755,14 +743,6 @@ bool MixerPage::handleEvent(gui_event_t *event) {
trig_interface.send_md_leds(is_md_device ? TRIGLED_OVERLAY : TRIGLED_EXCLUSIVE);
preview_mute_set = 255;
redraw();
for (uint8_t n = 0; n < 4; n++) {
MCLEncoder *enc = (MCLEncoder*) &encoders[n];
if (perf_locks_temp[n] != 255 && (trig_interface.is_key_down(MDX_KEY_NO))) {
enc->cur = perf_locks_temp[n];
enc->old = enc->cur;
}
perf_locks_temp[n] = 255;
}
}
break;
}
Expand Down
3 changes: 0 additions & 3 deletions avr/cores/megacommand/MCL/MixerPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class MixerPage : public LightPage {
bool draw_encoders;

PageIndex last_page = NULL_PAGE;
PageIndex encoder_entry_page = NULL_PAGE;

uint8_t current_mute_set = 255;
uint8_t preview_mute_set = 255;
Expand All @@ -60,8 +59,6 @@ class MixerPage : public LightPage {
bool load_types[4][2];
//

uint8_t perf_locks_temp[4];

uint8_t get_mute_set(uint8_t key);

MixerPage(Encoder *e1 = NULL, Encoder *e2 = NULL, Encoder *e3 = NULL,
Expand Down

0 comments on commit 0d6a9f1

Please sign in to comment.