lcd panel bed support

advance and ultipanel not any more in default config
2.0.x
Bernhard 13 years ago
parent 4bababf5b0
commit 415aadf704

@ -58,6 +58,10 @@
// Select one of these only to define how the bed temp is read. // Select one of these only to define how the bed temp is read.
//#define THERMISTORBED 1 //#define THERMISTORBED 1
//#define BED_USES_THERMISTOR //#define BED_USES_THERMISTOR
//#define BED_LIMIT_SWITCHING
#ifdef BED_LIMIT_SWITCHING
#define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
#endif
//#define BED_USES_AD595 //#define BED_USES_AD595
#define BED_CHECK_INTERVAL 5000 //ms #define BED_CHECK_INTERVAL 5000 //ms
@ -167,6 +171,7 @@
#define EXTRUDER_RUNOUT_SECONDS 30. #define EXTRUDER_RUNOUT_SECONDS 30.
#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament #define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
#define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
//=========================================================================== //===========================================================================
@ -296,7 +301,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
// hooke's law says: force = k * distance // hooke's law says: force = k * distance
// bernoulli's priniciple says: v ^ 2 / 2 + g . h + pressure / density = constant // bernoulli's priniciple says: v ^ 2 / 2 + g . h + pressure / density = constant
// so: v ^ 2 is proportional to number of steps we advance the extruder // so: v ^ 2 is proportional to number of steps we advance the extruder
#define ADVANCE //#define ADVANCE
#ifdef ADVANCE #ifdef ADVANCE
#define EXTRUDER_ADVANCE_K .0 #define EXTRUDER_ADVANCE_K .0
@ -315,7 +320,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
#define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift. #define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift.
#define ULTIPANEL //#define ULTIPANEL
#ifdef ULTIPANEL #ifdef ULTIPANEL
//#define NEWPANEL //enable this if you have a click-encoder panel //#define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT #define SDSUPPORT

@ -432,6 +432,7 @@ void CardReader::updir()
void CardReader::printingHasFinished() void CardReader::printingHasFinished()
{ {
st_synchronize();
quickStop(); quickStop();
sdprinting = false; sdprinting = false;
stop_heating_wait=true; stop_heating_wait=true;

@ -555,7 +555,7 @@
#define Z_ENABLE_PIN 35 #define Z_ENABLE_PIN 35
#define HEATER_BED_PIN 4 #define HEATER_BED_PIN 4
#define TEMP_BED_PIN 11 #define TEMP_BED_PIN 10
#define HEATER_0_PIN 2 #define HEATER_0_PIN 2
#define TEMP_0_PIN 8 #define TEMP_0_PIN 8
@ -734,4 +734,4 @@
HEATER_BED_PIN, FAN_PIN, \ HEATER_BED_PIN, FAN_PIN, \
_E0_PINS, _E1_PINS, _E2_PINS, \ _E0_PINS, _E1_PINS, _E2_PINS, \
TEMP_0_PIN, TEMP_1_PIN, TEMP_2_PIN, TEMP_BED_PIN } TEMP_0_PIN, TEMP_1_PIN, TEMP_2_PIN, TEMP_BED_PIN }
#endif #endif

@ -42,6 +42,10 @@
//=========================================================================== //===========================================================================
int target_raw[EXTRUDERS] = { 0 }; int target_raw[EXTRUDERS] = { 0 };
int target_raw_bed = 0; int target_raw_bed = 0;
#ifdef BED_LIMIT_SWITCHING
int target_bed_low_temp =0;
int target_bed_high_temp =0;
#endif
int current_raw[EXTRUDERS] = { 0 }; int current_raw[EXTRUDERS] = { 0 };
int current_raw_bed = 0; int current_raw_bed = 0;
@ -233,20 +237,39 @@ void manage_heater()
previous_millis_bed_heater = millis(); previous_millis_bed_heater = millis();
#if TEMP_BED_PIN > -1 #if TEMP_BED_PIN > -1
// Check if temperature is within the correct range
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) { #ifndef BED_LIMIT_SWITCHING
if(current_raw_bed >= target_raw_bed) // Check if temperature is within the correct range
{ if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
if(current_raw_bed >= target_raw_bed)
{
WRITE(HEATER_BED_PIN,LOW);
}
else
{
WRITE(HEATER_BED_PIN,HIGH);
}
}
else {
WRITE(HEATER_BED_PIN,LOW); WRITE(HEATER_BED_PIN,LOW);
} }
else #else //#ifdef BED_LIMIT_SWITCHING
{ // Check if temperature is within the correct band
WRITE(HEATER_BED_PIN,HIGH); if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
if(current_raw_bed > target_bed_high_temp)
{
WRITE(HEATER_BED_PIN,LOW);
}
else
if(current_raw_bed <= target_bed_low_temp)
{
WRITE(HEATER_BED_PIN,HIGH);
}
} }
} else {
else { WRITE(HEATER_BED_PIN,LOW);
WRITE(HEATER_BED_PIN,LOW); }
} #endif
#endif #endif
} }
@ -520,6 +543,9 @@ void setWatch()
void disable_heater() void disable_heater()
{ {
for(int i=0;i<EXTRUDERS;i++)
setTargetHotend(0,i);
setTargetBed(0);
#if TEMP_0_PIN > -1 #if TEMP_0_PIN > -1
target_raw[0]=0; target_raw[0]=0;
soft_pwm[0]=0; soft_pwm[0]=0;

@ -43,6 +43,10 @@ extern int heatingtarget_raw[EXTRUDERS];
extern int current_raw[EXTRUDERS]; extern int current_raw[EXTRUDERS];
extern int target_raw_bed; extern int target_raw_bed;
extern int current_raw_bed; extern int current_raw_bed;
#ifdef BED_LIMIT_SWITCHING
extern int target_bed_low_temp ;
extern int target_bed_high_temp ;
#endif
extern float Kp,Ki,Kd,Kc; extern float Kp,Ki,Kd,Kc;
#ifdef PIDTEMP #ifdef PIDTEMP
@ -83,7 +87,20 @@ FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
}; };
FORCE_INLINE void setTargetBed(const float &celsius) { FORCE_INLINE void setTargetBed(const float &celsius) {
target_raw_bed = temp2analogBed(celsius); target_raw_bed = temp2analogBed(celsius);
#ifdef BED_LIMIT_SWITCHING
if(celsius>BED_HYSTERESIS)
{
target_bed_low_temp= temp2analogBed(celsius-BED_HYSTERESIS);
target_bed_high_temp= temp2analogBed(celsius+BED_HYSTERESIS);
}
else
{
target_bed_low_temp=0;
target_bed_high_temp=0;
}
#endif
}; };
FORCE_INLINE bool isHeatingHotend(uint8_t extruder){ FORCE_INLINE bool isHeatingHotend(uint8_t extruder){
@ -125,6 +142,13 @@ FORCE_INLINE bool isCoolingBed() {
#error Invalid number of extruders #error Invalid number of extruders
#endif #endif
int getHeaterPower(int heater);
void disable_heater();
void setWatch();
void updatePID();
FORCE_INLINE void autotempShutdown(){ FORCE_INLINE void autotempShutdown(){
#ifdef AUTOTEMP #ifdef AUTOTEMP
if(autotemp_enabled) if(autotemp_enabled)
@ -135,11 +159,5 @@ FORCE_INLINE void autotempShutdown(){
} }
#endif #endif
} }
int getHeaterPower(int heater);
void disable_heater();
void setWatch();
void updatePID();
#endif #endif

@ -165,8 +165,13 @@ void lcd_status()
//previous_millis_buttons=millis(); //previous_millis_buttons=millis();
long ms=millis(); long ms=millis();
for(int8_t i=0; i<8; i++) { for(int8_t i=0; i<8; i++) {
#ifndef NEWPANEL
if((blocking[i]>ms)) if((blocking[i]>ms))
buttons &= ~(1<<i); buttons &= ~(1<<i);
#else
if((blocking>ms))
buttons &= ~(1<<i);
#endif
} }
if((buttons==oldbuttons) && ((millis() - previous_millis_lcd) < LCD_UPDATE_INTERVAL) ) if((buttons==oldbuttons) && ((millis() - previous_millis_lcd) < LCD_UPDATE_INTERVAL) )
return; return;
@ -326,14 +331,14 @@ void MainMenu::showStatus()
int tBed=intround(degBed()); int tBed=intround(degBed());
if((tBed!=oldtBed)||force_lcd_update) if((tBed!=oldtBed)||force_lcd_update)
{ {
lcd.setCursor(1,0); lcd.setCursor(11,0);
lcd.print(ftostr3(tBed)); lcd.print(ftostr3(tBed));
oldtBed=tBed; oldtBed=tBed;
} }
int targetBed=intround(degTargetBed()); int targetBed=intround(degTargetBed());
if((targetBed!=oldtargetBed)||force_lcd_update) if((targetBed!=oldtargetBed)||force_lcd_update)
{ {
lcd.setCursor(5,0); lcd.setCursor(15,0);
lcd.print(ftostr3(targetBed)); lcd.print(ftostr3(targetBed));
oldtargetBed=targetBed; oldtargetBed=targetBed;
} }
@ -352,11 +357,11 @@ void MainMenu::showStatus()
} }
} }
static int oldzpos=0; static int oldzpos=0;
int currentz=current_position[2]*10; int currentz=current_position[2]*100;
if((currentz!=oldzpos)||force_lcd_update) if((currentz!=oldzpos)||force_lcd_update)
{ {
lcd.setCursor(10,1); lcd.setCursor(10,1);
lcdprintPGM("Z:");lcd.print(itostr31(currentz)); lcdprintPGM("Z:");lcd.print(ftostr32(current_position[2]));
oldzpos=currentz; oldzpos=currentz;
} }
static int oldfeedmultiply=0; static int oldfeedmultiply=0;
@ -490,7 +495,11 @@ void MainMenu::showPrepare()
updateActiveLines(ItemP_extrude,encoderpos); updateActiveLines(ItemP_extrude,encoderpos);
} }
enum {ItemT_exit,ItemT_speed,ItemT_flow,ItemT_nozzle,ItemT_fan}; enum {ItemT_exit,ItemT_speed,ItemT_flow,ItemT_nozzle,
#if (HEATER_BED_PIN > -1)
ItemT_bed,
#endif
ItemT_fan};
void MainMenu::showTune() void MainMenu::showTune()
{ {
@ -572,6 +581,42 @@ void MainMenu::showTune()
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos)); lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
} }
}break; }break;
#if (HEATER_BED_PIN > -1)
case ItemT_bed:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
}
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
if(linechanging)
{
encoderpos=intround(degTargetBed());
}
else
{
setTargetBed(encoderpos);
encoderpos=activeline*lcdslow;
beepshort();
}
BLOCK;
}
if(linechanging)
{
if(encoderpos<0) encoderpos=0;
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}break;
#endif
case ItemT_fan: case ItemT_fan:
{ {
@ -677,6 +722,9 @@ enum {
ItemCT_autotempactive, ItemCT_autotempactive,
ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact, ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
#endif #endif
#if (HEATER_BED_PIN > -1)
ItemCT_bed,
#endif
ItemCT_fan, ItemCT_fan,
ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
}; };
@ -857,6 +905,41 @@ void MainMenu::showControlTemp()
}break; }break;
#endif //autotemp #endif //autotemp
#if (HEATER_BED_PIN > -1)
case ItemCT_bed:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
}
if((activeline!=line) )
break;
if(CLICKED)
{
linechanging=!linechanging;
if(linechanging)
{
encoderpos=intround(degTargetBed());
}
else
{
setTargetBed(encoderpos);
encoderpos=activeline*lcdslow;
beepshort();
}
BLOCK;
}
if(linechanging)
{
if(encoderpos<0) encoderpos=0;
if(encoderpos>260) encoderpos=260;
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
}
}break;
#endif
case ItemCT_fan: case ItemCT_fan:
{ {
if(force_lcd_update) if(force_lcd_update)

Loading…
Cancel
Save