diff --git a/src/components/ble/weather/WeatherService.cpp b/src/components/ble/weather/WeatherService.cpp index b9a6af556c..77f493a88a 100644 --- a/src/components/ble/weather/WeatherService.cpp +++ b/src/components/ble/weather/WeatherService.cpp @@ -606,6 +606,13 @@ namespace Pinetime { return result; } + int16_t WeatherService::GetTempFahrenheit(int16_t temp) const { + if (temp == -32768) { + return -32768; + } + return temp * 9 / 5 + 3200; + } + void WeatherService::CleanUpQcbor(QCBORDecodeContext* decodeContext) { QCBORDecode_ExitMap(decodeContext); QCBORDecode_Finish(decodeContext); diff --git a/src/components/ble/weather/WeatherService.h b/src/components/ble/weather/WeatherService.h index 609e8760d6..ee99fae69a 100644 --- a/src/components/ble/weather/WeatherService.h +++ b/src/components/ble/weather/WeatherService.h @@ -70,6 +70,12 @@ namespace Pinetime { */ int16_t GetTodayMinTemp() const; + /** + * Converts the temperature in degrees Celsius to degrees Fahrenheit + * @return -32768 if there's no data, degrees Fahrenheit times 100 otherwise + */ + int16_t GetTempFahrenheit(int16_t temp) const; + /* * Management functions */