From 8fa42f9f9107f460b49fa7ab171529942e66e7ea Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 12 Jul 2023 19:34:25 +0200 Subject: Add optional help prompt to the notif bar --- src/drawing.c | 39 ++++++++++++++++++++++++++++++++++----- src/main.c | 1 + src/sequencer.c | 1 + src/settings.c | 14 ++++++++++++++ src/settings.h | 15 ++++++++++++++- 5 files changed, 64 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/drawing.c b/src/drawing.c index b488ed1..18504bc 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1261,11 +1261,40 @@ draw_notif_bar() { } txt_drawf_small(msg, x0 + 2, y0 + 1, color); } else { - // if (notif.time > -16) { - // notif.time--; - // return; - // } - // TODO: More context dependent messages? Use instructions? + if (settings.help == HELP_ON) { + if (input_handler == handle_trigger_selection || + input_handler == handle_channel_selection) { + txt_drawf_small("L/R:NOTE A:PARAMS B:TOGGLE", x0 + 2, y0 + 1, color); + } else if (input_handler == handle_param_selection_sq1 || + input_handler == handle_param_selection_sq2 || + input_handler == handle_param_selection_wave || + input_handler == handle_param_selection_noise) { + txt_drawf_small("L/R:ADJUST SELECT:COPY", x0 + 2, y0 + 1, color); + } else if (input_handler == handle_pattern_selection) { + txt_drawf_small("L/R:CHAIN A:PARAMS B:QUEUE", x0 + 2, y0 + 1, color); + } else if (input_handler == handle_right_col_selection) { + if (right_col_selection_loc == R_COL_STOP) { + txt_drawf_small("B:STOP", x0 + 2, y0 + 1, color); + } else if (right_col_selection_loc == R_COL_PLAY) { + if (play_status == 0) { + txt_drawf_small("B:PLAY", x0 + 2, y0 + 1, color); + } else { + txt_drawf_small("B:PAUSE", x0 + 2, y0 + 1, color); + } + } else if (right_col_selection_loc == R_COL_BPM) { + txt_drawf_small("L/R:TEMPO", x0 + 2, y0 + 1, color); + } else if (right_col_selection_loc == R_COL_SETTINGS) { + txt_drawf_small("B:SETTINGS", x0 + 2, y0 + 1, color); + } else if (right_col_selection_loc == R_COL_BANK_A || + right_col_selection_loc == R_COL_BANK_B || + right_col_selection_loc == R_COL_BANK_C || + right_col_selection_loc == R_COL_BANK_D) { + txt_drawf_small("B:SAVE CURRENT BANK AND SWITCH", x0 + 2, y0 + 1, color); + } + } + return; + } + if (play_status == 0) { txt_drawf_small("STOPPED", x0 + 2, y0 + 1, color); } else { diff --git a/src/main.c b/src/main.c index 2e78b3c..54d46e6 100644 --- a/src/main.c +++ b/src/main.c @@ -115,6 +115,7 @@ render_settings(void) { txt_printf(" SYNC: %s\n\n", sync_setting_str[settings.sync]); txt_printf(" THEME: %s\n\n", theme_setting_str[settings.theme]); txt_printf(" CURSOR: %s\n\n", cursor_setting_str[settings.cursor]); + txt_printf(" HELP: %s\n\n", help_setting_str[settings.help]); txt_render(); txt_clear(); PROF(draw_settings_cursor(), draw_cursor_cycles); diff --git a/src/sequencer.c b/src/sequencer.c index a22c219..5b70bb2 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -70,6 +70,7 @@ play_step(void) { | sound_rates[trig->note]; } } else { + SOUND_SQUARE1_SWEEP = 0; SOUND_SQUARE1_CTRL = 0; SOUND_SQUARE1_FREQ = 0; } diff --git a/src/settings.c b/src/settings.c index 2c698d1..d2491b8 100644 --- a/src/settings.c +++ b/src/settings.c @@ -102,6 +102,13 @@ handle_settings_input(void) { settings.cursor++; } } break; + case 3: { + if ((settings.help + 1) >= HELP_NUM) { + settings.help = 0; + } else { + settings.help++; + } + } break; } save_metadata(); clear_screen = true; @@ -131,6 +138,13 @@ handle_settings_input(void) { settings.cursor--; } } break; + case 3: { + if (settings.help == 0) { + settings.help = HELP_NUM - 1; + } else { + settings.help--; + } + } break; } save_metadata(); clear_screen = true; diff --git a/src/settings.h b/src/settings.h index 1a45d75..c3e035e 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,7 +1,7 @@ #ifndef SETTINGS_H #define SETTINGS_H -#define N_SETTINGS 3 +#define N_SETTINGS 4 typedef enum SyncSetting { SYNC_NONE = 0, @@ -62,10 +62,23 @@ char * cursor_setting_str[] = { "THICK LINE", }; +typedef enum HelpSetting { + HELP_OFF = 0, + HELP_ON, + HELP_NUM, +} HelpSetting; + +char * help_setting_str[] = { + "OFF", + "ON", +}; + typedef struct Settings { SyncSetting sync; ThemeSetting theme; CursorSetting cursor; + HelpSetting help; + u8 reserved[63]; } Settings; #endif // SETTINGS_H -- cgit v1.2.1