A new attempt at rolling displays

So I thought I’d have another crack at this after my long time away. Also, when reminding myself of things I came across a few of the old questions and tricks so I thought it might be a good tutorial revision showcase. I’ll link as many as I can find to reference the original showcases. So…

The main issue is with the expressions for +/- 1/2 hours. You have to cope with crossing the reset number.
I had it as 24h only and was about to publish but realised I would almost certainly get requests to incorporate 12h. Normally that would make the expressions massively rediculous.

Took a break to add AM/PM as A/P and… Wait, no string functions? Ahhh, Yes

I asked that before.
The solution: $condition1?output1:$$condition2 && not condition1?output2:$
Thanks @petruuccios

So, ended with

Hour-2
$#DTIMEFORMAT#==24&&#DbZ#==00?22:$$#DTIMEFORMAT#==24&&#DbZ#=01?23:$$#DTIMEFORMAT#==24&&#DbZ#>01?pad(#DbZ#-2,2):$$#DTIMEFORMAT#==12&&#DbZ#==1?11:$$#DTIMEFORMAT#==12&&#DbZ#==2?12:$$#DTIMEFORMAT#==12&&#DbZ#>2?#DbZ#-2:$
Hour-1
$#DTIMEFORMAT#==24&&#DbZ#==00?23:$$#DTIMEFORMAT#==24&&#DbZ#>0?pad(#DbZ#-1,2):$$#DTIMEFORMAT#==12&&#DbZ#==1?12:$$#DTIMEFORMAT#==12&&#DbZ#>1?#DbZ#-1:$
Hour+1
$#DTIMEFORMAT#==24&&#DbZ#==23?pad(0,2):$$#DTIMEFORMAT#==24&&#DbZ#<23?pad(#DbZ#-(0-1),2):$$#DTIMEFORMAT#==12&&#DbZ#==12?1:$$#DTIMEFORMAT#==12&&#DbZ#<12?#DbZ#-(0-1):$
Hour+2
$#DTIMEFORMAT#==24&&#DbZ#==22?pad(0,2):$$#DTIMEFORMAT#==24&&#DbZ#=23?pad(1,2):$$#DTIMEFORMAT#==24&&#DbZ#<22?pad(#DbZ#-(-2),2):$$#DTIMEFORMAT#==12&&#DbZ#==11?1:$$#DTIMEFORMAT#==12&&#DbZ#=12?2:$$#DTIMEFORMAT#==12&&#DbZ#<11?#DbZ#-(-2):$

So, why #DbZ#-(-2), you may be wondering.
Well if #DbZ#== 02 then (#DbZ#+2) outputs 022 as it treats it as a string first but minus is int only.
I just find it more readable than pad(abs(#DbZ#)+2,2)

The battery was just because I already had a load of shape masks and I wanted a 10% incremental battery bar without a load of masks over a progress so I just added orders of maginitude added together. So for each 10 add 1* 1,10,100 etc:
(abs($#BLN#>90?1:0$)*1000000000+abs($#BLN#>80?1:0$)*100000000+abs($#BLN#>70?1:0$)*10000000+abs($#BLN#>60?1:0$)*1000000+abs($#BLN#>50?1:0$)*100000+abs($#BLN#>40?1:0$)*10000+abs($#BLN#>30?1:0$)*1000+abs($#BLN#>20?1:0$)*100+abs($#BLN#>10?1:0$)*10+abs($#BLN#>0?1:0$)*1)
For some reason you do need the abs() around the output from the conditional.

I did just notice though that I had forgotten to blank the string when battery zero but I’ll fix it there and leave it as an excercise here. I can’t see it being an on arm scenario.

6 Likes

I just realised that I hadn’t made the sunrise/set 12h compatible. This works:
$#DISDAYTIME#==true&&#DTIMEFORMAT#==12?#WSh#:$$#DISDAYTIME#==true&&#DTIMEFORMAT#==24?#WSHZ#:$$#DISDAYTIME#==false&&#DTIMEFORMAT#==12?#WRh#:$$#DISDAYTIME#==false&&#DTIMEFORMAT#==24?#WRHZ#:$:$#DISDAYTIME#==true?#WSmZ#:#WRmZ#$

Edit: Oops. Different face but I’ll leave it in here.

3 Likes

image

So the previous battery expression was a good exercise and as my first draft used the digital-lcd font it seemed logical at the time and of course the maths does not work with letters. See previous result.

I have updated it to something a bit more reasonable for use with Sans fonts:
$#BLN#>0?I :$$#BLN#>10?I :$$#BLN#>20?I :$$#BLN#>30?I :$$#BLN#>40?I :$$#BLN#>50?I :$$#BLN#>60?I :$$#BLN#>70?I :$$#BLN#>80?I :$$#BLN#>90?I :$

Oh, This also fixes the zero battery artefact.

3 Likes

Cool! I will take the time to look into this!

3 Likes

Congratulations!!! I thought it was wonderful!!!

2 Likes

Cheers.

It’s something I tried unsuccessfully a while before my 2 year absence from the platform and I thought: Fresh pair of eyes…

3 Likes