diff --git a/config.gen3.h b/config.gen3.h index 2d6bbf2..6299767 100644 --- a/config.gen3.h +++ b/config.gen3.h @@ -236,12 +236,13 @@ */ #define TEMP_RESIDENCY_TIME 60 -// which temperature sensors are you using? (intercom is the gen3-style separate extruder board) +/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board. // #define TEMP_MAX6675 // #define TEMP_THERMISTOR // #define TEMP_AD595 // #define TEMP_PT100 #define TEMP_INTERCOM +// #define TEMP_NONE /***************************************************************************\ * * @@ -250,7 +251,7 @@ * for GEN3 set temp_type to TT_INTERCOM and temp_pin to 0 * * * * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * -* TT_PT100, TT_INTERCOM. See list in temp.c. * +* TT_PT100, TT_INTERCOM, TT_NONE. See list in temp.c. * * * \***************************************************************************/ @@ -298,6 +299,10 @@ DEFINE_TEMP_SENSOR(bed, TT_INTERCOM, 1, 0) * * * Some common names are 'extruder', 'bed', 'fan', 'motor' * * * +* A milling spindle can also be defined as a heater. Attach it to a * +* temperature sensor of TT_NONE, then you can control the spindle's rpm * +* via temperature commands. M104 S1..255 for spindle on, M104 S0 for off. * +* * \***************************************************************************/ #ifndef DEFINE_HEATER @@ -398,7 +403,7 @@ DEFINE_TEMP_SENSOR(bed, TT_INTERCOM, 1, 0) /** \def DC_EXTRUDER DC extruder - If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above + If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above. */ // #define DC_EXTRUDER HEATER_motor // #define DC_EXTRUDER_PWM 180 diff --git a/config.gen6.h b/config.gen6.h index 24a940e..b6933ce 100644 --- a/config.gen6.h +++ b/config.gen6.h @@ -227,12 +227,13 @@ */ #define TEMP_RESIDENCY_TIME 60 -/// which temperature sensors are you using? (intercom is the gen3-style separate extruder board) +/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board. // #define TEMP_MAX6675 #define TEMP_THERMISTOR // #define TEMP_AD595 // #define TEMP_PT100 // #define TEMP_INTERCOM +// #define TEMP_NONE /***************************************************************************\ * * @@ -243,7 +244,7 @@ * do not affect firmware operation * * * * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * -* TT_PT100, TT_INTERCOM. See list in temp.c. * +* TT_PT100, TT_INTERCOM, TT_NONE. See list in temp.c. * * * \***************************************************************************/ @@ -285,6 +286,10 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, PINA5, THERMISTOR_EXTRUDER) * * * Some common names are 'extruder', 'bed', 'fan', 'motor' * * * +* A milling spindle can also be defined as a heater. Attach it to a * +* temperature sensor of TT_NONE, then you can control the spindle's rpm * +* via temperature commands. M104 S1..255 for spindle on, M104 S0 for off. * +* * \***************************************************************************/ #ifndef DEFINE_HEATER @@ -378,7 +383,7 @@ PWM value for 'off' /** \def DC_EXTRUDER DC extruder - If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above + If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above. */ // #define DC_EXTRUDER HEATER_motor // #define DC_EXTRUDER_PWM 180 diff --git a/config.gen7.h b/config.gen7.h index 5bf2387..1183229 100644 --- a/config.gen7.h +++ b/config.gen7.h @@ -239,12 +239,13 @@ */ #define TEMP_RESIDENCY_TIME 60 -/// which temperature sensors are you using? (intercom is the gen3-style separate extruder board) +/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board. // #define TEMP_MAX6675 #define TEMP_THERMISTOR // #define TEMP_AD595 // #define TEMP_PT100 // #define TEMP_INTERCOM +// #define TEMP_NONE /***************************************************************************\ * * @@ -253,7 +254,7 @@ * for GEN3 set temp_type to TT_INTERCOM and temp_pin to 0 * * * * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * -* TT_PT100, TT_INTERCOM. See list in temp.c. * +* TT_PT100, TT_INTERCOM, TT_NONE. See list in temp.c. * * * \***************************************************************************/ @@ -304,6 +305,10 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, PINA2, THERMISTOR_BED) * * * Some common names are 'extruder', 'bed', 'fan', 'motor' * * * +* A milling spindle can also be defined as a heater. Attach it to a * +* temperature sensor of TT_NONE, then you can control the spindle's rpm * +* via temperature commands. M104 S1..255 for spindle on, M104 S0 for off. * +* * \***************************************************************************/ #ifndef DEFINE_HEATER @@ -396,7 +401,7 @@ PWM value for 'off' /** \def DC_EXTRUDER DC extruder - If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above + If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above. */ // #define DC_EXTRUDER HEATER_motor // #define DC_EXTRUDER_PWM 180 diff --git a/config.h.dist b/config.h.dist index a299510..205f6d7 100644 --- a/config.h.dist +++ b/config.h.dist @@ -229,12 +229,13 @@ */ #define TEMP_RESIDENCY_TIME 60 -/// which temperature sensors are you using? (intercom is the gen3-style separate extruder board) +/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board. // #define TEMP_MAX6675 #define TEMP_THERMISTOR // #define TEMP_AD595 // #define TEMP_PT100 // #define TEMP_INTERCOM +// #define TEMP_NONE /***************************************************************************\ * * @@ -243,7 +244,7 @@ * for GEN3 set temp_type to TT_INTERCOM and temp_pin to 0 * * * * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * -* TT_PT100, TT_INTERCOM. See list in temp.c. * +* TT_PT100, TT_INTERCOM, TT_NONE. See list in temp.c. * * * \***************************************************************************/ @@ -289,6 +290,10 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, 0, THERMISTOR_EXTRUDER) * * * Some common names are 'extruder', 'bed', 'fan', 'motor' * * * +* A milling spindle can also be defined as a heater. Attach it to a * +* temperature sensor of TT_NONE, then you can control the spindle's rpm * +* via temperature commands. M104 S1..255 for spindle on, M104 S0 for off. * +* * \***************************************************************************/ #ifndef DEFINE_HEATER @@ -385,7 +390,7 @@ PWM value for 'off' /** \def DC_EXTRUDER DC extruder - If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above + If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above. */ // #define DC_EXTRUDER HEATER_motor // #define DC_EXTRUDER_PWM 180 diff --git a/config.ramps-v1.2.h b/config.ramps-v1.2.h index ece327b..d267419 100644 --- a/config.ramps-v1.2.h +++ b/config.ramps-v1.2.h @@ -238,12 +238,13 @@ temperature is "achieved" for purposes of M109 and friends when actual temperatu */ #define TEMP_RESIDENCY_TIME 60 -/// which temperature sensors are you using? (intercom is the gen3-style separate extruder board) +/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board. // #define TEMP_MAX6675 #define TEMP_THERMISTOR // #define TEMP_AD595 // #define TEMP_PT100 // #define TEMP_INTERCOM +// #define TEMP_NONE /***************************************************************************\ * * @@ -252,7 +253,7 @@ temperature is "achieved" for purposes of M109 and friends when actual temperatu * for GEN3 set temp_type to TT_INTERCOM and temp_pin to 0 * * * * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * -* TT_PT100, TT_INTERCOM. See list in temp.c. * +* TT_PT100, TT_INTERCOM, TT_NONE. See list in temp.c. * * * \***************************************************************************/ @@ -295,6 +296,10 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1_PIN, THERMISTOR_EXTRUDER) * * * Some common names are 'extruder', 'bed', 'fan', 'motor' * * * +* A milling spindle can also be defined as a heater. Attach it to a * +* temperature sensor of TT_NONE, then you can control the spindle's rpm * +* via temperature commands. M104 S1..255 for spindle on, M104 S0 for off. * +* * \***************************************************************************/ #ifndef DEFINE_HEATER @@ -392,7 +397,7 @@ PWM value for 'off' /** \def DC_EXTRUDER DC extruder - If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above + If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above. */ // #define DC_EXTRUDER HEATER_motor // #define DC_EXTRUDER_PWM 180 diff --git a/config.ramps-v1.3.h b/config.ramps-v1.3.h index e67e289..f91a2b2 100644 --- a/config.ramps-v1.3.h +++ b/config.ramps-v1.3.h @@ -239,12 +239,13 @@ temperature is "achieved" for purposes of M109 and friends when actual temperatu */ #define TEMP_RESIDENCY_TIME 60 -/// which temperature sensors are you using? (intercom is the gen3-style separate extruder board) +/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board. // #define TEMP_MAX6675 #define TEMP_THERMISTOR // #define TEMP_AD595 // #define TEMP_PT100 // #define TEMP_INTERCOM +// #define TEMP_NONE /***************************************************************************\ * * @@ -253,7 +254,7 @@ temperature is "achieved" for purposes of M109 and friends when actual temperatu * for GEN3 set temp_type to TT_INTERCOM and temp_pin to 0 * * * * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * -* TT_PT100, TT_INTERCOM. See list in temp.c. * +* TT_PT100, TT_INTERCOM, TT_NONE. See list in temp.c. * * * \***************************************************************************/ @@ -296,6 +297,10 @@ DEFINE_TEMP_SENSOR( extruder, TT_THERMISTOR, AIO13_PIN, THERMISTOR_EXTRUDER) * * * Some common names are 'extruder', 'bed', 'fan', 'motor' * * * +* A milling spindle can also be defined as a heater. Attach it to a * +* temperature sensor of TT_NONE, then you can control the spindle's rpm * +* via temperature commands. M104 S1..255 for spindle on, M104 S0 for off. * +* * \***************************************************************************/ #ifndef DEFINE_HEATER @@ -393,7 +398,7 @@ PWM value for 'off' /** \def DC_EXTRUDER DC extruder - If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above + If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above. */ // #define DC_EXTRUDER HEATER_motor // #define DC_EXTRUDER_PWM 180 diff --git a/heater.c b/heater.c index be2be0a..4bb074a 100644 --- a/heater.c +++ b/heater.c @@ -190,7 +190,7 @@ void heater_save_settings() { \param current_temp the temperature that the associated temp sensor is reporting \param target_temp the temperature we're trying to achieve */ -void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t target_temp) { +void heater_tick(heater_t h, temp_type_t type, uint16_t current_temp, uint16_t target_temp) { uint8_t pid_output; #ifndef BANG_BANG @@ -199,7 +199,7 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta int16_t t_error = target_temp - current_temp; #endif /* BANG_BANG */ - if (h >= NUM_HEATERS || t >= NUM_TEMP_SENSORS) + if (h >= NUM_HEATERS) return; if (target_temp == 0) { @@ -207,6 +207,14 @@ void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t ta return; } + #ifdef TEMP_NONE + if (type == TT_NONE) { + // it's something like a milling spindle + heater_set(h, target_temp >> 2); + return; + } + #endif /* TEMP_NONE */ + #ifndef BANG_BANG heaters_runtime[h].temp_history[heaters_runtime[h].temp_history_pointer++] = current_temp; heaters_runtime[h].temp_history_pointer &= (TH_COUNT - 1); diff --git a/heater.h b/heater.h index 61486e6..e2e2003 100644 --- a/heater.h +++ b/heater.h @@ -22,7 +22,7 @@ void heater_init(void); void heater_save_settings(void); void heater_set(heater_t index, uint8_t value); -void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t target_temp); +void heater_tick(heater_t h, temp_type_t type, uint16_t current_temp, uint16_t target_temp); uint8_t heaters_all_off(void); diff --git a/temp.c b/temp.c index 99553bc..cddba8f 100644 --- a/temp.c +++ b/temp.c @@ -33,6 +33,10 @@ #include "analog.h" #endif +#ifdef TEMP_NONE +// no actual sensor, just store the target temp +#endif + typedef enum { PRESENT, TCOPEN @@ -97,6 +101,12 @@ void temp_init() { break; #endif + #ifdef TEMP_NONE + case TT_NONE: + // nothing to do + break; + #endif + default: /* prevent compiler warning */ break; } @@ -253,6 +263,15 @@ void temp_sensor_tick() { break; #endif /* TEMP_INTERCOM */ + #ifdef TEMP_NONE + case TT_NONE: + temp_sensors_runtime[i].last_read_temp = + temp_sensors_runtime[i].target_temp; // for get_temp() + temp_sensors_runtime[i].next_read_time = 25; + + break; + #endif /* TEMP_NONE */ + #ifdef TEMP_DUMMY case TT_DUMMY: temp = temp_sensors_runtime[i].last_read_temp; @@ -281,7 +300,7 @@ void temp_sensor_tick() { } if (temp_sensors[i].heater < NUM_HEATERS) { - heater_tick(temp_sensors[i].heater, i, temp_sensors_runtime[i].last_read_temp, temp_sensors_runtime[i].target_temp); + heater_tick(temp_sensors[i].heater, temp_sensors[i].temp_type, temp_sensors_runtime[i].last_read_temp, temp_sensors_runtime[i].target_temp); } } } diff --git a/temp.h b/temp.h index 2e185f8..c9b4bce 100644 --- a/temp.h +++ b/temp.h @@ -27,6 +27,7 @@ typedef enum { TT_AD595, TT_PT100, TT_INTERCOM, + TT_NONE, TT_DUMMY, } temp_type_t;