Merge pull request #1889 from DRracer/fan_check_error_fix
Fan check error fix
This commit is contained in:
commit
327e6cd39b
|
|
@ -3416,8 +3416,10 @@ void process_commands()
|
||||||
{
|
{
|
||||||
#ifdef FANCHECK
|
#ifdef FANCHECK
|
||||||
if (fan_check_error){
|
if (fan_check_error){
|
||||||
fan_check_error = false;
|
if( fan_check_error == EFCE_DETECTED ){
|
||||||
lcd_pause_print();
|
fan_check_error = EFCE_REPORTED;
|
||||||
|
lcd_pause_print();
|
||||||
|
} // otherwise it has already been reported, so just ignore further processing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ float current_temperature_bed = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FANCHECK
|
#ifdef FANCHECK
|
||||||
volatile bool fan_check_error = false;
|
volatile uint8_t fan_check_error = EFCE_OK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned char soft_pwm_bed;
|
unsigned char soft_pwm_bed;
|
||||||
|
|
@ -512,6 +512,12 @@ void checkFanSpeed()
|
||||||
else fan_speed_errors[1] = 0;
|
else fan_speed_errors[1] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// drop the fan_check_error flag when both fans are ok
|
||||||
|
if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){
|
||||||
|
// we may even send some info to the LCD from here
|
||||||
|
fan_check_error = EFCE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if ((fan_speed_errors[0] > max_extruder_fan_errors) && fans_check_enabled) {
|
if ((fan_speed_errors[0] > max_extruder_fan_errors) && fans_check_enabled) {
|
||||||
fan_speed_errors[0] = 0;
|
fan_speed_errors[0] = 0;
|
||||||
fanSpeedError(0); //extruder fan
|
fanSpeedError(0); //extruder fan
|
||||||
|
|
@ -522,6 +528,23 @@ void checkFanSpeed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Prints serialMsg to serial port, displays lcdMsg onto the LCD and beeps.
|
||||||
|
//! Extracted from fanSpeedError to save some space.
|
||||||
|
//! @param serialMsg pointer into PROGMEM, this text will be printed to the serial port
|
||||||
|
//! @param lcdMsg pointer into PROGMEM, this text will be printed onto the LCD
|
||||||
|
static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){
|
||||||
|
SERIAL_ECHOLNRPGM(serialMsg);
|
||||||
|
if (get_message_level() == 0) {
|
||||||
|
if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)){
|
||||||
|
WRITE(BEEPER, HIGH);
|
||||||
|
delayMicroseconds(200);
|
||||||
|
WRITE(BEEPER, LOW);
|
||||||
|
delayMicroseconds(100); // what is this wait for?
|
||||||
|
}
|
||||||
|
LCD_ALERTMESSAGERPGM(lcdMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void fanSpeedError(unsigned char _fan) {
|
void fanSpeedError(unsigned char _fan) {
|
||||||
if (get_message_level() != 0 && isPrintPaused) return;
|
if (get_message_level() != 0 && isPrintPaused) return;
|
||||||
//to ensure that target temp. is not set to zero in case taht we are resuming print
|
//to ensure that target temp. is not set to zero in case taht we are resuming print
|
||||||
|
|
@ -530,7 +553,8 @@ void fanSpeedError(unsigned char _fan) {
|
||||||
lcd_print_stop();
|
lcd_print_stop();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fan_check_error = true;
|
fan_check_error = EFCE_DETECTED;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -538,27 +562,11 @@ void fanSpeedError(unsigned char _fan) {
|
||||||
SERIAL_ECHOLNPGM("// action:pause"); //for octoprint
|
SERIAL_ECHOLNPGM("// action:pause"); //for octoprint
|
||||||
}
|
}
|
||||||
switch (_fan) {
|
switch (_fan) {
|
||||||
case 0:
|
case 0: // extracting the same code from case 0 and case 1 into a function saves 72B
|
||||||
SERIAL_ECHOLNPGM("Extruder fan speed is lower then expected");
|
fanSpeedErrorBeep(PSTR("Extruder fan speed is lower than expected"), PSTR("Err: EXTR. FAN ERROR") );
|
||||||
if (get_message_level() == 0) {
|
|
||||||
if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT))
|
|
||||||
WRITE(BEEPER, HIGH);
|
|
||||||
delayMicroseconds(200);
|
|
||||||
WRITE(BEEPER, LOW);
|
|
||||||
delayMicroseconds(100);
|
|
||||||
LCD_ALERTMESSAGEPGM("Err: EXTR. FAN ERROR");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
SERIAL_ECHOLNPGM("Print fan speed is lower then expected");
|
fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") );
|
||||||
if (get_message_level() == 0) {
|
|
||||||
if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT))
|
|
||||||
WRITE(BEEPER, HIGH);
|
|
||||||
delayMicroseconds(200);
|
|
||||||
WRITE(BEEPER, LOW);
|
|
||||||
delayMicroseconds(100);
|
|
||||||
LCD_ALERTMESSAGEPGM("Err: PRINT FAN ERROR");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,12 @@ void checkExtruderAutoFans();
|
||||||
|
|
||||||
#if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1))
|
#if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1))
|
||||||
|
|
||||||
extern volatile bool fan_check_error;
|
enum {
|
||||||
|
EFCE_OK = 0, //!< normal operation, both fans are ok
|
||||||
|
EFCE_DETECTED, //!< fan error detected, but not reported yet
|
||||||
|
EFCE_REPORTED //!< fan error detected and reported to LCD and serial
|
||||||
|
};
|
||||||
|
extern volatile uint8_t fan_check_error;
|
||||||
|
|
||||||
void countFanSpeed();
|
void countFanSpeed();
|
||||||
void checkFanSpeed();
|
void checkFanSpeed();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue