removed leading zeros from sevensegmen

This commit is contained in:
Lucas Pleß 2013-06-15 07:10:34 +02:00
parent a64bc39662
commit 6cd04b244a
1 changed files with 19 additions and 6 deletions

View File

@ -90,13 +90,26 @@ static void print_sevenseg(uint8_t display, uint16_t value) {
d[0] = (value % 10);
if(display == 0) {
for(uint8_t i = 0; i< 3; i++) {
digitbuffer[i] = segment_translate[d[i]];
}
digitbuffer[0] = segment_translate[d[0]];
if(d[1] == 0)
digitbuffer[1] = 0x00;
else
digitbuffer[1] = segment_translate[d[1]];
if(d[2] == 0)
digitbuffer[2] = 0x00;
else
digitbuffer[2] = segment_translate[d[2]];
} else {
for(uint8_t i = 0; i< 3; i++) {
digitbuffer[i+3] = segment_translate[d[i]];
}
digitbuffer[3] = segment_translate[d[0]];
if(d[1] == 0)
digitbuffer[4] = 0x00;
else
digitbuffer[4] = segment_translate[d[1]];
if(d[2] == 0)
digitbuffer[5] = 0x00;
else
digitbuffer[5] = segment_translate[d[2]];
}
}