Improve lcd_write_integer_page()
The procedure `lcd_write_integer_page()` is improved by increasing the possible values of the `comperator` variable and adding comments.
This commit is contained in:
parent
0395da78de
commit
c4272c5230
1 changed files with 4 additions and 1 deletions
|
@ -370,15 +370,18 @@ static void lcd_write_integer_page(const uint32_t integer,
|
||||||
const bool invert) {
|
const bool invert) {
|
||||||
if (digits != 0 || integer != 0) {
|
if (digits != 0 || integer != 0) {
|
||||||
uint8_t input_digits = 0;
|
uint8_t input_digits = 0;
|
||||||
uint16_t comperator = 1;
|
uint32_t comperator = 1;
|
||||||
|
|
||||||
|
// Get digits
|
||||||
for (; comperator <= integer; comperator *= 10, input_digits++);
|
for (; comperator <= integer; comperator *= 10, input_digits++);
|
||||||
|
|
||||||
|
// Print leading zeroes
|
||||||
for (int8_t i = digits - input_digits; i > 0; i--) {
|
for (int8_t i = digits - input_digits; i > 0; i--) {
|
||||||
lcd_write_kerning(2, invert);
|
lcd_write_kerning(2, invert);
|
||||||
lcd_write_digit_page(0, page, invert);
|
lcd_write_digit_page(0, page, invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print number itself
|
||||||
for (; comperator >= 10; comperator /= 10) {
|
for (; comperator >= 10; comperator /= 10) {
|
||||||
lcd_write_kerning(2, invert);
|
lcd_write_kerning(2, invert);
|
||||||
lcd_write_digit_page((integer % comperator) / (comperator / 10),
|
lcd_write_digit_page((integer % comperator) / (comperator / 10),
|
||||||
|
|
Loading…
Reference in a new issue