Clamp not working as expected

My watchface above is WIP and includes a temperature guage - the blue needle indicates degrees celcius. if i put just the tag #WCT# in the rotation field the blue needle moves. So far so good, I introduced a factor - ((#WCT#*4.6)-11) to get the rotation to fit the scale (300 degrees - rotation not temp :smiley: ) My needle now goes to -30C and indicates 0 properly but goes past 35C - not quite what I wanted but close. I decided that it would be necessary to use ‘clamp’. Using (clamp(current,min,max)) I have - (clamp((#WCT#*4.6)-11),-30,35) and no needle movement at all. I’ve tried all sorts using examples given using search in the forum - with brackets here and there but nothing works as I expected. My logic is wrong somewhere but I have no idea where, can someone point me in the right direction please

4 Likes

PS. Yes I know the subdivisons are wrong - it’s WIP :slight_smile:

2 Likes

I am not a great fan of clamp . But this is doing what it say on the BOX . But mat be not what you want .
.
.
(clamp((((#WCT#*4.6)-11)),-30,35))
.
.
Added a pair of () .

3 Likes

Russel as always, your a hero!!

4 Likes

Sadly adding more chips to the plate is my only answer . Chips with everything . I always debug a Formula in a Text Layer .
.
.

2 Likes

@BIELITZ I like your design

2 Likes

That is because you used clamp on the output and restrained it to the limits of imput which are without the ratio significantly smaller and also misplaced the brackets.
You should either compute the limits with same factor like (clamp(#WCT#*4.6-11,-150,150)),
or simply use clamp only on the imput like (clamp(#WCT#,-30,35)*4.6-11) and apply ratio on its result

5 Likes

Peter was faster…
Yes, as Peter says, the clamp in your example is limiting from -30° to 35° only. So either extend the angles or change the formula.

3 Likes

Thanks for that - what you say makes sense to me now, :slight_smile:

3 Likes

Thanks - it seems I was mixing input and output limits in my version. No wonder it didn’t work!

3 Likes

Thanks - it’s chips with everything for me from now on!

2 Likes