Skip to content

Commit

Permalink
weather: Add functions for temperature in Fahrenheit
Browse files Browse the repository at this point in the history
  • Loading branch information
FintasticMan committed Nov 16, 2023
1 parent 9b8eb75 commit 9375e77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/ble/weather/WeatherService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/components/ble/weather/WeatherService.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 9375e77

Please sign in to comment.