mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-06 21:54:27 -04:00
Fix rounding bug when displaying frequencies (#1801)
This commit is contained in:
parent
ac1d350aaf
commit
0f85f247b6
3 changed files with 5 additions and 4 deletions
|
@ -498,12 +498,13 @@ void GeoMap::draw_scale(Painter& painter) {
|
|||
if (m < 1000) {
|
||||
km_string = to_string_dec_uint(m) + "m";
|
||||
} else {
|
||||
m += 50; // (add rounding factor for div by 100 below)
|
||||
uint32_t km = m / 1000;
|
||||
m -= km * 1000;
|
||||
if (m == 0) {
|
||||
km_string = to_string_dec_uint(km) + " km";
|
||||
} else {
|
||||
km_string = to_string_dec_uint(km) + "." + to_string_dec_uint((m + 50) / 100, 1) + "km";
|
||||
km_string = to_string_dec_uint(km) + "." + to_string_dec_uint(m / 100, 1) + "km";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue