File tree Expand file tree Collapse file tree 2 files changed +20
-29
lines changed Expand file tree Collapse file tree 2 files changed +20
-29
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 30
30
#define LED_BACKPACK_ALIGNMENT_RIGHT 2 // /< Right alignment
31
31
#define LED_BACKPACK_ALIGNMENT_DEFAULT \
32
32
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
35
34
36
35
/* !
37
36
@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 {
140
139
}
141
140
}
142
141
// 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
+ }
144
160
}
145
161
146
162
// Write to the display's buffer
147
163
int cur_idx = pos_start;
148
164
for (size_t i = 0 ; i < len_display; i++) {
165
+
149
166
// skip position 2
150
167
if (cur_idx == 2 ) {
151
168
cur_idx++;
You can’t perform that action at this time.
0 commit comments