247,15 → 247,22 |
void write_ndigit_number_u_10th(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) { |
char s[7]; |
itoa(number, s, 10 ); |
for (uint8_t i = 0; i < length - strlen(s); i++) { |
if (pad) write_char((x++)+(y * 30), 10); |
else write_ascii_char((x++)+(y * 30), 0); |
uint8_t len = strlen(s); |
for (uint8_t i = 0; i < length - len; i++) { |
if (pad) write_char((x++)+(y * 30), 10); // zero |
else write_char((x++)+(y * 30), 0); // blank |
} |
char rest = s[strlen(s)-1]; |
s[strlen(s)-1] = 0; |
if (number < 10) write_char((x-1)+(y * 30), 10); // zero |
else write_ascii_string(x, y, s); |
x += strlen(s); |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) { |
write_char((x-1)+(y * 30), 10); // zero |
} else if (len == 2 && s[0] == '-') { |
write_char((x-1)+(y * 30), 0x49); // minus |
write_char((x)+(y * 30), 10); // zero |
} else { |
write_ascii_string(x, y, s); |
} |
x += len - 1; |
write_char((x++)+(y * 30), 65); // decimal point |
write_ascii_char((x++)+(y * 30), rest); // after dot |
} |
268,20 → 275,24 |
void write_ndigit_number_s_10th(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) { |
char s[7]; |
itoa(number, s, 10 ); |
for (uint8_t i = 0; i < length - strlen(s); i++) { |
if (pad) write_char((x++)+(y * 30), 10); |
else write_char((x++)+(y * 30), 0); |
uint8_t len = strlen(s); |
for (uint8_t i = 0; i < length - len; i++) { |
if (pad) write_char((x++)+(y * 30), 10); // zero |
else write_char((x++)+(y * 30), 0); // blank |
} |
char rest = s[strlen(s)-1]; |
s[strlen(s)-1] = 0; |
if (number < 10) write_char((x)+(y * 30), 10); // zero |
else { |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) { |
write_char((x-1)+(y * 30), 10); // zero |
} else if (len == 2 && s[0] == '-') { |
write_char((x-1)+(y * 30), 0x49); // minus |
write_char((x)+(y * 30), 10); // zero |
} else { |
write_ascii_string(x, y, s); |
} |
x += strlen(s); |
x += len - 1; |
write_char((x++)+(y * 30), 65); // decimal point |
write_ascii_char((x++)+(y * 30), rest); // after dot |
|
} |
|
/** |