Corrected temp variables.
This commit is contained in:
parent
04d3b5537f
commit
2e8e8878e5
|
@ -803,14 +803,14 @@ inline void process_commands()
|
|||
}
|
||||
break;
|
||||
case 104: // M104
|
||||
if (code_seen('S')) target_raw[TEMPSENSOR_HOTEND] = temp2analog(code_value());
|
||||
if (code_seen('S')) target_raw[TEMPSENSOR_HOTEND_0] = temp2analog(code_value());
|
||||
#ifdef PIDTEMP
|
||||
pid_setpoint = code_value();
|
||||
#endif //PIDTEM
|
||||
#ifdef WATCHPERIOD
|
||||
if(target_raw[TEMPSENSOR_HOTEND] > current_raw[TEMPSENSOR_HOTEND]){
|
||||
if(target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0]){
|
||||
watchmillis = max(1,millis());
|
||||
watch_raw[TEMPSENSOR_HOTEND] = current_raw[TEMPSENSOR_HOTEND];
|
||||
watch_raw[TEMPSENSOR_HOTEND_0] = current_raw[TEMPSENSOR_HOTEND_0];
|
||||
}else{
|
||||
watchmillis = 0;
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ inline void process_commands()
|
|||
break;
|
||||
case 105: // M105
|
||||
#if (TEMP_0_PIN > -1) || defined (HEATER_USES_AD595)
|
||||
tt = analog2temp(current_raw[TEMPSENSOR_HOTEND]);
|
||||
tt = analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
|
||||
#endif
|
||||
#if TEMP_1_PIN > -1
|
||||
bt = analog2tempBed(current_raw[TEMPSENSOR_BED]);
|
||||
|
@ -852,14 +852,14 @@ inline void process_commands()
|
|||
//break;
|
||||
case 109: {// M109 - Wait for extruder heater to reach target.
|
||||
LCD_MESSAGE("Heating...");
|
||||
if (code_seen('S')) target_raw[TEMPSENSOR_HOTEND] = temp2analog(code_value());
|
||||
if (code_seen('S')) target_raw[TEMPSENSOR_HOTEND_0] = temp2analog(code_value());
|
||||
#ifdef PIDTEMP
|
||||
pid_setpoint = code_value();
|
||||
#endif //PIDTEM
|
||||
#ifdef WATCHPERIOD
|
||||
if(target_raw[TEMPSENSOR_HOTEND]>current_raw[TEMPSENSOR_HOTEND]){
|
||||
if(target_raw[TEMPSENSOR_HOTEND_0]>current_raw[TEMPSENSOR_HOTEND_0]){
|
||||
watchmillis = max(1,millis());
|
||||
watch_raw[TEMPSENSOR_HOTEND] = current_raw[TEMPSENSOR_HOTEND];
|
||||
watch_raw[TEMPSENSOR_HOTEND_0] = current_raw[TEMPSENSOR_HOTEND_0];
|
||||
} else {
|
||||
watchmillis = 0;
|
||||
}
|
||||
|
@ -867,21 +867,21 @@ inline void process_commands()
|
|||
codenum = millis();
|
||||
|
||||
/* See if we are heating up or cooling down */
|
||||
bool target_direction = (current_raw[0] < target_raw[0]); // true if heating, false if cooling
|
||||
bool target_direction = (current_raw[TEMPSENSOR_HOTEND_0] < target_raw[TEMPSENSOR_HOTEND_0]); // true if heating, false if cooling
|
||||
|
||||
#ifdef TEMP_RESIDENCY_TIME
|
||||
long residencyStart;
|
||||
residencyStart = -1;
|
||||
/* continue to loop until we have reached the target temp
|
||||
_and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
|
||||
while((target_direction ? (current_raw[0] < target_raw[0]) : (current_raw[0] > target_raw[0])) ||
|
||||
while((target_direction ? (current_raw[TEMPSENSOR_HOTEND_0] < target_raw[TEMPSENSOR_HOTEND_0]) : (current_raw[TEMPSENSOR_HOTEND_0] > target_raw[TEMPSENSOR_HOTEND_0])) ||
|
||||
(residencyStart > -1 && (millis() - residencyStart) < TEMP_RESIDENCY_TIME*1000) ) {
|
||||
#else
|
||||
while ( target_direction ? (current_raw[0] < target_raw[0]) : (current_raw[0] > target_raw[0]) ) {
|
||||
while ( target_direction ? (current_raw[TEMPSENSOR_HOTEND_0] < target_raw[TEMPSENSOR_HOTEND_0]) : (current_raw[TEMPSENSOR_HOTEND_0] > target_raw[TEMPSENSOR_HOTEND_0]) ) {
|
||||
#endif //TEMP_RESIDENCY_TIME
|
||||
if( (millis() - codenum) > 1000 ) { //Print Temp Reading every 1 second while heating up/cooling down
|
||||
Serial.print("T:");
|
||||
Serial.println( analog2temp(current_raw[TEMPSENSOR_HOTEND]) );
|
||||
Serial.println( analog2temp(current_raw[TEMPSENSOR_HOTEND_0]) );
|
||||
codenum = millis();
|
||||
}
|
||||
manage_heater();
|
||||
|
@ -889,9 +889,9 @@ inline void process_commands()
|
|||
#ifdef TEMP_RESIDENCY_TIME
|
||||
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
|
||||
or when current temp falls outside the hysteresis after target temp was reached */
|
||||
if ((residencyStart == -1 && target_direction && current_raw[0] >= target_raw[0]) ||
|
||||
(residencyStart == -1 && !target_direction && current_raw[0] <= target_raw[0]) ||
|
||||
(residencyStart > -1 && labs(analog2temp(current_raw[0]) - analog2temp(target_raw[0])) > TEMP_HYSTERESIS) ) {
|
||||
if ((residencyStart == -1 && target_direction && current_raw[TEMPSENSOR_HOTEND_0] >= target_raw[TEMPSENSOR_HOTEND_0]) ||
|
||||
(residencyStart == -1 && !target_direction && current_raw[TEMPSENSOR_HOTEND_0] <= target_raw[TEMPSENSOR_HOTEND_0]) ||
|
||||
(residencyStart > -1 && labs(analog2temp(current_raw[TEMPSENSOR_HOTEND_0]) - analog2temp(target_raw[TEMPSENSOR_HOTEND_0])) > TEMP_HYSTERESIS) ) {
|
||||
residencyStart = millis();
|
||||
}
|
||||
#endif //TEMP_RESIDENCY_TIME
|
||||
|
@ -907,7 +907,7 @@ inline void process_commands()
|
|||
{
|
||||
if( (millis()-codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
|
||||
{
|
||||
float tt=analog2temp(current_raw[TEMPSENSOR_HOTEND]);
|
||||
float tt=analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
|
||||
Serial.print("T:");
|
||||
Serial.println( tt );
|
||||
Serial.print("ok T:");
|
||||
|
|
|
@ -105,7 +105,7 @@ CRITICAL_SECTION_START;
|
|||
CRITICAL_SECTION_END;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
pid_input = analog2temp(current_raw[TEMPSENSOR_HOTEND]);
|
||||
pid_input = analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
|
||||
|
||||
#ifndef PID_OPENLOOP
|
||||
pid_error = pid_setpoint - pid_input;
|
||||
|
@ -440,16 +440,18 @@ ISR(TIMER0_COMPB_vect)
|
|||
raw_temp_2_value = 0;
|
||||
#ifdef HEATER_0_MAXTEMP
|
||||
#if (HEATER_0_PIN > -1)
|
||||
if(current_raw[TEMPSENSOR_HOTEND] >= maxttemp) {
|
||||
target_raw[TEMPSENSOR_HOTEND] = 0;
|
||||
if(current_raw[TEMPSENSOR_HOTEND_0] >= maxttemp_0) {
|
||||
target_raw[TEMPSENSOR_HOTEND_0] = 0;
|
||||
analogWrite(HEATER_0_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 0 switched off. MAXTEMP triggered !!");
|
||||
kill();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if(current_raw[TEMPSENSOR_AUX] >= maxttemp) {
|
||||
target_raw[TEMPSENSOR_AUX] = 0;
|
||||
#ifdef HEATER_1_MAXTEMP
|
||||
#if (HEATER_1_PIN > -1)
|
||||
if(current_raw[TEMPSENSOR_HOTEND_1] >= maxttemp_1) {
|
||||
target_raw[TEMPSENSOR_HOTEND_1] = 0;
|
||||
if(current_raw[2] >= maxttemp_1) {
|
||||
analogWrite(HEATER_2_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 1 switched off. MAXTEMP triggered !!");
|
||||
|
@ -459,8 +461,8 @@ ISR(TIMER0_COMPB_vect)
|
|||
#endif //MAXTEMP
|
||||
#ifdef HEATER_0_MINTEMP
|
||||
#if (HEATER_0_PIN > -1)
|
||||
if(current_raw[TEMPSENSOR_HOTEND] <= minttemp) {
|
||||
target_raw[TEMPSENSOR_HOTEND] = 0;
|
||||
if(current_raw[TEMPSENSOR_HOTEND_0] <= minttemp_0) {
|
||||
target_raw[TEMPSENSOR_HOTEND_0] = 0;
|
||||
analogWrite(HEATER_0_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 0 switched off. MINTEMP triggered !!");
|
||||
kill();
|
||||
|
@ -469,8 +471,8 @@ ISR(TIMER0_COMPB_vect)
|
|||
#endif
|
||||
#ifdef HEATER_1_MINTEMP
|
||||
#if (HEATER_2_PIN > -1)
|
||||
if(current_raw[TEMPSENSOR_AUX] <= minttemp) {
|
||||
target_raw[TEMPSENSOR_AUX] = 0;
|
||||
if(current_raw[TEMPSENSOR_HOTEND_1] <= minttemp_1) {
|
||||
target_raw[TEMPSENSOR_HOTEND_1] = 0;
|
||||
analogWrite(HEATER_2_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 1 switched off. MINTEMP triggered !!");
|
||||
kill();
|
||||
|
|
|
@ -34,7 +34,7 @@ int temp2analogBed(int celsius);
|
|||
float analog2temp(int raw);
|
||||
float analog2tempBed(int raw);
|
||||
|
||||
#ifdef HEATER_USES_THERMISTOR
|
||||
#ifdef HEATER_0_USES_THERMISTOR
|
||||
#define HEATERSOURCE 1
|
||||
#endif
|
||||
#ifdef BED_USES_THERMISTOR
|
||||
|
@ -50,7 +50,7 @@ extern float Ki;
|
|||
extern float Kd;
|
||||
extern float Kc;
|
||||
|
||||
enum {TEMPSENSOR_HOTEND=0,TEMPSENSOR_BED=1, TEMPSENSOR_AUX=2};
|
||||
enum {TEMPSENSOR_HOTEND_0=0,TEMPSENSOR_BED=1, TEMPSENSOR_HOTEND_1=2};
|
||||
extern int target_raw[3];
|
||||
extern int current_raw[3];
|
||||
extern double pid_setpoint;
|
||||
|
|
|
@ -253,17 +253,17 @@ void MainMenu::showStatus()
|
|||
}
|
||||
|
||||
|
||||
if((abs(current_raw[TEMPSENSOR_HOTEND]-oldcurrentraw)>3)||force_lcd_update)
|
||||
if((abs(current_raw[TEMPSENSOR_HOTEND_0]-oldcurrentraw)>3)||force_lcd_update)
|
||||
{
|
||||
lcd.setCursor(1,0);
|
||||
lcd.print(ftostr3(analog2temp(current_raw[TEMPSENSOR_HOTEND])));
|
||||
oldcurrentraw=current_raw[TEMPSENSOR_HOTEND];
|
||||
lcd.print(ftostr3(analog2temp(current_raw[TEMPSENSOR_HOTEND_0])));
|
||||
oldcurrentraw=current_raw[TEMPSENSOR_HOTEND_0];
|
||||
}
|
||||
if((target_raw[TEMPSENSOR_HOTEND]!=oldtargetraw)||force_lcd_update)
|
||||
if((target_raw[TEMPSENSOR_HOTEND_0]!=oldtargetraw)||force_lcd_update)
|
||||
{
|
||||
lcd.setCursor(5,0);
|
||||
lcd.print(ftostr3(analog2temp(target_raw[TEMPSENSOR_HOTEND])));
|
||||
oldtargetraw=target_raw[TEMPSENSOR_HOTEND];
|
||||
lcd.print(ftostr3(analog2temp(target_raw[TEMPSENSOR_HOTEND_0])));
|
||||
oldtargetraw=target_raw[TEMPSENSOR_HOTEND_0];
|
||||
}
|
||||
#if defined BED_USES_THERMISTOR || defined BED_USES_AD595
|
||||
static int oldcurrentbedraw=-1;
|
||||
|
@ -426,7 +426,7 @@ void MainMenu::showPrepare()
|
|||
if((activeline==line) && CLICKED)
|
||||
{
|
||||
BLOCK
|
||||
target_raw[TEMPSENSOR_HOTEND] = temp2analog(170);
|
||||
target_raw[TEMPSENSOR_HOTEND_0] = temp2analog(170);
|
||||
beepshort();
|
||||
}
|
||||
}break;
|
||||
|
@ -531,7 +531,7 @@ void MainMenu::showControl()
|
|||
if(force_lcd_update)
|
||||
{
|
||||
lcd.setCursor(0,line);lcd.print(" \002Nozzle:");
|
||||
lcd.setCursor(13,line);lcd.print(ftostr3(analog2temp(target_raw[TEMPSENSOR_HOTEND])));
|
||||
lcd.setCursor(13,line);lcd.print(ftostr3(analog2temp(target_raw[TEMPSENSOR_HOTEND_0])));
|
||||
}
|
||||
|
||||
if((activeline==line) )
|
||||
|
@ -541,11 +541,11 @@ void MainMenu::showControl()
|
|||
linechanging=!linechanging;
|
||||
if(linechanging)
|
||||
{
|
||||
encoderpos=(int)analog2temp(target_raw[TEMPSENSOR_HOTEND]);
|
||||
encoderpos=(int)analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
target_raw[TEMPSENSOR_HOTEND] = temp2analog(encoderpos);
|
||||
target_raw[TEMPSENSOR_HOTEND_0] = temp2analog(encoderpos);
|
||||
encoderpos=activeline*lcdslow;
|
||||
beepshort();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue