mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 20:47:42 +00:00
Fix rounding bug when displaying frequencies (#1801)
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user