Skip to content

Commit 6e9ce5c

Browse files
committed
Fix - degree symbol on 7seg display
1 parent 67abbc6 commit 6e9ce5c

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_7Seg.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
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 5
33+
#define LED_MAX_CHARS \
34+
5 ///< Maximum characters for 7-segment display, including ':'
35+
#define LED_BACKPACK_DEGREE_SYMBOL \
36+
0b01100011 ///< Degree symbol for 7-segment display
3437

3538
/*!
3639
@brief Class that provides a driver interface for 7-Segment
@@ -177,8 +180,14 @@ class WipperSnapper_I2C_Driver_Out_7Seg : public WipperSnapper_I2C_Driver_Out {
177180
display_dot = true;
178181
i++;
179182
len_display++;
183+
} else if (message[i] == 0xC2 && message[i + 1] == 0xB0 &&
184+
i + 1 < strlen(message)) {
185+
// Write degree symbol
186+
_matrix->writeDigitRaw(cur_idx, LED_BACKPACK_DEGREE_SYMBOL);
187+
i++;
188+
cur_idx++;
189+
continue; // skip to next character
180190
}
181-
182191
// Write the character to the display buffer
183192
_matrix->writeDigitAscii(cur_idx, ch, display_dot);
184193
cur_idx++;

src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_QuadAlphaNum.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
LED_BACKPACK_ALIGNMENT_LEFT ///< Default alignment
2828
#define LED_MAX_CHARS \
2929
4 ///< Maximum number of characters to display on the alphanumeric display
30+
#define ALPHANUM_DEGREE_SYMBOL \
31+
0b0000000011100011 ///< Degree symbol for alphanumeric display
3032

3133
/*!
3234
@brief Class that provides a driver interface for Quad Alphanumeric
@@ -147,11 +149,10 @@ class WipperSnapper_I2C_Driver_Out_QuadAlphaNum
147149
display_dot = true;
148150
i++;
149151
len_display++;
150-
}
151-
else if (message[i] == 0xC2 && message[i + 1] == 0xB0 && i + 1 < strlen(message)) {
152-
WS_DEBUG_PRINTLN("Degree symbol detected!");
153-
// Build a degree symbol (A, B, F, G1, G2 segments)
154-
_alpha4->writeDigitRaw(cur_idx, 0b0000000011100011);
152+
} else if (message[i] == 0xC2 && message[i + 1] == 0xB0 &&
153+
i + 1 < strlen(message)) {
154+
// Write the degree symbol
155+
_alpha4->writeDigitRaw(cur_idx, ALPHANUM_DEGREE_SYMBOL);
155156
i++;
156157
cur_idx++;
157158
continue;

0 commit comments

Comments
 (0)