It is currently December 1st, 2023, 7:04 am
General topics related to Rainmeter.
HitFrostbite
Posts: 15 Joined: May 20th, 2022, 1:34 pm
Post
by HitFrostbite » May 22nd, 2022, 12:51 pm
Hi,
I've created a skin to control the brightness and color temperature of my smart bulb via command line.
But the problem is that the values to control the color temperature range from 3000-6500,
I have set a scroll function using clamp to achieve that:
Code: Select all
MouseScrollDownAction=[!SetVariable Brightness (Clamp(#CT#-#CTIncrement#,3500,6500))][!CommandMeasure SetCT "Run"] [!Update]
MouseScrollUpAction=[!SetVariable Brightness (Clamp(#CT#+#CTIncrement#,3500,6500))][!CommandMeasure SetCT "Run"] [!Update]
But the x position of the slider on my skin needs to move from 0-255.
Is there any way to map the 3000-6500 to 0-255?
Thanks
eclectic-tech
Rainmeter Sage
Posts: 5230 Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Post
by eclectic-tech » May 22nd, 2022, 1:31 pm
HitFrostbite wrote: ↑ May 22nd, 2022, 12:51 pm
Hi,
I've created a skin to control the brightness and color temperature of my smart bulb via command line.
But the problem is that the values to control the color temperature range from 3000-6500,
I have set a scroll function using clamp to achieve that:
Code: Select all
MouseScrollDownAction=[!SetVariable Brightness (Clamp(#CT#-#CTIncrement#,3500,6500))][!CommandMeasure SetCT "Run"] [!Update]
MouseScrollUpAction=[!SetVariable Brightness (Clamp(#CT#+#CTIncrement#,3500,6500))][!CommandMeasure SetCT "Run"] [!Update]
But the x position of the slider on my skin needs to move from 0-255.
Is there any way to map the 3000-6500 to 0-255?
Thanks
Divide your range by 256 to find a divisor of the brightness variable to use in your formula.
If your range is 3000 (according to your scroll formula: 6500-3500), then you can set the X value to
X=(floor(#Brightness#/11.71875))
If you want the range to be 3500 (6500-3000), then set
X=(floor(#Brightness#/13.671875))
Add
DynamicVariables=1 to the meter to use the current value of #Brightness#.
HitFrostbite
Posts: 15 Joined: May 20th, 2022, 1:34 pm
Post
by HitFrostbite » May 22nd, 2022, 2:13 pm
Thanks I'll try it out.
HitFrostbite
Posts: 15 Joined: May 20th, 2022, 1:34 pm
Post
by HitFrostbite » May 22nd, 2022, 2:30 pm
eclectic-tech wrote: ↑ May 22nd, 2022, 1:31 pm
Divide your range by 256 to find a divisor of the brightness variable to use in your formula.
If your range is 3000 (according to your scroll formula: 6500-3500), then you can set the X value to
X=(floor(#Brightness#/11.71875))
If you want the range to be 3500 (6500-3000), then set
X=(floor(#Brightness#/13.671875))
Add
DynamicVariables=1 to the meter to use the current value of #Brightness#.
It worked!
Thanks a lot!
eclectic-tech
Rainmeter Sage
Posts: 5230 Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Post
by eclectic-tech » May 22nd, 2022, 3:22 pm