aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/Weather.h
diff options
context:
space:
mode:
authorFintasticMan <finlay.neon.kid@gmail.com>2024-02-20 11:25:02 +0100
committerJF <JF002@users.noreply.github.com>2024-11-04 21:22:38 +0100
commit29ad09f4ef54126831d36fe1b99e794059fc5421 (patch)
tree4699e2008850c8f99297abcf549844317ab0cdb2 /src/displayapp/Weather.h
parentafeded0126ff3bb30bdd5b1ed55f5dddca8b92d5 (diff)
weather: Refactor temperature type for type safety
There is now a Temperature struct in the weather service, which holds the internal representation. There is also a temperature struct in the Applications namespace, which holds the temperature in either Celsius or Fahrenheit.
Diffstat (limited to 'src/displayapp/Weather.h')
-rw-r--r--src/displayapp/Weather.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/displayapp/Weather.h b/src/displayapp/Weather.h
new file mode 100644
index 00000000..0dd17fce
--- /dev/null
+++ b/src/displayapp/Weather.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include <cstdint>
+#include <variant>
+
+#include "components/ble/SimpleWeatherService.h"
+#include "components/settings/Settings.h"
+
+namespace Pinetime {
+ namespace Applications {
+ struct Temperature {
+ int16_t temp;
+ };
+
+ Temperature Convert(Controllers::SimpleWeatherService::Temperature temp, Controllers::Settings::WeatherFormat format);
+ }
+}