aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ble/SimpleWeatherService.h
diff options
context:
space:
mode:
authorFintasticMan <finlay.neon.kid@gmail.com>2024-12-10 00:11:13 +0100
committermark9064 <30447455+mark9064@users.noreply.github.com>2025-12-21 20:18:04 +0000
commit52baa265feecbb83dcf0419cfaddcd75dde9ccba (patch)
tree02be0db6a29f91010ea4838ab50d925e2d95417c /src/components/ble/SimpleWeatherService.h
parent66b5977f39bf22e0641be43766439a3ed025d604 (diff)
weather: Fix incorrect rounding for negative temperatures
Diffstat (limited to 'src/components/ble/SimpleWeatherService.h')
-rw-r--r--src/components/ble/SimpleWeatherService.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/components/ble/SimpleWeatherService.h b/src/components/ble/SimpleWeatherService.h
index 469b571a..4d09d662 100644
--- a/src/components/ble/SimpleWeatherService.h
+++ b/src/components/ble/SimpleWeatherService.h
@@ -34,6 +34,7 @@
#include "components/datetime/DateTimeController.h"
#include <lvgl/lvgl.h>
#include "displayapp/InfiniTimeTheme.h"
+#include "utility/Math.h"
int WeatherCallback(uint16_t connHandle, uint16_t attrHandle, struct ble_gatt_access_ctxt* ctxt, void* arg);
@@ -77,11 +78,11 @@ namespace Pinetime {
}
[[nodiscard]] int16_t Celsius() const {
- return (PreciseCelsius() + 50) / 100;
+ return Utility::RoundedDiv(PreciseCelsius(), static_cast<int16_t>(100));
}
[[nodiscard]] int16_t Fahrenheit() const {
- return (PreciseFahrenheit() + 50) / 100;
+ return Utility::RoundedDiv(PreciseFahrenheit(), static_cast<int16_t>(100));
}
[[nodiscard]] lv_color_t Color() const {