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

Feature: show power grid usage on display #658

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

schlimmchen
Copy link
Member

if the power meter is enabled, the display will use two of three out of every three-second time slot to show the grid consumption.

closes #620.

This was fun and I like the result, but it took way too much time. Fiddling with the display is much more time consuming as one might think. At least it was in this instance for me.

The display shows this screen for three seconds:
image

This one for another three seconds (last line changes ever three seconds):
image

The third out of three three-second time slots will still show the total yield (if this was the actual successor screen of the frame above, it would show the date and time in the last line...):
image

Works for French as well (the word "reseau" is quite long):
image
image

I made sure that it works for small display as well:
image

Changes were made to the calculation of the text baselines, which I think were wrong and lead to space being wasted. Those changes will be proposed upstream as well.

This PR supersedes #644. Thanks @spcqike and @thinklerde for your feedback.

@spcqike
Copy link

spcqike commented Feb 10, 2024

Thanks for your work. I really appreciate it and like the outcome.

looking forward that it gets merged so we can update and try it :)

@schlimmchen
Copy link
Member Author

@spcqike Or try the artifacts on the bottom of this page: https://github.com/helgeerbe/OpenDTU-OnBattery/actions/runs/7854398954 which effectively are the released 2024.02.09 plus this change 😉

@spcqike
Copy link

spcqike commented Feb 10, 2024

Good to know. Let’s see what happens first, merge or our discharge from hospital.

I will update and try whatever version is available, when we get home :)

@schlimmchen schlimmchen marked this pull request as draft February 10, 2024 13:00
@schlimmchen
Copy link
Member Author

Still not done, there are more issues: The PV power now collides with the small diagram's y-axis label.

fix calculation of the text baselines, using getAscent() in favor of
getMaxCharHeight(), which includes ascent and descent. this moves the
first text up and allows to insert margin between the lines until the
display area is fully utilized.

on large displays, if the small diagram is selected, keep the first line
rather low to avoid collision with the diagram y-axis label. in this mode,
there is still more space between the text lines as before, allowing for
improved readability.
if the power meter is enabled, the display will use two of three out
of every three-second time slot to show the grid consumption.

closes hoylabs#620.
@schlimmchen schlimmchen force-pushed the grid-usage-on-display-v2 branch from 7dfe477 to 42d1cf1 Compare February 10, 2024 19:00
@schlimmchen
Copy link
Member Author

Can't make this work properly, i.e., without risking future glitches because the code relied on upstream errors, without correcting those issues as proposed in tbnobody#1729. That's because the descent of the third line reaches into the fourth line. When erasing the third line without the descent, a text change to something that uses the descent will cause a glitch (the descent is not erased).

For that reason, the changes proposed upstream are part of this PR.

@schlimmchen schlimmchen marked this pull request as ready for review February 10, 2024 19:04
@schlimmchen
Copy link
Member Author

The upstream PR tbnobody#1729 was merged and published. This PR and the upstream changes should merge cleanly.

@thinklerde
Copy link

Very nice!! Thank you so much!!

@spcqike
Copy link

spcqike commented Feb 14, 2024

@spcqike Or try the artifacts on the bottom of this page: https://github.com/helgeerbe/OpenDTU-OnBattery/actions/runs/7854398954 which effectively are the released 2024.02.09 plus this change 😉

habs installiert, scheint problemlos zu laufen. zumindest ist mir nichts aufgefallen, was komisch aussieht.
nun mal auf Sonne warten :)

@spcqike
Copy link

spcqike commented Feb 15, 2024

kurzes Feedback:

mir ist grad aufgefallen (sowohl auf meinem Modul, als auch jetzt hier beim Schreiben auf deinen Bildern), dass der Graph nicht läuft.
hängt das mit dem PR zusammen?

Display:
grafik

Aufzeichnung in Grafana:
grafik

Auch die Skalierung mit 18W erscheint mir zu gering.

Nachtrag:

in der Zwischenzeit zeigt er mir was an
grafik
grafik

@schlimmchen
Copy link
Member Author

Ich glaube hier möchte ich so weit gehen und ausschließen, dass das etwas mit der Änderung zu tun hat. Während ich das entwickelt und getestet habe, hat der Graph bei mir funktioniert.

@spcqike
Copy link

spcqike commented Feb 15, 2024

ok, dann gucke ich mal im Upstream, ob da was diesbezüglich steht. Bis zu deiner Version aus diesem PR hatte ich ne relativ alte, selbsterstellte Firmware laufen, in der ich eben auch den Netzbezug angezeigt habe. Der Graph ist für mich also erst seit gestern vorhanden 😄 und ich hab keine Vergleiche, ob es vorher anders war. Auch hab ich mir den Code dazu noch nicht näher angeguckt.

Ich bin auch eigentlich davon ausgegangen, dass deine Anpassung rein kosmetischer Natur (zumindest was den Graph angeht) ist, und nichts mit der Erfassung der Datenpunkte zu tun hat. Wollte aber nochmal nachfragen, ob dir nicht doch was aufgefallen ist :)

Nachtrag:
Manchmal stellt man sich einfach nur zu blöd an und sucht Fehler, wo keine sind :)
meine DTU hatte sich einfach kurz vorher neu gestartet und den Graph dann natürlich bei 0 angefangen.

@helgeerbe helgeerbe merged commit 9240663 into hoylabs:development Feb 19, 2024
8 checks passed
@schlimmchen schlimmchen deleted the grid-usage-on-display-v2 branch February 19, 2024 15:37
Copy link

github-actions bot commented Apr 4, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants