mirror of
https://github.com/joeycastillo/second-movement.git
synced 2025-10-29 11:38:27 +00:00
Merge pull request #29 from EmilienCourt/main
bring totp_face into Second Movement
This commit is contained in:
commit
8eaa9262ad
10
Makefile
10
Makefile
@ -62,6 +62,11 @@ INCLUDES += \
|
||||
-I./filesystem \
|
||||
-I./shell \
|
||||
-I./lib/sunriset \
|
||||
-I./lib/sha1 \
|
||||
-I./lib/sha256 \
|
||||
-I./lib/sha512 \
|
||||
-I./lib/base32 \
|
||||
-I./lib/TOTP \
|
||||
-I./lib/chirpy_tx \
|
||||
-I./lib/base64 \
|
||||
-I./watch-library/shared/watch \
|
||||
@ -84,6 +89,11 @@ SRCS += \
|
||||
./shell/shell.c \
|
||||
./shell/shell_cmd_list.c \
|
||||
./lib/sunriset/sunriset.c \
|
||||
./lib/base32/base32.c \
|
||||
./lib/TOTP/sha1.c \
|
||||
./lib/TOTP/sha256.c \
|
||||
./lib/TOTP/sha512.c \
|
||||
./lib/TOTP/TOTP.c \
|
||||
./lib/chirpy_tx/chirpy_tx.c \
|
||||
./lib/base64/base64.c \
|
||||
./watch-library/shared/driver/thermistor_driver.c \
|
||||
|
||||
@ -51,4 +51,5 @@
|
||||
#include "nanosec_face.h"
|
||||
#include "mars_time_face.h"
|
||||
#include "peek_memory_face.h"
|
||||
#include "totp_face.h"
|
||||
// New includes go above this line.
|
||||
|
||||
@ -11,6 +11,7 @@ SRCS += \
|
||||
./watch-faces/complication/sunrise_sunset_face.c \
|
||||
./watch-faces/complication/moon_phase_face.c \
|
||||
./watch-faces/complication/days_since_face.c \
|
||||
./watch-faces/complication/totp_face.c \
|
||||
./watch-faces/demo/all_segments_face.c \
|
||||
./watch-faces/demo/character_set_face.c \
|
||||
./watch-faces/demo/light_sensor_face.c \
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* Copyright © 2023 Jeremy O'Brien <neutral@fastmail.com>
|
||||
* Copyright © 2024 Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> (https://www.matheusmoreira.com/)
|
||||
* Copyright © 2024 Max Zettlmeißl <max@zettlmeissl.de>
|
||||
* Copyright © 2025 Emilien Court <emilien.court@telecomnancy.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -124,7 +125,7 @@ static void totp_display_error(totp_state_t *totp_state) {
|
||||
totp_t *totp = totp_current(totp_state);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%c%c ERROR ", totp->labels[0], totp->labels[1]);
|
||||
watch_display_string(buf, 0);
|
||||
watch_display_text(0, buf);
|
||||
}
|
||||
|
||||
static void totp_display_code(totp_state_t *totp_state) {
|
||||
@ -141,7 +142,7 @@ static void totp_display_code(totp_state_t *totp_state) {
|
||||
valid_for = totp->period - result.rem;
|
||||
sprintf(buf, "%c%c%2d%06lu", totp->labels[0], totp->labels[1], valid_for, totp_state->current_code);
|
||||
|
||||
watch_display_string(buf, 0);
|
||||
watch_display_text(0, buf);
|
||||
}
|
||||
|
||||
static void totp_display(totp_state_t *totp_state) {
|
||||
@ -158,7 +159,7 @@ static void totp_generate_and_display(totp_state_t *totp_state) {
|
||||
}
|
||||
|
||||
static inline uint32_t totp_compute_base_timestamp() {
|
||||
return watch_utility_date_time_to_unix_time(watch_rtc_get_date_time(), movement_get_current_timezone_offset());
|
||||
return watch_utility_date_time_to_unix_time(movement_get_utc_date_time(), 0);
|
||||
}
|
||||
|
||||
void totp_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
Loading…
x
Reference in New Issue
Block a user