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
   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
119
   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
120
   #define PID_ADD_EXTRUSION_RATE  
120
   #define PID_ADD_EXTRUSION_RATE  
121
   #ifdef PID_ADD_EXTRUSION_RATE
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
   #endif
123
   #endif
124
 #endif // PIDTEMP
124
 #endif // PIDTEMP
125
 
125
 
275
 #define N_ARC_CORRECTION 25
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
 const int dropsegments=0; //everything with less than this number of steps  will be ignored as move and joined with the next movement
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
 }
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
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
35
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
36
 #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
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
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
41
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
39
 #define SerialprintPGM(x) serialprintPGM(PSTR(x))
42
 #define SerialprintPGM(x) serialprintPGM(PSTR(x))
40
 inline void serialprintPGM(const char *str)
43
 inline void serialprintPGM(const char *str)

+ 1
- 2
Marlin/Marlin.pde View File

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

+ 35
- 0
Marlin/planner.cpp View File

84
 // The current position of the tool in absolute steps
84
 // The current position of the tool in absolute steps
85
 long position[4];   //rescaled from extern when axis_steps_per_unit are changed by gcode
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
 //=============================private variables ============================
93
 //=============================private variables ============================
363
   return(block);
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
 void check_axes_activity() {
398
 void check_axes_activity() {
367
   unsigned char x_active = 0;
399
   unsigned char x_active = 0;
368
   unsigned char y_active = 0;  
400
   unsigned char y_active = 0;  
581
   memcpy(position, target, sizeof(target)); // position[] = target[]
613
   memcpy(position, target, sizeof(target)); // position[] = target[]
582
 
614
 
583
   planner_recalculate();
615
   planner_recalculate();
616
+  #ifdef AUTOTEMP
617
+    getHighESpeed();
618
+  #endif
584
   st_wake_up();
619
   st_wake_up();
585
 }
620
 }
586
 
621
 

+ 3
- 1
Marlin/planner.h View File

89
 extern float max_z_jerk;
89
 extern float max_z_jerk;
90
 extern float mintravelfeedrate;
90
 extern float mintravelfeedrate;
91
 extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
91
 extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
92
-
92
+#ifdef AUTOTEMP
93
+extern float high_e_speed;
94
+#endif
93
 #endif
95
 #endif

+ 3
- 1
Marlin/ultralcd.pde View File

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

Loading…
Cancel
Save