Skip to content

Commit

Permalink
Added only green blink and It's to party time
Browse files Browse the repository at this point in the history
  • Loading branch information
voloved committed May 30, 2024
1 parent 02b6b7a commit d51132f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
37 changes: 27 additions & 10 deletions movement/watch_faces/complication/party_face.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
#include "party_face.h"
#include "watch_private_display.h"

void party_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
(void) settings;
Expand Down Expand Up @@ -54,18 +53,22 @@ void party_face_activate(movement_settings_t *settings, void *context) {

static void _party_face_init_lcd(party_state_t *state) {
char text[11];
const char partyTime[][7] = {"Tin&e", "To ","Party"};
const int partyTextNum = 3;
const char partyTime[][7] = {" It's","Party", "Tin&e"};
switch (state->text)
{
case 1:
sprintf(text, " Pron&");
break;
case 0:
default:
if (!state->blink)
state->party_text = 2;
if (!state->blink){
state->party_text = 1; // Party location
watch_clear_indicator(WATCH_INDICATOR_BELL);
}
else{
state->party_text = (state->party_text + 1) % 3;
state->party_text = (state->party_text + 1) % partyTextNum;
watch_set_indicator(WATCH_INDICATOR_BELL);
}
sprintf(text, "EF%02d %s", state->curr_year + 20, partyTime[state->party_text]);
break;
Expand All @@ -82,7 +85,7 @@ bool party_face_loop(movement_event_t event, movement_settings_t *settings, void
_party_face_init_lcd(state);
break;
case EVENT_LIGHT_BUTTON_UP:
state->led = !state->led;
state->led = (state->led + 1) % 3;
if (!state->led)
watch_set_led_off();
break;
Expand All @@ -93,7 +96,8 @@ bool party_face_loop(movement_event_t event, movement_settings_t *settings, void
case EVENT_ALARM_BUTTON_UP:
state->blink = !state->blink;
movement_request_tick_frequency(state->fast ? 8 : 2);
_party_face_init_lcd(state);
if (!state->blink)
_party_face_init_lcd(state);
break;
case EVENT_ALARM_LONG_PRESS:
state->fast = !state->fast;
Expand All @@ -111,12 +115,25 @@ bool party_face_loop(movement_event_t event, movement_settings_t *settings, void
if (state->blink) {
if (event.subsecond % 2 == 0)
_party_face_init_lcd(state);
else if (state->text == 0) // Clear only the bottom row when the party text is occurring
else if (state->text == 0){ // Clear only the bottom row when the party text is occurring
watch_clear_bottom_row();
watch_clear_indicator(WATCH_INDICATOR_BELL);
}
else
watch_clear_display();
}
if (state->led) {
switch (state->led)
{
case 0:
default:
break;
case 1:
if (event.subsecond % 2 == 0)
watch_set_led_green();
else
watch_set_led_off();
break;
case 2:
switch (state->color)
{
case 0:
Expand All @@ -132,7 +149,7 @@ bool party_face_loop(movement_event_t event, movement_settings_t *settings, void
watch_set_led_off();
break;
}
state->color = (state->color + 1) % 3;
state->color = (state->color + 1) % 3;
}
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions movement/watch_faces/complication/party_face.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
typedef struct {
bool blink;
bool fast;
bool led;
uint8_t text : 4;
uint8_t led : 2; // 0 = None; 1 = Green only; 2 = All
uint8_t text : 2;
uint8_t color : 2;
uint8_t led_duration_bak : 2;
uint8_t party_text : 2;
Expand Down

0 comments on commit d51132f

Please sign in to comment.