|
|
@ -505,7 +505,7 @@ int Temperature::getHeaterPower(int heater) {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Temperature Error Handlers
|
|
|
|
// Temperature Error Handlers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg) {
|
|
|
|
void Temperature::_temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg) {
|
|
|
|
static bool killed = false;
|
|
|
|
static bool killed = false;
|
|
|
|
if (IsRunning()) {
|
|
|
|
if (IsRunning()) {
|
|
|
|
SERIAL_ERROR_START();
|
|
|
|
SERIAL_ERROR_START();
|
|
|
@ -524,7 +524,7 @@ void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Temperature::max_temp_error(int8_t e) {
|
|
|
|
void Temperature::max_temp_error(const int8_t e) {
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
_temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
|
|
|
|
_temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
@ -534,7 +534,7 @@ void Temperature::max_temp_error(int8_t e) {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Temperature::min_temp_error(int8_t e) {
|
|
|
|
void Temperature::min_temp_error(const int8_t e) {
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
_temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
|
|
|
|
_temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
@ -545,7 +545,7 @@ void Temperature::min_temp_error(int8_t e) {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float Temperature::get_pid_output(int e) {
|
|
|
|
float Temperature::get_pid_output(const int8_t e) {
|
|
|
|
#if HOTENDS == 1
|
|
|
|
#if HOTENDS == 1
|
|
|
|
UNUSED(e);
|
|
|
|
UNUSED(e);
|
|
|
|
#define _HOTEND_TEST true
|
|
|
|
#define _HOTEND_TEST true
|
|
|
@ -890,7 +890,7 @@ float Temperature::analog2temp(int raw, uint8_t e) {
|
|
|
|
|
|
|
|
|
|
|
|
// Derived from RepRap FiveD extruder::getTemperature()
|
|
|
|
// Derived from RepRap FiveD extruder::getTemperature()
|
|
|
|
// For bed temperature measurement.
|
|
|
|
// For bed temperature measurement.
|
|
|
|
float Temperature::analog2tempBed(int raw) {
|
|
|
|
float Temperature::analog2tempBed(const int raw) {
|
|
|
|
#if ENABLED(BED_USES_THERMISTOR)
|
|
|
|
#if ENABLED(BED_USES_THERMISTOR)
|
|
|
|
float celsius = 0;
|
|
|
|
float celsius = 0;
|
|
|
|
byte i;
|
|
|
|
byte i;
|
|
|
@ -1292,7 +1292,7 @@ void Temperature::init() {
|
|
|
|
SERIAL_EOL();
|
|
|
|
SERIAL_EOL();
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
int heater_index = heater_id >= 0 ? heater_id : HOTENDS;
|
|
|
|
const int heater_index = heater_id >= 0 ? heater_id : HOTENDS;
|
|
|
|
|
|
|
|
|
|
|
|
#if HEATER_IDLE_HANDLER
|
|
|
|
#if HEATER_IDLE_HANDLER
|
|
|
|
// If the heater idle timeout expires, restart
|
|
|
|
// If the heater idle timeout expires, restart
|
|
|
@ -1922,7 +1922,7 @@ void Temperature::isr() {
|
|
|
|
case SensorsReady: {
|
|
|
|
case SensorsReady: {
|
|
|
|
// All sensors have been read. Stay in this state for a few
|
|
|
|
// All sensors have been read. Stay in this state for a few
|
|
|
|
// ISRs to save on calls to temp update/checking code below.
|
|
|
|
// ISRs to save on calls to temp update/checking code below.
|
|
|
|
constexpr int extra_loops = MIN_ADC_ISR_LOOPS - (int)SensorsReady;
|
|
|
|
constexpr int8_t extra_loops = MIN_ADC_ISR_LOOPS - (int8_t)SensorsReady;
|
|
|
|
static uint8_t delay_count = 0;
|
|
|
|
static uint8_t delay_count = 0;
|
|
|
|
if (extra_loops > 0) {
|
|
|
|
if (extra_loops > 0) {
|
|
|
|
if (delay_count == 0) delay_count = extra_loops; // Init this delay
|
|
|
|
if (delay_count == 0) delay_count = extra_loops; // Init this delay
|
|
|
|