watch_display_string("WO WordLE", 0);
}
+static void display_continue(wordle_state_t *state) {
+ char buf[7];
+ state->curr_screen = SCREEN_CONTINUE;
+ sprintf(buf, "Cont %c", state->continuing ? 'y' : 'n');
+ watch_display_string(buf, 4);
+}
+
static void display_streak(wordle_state_t *state) {
char buf[12];
state->curr_screen = SCREEN_STREAK;
watch_display_string(buf, 5);
}
-static bool act_on_btn(wordle_state_t *state) {
+static bool act_on_btn(wordle_state_t *state, const uint8_t pin) {
switch (state->curr_screen)
{
case SCREEN_RESULT:
#if USE_DAILY_STREAK
if (state->prev_day == get_day_unix_time()) {
display_wait(state);
- return true;
}
-#endif
- if (state->playing)
- display_playing(state);
+#else
+ if (state->playing) {
+ state->continuing = true;
+ display_continue(state);
+ }
else
display_streak(state);
+#endif
return true;
case SCREEN_STREAK:
#if USE_DAILY_STREAK
state->position = get_first_pos(state->word_elements_result);
display_playing(state);
return true;
+ case SCREEN_CONTINUE:
+ switch (pin)
+ {
+ case BTN_ALARM:
+ if (state->continuing)
+ display_playing(state);
+ else {
+ reset_board(state);
+ display_streak(state);
+ }
+ break;
+ case BTN_LIGHT:
+ state->continuing = !state->continuing;
+ display_continue(state);
+ break;
+ }
+ return true;
#if USE_DAILY_STREAK
case SCREEN_WAIT:
display_title(state);
if (state->curr_day != now) state->playing = false;
#endif
state->using_random_guess = false;
- if (state->playing && state->curr_screen >= SCREEN_WIN) {
+ if (state->playing && state->curr_screen >= SCREEN_RESULT) {
reset_incorrect_elements(state);
state->position = get_first_pos(state->word_elements_result);
}
}
break;
case EVENT_LIGHT_BUTTON_UP:
- if (act_on_btn(state)) break;
+ if (act_on_btn(state, BTN_LIGHT)) break;
get_next_letter(state->position, state->word_elements);
display_letter(state, true);
break;
display_letter(state, true);
break;
case EVENT_ALARM_BUTTON_UP:
- if (act_on_btn(state)) break;
+ if (act_on_btn(state, BTN_ALARM)) break;
display_letter(state, true);
if (state->word_elements[state->position] == _num_valid_letters) break;
state->playing = true;
case EVENT_ACTIVATE:
break;
case EVENT_TIMEOUT:
- if (state->curr_screen >= SCREEN_WIN)
+ if (state->curr_screen >= SCREEN_RESULT)
display_title(state);
break;
case EVENT_LOW_ENERGY_UPDATE: