Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weather: Add functions for temperature in Fahrenheit #1785

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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