diff --git a/src/SerialCmd.cpp b/src/SerialCmd.cpp index aeae799..978c156 100644 --- a/src/SerialCmd.cpp +++ b/src/SerialCmd.cpp @@ -60,7 +60,9 @@ int SerialCmd_readFromSerial (void) } else if(inputSize >= CMD_MAX) { - Serial.flush(); + for (int i = 0; i < inputSize; i++){ + Serial.read(); + } Serial.print("too much data, flush"); } return inputSize; diff --git a/src/main.cpp b/src/main.cpp index 5b49ee4..4585b20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ #define DELAY_TIME 1000 /**< time between measurements [ms] */ #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 INVALID_TEMP (MAX_TEMP+MAX_TEMP) /**< Invalid temperature (on sensor failures)*/ @@ -37,6 +37,8 @@ #define RPM_CONTROL_DEACTIVATED -1 +#define TEMPERATUR_HIGHVALUE MAX_TEMP + /******************* Settings for command mode ***************/ #define COMMAND_BRIGHTNESS 200 #define PERCENT_MAX 100 @@ -199,7 +201,8 @@ void loop() 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 { @@ -223,6 +226,10 @@ void loop() mAutomaticTargetRPM = PERCENT_MAX; } break; + default: + pixels->fill(Color(0,0,0)); + pixels->setBrightness(0); + break; } } } @@ -240,7 +247,15 @@ void loop() Serial.print(actualFanSpeedRpm); Serial.println("RPM"); - singleLed->fill(Color(0,128,128)); + if (temp < TEMPERATUR_HIGHVALUE) + { + singleLed->fill(Color(0,128,128)); + } + else + { + singleLed->fill(Color(255,0,0)); + } + singleLed->setBrightness(fanSpeedPercent); singleLed->show(); }