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

Replace secondary face index with "pages" system. #314

Closed
wants to merge 3 commits into from
Closed
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
27 changes: 16 additions & 11 deletions movement/movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@

#include "movement_custom_signal_tunes.h"

// Default to no secondary face behaviour.
#ifndef MOVEMENT_SECONDARY_FACE_INDEX
#define MOVEMENT_SECONDARY_FACE_INDEX 0
#endif

// Set default LED colors if not set
#ifndef MOVEMENT_DEFAULT_RED_COLOR
#define MOVEMENT_DEFAULT_RED_COLOR 0x0
Expand Down Expand Up @@ -232,11 +227,21 @@ bool movement_default_loop_handler(movement_event_t event, movement_settings_t *
movement_illuminate_led();
break;
case EVENT_MODE_LONG_PRESS:
if (MOVEMENT_SECONDARY_FACE_INDEX && movement_state.current_watch_face == 0) {
movement_move_to_face(MOVEMENT_SECONDARY_FACE_INDEX);
} else {
movement_move_to_face(0);
for (uint32_t i = 0; i < MOVEMENT_NUM_PAGES; i++) {
if (MOVEMENT_MODE_LONGPRESS_ALWAYS_NEXT_PAGE) {
if (movement_state.current_watch_face >= movement_pages[i] && movement_state.current_watch_face < movement_pages[(i + 1) % MOVEMENT_NUM_PAGES]) {
movement_move_to_face(movement_pages[(i + 1) % MOVEMENT_NUM_PAGES]);
return true;
}
} else {
if (movement_state.current_watch_face == movement_pages[i]) {
movement_move_to_face(movement_pages[(i + 1) % MOVEMENT_NUM_PAGES]);
return true;
}
}
}

movement_move_to_face(0);
break;
default:
break;
Expand All @@ -252,8 +257,8 @@ void movement_move_to_face(uint8_t watch_face_index) {

void movement_move_to_next_face(void) {
uint16_t face_max;
if (MOVEMENT_SECONDARY_FACE_INDEX) {
face_max = (movement_state.current_watch_face < (int16_t)MOVEMENT_SECONDARY_FACE_INDEX) ? MOVEMENT_SECONDARY_FACE_INDEX : MOVEMENT_NUM_FACES;
if (MOVEMENT_HIDDEN_FACES_INDEX) {
face_max = (movement_state.current_watch_face < (int16_t)MOVEMENT_HIDDEN_FACES_INDEX) ? MOVEMENT_HIDDEN_FACES_INDEX : MOVEMENT_NUM_FACES;
} else {
face_max = MOVEMENT_NUM_FACES;
}
Expand Down
32 changes: 26 additions & 6 deletions movement/movement_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,33 @@ const watch_face_t watch_faces[] = {

#define MOVEMENT_NUM_FACES (sizeof(watch_faces) / sizeof(watch_face_t))

/* Determines what face to go to from the first face on long press of the Mode button.
* Also excludes these faces from the normal rotation.
* In the default firmware, this lets you access temperature and battery voltage with a long press of Mode.
* Some folks also like to use this to hide the preferences and time set faces from the normal rotation.
* If you don't want any faces to be excluded, set this to 0 and a long Mode press will have no effect.
/* This allows you to set up multiple "pages" of faces. Pressing the mode
* button will move through the faces in the current page, and long-pressing
* mode from the first face on a page will jump to the next page. Pressing mode
* at the end of a page or long-pressing mode on a face that isn't at the start
* of a page will return you to the initial page.
*
* This allows you to quickly cycle through the faces that are important to
* you, while hiding and organizing lesser-used faces behind long-presses of
* the mode button.
*
* By default, the second page of faces (temperature and battery voltage) are
* hidden using MOVEMENT_HIDDEN_FACES_INDEX. If you just want a simple list of
* faces instead of having some hidden, you can set movement_pages to { 0 } and
* MOVEMENT_HIDDEN_FACES_INDEX to 0.
*/
#define MOVEMENT_SECONDARY_FACE_INDEX (MOVEMENT_NUM_FACES - 2) // or (0)
const uint8_t movement_pages[] = { 0, MOVEMENT_NUM_FACES - 2 };

#define MOVEMENT_NUM_PAGES (sizeof(movement_pages) / sizeof(*movement_pages))

#define MOVEMENT_HIDDEN_FACES_INDEX MOVEMENT_NUM_FACES - 2

/* Setting this to true will make a long-press of the mode button always jump
* to the next page, instead of the default behaviour, which is only jumping to
* the next page if you are on the first face of a page. This is likely most
* useful if you have a large number of faces, but it has the downside that it
* can make returning to the first face more difficult. */
#define MOVEMENT_MODE_LONGPRESS_ALWAYS_NEXT_PAGE false

/* Custom hourly chime tune. Check movement_custom_signal_tunes.h for options */
#define SIGNAL_TUNE_DEFAULT
Expand Down