optimisation: Always make sound when knob is clicked or rotated
This commit adds the ability for firmware to make sounds when the knob is clicked or rotated, when LCD updates are disabled. The improvement here is the sound is being made with one line of code whether or not LCD updates are enabled or disabled. Change in memory: Flash: -24 bytes SRAM: 0 bytes
This commit is contained in:
parent
7de725f840
commit
0cac7612db
|
|
@ -701,6 +701,12 @@ void lcd_update(uint8_t lcdDrawUpdateOverride)
|
|||
if (lcd_backlight_wake_trigger) {
|
||||
lcd_backlight_wake_trigger = false;
|
||||
backlight_wake();
|
||||
if (abs(lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP) {
|
||||
// TODO: update lcd_encoder here
|
||||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
} else {
|
||||
Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
|
||||
}
|
||||
}
|
||||
|
||||
backlight_update();
|
||||
|
|
|
|||
|
|
@ -179,14 +179,12 @@ static uint8_t ReportErrorHookMonitor(uint8_t ei) {
|
|||
// More button for two button screen
|
||||
lcd_putc_at(18, 3, current_selection == LCD_MIDDLE_BUTTON_CHOICE ? '>': ' ');
|
||||
}
|
||||
// Consume rotation event and make feedback sound
|
||||
// Consume rotation event
|
||||
enc_dif = lcd_encoder_diff;
|
||||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
}
|
||||
|
||||
// Check if knob was clicked and consume the event
|
||||
if (lcd_clicked()) {
|
||||
Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
|
||||
choice_selected = current_selection;
|
||||
} else {
|
||||
// continue monitoring
|
||||
|
|
|
|||
|
|
@ -2230,8 +2230,7 @@ uint8_t lcd_alright() {
|
|||
lcd_consume_click();
|
||||
while (1)
|
||||
{
|
||||
manage_heater();
|
||||
manage_inactivity(true);
|
||||
delay_keep_alive(0);
|
||||
|
||||
if (abs(enc_dif - lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP)
|
||||
{
|
||||
|
|
@ -2257,13 +2256,11 @@ uint8_t lcd_alright() {
|
|||
|
||||
// Consume rotation event and make feedback sound
|
||||
enc_dif = lcd_encoder_diff;
|
||||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
_delay(100);
|
||||
}
|
||||
|
||||
if (lcd_clicked())
|
||||
{
|
||||
Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
|
||||
lcd_clear();
|
||||
lcd_return_to_status();
|
||||
return cursor_pos;
|
||||
|
|
@ -3132,14 +3129,12 @@ uint8_t lcd_show_multiscreen_message_with_choices_and_wait_P(
|
|||
}
|
||||
lcd_show_choices_prompt_P(current_selection, first_choice, second_choice, second_col, third_choice);
|
||||
enc_dif = lcd_encoder_diff;
|
||||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
} else {
|
||||
Sound_MakeSound(e_SOUND_TYPE_BlindAlert);
|
||||
break; // turning knob skips waiting loop
|
||||
}
|
||||
}
|
||||
if (lcd_clicked()) {
|
||||
Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
|
||||
if (msg_next == NULL) {
|
||||
goto exit;
|
||||
} else
|
||||
|
|
@ -4736,8 +4731,7 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite
|
|||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
while (1)
|
||||
{
|
||||
manage_heater();
|
||||
manage_inactivity(true);
|
||||
delay_keep_alive(0);
|
||||
|
||||
if (abs((enc_dif - lcd_encoder_diff)) > 4)
|
||||
{
|
||||
|
|
@ -4751,7 +4745,6 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite
|
|||
cursor_pos++;
|
||||
}
|
||||
enc_dif = lcd_encoder_diff;
|
||||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
}
|
||||
|
||||
if (cursor_pos > 3)
|
||||
|
|
@ -4802,7 +4795,6 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite
|
|||
|
||||
if (lcd_clicked())
|
||||
{
|
||||
Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
lcd_encoder_diff = 0;
|
||||
return(cursor_pos + first - 1);
|
||||
|
|
@ -4834,8 +4826,7 @@ char reset_menu() {
|
|||
lcd_puts_at_P(1, i, item[first + i]);
|
||||
}
|
||||
|
||||
manage_heater();
|
||||
manage_inactivity(true);
|
||||
delay_keep_alive(0);
|
||||
|
||||
if (abs((enc_dif - lcd_encoder_diff)) > 4) {
|
||||
|
||||
|
|
@ -4868,7 +4859,6 @@ char reset_menu() {
|
|||
lcd_puts_at_P(0, 0, PSTR(" \n \n \n "));
|
||||
lcd_set_cursor(0, cursor_pos);
|
||||
lcd_putc('>');
|
||||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
enc_dif = lcd_encoder_diff;
|
||||
_delay(100);
|
||||
}
|
||||
|
|
@ -4876,7 +4866,6 @@ char reset_menu() {
|
|||
}
|
||||
|
||||
if (lcd_clicked()) {
|
||||
Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
|
||||
return(cursor_pos + first);
|
||||
}
|
||||
|
||||
|
|
@ -7499,7 +7488,6 @@ void menu_lcd_lcdupdate_func(void)
|
|||
if (lcd_draw_update == 0)
|
||||
lcd_draw_update = 1;
|
||||
lcd_encoder += lcd_encoder_diff / ENCODER_PULSES_PER_STEP;
|
||||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
lcd_encoder_diff = 0;
|
||||
lcd_timeoutToStatus.start();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue