File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3030#define LED_BACKPACK_ALIGNMENT_RIGHT 2 // /< Right alignment
3131#define LED_BACKPACK_ALIGNMENT_DEFAULT \
3232 LED_BACKPACK_ALIGNMENT_LEFT // /< Default alignment
33- #define LED_MAX_CHARS \
34- 4 // /< Maximum number of characters to display on the alphanumeric display
33+ #define LED_MAX_CHARS 5
3534
3635/* !
3736 @brief Class that provides a driver interface for 7-Segment
@@ -140,12 +139,30 @@ class WipperSnapper_I2C_Driver_Out_7Seg : public WipperSnapper_I2C_Driver_Out {
140139 }
141140 }
142141 // start at the rightmost position of the display
143- pos_start = LED_MAX_CHARS - seg_chars;
142+ switch (seg_chars) {
143+ case 4 :
144+ pos_start = 0 ;
145+ break ;
146+ case 3 :
147+ pos_start = 1 ;
148+ break ;
149+ case 2 :
150+ pos_start = 3 ; // if 2 characters, start at position 3 is required
151+ // because ':' is position 2 and we need to skip it
152+ break ;
153+ case 1 :
154+ pos_start = 4 ;
155+ break ;
156+ default :
157+ pos_start = 0 ; // if no characters or overflow, start at position 0
158+ break ;
159+ }
144160 }
145161
146162 // Write to the display's buffer
147163 int cur_idx = pos_start;
148164 for (size_t i = 0 ; i < len_display; i++) {
165+
149166 // skip position 2
150167 if (cur_idx == 2 ) {
151168 cur_idx++;
You can’t perform that action at this time.
0 commit comments