Skip to content

Commit

Permalink
SimpleWeatherService : Update protocol (InfiniTime now uses int16_t i…
Browse files Browse the repository at this point in the history
…nstead of uint8_t to store the temperature).
  • Loading branch information
JF002 committed Dec 23, 2023
1 parent 690b366 commit 91814aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions daemon/src/services/simpleweatherservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ void SimpleWeatherService::sendWeather(CurrentWeather *weather)
weatherBytes += TypeConversion::fromInt8(0); // message type
weatherBytes += TypeConversion::fromInt8(0); // version information
weatherBytes += TypeConversion::fromInt64(weather->dateTime());
weatherBytes += TypeConversion::fromInt8( round(weather->temperature() - 273.15) );
weatherBytes += TypeConversion::fromInt8( round(weather->minTemperature() - 273.15) );
weatherBytes += TypeConversion::fromInt8( round(weather->maxTemperature() - 273.15) );
weatherBytes += TypeConversion::fromInt16( round((weather->temperature() - 273.15) * 100) );
weatherBytes += TypeConversion::fromInt16( round((weather->minTemperature() - 273.15) * 100) );
weatherBytes += TypeConversion::fromInt16( round((weather->maxTemperature() - 273.15) * 100) );
weatherBytes += cityNameBytes;
weatherBytes += TypeConversion::fromInt8( (int)iconToEnum(weather->weatherIcon()) );

Expand Down Expand Up @@ -106,8 +106,8 @@ void SimpleWeatherService::sendWeather(CurrentWeather *weather)
<< (int)iconToEnum(fc.weatherIcon())
;

forecastBytes += TypeConversion::fromInt8( round(fc.minTemperature() - 273.15) );
forecastBytes += TypeConversion::fromInt8( round(fc.maxTemperature() - 273.15) );
forecastBytes += TypeConversion::fromInt16( round((fc.minTemperature() - 273.15) * 100) );
forecastBytes += TypeConversion::fromInt16( round((fc.maxTemperature() - 273.15) * 100) );
forecastBytes += TypeConversion::fromInt8( (int)iconToEnum(fc.weatherIcon()) );

}
Expand Down

0 comments on commit 91814aa

Please sign in to comment.