Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default keymaps for OLKB boards to play Startup Sound #6721

Merged
merged 2 commits into from
Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 39 additions & 34 deletions keyboards/planck/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,46 +290,51 @@ void encoder_update(bool clockwise) {
}

void dip_switch_update_user(uint8_t index, bool active) {
switch (index) {
case 0:
if (active) {
#ifdef AUDIO_ENABLE
PLAY_SONG(plover_song);
#endif
layer_on(_ADJUST);
} else {
#ifdef AUDIO_ENABLE
PLAY_SONG(plover_gb_song);
#endif
layer_off(_ADJUST);
}
break;
case 1:
if (active) {
muse_mode = true;
} else {
muse_mode = false;
#ifdef AUDIO_ENABLE
stop_all_notes();
#endif
}
}
switch (index) {
case 0: {
static bool play_sound = false;
if (active) {
#ifdef AUDIO_ENABLE
if (play_sound) { PLAY_SONG(plover_song); }
#endif
layer_on(_ADJUST);
} else {
#ifdef AUDIO_ENABLE
if (play_sound) { PLAY_SONG(plover_gb_song); }
#endif
layer_off(_ADJUST);
}
play_sound = true;
break;
}
case 1:
if (active) {
muse_mode = true;
} else {
muse_mode = false;
}
}
}

void matrix_scan_user(void) {
#ifdef AUDIO_ENABLE
#ifdef AUDIO_ENABLE
if (muse_mode) {
if (muse_counter == 0) {
uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
if (muse_note != last_muse_note) {
stop_note(compute_freq_for_midi_note(last_muse_note));
play_note(compute_freq_for_midi_note(muse_note), 0xF);
last_muse_note = muse_note;
if (muse_counter == 0) {
uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
if (muse_note != last_muse_note) {
stop_note(compute_freq_for_midi_note(last_muse_note));
play_note(compute_freq_for_midi_note(muse_note), 0xF);
last_muse_note = muse_note;
}
}
muse_counter = (muse_counter + 1) % muse_tempo;
} else {
if (muse_counter) {
stop_all_notes();
muse_counter = 0;
}
}
muse_counter = (muse_counter + 1) % muse_tempo;
}
#endif
#endif
}

bool music_mask_user(uint16_t keycode) {
Expand Down
59 changes: 31 additions & 28 deletions keyboards/preonic/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,40 +260,43 @@ void encoder_update_user(uint8_t index, bool clockwise) {
}

void dip_switch_update_user(uint8_t index, bool active) {
switch (index) {
case 0:
if (active) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
break;
case 1:
if (active) {
muse_mode = true;
} else {
muse_mode = false;
#ifdef AUDIO_ENABLE
stop_all_notes();
#endif
}
}
switch (index) {
case 0:
if (active) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
break;
case 1:
if (active) {
muse_mode = true;
} else {
muse_mode = false;
}
xs}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drashna seems you missed this 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no :(

And why did Travis not catch that, either?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making all keymaps for preonic
QMK Firmware 0.7.13
make: *** No rule to make target 'preonic:all'. Stop.
|
|  QMK's make format recently changed to use folder locations and colons:
|     make project_folder:keymap[:target]
|  Examples:
|     make planck/rev4:default:dfu
|     make planck:default
|
The command "bash util/travis_build.sh" exited with 0.

😕

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that ... would be why. Opened another PR to fix that, and a couple of other issues that snuck by

}


void matrix_scan_user(void) {
#ifdef AUDIO_ENABLE
#ifdef AUDIO_ENABLE
if (muse_mode) {
if (muse_counter == 0) {
uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
if (muse_note != last_muse_note) {
stop_note(compute_freq_for_midi_note(last_muse_note));
play_note(compute_freq_for_midi_note(muse_note), 0xF);
last_muse_note = muse_note;
if (muse_counter == 0) {
uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
if (muse_note != last_muse_note) {
stop_note(compute_freq_for_midi_note(last_muse_note));
play_note(compute_freq_for_midi_note(muse_note), 0xF);
last_muse_note = muse_note;
}
}
muse_counter = (muse_counter + 1) % muse_tempo;
} else {
if (muse_counter) {
stop_all_notes();
muse_counter = 0;
}
}
muse_counter = (muse_counter + 1) % muse_tempo;
}
#endif
#endif
}

bool music_mask_user(uint16_t keycode) {
Expand Down