diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/ble/SimpleWeatherService.cpp | 8 | ||||
| -rw-r--r-- | src/components/ble/SimpleWeatherService.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/components/ble/SimpleWeatherService.cpp b/src/components/ble/SimpleWeatherService.cpp index a58c3a76..51baf543 100644 --- a/src/components/ble/SimpleWeatherService.cpp +++ b/src/components/ble/SimpleWeatherService.cpp @@ -52,7 +52,7 @@ namespace { SimpleWeatherService::Forecast CreateForecast(const uint8_t* dataBuffer) { auto timestamp = static_cast<uint64_t>(ToUInt64(&dataBuffer[2])); - std::array<SimpleWeatherService::Forecast::Day, SimpleWeatherService::MaxNbForecastDays> days; + std::array<std::optional<SimpleWeatherService::Forecast::Day>, SimpleWeatherService::MaxNbForecastDays> days; const uint8_t nbDaysInBuffer = dataBuffer[10]; const uint8_t nbDays = std::min(SimpleWeatherService::MaxNbForecastDays, nbDaysInBuffer); for (int i = 0; i < nbDays; i++) { @@ -112,9 +112,9 @@ int SimpleWeatherService::OnCommand(struct ble_gatt_access_ctxt* ctxt) { for (int i = 0; i < 5; i++) { NRF_LOG_INFO("\t[%d] Min: %d - Max : %d - Icon : %d", i, - forecast->days[i].minTemperature.PreciseCelsius(), - forecast->days[i].maxTemperature.PreciseCelsius(), - forecast->days[i].iconId); + forecast->days[i]->minTemperature.PreciseCelsius(), + forecast->days[i]->maxTemperature.PreciseCelsius(), + forecast->days[i]->iconId); } } break; diff --git a/src/components/ble/SimpleWeatherService.h b/src/components/ble/SimpleWeatherService.h index 36bbea48..0f8c181b 100644 --- a/src/components/ble/SimpleWeatherService.h +++ b/src/components/ble/SimpleWeatherService.h @@ -63,7 +63,7 @@ namespace Pinetime { class Temperature { public: - explicit Temperature(int16_t raw = 0) : raw {raw} { + explicit Temperature(int16_t raw) : raw {raw} { } [[nodiscard]] int16_t PreciseCelsius() const { @@ -129,7 +129,7 @@ namespace Pinetime { bool operator==(const Day& other) const; }; - std::array<Day, MaxNbForecastDays> days; + std::array<std::optional<Day>, MaxNbForecastDays> days; bool operator==(const Forecast& other) const; }; |
