]> git.earman.xyz Git - sensor-watch.git/commitdiff
slcd: we can fit these segment mappings into one byte
authorJoey Castillo <joeycastillo@utexas.edu>
Wed, 21 May 2025 03:50:09 +0000 (23:50 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Wed, 21 May 2025 03:50:09 +0000 (23:50 -0400)
watch-library/shared/watch/watch_common_display.c
watch-library/shared/watch/watch_slcd.h

index a06c9dbfd2f90cf04ceead6bdd1163eca3566d06..ed558a1bdec7cc1a22ae23a60e7db36846d08efc 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include <math.h>
 
-uint32_t IndicatorSegments[8] = {
+uint8_t IndicatorSegments[8] = {
     SLCD_SEGID(0, 17), // WATCH_INDICATOR_SIGNAL
     SLCD_SEGID(0, 16), // WATCH_INDICATOR_BELL
     SLCD_SEGID(2, 17), // WATCH_INDICATOR_PM
index dde7366c155ccf355a223b002a4d45f0829f0dd0..b94b3f804e507321abd4b36fadb62ca3e997a2bb 100644 (file)
@@ -42,9 +42,9 @@
   */
 /// @{
 
-#define SLCD_SEGID(com, seg) (((com) << 16) | (seg))
-#define SLCD_COMNUM(segid) (((segid) >> 16) & 0xFF)
-#define SLCD_SEGNUM(segid) ((segid)&0xFF)
+#define SLCD_SEGID(com, seg) (((com) << 5) | (seg))
+#define SLCD_COMNUM(segid) (((segid) >> 5) & 0x07)
+#define SLCD_SEGNUM(segid) ((segid) & 0x1F)
 
 /// An enum listing the icons and indicators available on the watch.
 typedef enum {