Change LED on high temperatur

This commit is contained in:
Ollo 2024-12-07 12:26:10 +01:00
parent 900c938a97
commit 4fa2e48b62
2 changed files with 21 additions and 4 deletions

View File

@ -60,7 +60,9 @@ int SerialCmd_readFromSerial (void)
} }
else if(inputSize >= CMD_MAX) else if(inputSize >= CMD_MAX)
{ {
Serial.flush(); for (int i = 0; i < inputSize; i++){
Serial.read();
}
Serial.print("too much data, flush"); Serial.print("too much data, flush");
} }
return inputSize; return inputSize;

View File

@ -28,7 +28,7 @@
#define DELAY_TIME 1000 /**< time between measurements [ms] */ #define DELAY_TIME 1000 /**< time between measurements [ms] */
#define MIN_FAN_SPEED_PERCENT 24 /**< minimum fan speed [%] */ #define MIN_FAN_SPEED_PERCENT 24 /**< minimum fan speed [%] */
#define MIN_TEMP 25 /**< turn fan off below [deg C] */ #define MIN_TEMP 27 /**< turn fan off below [deg C] */
#define MAX_TEMP 40 /**< turn fan to full speed above [deg C] */ #define MAX_TEMP 40 /**< turn fan to full speed above [deg C] */
#define INVALID_TEMP (MAX_TEMP+MAX_TEMP) /**< Invalid temperature (on sensor failures)*/ #define INVALID_TEMP (MAX_TEMP+MAX_TEMP) /**< Invalid temperature (on sensor failures)*/
@ -37,6 +37,8 @@
#define RPM_CONTROL_DEACTIVATED -1 #define RPM_CONTROL_DEACTIVATED -1
#define TEMPERATUR_HIGHVALUE MAX_TEMP
/******************* Settings for command mode ***************/ /******************* Settings for command mode ***************/
#define COMMAND_BRIGHTNESS 200 #define COMMAND_BRIGHTNESS 200
#define PERCENT_MAX 100 #define PERCENT_MAX 100
@ -200,6 +202,7 @@ void loop()
if(checkCmd == 0) if(checkCmd == 0)
{ {
Serial.println(F("if you dont know what to do type \"" SERIALCMD_COMMAND_HELP "\"")); Serial.println(F("if you dont know what to do type \"" SERIALCMD_COMMAND_HELP "\""));
pixels->setBrightness(0);
} }
else else
{ {
@ -223,6 +226,10 @@ void loop()
mAutomaticTargetRPM = PERCENT_MAX; mAutomaticTargetRPM = PERCENT_MAX;
} }
break; break;
default:
pixels->fill(Color(0,0,0));
pixels->setBrightness(0);
break;
} }
} }
} }
@ -240,7 +247,15 @@ void loop()
Serial.print(actualFanSpeedRpm); Serial.print(actualFanSpeedRpm);
Serial.println("RPM"); Serial.println("RPM");
if (temp < TEMPERATUR_HIGHVALUE)
{
singleLed->fill(Color(0,128,128)); singleLed->fill(Color(0,128,128));
}
else
{
singleLed->fill(Color(255,0,0));
}
singleLed->setBrightness(fanSpeedPercent); singleLed->setBrightness(fanSpeedPercent);
singleLed->show(); singleLed->show();
} }