Fix cooler temperature checks

parent 32ebb8df
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
#define HEATER_2_MAXTEMP 275 // (degC) #define HEATER_2_MAXTEMP 275 // (degC)
#define HEATER_3_MAXTEMP 275 // (degC) #define HEATER_3_MAXTEMP 275 // (degC)
#define BED_MAXTEMP 150 // (degC) #define BED_MAXTEMP 150 // (degC)
#define COOLER_MAXTEMP 30 // #define COOLER_MAXTEMP 35 //
// The minimal temperature defines the temperature below which the heater will not be enabled It is used // The minimal temperature defines the temperature below which the heater will not be enabled It is used
// or, in case of cooler, it will switched off. // or, in case of cooler, it will switched off.
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
#define HEATER_2_MINTEMP 5 // (degC) #define HEATER_2_MINTEMP 5 // (degC)
#define HEATER_3_MINTEMP 5 // (degC) #define HEATER_3_MINTEMP 5 // (degC)
#define BED_MINTEMP 5 // (degC) #define BED_MINTEMP 5 // (degC)
#define COOLER_MINTEMP 15 // (degC) #define COOLER_MINTEMP 10 // (degC)
//Preheat Constants //Preheat Constants
#define PLA_PREHEAT_HOTEND_TEMP 190 #define PLA_PREHEAT_HOTEND_TEMP 190
......
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
#define HEATER_2_MAXTEMP 275 // (degC) #define HEATER_2_MAXTEMP 275 // (degC)
#define HEATER_3_MAXTEMP 275 // (degC) #define HEATER_3_MAXTEMP 275 // (degC)
#define BED_MAXTEMP 150 // (degC) #define BED_MAXTEMP 150 // (degC)
#define COOLER_MAXTEMP 25 // #define COOLER_MAXTEMP 35 //
// The minimal temperature defines the temperature below which the heater will not be enabled It is used // The minimal temperature defines the temperature below which the heater will not be enabled It is used
// or, in case of cooler, it will switched off. // or, in case of cooler, it will switched off.
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
#define HEATER_2_MINTEMP 5 // (degC) #define HEATER_2_MINTEMP 5 // (degC)
#define HEATER_3_MINTEMP 5 // (degC) #define HEATER_3_MINTEMP 5 // (degC)
#define BED_MINTEMP 5 // (degC) #define BED_MINTEMP 5 // (degC)
#define COOLER_MINTEMP 15 // (degC) #define COOLER_MINTEMP 10 // (degC)
//Preheat Constants //Preheat Constants
#define PLA_PREHEAT_HOTEND_TEMP 190 #define PLA_PREHEAT_HOTEND_TEMP 190
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
#define LASER_FIRING_PIN 5 #define LASER_FIRING_PIN 5
#endif #endif
#if DISABLED(ORIG_TEMP_COOLER_PIN) #if DISABLED(ORIG_TEMP_COOLER_PIN)
#define TEMP_COOLER_PIN ORIG_HEATER_0_PIN // Default to the first thermistor #define TEMP_COOLER_PIN ORIG_TEMP_0_PIN // Default to the first thermistor
#endif #endif
#if ENABLED(LASER_POWER_DOWN) #if ENABLED(LASER_POWER_DOWN)
#define LASER_POWER_PIN 9 // This is currently hard-coded to timer2 which services pins 9, 10 #define LASER_POWER_PIN 9 // This is currently hard-coded to timer2 which services pins 9, 10
......
...@@ -2948,13 +2948,9 @@ inline void do_blocking_move_to_z(float z) { do_blocking_move_to(current_positio ...@@ -2948,13 +2948,9 @@ inline void do_blocking_move_to_z(float z) { do_blocking_move_to(current_positio
ECHO_M(SERIAL_CAT); ECHO_M(SERIAL_CAT);
#if ENABLED(COOLER_WATTS) #if ENABLED(COOLER_WATTS)
ECHO_VM(((COOLER_WATTS) * getCoolerPower()) / 127, "W"); ECHO_VM(((COOLER_WATTS) * getCoolerPower()) / 127, "W");
#else
#if ENABLED(FAST_PWM_COOLER)
ECHO_V(getPwmCooler(false));
#else #else
ECHO_V(getCoolerPower()); ECHO_V(getCoolerPower());
#endif #endif
#endif
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
ECHO_MV(" ADC C:", degCooler(), 1); ECHO_MV(" ADC C:", degCooler(), 1);
ECHO_MV("C->", rawBedCooler() / OVERSAMPLENR, 0); ECHO_MV("C->", rawBedCooler() / OVERSAMPLENR, 0);
...@@ -8404,7 +8400,7 @@ void process_next_command() { ...@@ -8404,7 +8400,7 @@ void process_next_command() {
#if HAS(TEMP_BED) || HAS(TEMP_COOLER) #if HAS(TEMP_BED) || HAS(TEMP_COOLER)
case 190: // M190 - Wait for bed heater or for cooler to reach target. case 190: // M190 - Wait for bed heater or for cooler to reach target.
gcode_M190(); break; gcode_M190(); break;
#endif //TEMP_BED_PIN #endif //TEMP_BED || TEMP_COOLER
case 200: // M200 D<millimetres> set filament diameter and set E axis units to cubic millimetres (use S0 to set back to millimeters). case 200: // M200 D<millimetres> set filament diameter and set E axis units to cubic millimetres (use S0 to set back to millimeters).
gcode_M200(); break; gcode_M200(); break;
......
...@@ -351,7 +351,9 @@ ...@@ -351,7 +351,9 @@
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, \ PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, \
_H0_PINS _H1_PINS _H2_PINS _H3_PINS \ _H0_PINS _H1_PINS _H2_PINS _H3_PINS \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS \ _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS \
analogInputToDigitalPin(TEMP_BED_PIN) \ analogInputToDigitalPin(TEMP_BED_PIN), \
analogInputToDigitalPin(TEMP_COOLER_PIN), \
COOLER_PIN \
} }
#endif //__PINS_H #endif //__PINS_H
...@@ -98,6 +98,9 @@ float current_temperature_cooler = 0.0; ...@@ -98,6 +98,9 @@ float current_temperature_cooler = 0.0;
unsigned char soft_pwm_bed; unsigned char soft_pwm_bed;
unsigned char soft_pwm_cooler; unsigned char soft_pwm_cooler;
#if ENABLED(FAST_PWM_COOLER)
unsigned char fast_pwm_cooler;
#endif
void setPwmCooler(unsigned char pwm); void setPwmCooler(unsigned char pwm);
...@@ -273,8 +276,10 @@ static void updateTemperaturesFromRawValues(); ...@@ -273,8 +276,10 @@ static void updateTemperaturesFromRawValues();
void setPwmCooler(unsigned char pwm) { void setPwmCooler(unsigned char pwm) {
soft_pwm_cooler = pwm >> 1; soft_pwm_cooler = pwm >> 1;
#if ENABLED(FAST_PWM_COOLER) #if ENABLED(FAST_PWM_COOLER)
fast_pwm_cooler = pwm;
analogWrite(COOLER_PIN, pwm); analogWrite(COOLER_PIN, pwm);
#endif #endif
} }
...@@ -282,7 +287,7 @@ unsigned char getPwmCooler(bool soft=true) { ...@@ -282,7 +287,7 @@ unsigned char getPwmCooler(bool soft=true) {
if(soft) if(soft)
return soft_pwm_cooler; return soft_pwm_cooler;
#if ENABLED(FAST_PWM_COOLER) #if ENABLED(FAST_PWM_COOLER)
return analogRead(COOLER_PIN); return fast_pwm_cooler;
#else #else
return soft_pwm_cooler * 2; return soft_pwm_cooler * 2;
#endif #endif
...@@ -552,7 +557,11 @@ int getHeaterPower(int heater) { ...@@ -552,7 +557,11 @@ int getHeaterPower(int heater) {
} }
int getCoolerPower() { int getCoolerPower() {
#if ENABLED(FAST_PWM_COOLER)
return fast_pwm_cooler;
#else
return soft_pwm_cooler; return soft_pwm_cooler;
#endif
} }
#if HAS(AUTO_FAN) #if HAS(AUTO_FAN)
...@@ -2228,6 +2237,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -2228,6 +2237,7 @@ ISR(TIMER0_COMPB_vect) {
temp_count = 0; temp_count = 0;
for (int i = 0; i < 4; i++) raw_temp_value[i] = 0; for (int i = 0; i < 4; i++) raw_temp_value[i] = 0;
raw_temp_bed_value = 0; raw_temp_bed_value = 0;
raw_temp_cooler_value = 0;
#if HAS(POWER_CONSUMPTION_SENSOR) #if HAS(POWER_CONSUMPTION_SENSOR)
raw_powconsumption_value = 0; raw_powconsumption_value = 0;
...@@ -2279,8 +2289,8 @@ ISR(TIMER0_COMPB_vect) { ...@@ -2279,8 +2289,8 @@ ISR(TIMER0_COMPB_vect) {
#else #else
#define GEBED >= #define GEBED >=
#endif #endif
if (current_temperature_bed_raw GEBED bed_maxttemp_raw) _temp_error(-1, PSTR(SERIAL_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP_BED)); if (current_temperature_bed_raw GEBED bed_maxttemp_raw) _temp_error(-1, SERIAL_T_MAXTEMP, PSTR(MSG_ERR_MAXTEMP_BED));
if (bed_minttemp_raw GEBED current_temperature_bed_raw) _temp_error(-1, PSTR(SERIAL_T_MINTEMP), PSTR(MSG_ERR_MINTEMP_BED)); if (bed_minttemp_raw GEBED current_temperature_bed_raw) _temp_error(-1, SERIAL_T_MINTEMP, PSTR(MSG_ERR_MINTEMP_BED));
#endif #endif
#if HAS(TEMP_COOLER) #if HAS(TEMP_COOLER)
#if COOLER_RAW_LO_TEMP > COOLER_RAW_HI_TEMP #if COOLER_RAW_LO_TEMP > COOLER_RAW_HI_TEMP
...@@ -2288,8 +2298,8 @@ ISR(TIMER0_COMPB_vect) { ...@@ -2288,8 +2298,8 @@ ISR(TIMER0_COMPB_vect) {
#else #else
#define GECOOLER >= #define GECOOLER >=
#endif #endif
if (current_temperature_cooler_raw GECOOLER cooler_maxttemp_raw) _temp_error(-2, PSTR(SERIAL_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP_COOLER)); if (current_temperature_cooler_raw GECOOLER cooler_maxttemp_raw) _temp_error(-2, SERIAL_T_MAXTEMP, PSTR(MSG_ERR_MAXTEMP_COOLER));
if (cooler_minttemp_raw GECOOLER current_temperature_cooler_raw) _temp_error(-2, PSTR(SERIAL_T_MINTEMP), PSTR(MSG_ERR_MINTEMP_COOLER)); if (cooler_minttemp_raw GECOOLER current_temperature_cooler_raw) _temp_error(-2, SERIAL_T_MINTEMP, PSTR(MSG_ERR_MINTEMP_COOLER));
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment