]> git.earman.xyz Git - sensor-watch.git/commitdiff
faces/totp: fix error message not displayed bug
authorMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Wed, 20 Mar 2024 14:29:02 +0000 (11:29 -0300)
committerMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Wed, 20 Mar 2024 15:54:10 +0000 (12:54 -0300)
Forgot to call watch_display_string on the error message.
Of course the message isn't going to be displayed.

Also, increase the buffer size to 10 characters
and output a space to the last position.
This ensures the segments are cleared.

Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: madhogs <59648482+madhogs@users.noreply.github.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/385

movement/watch_faces/complication/totp_face.c

index 150add0077738c90c3327bd2d380dec6fafec0f5..2938337e896a9f48938b469f732ce5e56ccec5c5 100644 (file)
@@ -121,10 +121,11 @@ static bool totp_generate(totp_state_t *totp_state) {
 }
 
 static void totp_display_error(totp_state_t *totp_state) {
-    char buf[9 + 1];
+    char buf[10 + 1];
     totp_t *totp = totp_current(totp_state);
 
-    snprintf(buf, sizeof(buf), "%c%c  ERROR", totp->labels[0], totp->labels[1]);
+    snprintf(buf, sizeof(buf), "%c%c  ERROR ", totp->labels[0], totp->labels[1]);
+    watch_display_string(buf, 0);
 }
 
 static void totp_display(totp_state_t *totp_state) {