Browse Source

minor changes and first not-well working version of autotemp

Bernhard Kubicek 13 years ago
parent
commit
36958ee305
7 changed files with 56 additions and 6 deletions
  1. 11
    1
      Marlin/Configuration.h
  2. 0
    1
      Marlin/EEPROMwrite.h
  3. 3
    0
      Marlin/Marlin.h
  4. 1
    2
      Marlin/Marlin.pde
  5. 35
    0
      Marlin/planner.cpp
  6. 3
    1
      Marlin/planner.h
  7. 3
    1
      Marlin/ultralcd.pde

+ 11
- 1
Marlin/Configuration.h View File

@@ -119,7 +119,7 @@
119 119
   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
120 120
   #define PID_ADD_EXTRUSION_RATE  
121 121
   #ifdef PID_ADD_EXTRUSION_RATE
122
-    #define  DEFAULT_Kc (5) //heatingpower=Kc*(e_speed)
122
+    #define  DEFAULT_Kc (3) //heatingpower=Kc*(e_speed)
123 123
   #endif
124 124
 #endif // PIDTEMP
125 125
 
@@ -275,6 +275,16 @@ const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the
275 275
 #define N_ARC_CORRECTION 25
276 276
 
277 277
 
278
+//automatic temperature: just for testing, this is very dangerous, keep disabled!
279
+// not working yet.
280
+//Erik: the settings currently depend dramatically on skeinforge39 or 41.
281
+//#define AUTOTEMP
282
+#define AUTOTEMP_MIN 190
283
+#define AUTOTEMP_MAX 260
284
+#define AUTOTEMP_FACTOR 1000.  //current target temperature= min+largest buffered espeeds)*FACTOR
285
+
286
+
287
+
278 288
 const int dropsegments=0; //everything with less than this number of steps  will be ignored as move and joined with the next movement
279 289
 
280 290
 //===========================================================================

+ 0
- 1
Marlin/EEPROMwrite.h View File

@@ -25,7 +25,6 @@ template <class T> int EEPROM_readAnything(int &ee, T& value)
25 25
 }
26 26
 //======================================================================================
27 27
 
28
-#define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);}
29 28
 
30 29
 
31 30
 

+ 3
- 0
Marlin/Marlin.h View File

@@ -35,6 +35,9 @@ const char echomagic[] PROGMEM ="echo:";
35 35
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
36 36
 #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
37 37
 
38
+#define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);}
39
+
40
+
38 41
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
39 42
 #define SerialprintPGM(x) serialprintPGM(PSTR(x))
40 43
 inline void serialprintPGM(const char *str)

+ 1
- 2
Marlin/Marlin.pde View File

@@ -211,7 +211,6 @@ void setup()
211 211
 { 
212 212
   Serial.begin(BAUDRATE);
213 213
   SERIAL_ECHO_START;
214
-  SERIAL_ECHOPGM("Marlin ");
215 214
   SERIAL_ECHOLN(version_string);
216 215
   SERIAL_PROTOCOLLNPGM("start");
217 216
   SERIAL_ECHO_START;
@@ -785,8 +784,8 @@ inline void process_commands()
785 784
       }
786 785
       else
787 786
       { 
788
-        LCD_MESSAGEPGM("Free move.");
789 787
         st_synchronize(); 
788
+        LCD_MESSAGEPGM("Free move.");
790 789
         disable_x(); 
791 790
         disable_y(); 
792 791
         disable_z(); 

+ 35
- 0
Marlin/planner.cpp View File

@@ -84,6 +84,10 @@ unsigned long axis_steps_per_sqr_second[NUM_AXIS];
84 84
 // The current position of the tool in absolute steps
85 85
 long position[4];   //rescaled from extern when axis_steps_per_unit are changed by gcode
86 86
 
87
+#ifdef AUTOTEMP
88
+float high_e_speed=0;
89
+#endif
90
+
87 91
 
88 92
 //===========================================================================
89 93
 //=============================private variables ============================
@@ -363,6 +367,34 @@ block_t *plan_get_current_block() {
363 367
   return(block);
364 368
 }
365 369
 
370
+#ifdef AUTOTEMP
371
+void getHighESpeed()
372
+{
373
+  if(degTargetHotend0()+2<AUTOTEMP_MIN)  //probably temperature set to zero.
374
+    return; //do nothing
375
+  float high=0;
376
+  char block_index = block_buffer_tail;
377
+  
378
+  while(block_index != block_buffer_head) {
379
+    float se=block_buffer[block_index].speed_e;
380
+    if(se>high)
381
+    {
382
+      high=se;
383
+    }
384
+    block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1);
385
+  }
386
+  high_e_speed=high*axis_steps_per_unit[E_AXIS]/(1000000.0);  //so it is independent of the esteps/mm. before 
387
+   
388
+  float g=AUTOTEMP_MIN+high_e_speed*AUTOTEMP_FACTOR;
389
+  float t=constrain(AUTOTEMP_MIN,g,AUTOTEMP_MAX);
390
+  setTargetHotend0(t);
391
+  SERIAL_ECHO_START;
392
+  SERIAL_ECHOPAIR("highe",high_e_speed);
393
+  SERIAL_ECHOPAIR(" t",t);
394
+  SERIAL_ECHOLN("");
395
+}
396
+#endif
397
+
366 398
 void check_axes_activity() {
367 399
   unsigned char x_active = 0;
368 400
   unsigned char y_active = 0;  
@@ -581,6 +613,9 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
581 613
   memcpy(position, target, sizeof(target)); // position[] = target[]
582 614
 
583 615
   planner_recalculate();
616
+  #ifdef AUTOTEMP
617
+    getHighESpeed();
618
+  #endif
584 619
   st_wake_up();
585 620
 }
586 621
 

+ 3
- 1
Marlin/planner.h View File

@@ -89,5 +89,7 @@ extern float max_xy_jerk; //speed than can be stopped at once, if i understand c
89 89
 extern float max_z_jerk;
90 90
 extern float mintravelfeedrate;
91 91
 extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
92
-
92
+#ifdef AUTOTEMP
93
+extern float high_e_speed;
94
+#endif
93 95
 #endif

+ 3
- 1
Marlin/ultralcd.pde View File

@@ -71,10 +71,12 @@ void lcd_statuspgm(const char* message)
71 71
 {
72 72
   char ch=pgm_read_byte(message);
73 73
   char *target=messagetext;
74
-  while(ch)
74
+  uint8_t cnt=0;
75
+  while(ch &&cnt<LCD_WIDTH)
75 76
   {
76 77
     *target=ch;
77 78
     target++;
79
+    cnt++;
78 80
     ch=pgm_read_byte(++message);
79 81
   }
80 82
 }

Loading…
Cancel
Save