It is currently March 28th, 2024, 10:11 pm

How to change "linecolor" when a fan speed up or speed down

Get help with creating, editing & fixing problems with skins
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

How to change "linecolor" when a fan speed up or speed down

Post by Rambytes »

Hello there, first sorry for my english.

I have some speedfan module, and the color of the graphic "LineColor" is a light blue color. But what I want is to change this color if the fan of my PC (I have 3 of them) if the fan is speedup or slowdown. When my fan speed up, the color change to orange, and when the fan is slowdown, the color change to green.

Possible?

This is the code of my module:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
MaxFanSpeed=1750
Radius=60
Thickness=18
FontSize=28
FontSizeCoreText=17
FontFace=HighlandGothicFLF
CouleurLigne=134,169,255
CouleurLigneFond=134,169,255,100
TITRE=FAN 2

[MeasureMin]
Measure=Calc
Formula=0

[MeasureMax]
Measure=Calc
Formula=100

[StyleCircle]
StartAngle=-1.570796326
RotationAngle=-4.712388978
X=(#Radius#+#Gap#)r
Y=0
W=(2*#Radius#)
H=(2*#Radius#)
LineStart=#Radius#
LineLength=(#Radius#-#Thickness#)
Solid=1
AntiAlias=1
LineColor=#CouleurLigne#

[StyleFullCircle]
StartAngle=-1.570796326
RotationAngle=-4.712388978
X=0r
Y=0
W=(2*#Radius#)
H=(2*#Radius#)
LineStart=#Radius#
LineLength=(#Radius#-#Thickness#)
Solid=1
AntiAlias=1
LineColor=#CouleurLigneFond#

[StyleCPUText]
X=(#Radius#)r
Y=(#Radius#)+5
FontSize=#FontSize#
FontFace=#FontFace#
FontColor=255,255,255,255
StringAlign=CenterCenter
AntiAlias=1
NumOfDecimals=0

[StyleCOREText]
X=((#Radius#)+25)
Y=(#Radius#)-25
FontSize=#FontSizeCoreText#
FontFace=#FontFace#
FontColor=255,255,255,255
StringAlign=CenterCenter
AntiAlias=1
NumOfDecimals=0

[MeasureSpeed]
Measure=Plugin
Plugin=SpeedFanPlugin
SpeedFanType=FAN
SpeedFanNumber=2
DynamicVariables=1

[MeasurePercent]
Measure=Calc
Formula=(100*[MeasureSpeed]/#MaxFanSpeed#)
DynamicVariables=1
MinValue=0
MaxValue=100

[CPUCircle]
Meter=Roundline
MeasureName=MeasurePercent
MeterStyle=StyleCircle
X=0
LeftMouseUpAction=[!Refresh]

[CPUFullCircle]
Meter=Roundline
MeterStyle=StyleFullCircle
LeftMouseUpAction=[!Refresh]

[CPUText]
Meter=String
MeasureName=MeasurePercent
MeterStyle=StyleCPUText
AntiAlias=1
NumOfDecimals=0
Postfix="%"

[COREText]
Meter=String
MeterStyle=StyleCOREText
Text=#TITRE#
User avatar
theimmersion
Posts: 55
Joined: November 27th, 2016, 1:51 pm

Re: How to change "linecolor" when a fan speed up or speed down

Post by theimmersion »

I guess use either the top speed or a speed you would like when its on load as a divider to change color.

What i mean by that is that a system can for instance have a speed limit of 3000 rpm but the fan never reaching that speed because it never gets overloaded unless with specific software to test hardware under load. In this case, if you want the color to go red on its normal on load speed like 2000 rpm, you set that number as MaxFanSpeed and not 3000, otherwise, the color will never go full red unless as above state, you dont use a very demanding game to bring the temps and thus speed to its top or a testing software.^^

Code: Select all

MaxFanSpeed=1750
FanSpeedDivider=(#MaxFanSpeed#/255)

[Red]
Measure=Calc
Formula=([MeasureSpeed]/#FanSpeedDivider#)
DynamicVariables=1
You should get the 0-255 color channel to use for

Code: Select all

LineColor=[Red],200,50
Now, when the speed is idle and you know its idle speed and you want red channel at 0, you can mitigate it like this:

Code: Select all

MaxFanSpeed=1750
IdleFanSpeed=400
FanSpeedDivider=((#MaxFanSpeed#-#IdleFanSpeed#)/255)

[Red]
Measure=Calc
Formula=([MeasureSpeed] <= #IdleFanSpeed# ? 0 : (([MeasureSpeed]-#IdleFanSpeed#)/#FanSpeedDivider#) )
DynamicVariables=1
This way, the red channel should be 0 on idle and go towards full color 255 based on idle speed upwards.
If i didnt f*ck up the formula, that is. xD

Also, id suggest using Clamp() on the end result since rainmeter likes to go GAGA when for what ever reason a channel number goes over 255. Like, Clamp([Red],0,255).
Of course this is for full red, you can choose the color limit if you want orange on full load by using a number less than 255.
Get the color you would like for top speed fan and modify the numbers to reach those values.
Btw, why would you not use a red color for top speed! Its top speed, its red, its how its meant to be! :P ;)

Posting from friends PC so cant check the code on a rainmeter skin atm. I think that should do it tho. Experiment. ^^
Hope it helps. Good Luck!

Sorry, edited for a better comparison to your script.
User avatar
theimmersion
Posts: 55
Joined: November 27th, 2016, 1:51 pm

Re: How to change "linecolor" when a fan speed up or speed down

Post by theimmersion »

This is how it would look for having some blue color for idle and some stronge orange color for under load, which needs to change all color channels.

Code: Select all

MaxFanSpeed=1750
IdleFanSpeed=400

IdleRed=30
IdleGreen=150
IdleBlue=30
LoadRed=200
LoadGreen=40
LoadBlue=40

;This red color divider gives a color range of 170 since we start off from 30 on idle and want to increase to 200 under load.
FanSpeedDividerRed=((#MaxFanSpeed#-#IdleFanSpeed#)/Abs(#IdleRed#-#LoadRed#))
FanSpeedDividerGreen=((#MaxFanSpeed#-#IdleFanSpeed#)/Abs(#IdleGreen#-#LoadGreen#))
FanSpeedDividerBlue=((#MaxFanSpeed#-#IdleFanSpeed#)/Abs(#IdleBlue#-#LoadBlue#))

[Red]
Measure=Calc
Formula=([MeasureSpeed] <= #IdleFanSpeed# ? 0 : (([MeasureSpeed]-#IdleFanSpeed#)/#FanSpeedDividerRed#) )
DynamicVariables=1

[Green]
Measure=Calc
Formula=([MeasureSpeed] <= #IdleFanSpeed# ? 0 : (0-(([MeasureSpeed]-#IdleFanSpeed#)/#FanSpeedDividerGreen#)) )
DynamicVariables=1

[Blue]
Measure=Calc
Formula=([MeasureSpeed] <= #IdleFanSpeed# ? 0 : (0-(([MeasureSpeed]-#IdleFanSpeed#)/#FanSpeedDividerBlue#)) )
DynamicVariables=1

[SOME_SHAPE_METER]
LineColor=(#IdleRed#+[Red]),(#IdleGreen#+[Green]),(#IdleBlue#+[Blue])
Now you can also utilize fan speed 0-100 percentage instead of fans rpm.
Im sure there are simpler ways but i use these kinds as it gives me more freedom for individual manipulations when i get individual raw data so to speak.