From e40d77d9f35d30b0eedced94c80f44bb6b92ae67 Mon Sep 17 00:00:00 2001 From: Patrick Moessler Date: Sun, 14 Jan 2024 03:14:03 +0100 Subject: [PATCH] better output --- esp32-clock-template.yaml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/esp32-clock-template.yaml b/esp32-clock-template.yaml index 9eae160..f1527da 100644 --- a/esp32-clock-template.yaml +++ b/esp32-clock-template.yaml @@ -45,12 +45,16 @@ time: id: sntp_time timezone: Europe/Berlin on_time: - - seconds: 10 + - seconds: /10 then: - logger.log: level: INFO format: "%2d %2d %2d %2d" - args: ['int(id(runtime).state/3600)%24', 'int(id(runtime).state/60)%60', 'int(id(runtime).state)%60', 'int(id(runtime).state-int(id(runtime).state)*25)'] + args: + - 'int(id(runtime).state/3600) - int(id(runtime).state/86400)*86400' + - 'int(id(runtime).state/60) - int(id(runtime).state/3600)*3600' + - 'int(id(runtime).state) - int(id(runtime).state/60)*60' + - 'int((id(runtime).state - int(id(runtime).state))*25)' spi: clk_pin: GPIO18 @@ -78,14 +82,22 @@ display: clock_frames++; } - it.strftime(0, "%H%M%s", id(sntp_time).now()); - it.printf(7, "%2d", clock_frames); - it.printf(8, ".*-_'`,0"); - /*it.strftime(8, "%H%M%s", id(sntp_time).now());*/ - /*it.printf(11, "%1d", 0)*/ - it.printf(12, "%2d%2d%2d%2d", int(id(runtime).state/3600)%24, int(id(runtime).state/60)%60, int(id(runtime).state)%60, int(id(runtime).state-int(id(runtime).state)*25) ); + it.printf(0, ".*-_'`,0"); + /*it.strftime(0, "%H%M%s", id(sntp_time).now());*/ + /*it.printf(6, "%2d", clock_frames);*/ -# the second display should display a test string to figure out the digit and segment map: + it.strftime(8, "%H%M%s", id(sntp_time).now()); + it.printf(14, "%2d", clock_frames); + /*it.strftime(8, "%H%M%s", id(sntp_time).now());*/ + /*it.printf(14, "%1d", 0)*/ + + it.printf(16, "%2d%2d%2d%2d", + int(id(runtime).state/3600) - int(id(runtime).state/86400)*86400, + int(id(runtime).state/60) - int(id(runtime).state/3600)*3600, + int(id(runtime).state) - int(id(runtime).state/60)*60, + int((id(runtime).state - int(id(runtime).state))*25) ); + +# the first display should display a test string to figure out the digit and segment map: # digit 0: >.< character (dot segment on) # digit 1: >*< character (upper segment on) # digit 2: >-< character (middle segment on)