lcd panel bed support

advance and ultipanel not any more in default config
This commit is contained in:
Bernhard 2011-12-22 11:45:52 +01:00
parent 4bababf5b0
commit 415aadf704
6 changed files with 159 additions and 26 deletions

View file

@ -58,6 +58,10 @@
// Select one of these only to define how the bed temp is read.
//#define THERMISTORBED 1
//#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_CHECK_INTERVAL 5000 //ms
@ -167,6 +171,7 @@
#define EXTRUDER_RUNOUT_SECONDS 30.
#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
#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
// 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
#define ADVANCE
//#define ADVANCE
#ifdef ADVANCE
#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_RELEASECOMMAND "M84 X Y E" // no z because of layer shift.
#define ULTIPANEL
//#define ULTIPANEL
#ifdef ULTIPANEL
//#define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT

View file

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

View file

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

View file

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

View file

@ -43,6 +43,10 @@ extern int heatingtarget_raw[EXTRUDERS];
extern int current_raw[EXTRUDERS];
extern int target_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;
#ifdef PIDTEMP
@ -83,7 +87,20 @@ FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
};
FORCE_INLINE void setTargetBed(const float &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){
@ -125,6 +142,13 @@ FORCE_INLINE bool isCoolingBed() {
#error Invalid number of extruders
#endif
int getHeaterPower(int heater);
void disable_heater();
void setWatch();
void updatePID();
FORCE_INLINE void autotempShutdown(){
#ifdef AUTOTEMP
if(autotemp_enabled)
@ -135,11 +159,5 @@ FORCE_INLINE void autotempShutdown(){
}
#endif
}
int getHeaterPower(int heater);
void disable_heater();
void setWatch();
void updatePID();
#endif

View file

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