Skip to content

Commit

Permalink
main: send v1 CurrentWeather package with sunrise/sunset
Browse files Browse the repository at this point in the history
  • Loading branch information
NeroBurner committed Sep 25, 2024
1 parent ed393d0 commit 721dda2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ class Framework {
}
void set_current_weather(uint64_t timestamp, int16_t temperature, int iconId)
{
std::array<uint8_t, 49> dataBuffer {};
std::array<uint8_t, 53> dataBuffer {};
std::span<uint8_t> data(dataBuffer);
os_mbuf buffer;
ble_gatt_access_ctxt ctxt;
Expand All @@ -840,12 +840,14 @@ class Framework {
int16_t minTemperature = temperature;
int16_t maxTemperature = temperature;
dataBuffer.at(0) = 0; // MessageType::CurrentWeather
dataBuffer.at(1) = 0; // Vesion 0
dataBuffer.at(1) = 1; // Vesion 1
write_uint64(data.subspan(2), timestamp);
write_int16(data.subspan(10), temperature);
write_int16(data.subspan(12), minTemperature);
write_int16(data.subspan(14), maxTemperature);
dataBuffer.at(48) = static_cast<uint8_t>(iconId);
write_int16(data.subspan(49), 6*60);
write_int16(data.subspan(51), 18*60);

// send weather to SimpleWeatherService
systemTask.nimble().weather().OnCommand(&ctxt);
Expand Down

0 comments on commit 721dda2

Please sign in to comment.