Skip to content

Commit

Permalink
fix #2
Browse files Browse the repository at this point in the history
M106 P1 S100 раньше ничего не делала (т.к. есть только P0 - обдув модели) - теперь запоминает, с какой скоростью после 50° надо обдувать coldend.
100 гораздо тише, чем 200 - но понравится ли это пластикам? Время покажет. Сохранять в EEPROM не стал, т.к. разным пластикам (возможно) разные значения нужны, поэтому лучше в слайсер добавить.
  • Loading branch information
ursoft committed Nov 19, 2019
1 parent 4341353 commit f959c57
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@

#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 200 // 255 == full speed
#define EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE
//#define CHAMBER_AUTO_FAN_TEMPERATURE 30
//#define CHAMBER_AUTO_FAN_SPEED 255

Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/gcode/temperature/M106_M107.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ void GcodeSuite::M106() {

thermalManager.set_fan_speed(p, s);
}
#if ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE)
if (p == _CNT_P) {
uint16_t s = parser.ushortval('S', EXTRUDER_AUTO_FAN_SPEED);
NOMORE(s, 255U);
thermalManager.extruder_auto_fan_speed = (uint8_t)s;
}
#endif
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1850,8 +1850,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/**
* Auto Fan check for PWM pins
*/
#if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255
#define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255."
#if HAS_AUTO_FAN && (EXTRUDER_AUTO_FAN_SPEED != 255 || ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE))
#define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255 and disable EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE."
#if HAS_AUTO_FAN_0
static_assert(PWM_PIN(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF);
#elif HAS_AUTO_FAN_1
Expand Down
20 changes: 12 additions & 8 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ Temperature thermalManager;
uint8_t Temperature::chamberfan_speed; // = 0
#endif

#if ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE)
uint8_t Temperature::extruder_auto_fan_speed = EXTRUDER_AUTO_FAN_SPEED;
#endif

#if FAN_COUNT > 0

uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
Expand Down Expand Up @@ -682,29 +686,29 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
#endif
default:
#if ENABLED(AUTO_POWER_E_FANS)
autofan_speed[realFan] = fan_on ? EXTRUDER_AUTO_FAN_SPEED : 0;
autofan_speed[realFan] = fan_on ? extruder_auto_fan_speed : 0;
#endif
break;
}

switch (f) {
#if HAS_AUTO_FAN_0
case 0: _UPDATE_AUTO_FAN(E0, fan_on, EXTRUDER_AUTO_FAN_SPEED); break;
case 0: _UPDATE_AUTO_FAN(E0, fan_on, extruder_auto_fan_speed); break;
#endif
#if HAS_AUTO_FAN_1
case 1: _UPDATE_AUTO_FAN(E1, fan_on, EXTRUDER_AUTO_FAN_SPEED); break;
case 1: _UPDATE_AUTO_FAN(E1, fan_on, extruder_auto_fan_speed); break;
#endif
#if HAS_AUTO_FAN_2
case 2: _UPDATE_AUTO_FAN(E2, fan_on, EXTRUDER_AUTO_FAN_SPEED); break;
case 2: _UPDATE_AUTO_FAN(E2, fan_on, extruder_auto_fan_speed); break;
#endif
#if HAS_AUTO_FAN_3
case 3: _UPDATE_AUTO_FAN(E3, fan_on, EXTRUDER_AUTO_FAN_SPEED); break;
case 3: _UPDATE_AUTO_FAN(E3, fan_on, extruder_auto_fan_speed); break;
#endif
#if HAS_AUTO_FAN_4
case 4: _UPDATE_AUTO_FAN(E4, fan_on, EXTRUDER_AUTO_FAN_SPEED); break;
case 4: _UPDATE_AUTO_FAN(E4, fan_on, extruder_auto_fan_speed); break;
#endif
#if HAS_AUTO_FAN_5
case 5: _UPDATE_AUTO_FAN(E5, fan_on, EXTRUDER_AUTO_FAN_SPEED); break;
case 5: _UPDATE_AUTO_FAN(E5, fan_on, extruder_auto_fan_speed); break;
#endif
#if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E
case CHAMBER_FAN_INDEX: _UPDATE_AUTO_FAN(CHAMBER, fan_on, CHAMBER_AUTO_FAN_SPEED); break;
Expand Down Expand Up @@ -1521,7 +1525,7 @@ void Temperature::updateTemperaturesFromRawValues() {
#define SET_FAST_PWM_FREQ(P) NOOP
#endif
#define INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0)
#if EXTRUDER_AUTO_FAN_SPEED != 255
#if EXTRUDER_AUTO_FAN_SPEED != 255 || ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE)
#define INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(FAST_PWM_FAN_FREQUENCY); } else SET_OUTPUT(P); }while(0)
#else
#define INIT_E_AUTO_FAN_PIN(P) SET_OUTPUT(P)
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ class Temperature {
static uint8_t chamberfan_speed;
#endif

#if ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE)
static uint8_t extruder_auto_fan_speed;
#endif

#if ENABLED(FAN_SOFT_PWM)
static uint8_t soft_pwm_amount_fan[FAN_COUNT],
soft_pwm_count_fan[FAN_COUNT];
Expand Down

0 comments on commit f959c57

Please sign in to comment.