Browse Source

lcd panel bed support

advance and ultipanel not any more in default config
Bernhard 12 years ago
parent
commit
415aadf704
6 changed files with 159 additions and 26 deletions
  1. 7
    2
      Marlin/Configuration.h
  2. 1
    0
      Marlin/cardreader.pde
  3. 2
    2
      Marlin/pins.h
  4. 37
    11
      Marlin/temperature.cpp
  5. 24
    6
      Marlin/temperature.h
  6. 88
    5
      Marlin/ultralcd.pde

+ 7
- 2
Marlin/Configuration.h View File

@@ -58,6 +58,10 @@
58 58
 // Select one of these only to define how the bed temp is read.
59 59
 //#define THERMISTORBED 1
60 60
 //#define BED_USES_THERMISTOR
61
+//#define BED_LIMIT_SWITCHING
62
+#ifdef BED_LIMIT_SWITCHING
63
+  #define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
64
+#endif
61 65
 //#define BED_USES_AD595
62 66
 
63 67
 #define BED_CHECK_INTERVAL 5000 //ms
@@ -167,6 +171,7 @@
167 171
 #define EXTRUDER_RUNOUT_SECONDS 30.
168 172
 #define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
169 173
 #define EXTRUDER_RUNOUT_SPEED 1500.  //extrusion speed
174
+#define EXTRUDER_RUNOUT_EXTRUDE 100
170 175
 
171 176
 
172 177
 //===========================================================================
@@ -296,7 +301,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
296 301
 // hooke's law says:		force = k * distance
297 302
 // bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
298 303
 // so: v ^ 2 is proportional to number of steps we advance the extruder
299
-#define ADVANCE
304
+//#define ADVANCE
300 305
 
301 306
 #ifdef ADVANCE
302 307
   #define EXTRUDER_ADVANCE_K .0
@@ -315,7 +320,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
315 320
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
316 321
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift.
317 322
 
318
-#define ULTIPANEL
323
+//#define ULTIPANEL
319 324
 #ifdef ULTIPANEL
320 325
   //#define NEWPANEL  //enable this if you have a click-encoder panel
321 326
   #define SDSUPPORT

+ 1
- 0
Marlin/cardreader.pde View File

@@ -432,6 +432,7 @@ void CardReader::updir()
432 432
 
433 433
 void CardReader::printingHasFinished()
434 434
 {
435
+ st_synchronize();
435 436
  quickStop();
436 437
  sdprinting = false;
437 438
  stop_heating_wait=true;

+ 2
- 2
Marlin/pins.h View File

@@ -555,7 +555,7 @@
555 555
 #define Z_ENABLE_PIN 35
556 556
 
557 557
 #define HEATER_BED_PIN 4 
558
-#define TEMP_BED_PIN 11  
558
+#define TEMP_BED_PIN 10  
559 559
 
560 560
 #define HEATER_0_PIN  2
561 561
 #define TEMP_0_PIN 8   
@@ -734,4 +734,4 @@
734 734
                         HEATER_BED_PIN, FAN_PIN,                  \
735 735
                         _E0_PINS, _E1_PINS, _E2_PINS,             \
736 736
                         TEMP_0_PIN, TEMP_1_PIN, TEMP_2_PIN, TEMP_BED_PIN }
737
-#endif
737
+#endif

+ 37
- 11
Marlin/temperature.cpp View File

@@ -42,6 +42,10 @@
42 42
 //===========================================================================
43 43
 int target_raw[EXTRUDERS] = { 0 };
44 44
 int target_raw_bed = 0;
45
+#ifdef BED_LIMIT_SWITCHING
46
+int target_bed_low_temp =0;  
47
+int target_bed_high_temp =0;
48
+#endif
45 49
 int current_raw[EXTRUDERS] = { 0 };
46 50
 int current_raw_bed = 0;
47 51
 
@@ -233,20 +237,39 @@ void manage_heater()
233 237
   previous_millis_bed_heater = millis();
234 238
   
235 239
   #if TEMP_BED_PIN > -1
236
-    // Check if temperature is within the correct range
237
-    if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
238
-      if(current_raw_bed >= target_raw_bed)
239
-      {
240
+  
241
+    #ifndef BED_LIMIT_SWITCHING
242
+      // Check if temperature is within the correct range
243
+      if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
244
+        if(current_raw_bed >= target_raw_bed)
245
+        {
246
+          WRITE(HEATER_BED_PIN,LOW);
247
+        }
248
+        else 
249
+        {
250
+          WRITE(HEATER_BED_PIN,HIGH);
251
+        }
252
+      }
253
+      else {
240 254
         WRITE(HEATER_BED_PIN,LOW);
241 255
       }
242
-      else 
243
-      {
244
-        WRITE(HEATER_BED_PIN,HIGH);
256
+    #else //#ifdef BED_LIMIT_SWITCHING
257
+      // Check if temperature is within the correct band
258
+      if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
259
+        if(current_raw_bed > target_bed_high_temp)
260
+        {
261
+          WRITE(HEATER_BED_PIN,LOW);
262
+        }
263
+        else 
264
+          if(current_raw_bed <= target_bed_low_temp)
265
+        {
266
+          WRITE(HEATER_BED_PIN,HIGH);
267
+        }
245 268
       }
246
-    }
247
-    else {
248
-      WRITE(HEATER_BED_PIN,LOW);
249
-    }  
269
+      else {
270
+        WRITE(HEATER_BED_PIN,LOW);
271
+      }
272
+    #endif
250 273
   #endif
251 274
 }
252 275
 
@@ -520,6 +543,9 @@ void setWatch()
520 543
 
521 544
 void disable_heater()
522 545
 {
546
+  for(int i=0;i<EXTRUDERS;i++)
547
+    setTargetHotend(0,i);
548
+  setTargetBed(0);
523 549
   #if TEMP_0_PIN > -1
524 550
   target_raw[0]=0;
525 551
   soft_pwm[0]=0;

+ 24
- 6
Marlin/temperature.h View File

@@ -43,6 +43,10 @@ extern int heatingtarget_raw[EXTRUDERS];
43 43
 extern int current_raw[EXTRUDERS];
44 44
 extern int target_raw_bed;
45 45
 extern int current_raw_bed;
46
+#ifdef BED_LIMIT_SWITCHING
47
+  extern int target_bed_low_temp ;  
48
+  extern int target_bed_high_temp ;
49
+#endif
46 50
 extern float Kp,Ki,Kd,Kc;
47 51
 
48 52
 #ifdef PIDTEMP
@@ -83,7 +87,20 @@ FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
83 87
 };
84 88
 
85 89
 FORCE_INLINE void setTargetBed(const float &celsius) {  
90
+  
86 91
   target_raw_bed = temp2analogBed(celsius);
92
+  #ifdef BED_LIMIT_SWITCHING
93
+    if(celsius>BED_HYSTERESIS)
94
+    {
95
+    target_bed_low_temp= temp2analogBed(celsius-BED_HYSTERESIS);
96
+    target_bed_high_temp= temp2analogBed(celsius+BED_HYSTERESIS);
97
+    }
98
+    else
99
+    { 
100
+      target_bed_low_temp=0;
101
+      target_bed_high_temp=0;
102
+    }
103
+  #endif
87 104
 };
88 105
 
89 106
 FORCE_INLINE bool isHeatingHotend(uint8_t extruder){  
@@ -125,6 +142,13 @@ FORCE_INLINE bool isCoolingBed() {
125 142
 #error Invalid number of extruders
126 143
 #endif
127 144
 
145
+
146
+
147
+int getHeaterPower(int heater);
148
+void disable_heater();
149
+void setWatch();
150
+void updatePID();
151
+
128 152
 FORCE_INLINE void autotempShutdown(){
129 153
  #ifdef AUTOTEMP
130 154
  if(autotemp_enabled)
@@ -135,11 +159,5 @@ FORCE_INLINE void autotempShutdown(){
135 159
  }
136 160
  #endif
137 161
 }
138
-
139
-int getHeaterPower(int heater);
140
-void disable_heater();
141
-void setWatch();
142
-void updatePID();
143
-
144 162
 #endif
145 163
 

+ 88
- 5
Marlin/ultralcd.pde View File

@@ -165,8 +165,13 @@ void lcd_status()
165 165
     //previous_millis_buttons=millis();
166 166
     long ms=millis();
167 167
     for(int8_t i=0; i<8; i++) {
168
+      #ifndef NEWPANEL
168 169
       if((blocking[i]>ms))
169 170
         buttons &= ~(1<<i);
171
+      #else
172
+      if((blocking>ms))
173
+        buttons &= ~(1<<i);        
174
+      #endif
170 175
     }
171 176
     if((buttons==oldbuttons) &&  ((millis() - previous_millis_lcd) < LCD_UPDATE_INTERVAL)   )
172 177
       return;
@@ -326,14 +331,14 @@ void MainMenu::showStatus()
326 331
     int tBed=intround(degBed());
327 332
     if((tBed!=oldtBed)||force_lcd_update)
328 333
     {
329
-      lcd.setCursor(1,0);
334
+      lcd.setCursor(11,0);
330 335
       lcd.print(ftostr3(tBed));
331 336
       oldtBed=tBed;
332 337
     }
333 338
     int targetBed=intround(degTargetBed());
334 339
     if((targetBed!=oldtargetBed)||force_lcd_update)
335 340
     {
336
-      lcd.setCursor(5,0);
341
+      lcd.setCursor(15,0);
337 342
       lcd.print(ftostr3(targetBed));
338 343
       oldtargetBed=targetBed;
339 344
     }
@@ -352,11 +357,11 @@ void MainMenu::showStatus()
352 357
     }
353 358
   }
354 359
   static int oldzpos=0;
355
-  int currentz=current_position[2]*10;
360
+  int currentz=current_position[2]*100;
356 361
   if((currentz!=oldzpos)||force_lcd_update)
357 362
   {
358 363
     lcd.setCursor(10,1);
359
-    lcdprintPGM("Z:");lcd.print(itostr31(currentz));
364
+    lcdprintPGM("Z:");lcd.print(ftostr32(current_position[2]));
360 365
     oldzpos=currentz;
361 366
   }
362 367
   static int oldfeedmultiply=0;
@@ -490,7 +495,11 @@ void MainMenu::showPrepare()
490 495
  updateActiveLines(ItemP_extrude,encoderpos);
491 496
 }
492 497
 
493
-enum {ItemT_exit,ItemT_speed,ItemT_flow,ItemT_nozzle,ItemT_fan};
498
+enum {ItemT_exit,ItemT_speed,ItemT_flow,ItemT_nozzle,
499
+#if (HEATER_BED_PIN > -1)
500
+ItemT_bed,
501
+#endif
502
+ItemT_fan};
494 503
 
495 504
 void MainMenu::showTune()
496 505
 { 
@@ -572,6 +581,42 @@ void MainMenu::showTune()
572 581
           lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
573 582
         }
574 583
       }break;
584
+      #if (HEATER_BED_PIN > -1)
585
+      case ItemT_bed:
586
+      {
587
+        if(force_lcd_update)
588
+        {
589
+          lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
590
+          lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
591
+        }
592
+        
593
+        if((activeline!=line) )
594
+          break;
595
+        
596
+        if(CLICKED)
597
+        {
598
+          linechanging=!linechanging;
599
+          if(linechanging)
600
+          {
601
+              encoderpos=intround(degTargetBed());
602
+          }
603
+          else
604
+          {
605
+            setTargetBed(encoderpos);
606
+            encoderpos=activeline*lcdslow;
607
+            beepshort();
608
+          }
609
+          BLOCK;
610
+        }
611
+        if(linechanging)
612
+        {
613
+          if(encoderpos<0) encoderpos=0;
614
+          if(encoderpos>260) encoderpos=260;
615
+          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
616
+        }
617
+      }break;
618
+      #endif
619
+
575 620
       
576 621
       case ItemT_fan:
577 622
       {
@@ -677,6 +722,9 @@ enum {
677 722
   ItemCT_autotempactive,
678 723
   ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
679 724
 #endif
725
+#if (HEATER_BED_PIN > -1)
726
+ItemCT_bed,
727
+#endif  
680 728
   ItemCT_fan,
681 729
   ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
682 730
 };
@@ -857,6 +905,41 @@ void MainMenu::showControlTemp()
857 905
         
858 906
       }break;  
859 907
       #endif //autotemp
908
+      #if (HEATER_BED_PIN > -1)
909
+      case ItemCT_bed:
910
+      {
911
+        if(force_lcd_update)
912
+        {
913
+          lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
914
+          lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
915
+        }
916
+        
917
+        if((activeline!=line) )
918
+          break;
919
+        
920
+        if(CLICKED)
921
+        {
922
+          linechanging=!linechanging;
923
+          if(linechanging)
924
+          {
925
+              encoderpos=intround(degTargetBed());
926
+          }
927
+          else
928
+          {
929
+            setTargetBed(encoderpos);
930
+            encoderpos=activeline*lcdslow;
931
+            beepshort();
932
+          }
933
+          BLOCK;
934
+        }
935
+        if(linechanging)
936
+        {
937
+          if(encoderpos<0) encoderpos=0;
938
+          if(encoderpos>260) encoderpos=260;
939
+          lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
940
+        }
941
+      }break;
942
+      #endif
860 943
       case ItemCT_fan:
861 944
       {
862 945
         if(force_lcd_update)

Loading…
Cancel
Save