]> git.earman.xyz Git - sensor-watch.git/commitdiff
slcd: add more special cases
authorJoey Castillo <jose.castillo@gmail.com>
Mon, 4 Oct 2021 14:48:04 +0000 (10:48 -0400)
committerJoey Castillo <jose.castillo@gmail.com>
Mon, 4 Oct 2021 18:12:39 +0000 (14:12 -0400)
watch-library/watch/watch_slcd.c

index c1e24308eed9b9f788852613ec07821d94b745ff..fc8c255a3097503e875da80f1e095db32cfb8a3d 100644 (file)
@@ -114,8 +114,8 @@ static const uint8_t Character_Set[] =
     0b01010000, // r
     0b01101101, // s
     0b01111000, // t
-    0b01100010, // u (appears as superscript to work in more positions)
-    0b01100010, // v (appears as superscript to work in more positions)
+    0b01100010, // u (appears in (u)pper half to work in more positions)
+    0b00011100, // v (looks like u but in the lower half)
     0b10111110, // w (only works in position 0)
     0b01111110, // x
     0b01101110, // y
@@ -169,8 +169,16 @@ void watch_clear_display() {
 }
 
 void watch_display_character(uint8_t character, uint8_t position) {
-    // handle lowercase 7 if needed
-    if (character == '7' && (position == 4 || position == 6)) character = '&';
+    // special cases for positions 4 and 6
+    if (position == 4 || position == 6) {
+        if (character == '7') character = '&'; // "lowercase" 7
+        if (character == 'v') character = 'u'; // bottom segment duplicated, so show in top half
+        if (character == 'J') character = 'j'; // same
+    } else if (position != 4 && position != 6) {
+        if (character == 'u') character = 'v'; // we can use the bottom segment; move to lower half
+        if (character == 'j') character = 'J'; // same but just display a normal J
+    }
+    if (position == 0) slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(0, 15)); // clear funky ninth segment
 
     uint64_t segmap = Segment_Map[position];
     uint64_t segdata = Character_Set[character - 0x20];
@@ -189,7 +197,8 @@ void watch_display_character(uint8_t character, uint8_t position) {
         segmap = segmap >> 8;
         segdata = segdata >> 1;
     }
-    if (character == 'T' && position == 1) slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(1, 12));
+    if (character == 'T' && position == 1) slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(1, 12)); // add descender
+    else if (position == 0 && (character == 'B' || character == 'D')) slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(0, 15)); // add funky ninth segment
 }
 
 void watch_display_string(char *string, uint8_t position) {