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

Make uptime in /C more legible #594

Merged
merged 2 commits into from
Oct 14, 2023

Conversation

DE-cr
Copy link
Contributor

@DE-cr DE-cr commented Oct 14, 2023

I always need a calculator to convert long ms values to d+h:m:s
With this PR in place, I don't:
grafik

@DE-cr
Copy link
Contributor Author

DE-cr commented Oct 14, 2023

P.s. I forgot to mention: I do consider this ready to be merged into BSB-LAN's master branch. :)

@fredlcore
Copy link
Owner

Good idea, but please add it in a way that this information is printed in a new line (but without
so that visually, it remains in the same line). Background: People who parse the current Uptime line using regex might catch everything after the colon and therefore wouldn't get a number back. If it's in a new line, this problem would not occur.

@DE-cr
Copy link
Contributor Author

DE-cr commented Oct 14, 2023

That would be an overly simple parser. ;)

What do you mean by "(but without
so that visually, it remains in the same line)"?

@fredlcore
Copy link
Owner

fredlcore commented Oct 14, 2023

Well, that's how I parse the HTML output of BSB-LAN. If it is clear how the rest of the line looks like, why should I create an overly complex regex? That would be a waste of time and resources.
What I meant is: Add a crlf at the beginning of the line, but don't add a <BR>.

... but keep it rendered in the same line (i.e. no <br>)
@fredlcore fredlcore merged commit 6a114e0 into fredlcore:master Oct 14, 2023
2 checks passed
@DE-cr
Copy link
Contributor Author

DE-cr commented Oct 14, 2023

Done, thanks for suggesting this:

</form>
<BR>Hardware: ESP32<BR>
Version: 3.2.2-20230606224119<BR>
Freier Speicher: 215548 Bytes<BR>
Uptime: 78504
ms = 0d+00:01:18.504<BR>
1-Wire Bus Pins: 
0, Sensoren: 0
<BR>
<BR><BR>
Installierte Module: <BR>

This didn't occur to me, as I usually try to layout my html similar to its expected rendering.

As for the regex: I personally wouldn't consider \d+ "overly complex", but safer than .+ (or even .*).
...and it could also be used to parse Freier Speicher: 215548 Bytes<BR>, e.g.
;)

@fredlcore
Copy link
Owner

Good for you.

@DE-cr DE-cr deleted the make-uptime-in-/C-more-legible branch October 14, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants