Browse Source

lcd panel bed support

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

+ 1
- 0
Marlin/cardreader.pde View File

432
 
432
 
433
 void CardReader::printingHasFinished()
433
 void CardReader::printingHasFinished()
434
 {
434
 {
435
+ st_synchronize();
435
  quickStop();
436
  quickStop();
436
  sdprinting = false;
437
  sdprinting = false;
437
  stop_heating_wait=true;
438
  stop_heating_wait=true;

+ 2
- 2
Marlin/pins.h View File

555
 #define Z_ENABLE_PIN 35
555
 #define Z_ENABLE_PIN 35
556
 
556
 
557
 #define HEATER_BED_PIN 4 
557
 #define HEATER_BED_PIN 4 
558
-#define TEMP_BED_PIN 11  
558
+#define TEMP_BED_PIN 10  
559
 
559
 
560
 #define HEATER_0_PIN  2
560
 #define HEATER_0_PIN  2
561
 #define TEMP_0_PIN 8   
561
 #define TEMP_0_PIN 8   
734
                         HEATER_BED_PIN, FAN_PIN,                  \
734
                         HEATER_BED_PIN, FAN_PIN,                  \
735
                         _E0_PINS, _E1_PINS, _E2_PINS,             \
735
                         _E0_PINS, _E1_PINS, _E2_PINS,             \
736
                         TEMP_0_PIN, TEMP_1_PIN, TEMP_2_PIN, TEMP_BED_PIN }
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
 //===========================================================================
42
 //===========================================================================
43
 int target_raw[EXTRUDERS] = { 0 };
43
 int target_raw[EXTRUDERS] = { 0 };
44
 int target_raw_bed = 0;
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
 int current_raw[EXTRUDERS] = { 0 };
49
 int current_raw[EXTRUDERS] = { 0 };
46
 int current_raw_bed = 0;
50
 int current_raw_bed = 0;
47
 
51
 
233
   previous_millis_bed_heater = millis();
237
   previous_millis_bed_heater = millis();
234
   
238
   
235
   #if TEMP_BED_PIN > -1
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
         WRITE(HEATER_BED_PIN,LOW);
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
   #endif
273
   #endif
251
 }
274
 }
252
 
275
 
520
 
543
 
521
 void disable_heater()
544
 void disable_heater()
522
 {
545
 {
546
+  for(int i=0;i<EXTRUDERS;i++)
547
+    setTargetHotend(0,i);
548
+  setTargetBed(0);
523
   #if TEMP_0_PIN > -1
549
   #if TEMP_0_PIN > -1
524
   target_raw[0]=0;
550
   target_raw[0]=0;
525
   soft_pwm[0]=0;
551
   soft_pwm[0]=0;

+ 24
- 6
Marlin/temperature.h View File

43
 extern int current_raw[EXTRUDERS];
43
 extern int current_raw[EXTRUDERS];
44
 extern int target_raw_bed;
44
 extern int target_raw_bed;
45
 extern int current_raw_bed;
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
 extern float Kp,Ki,Kd,Kc;
50
 extern float Kp,Ki,Kd,Kc;
47
 
51
 
48
 #ifdef PIDTEMP
52
 #ifdef PIDTEMP
83
 };
87
 };
84
 
88
 
85
 FORCE_INLINE void setTargetBed(const float &celsius) {  
89
 FORCE_INLINE void setTargetBed(const float &celsius) {  
90
+  
86
   target_raw_bed = temp2analogBed(celsius);
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
 FORCE_INLINE bool isHeatingHotend(uint8_t extruder){  
106
 FORCE_INLINE bool isHeatingHotend(uint8_t extruder){  
125
 #error Invalid number of extruders
142
 #error Invalid number of extruders
126
 #endif
143
 #endif
127
 
144
 
145
+
146
+
147
+int getHeaterPower(int heater);
148
+void disable_heater();
149
+void setWatch();
150
+void updatePID();
151
+
128
 FORCE_INLINE void autotempShutdown(){
152
 FORCE_INLINE void autotempShutdown(){
129
  #ifdef AUTOTEMP
153
  #ifdef AUTOTEMP
130
  if(autotemp_enabled)
154
  if(autotemp_enabled)
135
  }
159
  }
136
  #endif
160
  #endif
137
 }
161
 }
138
-
139
-int getHeaterPower(int heater);
140
-void disable_heater();
141
-void setWatch();
142
-void updatePID();
143
-
144
 #endif
162
 #endif
145
 
163
 

+ 88
- 5
Marlin/ultralcd.pde View File

165
     //previous_millis_buttons=millis();
165
     //previous_millis_buttons=millis();
166
     long ms=millis();
166
     long ms=millis();
167
     for(int8_t i=0; i<8; i++) {
167
     for(int8_t i=0; i<8; i++) {
168
+      #ifndef NEWPANEL
168
       if((blocking[i]>ms))
169
       if((blocking[i]>ms))
169
         buttons &= ~(1<<i);
170
         buttons &= ~(1<<i);
171
+      #else
172
+      if((blocking>ms))
173
+        buttons &= ~(1<<i);        
174
+      #endif
170
     }
175
     }
171
     if((buttons==oldbuttons) &&  ((millis() - previous_millis_lcd) < LCD_UPDATE_INTERVAL)   )
176
     if((buttons==oldbuttons) &&  ((millis() - previous_millis_lcd) < LCD_UPDATE_INTERVAL)   )
172
       return;
177
       return;
326
     int tBed=intround(degBed());
331
     int tBed=intround(degBed());
327
     if((tBed!=oldtBed)||force_lcd_update)
332
     if((tBed!=oldtBed)||force_lcd_update)
328
     {
333
     {
329
-      lcd.setCursor(1,0);
334
+      lcd.setCursor(11,0);
330
       lcd.print(ftostr3(tBed));
335
       lcd.print(ftostr3(tBed));
331
       oldtBed=tBed;
336
       oldtBed=tBed;
332
     }
337
     }
333
     int targetBed=intround(degTargetBed());
338
     int targetBed=intround(degTargetBed());
334
     if((targetBed!=oldtargetBed)||force_lcd_update)
339
     if((targetBed!=oldtargetBed)||force_lcd_update)
335
     {
340
     {
336
-      lcd.setCursor(5,0);
341
+      lcd.setCursor(15,0);
337
       lcd.print(ftostr3(targetBed));
342
       lcd.print(ftostr3(targetBed));
338
       oldtargetBed=targetBed;
343
       oldtargetBed=targetBed;
339
     }
344
     }
352
     }
357
     }
353
   }
358
   }
354
   static int oldzpos=0;
359
   static int oldzpos=0;
355
-  int currentz=current_position[2]*10;
360
+  int currentz=current_position[2]*100;
356
   if((currentz!=oldzpos)||force_lcd_update)
361
   if((currentz!=oldzpos)||force_lcd_update)
357
   {
362
   {
358
     lcd.setCursor(10,1);
363
     lcd.setCursor(10,1);
359
-    lcdprintPGM("Z:");lcd.print(itostr31(currentz));
364
+    lcdprintPGM("Z:");lcd.print(ftostr32(current_position[2]));
360
     oldzpos=currentz;
365
     oldzpos=currentz;
361
   }
366
   }
362
   static int oldfeedmultiply=0;
367
   static int oldfeedmultiply=0;
490
  updateActiveLines(ItemP_extrude,encoderpos);
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
 void MainMenu::showTune()
504
 void MainMenu::showTune()
496
 { 
505
 { 
572
           lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
581
           lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
573
         }
582
         }
574
       }break;
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
       case ItemT_fan:
621
       case ItemT_fan:
577
       {
622
       {
677
   ItemCT_autotempactive,
722
   ItemCT_autotempactive,
678
   ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
723
   ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
679
 #endif
724
 #endif
725
+#if (HEATER_BED_PIN > -1)
726
+ItemCT_bed,
727
+#endif  
680
   ItemCT_fan,
728
   ItemCT_fan,
681
   ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
729
   ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
682
 };
730
 };
857
         
905
         
858
       }break;  
906
       }break;  
859
       #endif //autotemp
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
       case ItemCT_fan:
943
       case ItemCT_fan:
861
       {
944
       {
862
         if(force_lcd_update)
945
         if(force_lcd_update)

Loading…
Cancel
Save