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

weather: Add new app with forecast #1995

Merged
merged 5 commits into from
Feb 18, 2024
Merged

Conversation

vkareh
Copy link
Contributor

@vkareh vkareh commented Jan 31, 2024

Added a new weather app that shows the current weather and forecast. If forecast is not available, it just shows the current weather.

InfiniSim_2024-02-02_145908

Building the sim requires InfiniTimeOrg/InfiniSim#138

Copy link

github-actions bot commented Jan 31, 2024

Build size and comparison to main:

Section Size Difference
text 377080B 3840B
data 940B 0B
bss 63516B 0B

@FintasticMan
Copy link
Member

Looks good! Is there enough space to add the ° symbol to the forecast? It looks a bit off without it IMO. It might also be nice to know the current min and max temp?

About the forecast not showing up with Breezy Weather + Gadgetbridge, could you check if it works with Tiny Weather Forecast Germany? The Gadgetbridge side should be working, so I suspect that Breezy Weather just doesn't provide that information.

Copy link
Member

@FintasticMan FintasticMan left a comment

Choose a reason for hiding this comment

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

One small thing, for the rest this looks good!

src/displayapp/screens/Weather.h Outdated Show resolved Hide resolved
@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

Ha! Found the issue. The wrong variable was being referenced in Gadgetbridge and so was not sending forecast data. I've submitted a patch to fix it: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/3551

@FintasticMan Thanks for reviewing, I'll start addressing these issues sometime today.

@FintasticMan
Copy link
Member

Oh oopsie, that was my code in GB 😅

Thanks for finding and submitting a fix.

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

@FintasticMan

Looks good! Is there enough space to add the ° symbol to the forecast? It looks a bit off without it IMO.

Unfortunately no. With the ° symbol things start wrapping when you get to double-digit negative temperatures. This is also already the smallest font available.

It might also be nice to know the current min and max temp?

Added that now. Also added the location. Maybe it's too busy?

I also made the temperature yellow so that it stands out a bit more from the rest.

InfiniSim_2024-02-01_102010

Thoughts?

@FintasticMan
Copy link
Member

I think that looks good, but I'm not exactly the best at UI design. If some more people chime in, I think that this is good! (You do still need to fix some formatting FYI. You can use the git pre-commit hook to do this automatically.)

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

@FintasticMan thanks - formatting is fixed now. The sim build breaks due to a new operator override in the Forecast struct. Should be fixed by InfiniTimeOrg/InfiniSim#138

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

I removed the location display. It was causing my watch to crash and reboot. I might debug it later, but easier to remove it for now...

InfiniSim_2024-02-01_112143

@FintasticMan
Copy link
Member

Do positive numbers above 100 display fine? That is possible with Fahrenheit I think...

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

Yep, they look fine. The problem would be if it gets to 100 below zero (e.g. -100 has 4 characters), but we have far bigger problems if that's the case 😆

Acceptable display range would then be -99 to 999, from a purely technical point of view.

InfiniSim_2024-02-01_113440

@minacode
Copy link
Contributor

minacode commented Feb 1, 2024

This looks very good! I am looking forward to use this app once the support in InfiniLink is ready.

One small thing: you could use InfiniTimes theme colors.

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

@minacode

One small thing: you could use InfiniTimes theme colors.

I'd be more than happy to take suggestions on how to improve the thing. Here are two options using the InfiniTimeTheme colors:

InfiniSim_2024-02-01_130349 InfiniSim_2024-02-01_130434

Any preference? Other color combinations? I haven't been able to figure out how to change the color of the text in the forecast table...

@KaffeinatedKat
Copy link
Contributor

that looks incredible, great work. Would it be possible to have the color change based on the temp? (eg. blue for cold and yellow/red for hot). That would really help bring it together imo

@JustScott
Copy link
Contributor

JustScott commented Feb 1, 2024

Wow this looks great! Do you think it would be possible to fit the date and/or week day above or below each forecast. Example: 'thu', 'fri', '2/1', '2/17'?

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

that looks incredible, great work. Would it be possible to have the color change based on the temp? (eg. blue for cold and yellow/red for hot). That would really help bring it together imo

Thanks! I love this idea.

Wow this looks great! Do you think it would be possible to fit the date and/or week day above or below each forecast. Example: 'thu', 'fri', '2/1', '2/17'?

I'll try, but I suspect there won't be much room for this. Also, this app is already annoyingly heavy (3388B as of last build), and calculating the days based on timestamps and then displaying that on a table will eat up a lot more, I think.

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

What are your thoughts on this? Anything 0°C or below is blue, 40°C or above is red, anything else is yellowish:
InfiniSim_2024-02-01_132859 InfiniSim_2024-02-01_132904 InfiniSim_2024-02-01_133258

@JustScott
Copy link
Contributor

Wow this looks great! Do you think it would be possible to fit the date and/or week day above or below each forecast. Example: 'thu', 'fri', '2/1', '2/17'?

I'll try, but I suspect there won't be much room for this. Also, this app is already annoyingly heavy (3388B as of last build), and calculating the days based on timestamps and then displaying that on a table will eat up a lot more, I think.

Perhaps just adding the weekday and date for today somewhere could work, like is done on the digital watch face where it's a less visible grey.

@minacode
Copy link
Contributor

minacode commented Feb 1, 2024

Maybe increase the space between the big temperature and the description above?

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

How about now?
InfiniSim_2024-02-01_154859 InfiniSim_2024-02-01_155008

I tried putting the current day/time (last updated time, really) but it was hard to align everything. It was just too cluttered...

@KaffeinatedKat
Copy link
Contributor

KaffeinatedKat commented Feb 1, 2024

that looks really awesome, we don't really need to show the current day/time because that's easily accessible elsewhere. Having the forecasted days shown is more important. Great work

@MoonlightWave-12
Copy link

MoonlightWave-12 commented Feb 1, 2024

What are your thoughts on this? Anything 0°C or below is blue, 40°C or above is red, anything else is yellowish:

I think blue for ~10°C and lower, and red for ~30°C and higher would be more useful.

Personally, i would prefer it to be separated somewhat like this:

  • <= 4°C: blue – water can freeze at those temperatures
  • 5-15°C: bright blue – a cool temperature-range
  • 15-22°C: white – medium-range
  • 22-28°C: yellow – like a warm spring or mild summer
  • >= 29°C: red – hot

2 more suggestions:

  • Assuming the top forecast-values are minimum and the bottom ones maximum:
    The maximum should be at the top, because it is higher.

  • Maybe also colour the forecast-values, so that one can see the temperature-ranges easily at a glance?

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

@MoonlightWave-12

The maximum should be at the top, because it is higher.

Good idea. Done:
InfiniSim_2024-02-01_161858

With regards to temperature colors, anything between 0°C and 40°C starts to become really subjective. Where I live currently 5°C is a very warm winter day, whereas 30°C is a hot summer day. However, I grew up in a place where 90°F is a mild winter day.

I'm okay with your ranges, but would like some consensus before comitting to those numbers. I also propose these:

  • 0 or lower: blue (freezing)
  • 0 - 4: cyan (ice warning)
  • 4 - 32: yellow (nothing special, but color white doesn't look great here)
  • 32 or higher: red (hot)

The 32°C number is from wikipedia but we can also use 27°C

@vkareh
Copy link
Contributor Author

vkareh commented Feb 1, 2024

@MoonlightWave-12

Maybe also colour the forecast-values, so that one can see the temperature-ranges easily at a glance?

That'd be nice, but I haven't figured out how to apply color to the table cells, only the table border (which I made black to blend in with the background)

@vkareh vkareh force-pushed the weather-app branch 2 times, most recently from 698ae9a to ce5f0d9 Compare February 1, 2024 21:45
@minacode
Copy link
Contributor

minacode commented Feb 8, 2024

We could center the cells and pad them with spaces if necessary.

@FintasticMan
Copy link
Member

Good thinking!

@vkareh
Copy link
Contributor Author

vkareh commented Feb 8, 2024

Sounds like a good idea. I can try, but each cell will need to know how many digits are in the temperature above or below itself and then add padding based on that. Maybe just centering all of them is not that bad after all?

Anyway, I'll see what I can pull off next time I'm playing with this.

@vkareh
Copy link
Contributor Author

vkareh commented Feb 10, 2024

@FintasticMan @minacode - success! I managed to use character padding to align temperatures:

  • With table borders (to visualize the alignment):
    InfiniSim_2024-02-10_131558
  • Without table borders:
    InfiniSim_2024-02-10_132039
  • With more realistic data:
    InfiniSim_2024-02-10_132314 InfiniSim_2024-02-10_132253 InfiniSim_2024-02-10_132229

src/displayapp/screens/Weather.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@JF002 JF002 left a comment

Choose a reason for hiding this comment

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

I'm very happy to see this new app since the protocol allows for forecast data, but we had no way of displaying those info so far!

This feature looks good overall and I guess we'll be able to merge it as soon as the remaining code change requests and review are addressed :)

src/displayapp/screens/Weather.cpp Outdated Show resolved Hide resolved
src/displayapp/screens/Weather.cpp Outdated Show resolved Hide resolved
tempUnit = 'F';
}
temp = temp / 100 + (temp % 100 >= 50 ? 1 : 0);
maxTemp = maxTemp / 100 + (maxTemp % 100 >= 50 ? 1 : 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This calculation is done multiple times (and it's not easy to understand what it does - rounding?). Consider moving it to a dedicated function. The name of this function will also help understanding the meaning of it.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this is so that it gets rounded properly. I added it to the PTS watch face, but maybe we should add a function to SimpleWeatherService that does this calculation.

Copy link
Member

Choose a reason for hiding this comment

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

I've just created that function in #2015.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this function directly in the weather app to avoid having to push a new change to InfiniSim, but let me know if we should change this.

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to have the function in the weather service tbh, but it doesn't matter so much.

src/displayapp/screens/Weather.cpp Outdated Show resolved Hide resolved
@vkareh vkareh force-pushed the weather-app branch 7 times, most recently from df9306a to a259df9 Compare February 12, 2024 21:13
This allows it to be used outside of the current datetime context and
makes it consistent with the MonthShortToStringLow function.
Copy link
Collaborator

@JF002 JF002 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for your work @vkareh !

I've just tested it with Tiny Weather Forecast Germany and Gadgetbridge :
20240218_125006

Reminder : the current version of Gadgetbridge (0.78) has a bug that prevents forecast from being sent to the watch (https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/3551). The fix is merged, so I guess it'll be available in 0.79 (which is already tagged but not available in f-droid).

@JF002 JF002 merged commit 6ab512a into InfiniTimeOrg:main Feb 18, 2024
7 checks passed
@tituscmd
Copy link
Contributor

tituscmd commented Mar 2, 2024

Out of curiosity:
Are the weekdays on the bottom displaying the next week, or is it the current week?
If it is the current week, I think it would be a good idea to color the current day - maybe red?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new app This thread is about a new app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants