Introduce TEMP_NONE, a "sensor" just storing the target temperature.

This is useful when operation a milling spindle. In this case,
set the spindle speed with M104 Sxxx, where xxx is 1..255.
M104 S0 turns the spindle off.
This commit is contained in:
Markus Hitter 2011-09-01 01:02:30 +02:00
parent a6c22eed09
commit f9a4495aa1
10 changed files with 80 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);

21
temp.c
View File

@ -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);
}
}
}

1
temp.h
View File

@ -27,6 +27,7 @@ typedef enum {
TT_AD595,
TT_PT100,
TT_INTERCOM,
TT_NONE,
TT_DUMMY,
} temp_type_t;