Hi
On many, if not all, of my watch faces I have a so-called “Battery Warning”. A red dot starts flashing when the battery goes below 30%. It has always worked without problems, but for some time now I find the dot flashing even if the battery is at 50%. In this case I should not see the dot flashing at all.
This is the formula I use in the “Opacity” field and it has always worked:
$#PBN#<=30?(1*sin(#DWFSS#)*100):0$
Any ideas on this and how to fix it?
Thanks for your help
A nice sunday to all
There is no reason why that should not work . I always use more ( ) . I know it is a bit childish but I think it makes Formulas more robust . I will check that later . Even with a small formula like that it is work format protecting when it is posted here . Sometimes Retyping a formula clears any tiny format bugs in it .
@diavo Phone / Mobile Battery yes ? There is noting wrong with your formula. I am not sure what the 1* was doing .
I have simplified it and put some more () in there to show how the formula works . I think the issue is that Phone Battery data is having problems . It is not available in Google Store faces only from a Complication . I think Google and Samsung are working out how to Give the stuff that facer gives on thier Faces but is not doing a very good job . They have now included weather stuff but it is only available on a WOS5 updated Watch . Stand by a lot is changing at the moment .
$#PBN#<=30?((sin(#DWFSS#))*100):0$
The formula could be as below which gives the on time a bit longer .
((1+(sin(#DWFSS#)))*100)
Are you measuring the phone battery by your phone or by a text indicator on the watch?
I have noticed since back that phone battery is not updated on the watch very often, sometimes hours if you don’t go full on mode, and even then only after some interactions.
Just as an aside try the following changes for configurability:
$#PBN#<=30?abs(sin(#DWFSS#/2)*100):0$
No need for the 1*
The abs keeps the numbers positive.
The /2 slows the blink the more it is increased.
I’m the opposite. I like putting enough brackets to ensure order of precedence and occasionally an extra set to group a contained set of calculations but find adding more, for me, diminishes readability and my brain’s troubleshooting circuits. I would write that as:
((1+sin(#DWFSS#))*100)
as the sin() is its own enclosed statement and does not need to be extra enclosed. Maybe just me though.
Also, I often find ((sin(#DWFSS#)+1)*100)
is more readable but that is definately a personal preference thing.
I find the special cases so confusing . I just carry on as before . I often wonder why accelerometerRawY()*10 is right and sin(#DWFSS#) .
That is why I put the multiplication before the sin, that way its clear it applies to the operation result, not to its argument.
I do see what you mean which is why I added the definitely personal caveat. My brain works calculation first, maths on calculation next. For me, I can see that the +1 applies to the sin not the #DWFSS# as it is outside the brackets. I can read it either way though.
It is another reason I try not to add more brackets than needed though, as a mass of brackets can make it unclear what the basic maths operators are applying to.
Having insight into how we prefer our expressions will definitely help us read the inspections easier though. In the end if the result is the same there is no absolutely correct way outside of a maths theory degree course.
Also, sorry @diavo. We’ve kind of hijacked your question about the trigger for the expression being out of kilter, with discussion on expression semantics.
Did you have a BLN text field on the watch to check the accuracy of the data the watch has?
Sorry everyone. I obviously didn’t explain myself well. The problem was with the watch battery warning.
I still need to do an update. Today the formula works correctly.
I don’t understand yesterday’s error. I also tried a reboot of the watch, but nothing. The red dot flashed with 50% battery, even after reboot. Last night, as usual, I turned off the watch and this morning everything was working fine.
May be a poltergeist?
Thanks everyone for your concern. If I encounter any other problems I will let you know.
@diavo The formula you showed us is for Phone Battery .
The formula for Watch Battery would be .
.
$#BLN#<=30?((sin(#DWFSS#))*100):0$
@russellcresser
Hi Russell, you are absolutely right. I made a real mess. The thing is that in the watch face there are warnings for both the watch and the phone battery. Without realizing it I took the wrong formula. In any case I swear I was not drunk.
This is the formula, I hope correct this time, for the clock.
$#BLN#<=30?(1*sin(#DWFSS#)*100):0$
With ashes on my head and with great shame I apologize to everyone.
Anyway, now everything seems to be working as it should.
Thanks again to everyone
@diavo . We are all learning . This is an intresting topic . It is great to hear from you . There have been Syntax rule changes over time . I have had to go back and change stuff that stopped working propetly .
@russellcresser
Hi Russell
I’m also happy to hear from you. As you say…It’s never too late to learn
Indeed, And you are at the right place for it. There is a trove of stuff, and good folks here.
No doubt, with new eyes, we will be learning new angles from yourself soon.
And remember. If you are ever thinking ‘there must be an easier way’, there often is and you can but ask. It may well be something that the rest of use have been doing the long way out of rote just because it’s the way it always was and just needs to be revisited. 2 years away has done wonders for my perspective.