port nanosec and finetune to Second Movement

This commit is contained in:
Joey Castillo 2025-05-21 00:50:15 -04:00
parent 20a72b4590
commit e0010f6760
6 changed files with 37 additions and 24 deletions

View File

@ -48,4 +48,6 @@
#include "light_sensor_face.h"
#include "irda_upload_face.h"
#include "chirpy_demo_face.h"
#include "finetune_face.h"
#include "nanosec_face.h"
// New includes go above this line.

View File

@ -21,6 +21,8 @@ SRCS += \
./watch-faces/settings/set_time_face.c \
./watch-faces/settings/preferences_face.c \
./watch-faces/settings/settings_face.c \
./watch-faces/settings/finetune_face.c \
./watch-faces/settings/nanosec_face.c \
./watch-faces/io/chirpy_demo_face.c \
./watch-faces/io/irda_upload_face.c \
# New watch faces go above this line.

View File

@ -28,6 +28,7 @@
#include "finetune_face.h"
#include "nanosec_face.h"
#include "watch_utility.h"
#include "delay.h"
extern nanosec_state_t nanosec_state;
@ -44,7 +45,7 @@ void finetune_face_activate(void *context) {
(void) context;
// Handle any tasks related to your watch face coming on screen.
watch_display_string("FT", 0);
watch_display_text(WATCH_POSITION_TOP_LEFT, "FT");
total_adjustment = 0;
finetune_page = 0;
}
@ -62,32 +63,33 @@ static void finetune_update_display(void) {
char buf[25];
if (finetune_page == 0) {
watch_display_string("FT", 0);
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "FTU", "FT");
watch_date_time_t date_time = watch_rtc_get_date_time();
sprintf(buf, "%02d", date_time.unit.second);
watch_display_string(buf, 8);
sprintf(buf, "%04d", abs(total_adjustment));
watch_display_string(buf, 4);
sprintf(buf, "%04d%02d", abs(total_adjustment), date_time.unit.second);
watch_display_text(WATCH_POSITION_BOTTOM, buf);
if (total_adjustment < 0) {
watch_display_string("--", 2);
watch_display_text(WATCH_POSITION_TOP_RIGHT, "--");
} else {
watch_display_string(" ", 2);
watch_display_text(WATCH_POSITION_TOP_RIGHT, " ");
}
} else if (finetune_page == 1) {
float hours = finetune_get_hours_passed();
sprintf(buf, "DT %4d%02d", (int)hours, (int)(fmodf(hours, 1.) * 100));
watch_display_string(buf, 0);
watch_display_text(WATCH_POSITION_TOP_RIGHT, " ");
watch_display_text_with_fallback(WATCH_POSITION_TOP, "DELtA", "DT");
sprintf(buf, "%4d%02d", (int)hours, (int)(fmodf(hours, 1.) * 100));
watch_display_text(WATCH_POSITION_BOTTOM, buf);
} else if (finetune_page == 2) {
watch_display_text(WATCH_POSITION_TOP_RIGHT, " ");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "Frq", " F");
if (finetune_get_hours_passed() < 6) {
sprintf(buf, " F 6HR ");
watch_display_string(buf, 0);
watch_display_text(WATCH_POSITION_BOTTOM, "6HR ");
} else {
float correction = finetune_get_correction();
sprintf(buf, " F%s%2d%04d", (total_adjustment < 0) ? " -" : " ", (int)fabsf(correction), (int)(remainderf(fabsf(correction), 1.) * 10000));
watch_display_string(buf, 0);
watch_display_text(WATCH_POSITION_TOP_RIGHT, (total_adjustment < 0) ? " -" : " ");
sprintf(buf, "%2d%04d", (int)fabsf(correction), (int)(remainderf(fabsf(correction), 1.) * 10000));
watch_display_text(WATCH_POSITION_BOTTOM, buf);
}
}
}

View File

@ -178,28 +178,35 @@ static void nanosec_update_display() {
switch (nanosec_screen) {
case 0:
sprintf(buf, "FC %6d", nanosec_state.freq_correction);
watch_display_text_with_fallback(WATCH_POSITION_TOP, "FCorr", "FC");
sprintf(buf, "%6d", nanosec_state.freq_correction);
break;
case 1:
sprintf(buf, "T0 %6d", nanosec_state.center_temperature);
watch_display_text_with_fallback(WATCH_POSITION_TOP, "CTMP ", "T0");
sprintf(buf, "%6d", nanosec_state.center_temperature);
break;
case 2:
sprintf(buf, "2C %6d", nanosec_state.quadratic_tempco);
watch_display_text_with_fallback(WATCH_POSITION_TOP, "2Coef", "2C");
sprintf(buf, "%6d", nanosec_state.quadratic_tempco);
break;
case 3:
sprintf(buf, "3C %6d", nanosec_state.cubic_tempco);
watch_display_text_with_fallback(WATCH_POSITION_TOP, "3Coef", "3C");
sprintf(buf, "%6d", nanosec_state.cubic_tempco);
break;
case 4: // Profile
sprintf(buf, "PR P%1d", nanosec_state.correction_profile);
watch_display_text_with_fallback(WATCH_POSITION_TOP, "PROFL", "PR");
sprintf(buf, " P%1d", nanosec_state.correction_profile);
break;
case 5: // Cadence
sprintf(buf, "CD %2d", nanosec_state.correction_cadence);
watch_display_text_with_fallback(WATCH_POSITION_TOP, "Cadnc", "CD");
sprintf(buf, " %2d", nanosec_state.correction_cadence);
break;
case 6: // Aging
sprintf(buf, "AA %6d", nanosec_state.aging_ppm_pa);
watch_display_text_with_fallback(WATCH_POSITION_TOP, "AgeCo", "CD");
sprintf(buf, "%6d", nanosec_state.aging_ppm_pa);
break;
}
watch_display_string(buf, 0);
watch_display_text(WATCH_POSITION_BOTTOM, buf);
}
static void value_increase(int16_t delta) {