Skip to content

Commit

Permalink
Merge pull request #258 from analogist/nanosec-fix-profbounds
Browse files Browse the repository at this point in the history
fix nanosec_face correction_profile bounds from going negative
  • Loading branch information
joeycastillo authored Jul 29, 2023
2 parents 340e5d1 + 19672ed commit 2738a8b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion movement/watch_faces/settings/nanosec_face.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ static void value_increase(int16_t delta) {
break;
case 4: // Profile
nanosec_state.correction_profile = (nanosec_state.correction_profile + delta) % nanosec_profile_count;
// if ALARM decreases profile below 0, roll back around
if (nanosec_state.correction_profile < 0) {
nanosec_state.correction_profile += nanosec_profile_count;
}
break;
case 5: // Cadence
switch (nanosec_state.correction_cadence) {
Expand Down Expand Up @@ -330,7 +334,11 @@ bool nanosec_face_loop(movement_event_t event, movement_settings_t *settings, vo
value_increase(-1);
break;
case EVENT_ALARM_LONG_PRESS:
value_increase(-50);
if (nanosec_screen == 4) { // If we are in profile - still decrease by 1
value_increase(-1);
} else {
value_increase(-50);
}
break;
case EVENT_TIMEOUT:
// Your watch face will receive this event after a period of inactivity. If it makes sense to resign,
Expand Down

0 comments on commit 2738a8b

Please sign in to comment.