Skip to content

Commit

Permalink
Change variables to camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
minacode authored Dec 7, 2024
1 parent acf38e9 commit 9cb3b65
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/displayapp/screens/Calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,18 @@ void Calculator::UpdateResultLabel() const {
remainder = -remainder;
}

uint8_t min_width = N_DECIMALS;
uint8_t minWidth = N_DECIMALS;

// cut "0"-digits on the right
while ((remainder > 0) && (remainder % 10 == 0)) {
remainder /= 10;
min_width--;
minWidth--;
}

if ((integer == 0) && negative) {
lv_label_set_text_fmt(resultLabel, "-0.%0*" PRId64, min_width, remainder);
lv_label_set_text_fmt(resultLabel, "-0.%0*" PRId64, minWidth, remainder);
} else {
lv_label_set_text_fmt(resultLabel, "%" PRId64 ".%0*" PRId64, integer, min_width, remainder);
lv_label_set_text_fmt(resultLabel, "%" PRId64 ".%0*" PRId64, integer, minWidth, remainder);
}
}

Expand All @@ -288,31 +288,31 @@ void Calculator::UpdateValueLabel() {

int64_t printRemainder = remainder < 0 ? -remainder : remainder;

uint8_t min_width = 0;
int64_t tmp_offset = offset;
uint8_t minWidth = 0;
int64_t tmpOffset = offset;

if (tmp_offset == 0) {
tmp_offset = 1;
min_width = 1;
if (tmpOffset == 0) {
tmpOffset = 1;
minWidth = 1;
}
while (tmp_offset < FIXED_POINT_OFFSET) {
tmp_offset *= 10;
min_width++;
while (tmpOffset < FIXED_POINT_OFFSET) {
tmpOffset *= 10;
minWidth++;
}
min_width--;
minWidth--;

for (uint8_t i = min_width; i < N_DECIMALS; i++) {
for (uint8_t i = minWidth; i < N_DECIMALS; i++) {
printRemainder /= 10;
}

if ((integer == 0) && negative) {
lv_label_set_text_fmt(valueLabel, "-0.%0*" PRId64, min_width, printRemainder);
lv_label_set_text_fmt(valueLabel, "-0.%0*" PRId64, minWidth, printRemainder);
} else if (offset == FIXED_POINT_OFFSET) {
lv_label_set_text_fmt(valueLabel, "%" PRId64, integer);
} else if ((offset == (FIXED_POINT_OFFSET / 10)) && (remainder == 0)) {
lv_label_set_text_fmt(valueLabel, "%" PRId64 ".", integer);
} else {
lv_label_set_text_fmt(valueLabel, "%" PRId64 ".%0*" PRId64, integer, min_width, printRemainder);
lv_label_set_text_fmt(valueLabel, "%" PRId64 ".%0*" PRId64, integer, minWidth, printRemainder);
}
} break;
}
Expand Down

0 comments on commit 9cb3b65

Please sign in to comment.