From 358ddeaea9882dc4d52690d8778035b2aeb44c7b Mon Sep 17 00:00:00 2001 From: David Volovskiy Date: Sat, 23 Aug 2025 11:31:59 -0400 Subject: [PATCH] Added watch_disable_display --- watch-library/hardware/watch/watch_slcd.c | 4 ++++ watch-library/shared/watch/watch_slcd.h | 4 ++++ watch-library/simulator/watch/watch_slcd.c | 14 ++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/watch-library/hardware/watch/watch_slcd.c b/watch-library/hardware/watch/watch_slcd.c index db6b1942..457962cb 100644 --- a/watch-library/hardware/watch/watch_slcd.c +++ b/watch-library/hardware/watch/watch_slcd.c @@ -260,6 +260,10 @@ void watch_enable_display(void) { slcd_enable(); } +void watch_disable_display(void) { + slcd_disable(); +} + inline void watch_set_pixel(uint8_t com, uint8_t seg) { slcd_set_segment(com, seg); } diff --git a/watch-library/shared/watch/watch_slcd.h b/watch-library/shared/watch/watch_slcd.h index b94b3f80..43a4f849 100644 --- a/watch-library/shared/watch/watch_slcd.h +++ b/watch-library/shared/watch/watch_slcd.h @@ -98,6 +98,10 @@ typedef enum { */ void watch_enable_display(void); +/** @brief Disables the Segment LCD display. + */ +void watch_disable_display(void); + /** @brief Sets a pixel. Use this to manually set a pixel with a given common and segment number. * See segmap.html. * @param com the common pin, numbered from 0-2. diff --git a/watch-library/simulator/watch/watch_slcd.c b/watch-library/simulator/watch/watch_slcd.c index 34d8878c..1990e90c 100644 --- a/watch-library/simulator/watch/watch_slcd.c +++ b/watch-library/simulator/watch/watch_slcd.c @@ -50,17 +50,23 @@ void watch_enable_display(void) { _watch_update_indicator_segments(); #endif - EM_ASM({ #if defined(FORCE_CUSTOM_LCD_TYPE) - document.getElementById("classic").style.display = "none"; + EM_ASM({document.getElementById("custom").style.display = "";}); + EM_ASM({document.getElementById("classic").style.display = "none";}); #else - document.getElementById("custom").style.display = "none"; + EM_ASM({document.getElementById("custom").style.display = "none";}); + EM_ASM({document.getElementById("classic").style.display = "";}); #endif - }); watch_clear_display(); } +void watch_disable_display(void) { + watch_clear_display(); + EM_ASM({document.getElementById("classic").style.display = "none";}); + EM_ASM({document.getElementById("custom").style.display = "none";}); +} + void watch_set_pixel(uint8_t com, uint8_t seg) { EM_ASM({ document.querySelectorAll("[data-com='" + $0 + "'][data-seg='" + $1 + "']")