InfiniTimeOrg / InfiniSim

Simulator for InfiniTime user interface without needing a PineTime
GNU General Public License v3.0
164 stars 66 forks source link

SimpleWeatherService: Generate random weather data #138

Closed vkareh closed 7 months ago

vkareh commented 8 months ago

Generates random weather and forecast data. Also adds a new simulation key handler for weather data:

Needed to build the sim for the weather app in https://github.com/InfiniTimeOrg/InfiniTime/pull/1995

NeroBurner commented 8 months ago

Thank you for the PR. I don't like to have to restart the sim to get new data. Furthermore I can't test the 'no-data' case anymore.

Could you restructure the code such that it is bound to a key binding. Just as I've done for the heart rate measurements or even better the notifications? Maybe use 'w' key to cycle through the weather data and 'shift+w' to have 'no-weather-data' -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

vkareh commented 8 months ago

@NeroBurner yes, that was my first iteration, but had issues refreshing the weather since the instance of weatherService in main.cpp was different than the instance being used by the displayapp. I've finally solved it and now you can use w for generating random weather and W for clearing it.

vkareh commented 8 months ago

Adding weather to the sim exposed a bug in the PTS face, where the value will always be considered dirty and attempt to display a formatted string even if the weather data is cleared. I've submitted a fix here: https://github.com/InfiniTimeOrg/InfiniTime/pull/1965

edit: This fix is now merged upstream

vkareh commented 7 months ago

I also added forecast data now.

vkareh commented 7 months ago

@NeroBurner

Please inform me if the extra code should stay in (and why). After that I'll happily merge :)

Absolutely! Thanks for the review. The extra code is just operator overrides to support the Forecast/Day structs. Without it, any screen that relies on DirtyValue to display up-to-date Forecast data will make the sim build fail.

I currently added it to the InfiniTime SimpleWeatherService in https://github.com/InfiniTimeOrg/InfiniTime/pull/1995, but I can submit it as a separate PR to add just the overrides if you prefer.

vkareh commented 7 months ago

I've submitted a patch for InfiniTime with only the operator overrides: https://github.com/InfiniTimeOrg/InfiniTime/pull/2011

NeroBurner commented 7 months ago

That makes sense! Then yes please keep the operator overrides. They are indeed useful and I am positive they will find their way into InfiniTime eventually 😁

NeroBurner commented 7 months ago

One VERY last thing. Please update the readme.md as well with the new key to show and clear weather data 🙇‍♂️

vkareh commented 7 months ago

@NeroBurner

One VERY last thing. Please update the readme.md as well with the new key to show and clear weather data 🙇‍♂️

Done!

NeroBurner commented 7 months ago

Merged! Thanks a lot!