Skip to content

Commit 878d186

Browse files
committed
Fix float issues
1 parent eb2cfa1 commit 878d186

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/i2c/drivers/drvOutQuadAlphaNum.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,13 @@ class drvOutQuadAlphaNum : public drvOutputBase {
133133
pos_start = LED_MAX_CHARS - seg_chars;
134134
}
135135

136+
136137
WS_DEBUG_PRINT("Message to display: ");
137-
WS_DEBUG_PRINT(message);
138+
WS_DEBUG_PRINTLN(message);
138139
WS_DEBUG_PRINT(" with len_display: ");
139-
WS_DEBUG_PRINT(len_display);
140+
WS_DEBUG_PRINTLN(len_display);
140141
WS_DEBUG_PRINT(" at pos_start: ");
141-
WS_DEBUG_PRINT(pos_start);
142+
WS_DEBUG_PRINTLN(pos_start);
142143

143144
// TODO FRIDAY
144145
// NOTE: If there's a ., increment len_display by 1 to account for the decimal
@@ -154,11 +155,12 @@ class drvOutQuadAlphaNum : public drvOutputBase {
154155
if (i + 1 < len_display && message[i + 1] == '.') {
155156
display_dot = true;
156157
i++;
158+
len_display++;
157159
}
158160

159161
// Write the character to the display buffer
160162
WS_DEBUG_PRINT("Writing char: ");
161-
WS_DEBUG_PRINT(message[i]);
163+
WS_DEBUG_PRINT(ch);
162164
WS_DEBUG_PRINT(" at index: ");
163165
WS_DEBUG_PRINT(cur_idx);
164166
WS_DEBUG_PRINT(" with dot: ");
@@ -177,7 +179,7 @@ class drvOutQuadAlphaNum : public drvOutputBase {
177179
displayed.
178180
*/
179181
void WriteValue(float value) {
180-
char message[LED_MAX_CHARS + 1];
182+
char message[8+1];
181183
snprintf(message, sizeof(message), "%.5f", value);
182184
WriteMessage(message);
183185
}

0 commit comments

Comments
 (0)