Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleWeatherService: Generate random weather data #138

Merged
merged 2 commits into from
Feb 10, 2024

Conversation

vkareh
Copy link
Contributor

@vkareh vkareh commented Jan 11, 2024

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

  • 'w' will generate new weather, cycling through the various conditions
  • 'W' will clear the weather data

Needed to build the sim for the weather app in InfiniTimeOrg/InfiniTime#1995

@NeroBurner NeroBurner added the enhancement New feature or request label Jan 11, 2024
@NeroBurner
Copy link
Collaborator

NeroBurner commented Jan 12, 2024 via email

@vkareh vkareh force-pushed the generate-weather-data branch from 9e4f899 to 925d402 Compare January 12, 2024 20:14
@vkareh
Copy link
Contributor Author

vkareh commented Jan 12, 2024

@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
Copy link
Contributor Author

vkareh commented Jan 13, 2024

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: InfiniTimeOrg/InfiniTime#1965

edit: This fix is now merged upstream

@vkareh vkareh force-pushed the generate-weather-data branch from 925d402 to 45a795e Compare February 1, 2024 15:54
@vkareh vkareh changed the title SimpleWeatherService: Generate random weather data on start SimpleWeatherService: Generate random weather data Feb 1, 2024
@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

I also added forecast data now.

@vkareh vkareh force-pushed the generate-weather-data branch 2 times, most recently from c9564d5 to 3648ffe Compare February 7, 2024 18:50
Copy link
Collaborator

@NeroBurner NeroBurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the long delay to do this review. Thank you looks perfect! Just some extra code I suspect is a leftover of refactoring. But works just as I wanted. Perfect!

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

@@ -80,11 +80,18 @@ class SimpleWeatherService {
int16_t minTemperature;
int16_t maxTemperature;
Icons iconId;

bool operator==(const Day& other) const;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does this function come from? I don't think it is needed for the current implementation, and it is not in the current InfiniTime version of SimpleWeatherService.h

sim/components/ble/SimpleWeatherService.h Show resolved Hide resolved
sim/components/ble/SimpleWeatherService.cpp Show resolved Hide resolved
sim/components/ble/SimpleWeatherService.cpp Outdated Show resolved Hide resolved
@vkareh
Copy link
Contributor Author

vkareh commented Feb 10, 2024

@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 InfiniTimeOrg/InfiniTime#1995, but I can submit it as a separate PR to add just the overrides if you prefer.

@vkareh vkareh force-pushed the generate-weather-data branch 2 times, most recently from 6e89f1b to 0a98a85 Compare February 10, 2024 16:23
@vkareh
Copy link
Contributor Author

vkareh commented Feb 10, 2024

I've submitted a patch for InfiniTime with only the operator overrides: InfiniTimeOrg/InfiniTime#2011

@NeroBurner
Copy link
Collaborator

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
Copy link
Collaborator

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

Add a new simulation key handler for weather data:
- 'w' will generate new weather, cycling through the various conditions
- 'W' will clear the weather data
@vkareh vkareh force-pushed the generate-weather-data branch from 0a98a85 to 30abc55 Compare February 10, 2024 18:35
@vkareh
Copy link
Contributor Author

vkareh commented Feb 10, 2024

@NeroBurner

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

Done!

@NeroBurner NeroBurner merged commit 8b22bcd into InfiniTimeOrg:main Feb 10, 2024
1 check passed
@NeroBurner
Copy link
Collaborator

Merged! Thanks a lot!

@vkareh vkareh deleted the generate-weather-data branch February 12, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants