Tweaks to temperature code

This commit is contained in:
Scott Lahteine 2017-06-15 15:14:08 -05:00
parent d9da126776
commit 7769a22064
3 changed files with 22 additions and 22 deletions

View file

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

View file

@ -535,15 +535,15 @@ class Temperature {
static void checkExtruderAutoFans(); static void checkExtruderAutoFans();
static float get_pid_output(int e); static float get_pid_output(const int8_t e);
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
static float get_pid_output_bed(); static float get_pid_output_bed();
#endif #endif
static void _temp_error(int e, const char* serial_msg, const char* lcd_msg); static void _temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg);
static void min_temp_error(int8_t e); static void min_temp_error(const int8_t e);
static void max_temp_error(int8_t e); static void max_temp_error(const int8_t e);
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED

View file

@ -23,27 +23,27 @@
// PT100 with INA826 amp on Ultimaker v2.0 electronics // PT100 with INA826 amp on Ultimaker v2.0 electronics
// The PT100 in the Ultimaker v2.0 electronics has a high sample value for a high temperature. // The PT100 in the Ultimaker v2.0 electronics has a high sample value for a high temperature.
// This does not match the normal thermistor behaviour so we need to set the following defines // This does not match the normal thermistor behaviour so we need to set the following defines
#if (THERMISTORHEATER_0 == 20) #if THERMISTORHEATER_0 == 20
#define HEATER_0_RAW_HI_TEMP 16383 #define HEATER_0_RAW_HI_TEMP 16383
#define HEATER_0_RAW_LO_TEMP 0 #define HEATER_0_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_1 == 20) #if THERMISTORHEATER_1 == 20
#define HEATER_1_RAW_HI_TEMP 16383 #define HEATER_1_RAW_HI_TEMP 16383
#define HEATER_1_RAW_LO_TEMP 0 #define HEATER_1_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_2 == 20) #if THERMISTORHEATER_2 == 20
#define HEATER_2_RAW_HI_TEMP 16383 #define HEATER_2_RAW_HI_TEMP 16383
#define HEATER_2_RAW_LO_TEMP 0 #define HEATER_2_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_3 == 20) #if THERMISTORHEATER_3 == 20
#define HEATER_3_RAW_HI_TEMP 16383 #define HEATER_3_RAW_HI_TEMP 16383
#define HEATER_3_RAW_LO_TEMP 0 #define HEATER_3_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_4 == 20) #if THERMISTORHEATER_4 == 20
#define HEATER_4_RAW_HI_TEMP 16383 #define HEATER_4_RAW_HI_TEMP 16383
#define HEATER_4_RAW_LO_TEMP 0 #define HEATER_4_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORBED == 20) #if THERMISTORBED == 20
#define HEATER_BED_RAW_HI_TEMP 16383 #define HEATER_BED_RAW_HI_TEMP 16383
#define HEATER_BED_RAW_LO_TEMP 0 #define HEATER_BED_RAW_LO_TEMP 0
#endif #endif