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 Jun 28, 2023
1 parent 5f3acfa commit 9fa4e56
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/ble/weather/WeatherData.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,34 @@ namespace Pinetime {
* -32768 is reserved for "no data"
*/
int16_t temperature;

/**
* Temperature °F but multiplied by 100 (e.g. -12.50°F becomes -1250)
* -32768 is reserved for "no data"
*/
int16_t GetTempFahrenheit() {
if (temperature == -32768) {
return -32768;
}
return temperature * 9 / 5 + 3200;
}

/**
* Dewpoint °C but multiplied by 100 (e.g. -12.50°C becomes -1250)
* -32768 is reserved for "no data"
*/
int16_t dewPoint;

/**
* Dewpoint °F but multiplied by 100 (e.g. -12.50°F becomes -1250)
* -32768 is reserved for "no data"
*/
int16_t GetDewPointFahrenheit() {
if (dewPoint == -32768) {
return -32768;
}
return dewPoint * 9 / 5 + 3200;
}
};

/**
Expand Down

0 comments on commit 9fa4e56

Please sign in to comment.