summaryrefslogtreecommitdiffstats
path: root/movement
diff options
context:
space:
mode:
authorJose Castillo <joeycastillo@utexas.edu>2023-07-29 07:30:40 -0400
committerGitHub <noreply@github.com>2023-07-29 07:30:40 -0400
commit2738a8b77afeb82bb99969741907bab90bb14368 (patch)
tree85365f9e889aed36ef1f3c3bd617b2b6dccdfda6 /movement
parent340e5d1a4ad8d0028f3977c56af82def1544962d (diff)
parent19672edcfbf7f3a906d13092fd647f35ad0c7382 (diff)
downloadSensor-Watch-2738a8b77afeb82bb99969741907bab90bb14368.tar.gz
Sensor-Watch-2738a8b77afeb82bb99969741907bab90bb14368.tar.bz2
Sensor-Watch-2738a8b77afeb82bb99969741907bab90bb14368.zip
Merge pull request #258 from analogist/nanosec-fix-profbounds
fix nanosec_face correction_profile bounds from going negative
Diffstat (limited to 'movement')
-rw-r--r--movement/watch_faces/settings/nanosec_face.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/movement/watch_faces/settings/nanosec_face.c b/movement/watch_faces/settings/nanosec_face.c
index 87f567d3..b9655c1d 100644
--- a/movement/watch_faces/settings/nanosec_face.c
+++ b/movement/watch_faces/settings/nanosec_face.c
@@ -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) {
@@ -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,