extr fan RPM measuring fix

This commit is contained in:
PavelSindler 2019-02-06 22:56:10 +01:00
parent a85d8e7f97
commit ff52499bdc
2 changed files with 10 additions and 5 deletions

View File

@ -2070,10 +2070,17 @@ else { // ambient temperature is stan
#if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1)) #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1))
void check_fans() { void check_fans() {
#ifdef FAN_SOFT_PWM
if (READ(TACH_0) != fan_state[0]) {
if(fan_measuring) fan_edge_counter[0] ++;
fan_state[0] = !fan_state[0];
}
#else //FAN_SOFT_PWM
if (READ(TACH_0) != fan_state[0]) { if (READ(TACH_0) != fan_state[0]) {
fan_edge_counter[0] ++; fan_edge_counter[0] ++;
fan_state[0] = !fan_state[0]; fan_state[0] = !fan_state[0];
} }
#endif
//if (READ(TACH_1) != fan_state[1]) { //if (READ(TACH_1) != fan_state[1]) {
// fan_edge_counter[1] ++; // fan_edge_counter[1] ++;
// fan_state[1] = !fan_state[1]; // fan_state[1] = !fan_state[1];

View File

@ -7352,15 +7352,13 @@ static bool lcd_selftest_fan_dialog(int _fan)
setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, 1); //extruder fan setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, 1); //extruder fan
#ifdef FAN_SOFT_PWM #ifdef FAN_SOFT_PWM
extruder_autofan_last_check = _millis(); extruder_autofan_last_check = _millis();
fan_measuring = true;
#endif //FAN_SOFT_PWM #endif //FAN_SOFT_PWM
_delay(2000); //delay_keep_alive would turn off extruder fan, because temerature is too low _delay(2000); //delay_keep_alive would turn off extruder fan, because temerature is too low
#ifdef FAN_SOFT_PWM
countFanSpeed();
if (!fan_speed[0]) _result = false;
#else //FAN_SOFT_PWM
manage_heater(); //count average fan speed from 2s delay and turn off fans manage_heater(); //count average fan speed from 2s delay and turn off fans
if (!fan_speed[0]) _result = false; if (!fan_speed[0]) _result = false;
#endif //FAN_SOFT_PWM
printf_P(PSTR("Test 1:\n")); printf_P(PSTR("Test 1:\n"));
printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]); printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]);