Skip to content

Commit 799c040

Browse files
committed
fixed led bug
1 parent fb04b2d commit 799c040

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

firmware/Core/Src/main.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,16 @@ void temp_timer(){
143143
sprintf(tmp_str, "%lu.0\t", HAL_GetTick());
144144
strcat(tsv_str, tmp_str);
145145
for(uint8_t i = 0; i <=3; i++){
146-
if(tp[i] < 2045){
147-
led_set(i, STATE_GREEN);
148-
} else {
149-
led_set(i, STATE_RED);
150-
}
151146
char tmp_str[24];
152147
sprintf(tmp_str, "%.4f\t", tp[i]);
153148
strcat(tsv_str, tmp_str);
154149
}
150+
151+
led_set(LED0, tp[3] < 2045 ? STATE_GREEN : STATE_RED);
152+
led_set(LED1, tp[2] < 2045 ? STATE_GREEN : STATE_RED);
153+
led_set(LED2, tp[1] < 2045 ? STATE_GREEN : STATE_RED);
154+
led_set(LED3, tp[0] < 2045 ? STATE_GREEN : STATE_RED);
155+
155156
strcat(tsv_str, "\n");
156157
CDC_Transmit_FS((uint8_t *) &tsv_str, sizeof tsv_str);
157158

0 commit comments

Comments
 (0)