Browse Source

trying to get autotemp to work.

Bernhard Kubicek 13 years ago
parent
commit
8a08b8e07e
3 changed files with 30 additions and 8 deletions
  1. 10
    0
      Marlin/Marlin.pde
  2. 13
    7
      Marlin/planner.cpp
  3. 7
    1
      Marlin/planner.h

+ 10
- 0
Marlin/Marlin.pde View File

695
     case 109: 
695
     case 109: 
696
     {// M109 - Wait for extruder heater to reach target.
696
     {// M109 - Wait for extruder heater to reach target.
697
         LCD_MESSAGEPGM("Heating...");
697
         LCD_MESSAGEPGM("Heating...");
698
+        autotemp_enabled=false;
698
         if (code_seen('S')) setTargetHotend0(code_value());
699
         if (code_seen('S')) setTargetHotend0(code_value());
700
+        #ifdef AUTOTEMP
701
+          if (code_seen('S')) autotemp_min=code_value();
702
+          if (code_seen('T')) autotemp_max=code_value();
703
+          if (code_seen('F')) 
704
+          {
705
+            autotemp_factor=code_value();
706
+            autotemp_enabled=true;
707
+          }
708
+        #endif
699
         
709
         
700
         setWatch();
710
         setWatch();
701
         codenum = millis(); 
711
         codenum = millis(); 

+ 13
- 7
Marlin/planner.cpp View File

87
 static float previous_nominal_speed; // Nominal speed of previous path line segment
87
 static float previous_nominal_speed; // Nominal speed of previous path line segment
88
 
88
 
89
 #ifdef AUTOTEMP
89
 #ifdef AUTOTEMP
90
-float high_e_speed=0;
90
+    float autotemp_max=250;
91
+    float autotemp_min=210;
92
+    float autotemp_factor=1;
93
+    bool autotemp_enabled=false;
91
 #endif
94
 #endif
92
 
95
 
93
 
96
 
379
 #ifdef AUTOTEMP
382
 #ifdef AUTOTEMP
380
 void getHighESpeed()
383
 void getHighESpeed()
381
 {
384
 {
382
-  if(degTargetHotend0()+2<AUTOTEMP_MIN)  //probably temperature set to zero.
385
+  if(!autotemp_enabled)
386
+    return;
387
+  if(degTargetHotend0()+2<autotemp_min)  //probably temperature set to zero.
383
     return; //do nothing
388
     return; //do nothing
389
+  
384
   float high=0;
390
   float high=0;
385
   char block_index = block_buffer_tail;
391
   char block_index = block_buffer_tail;
386
   
392
   
387
   while(block_index != block_buffer_head) {
393
   while(block_index != block_buffer_head) {
388
-    float se=block_buffer[block_index].speed_e;
394
+    float se=block_buffer[block_index].steps_e/float(block_buffer[block_index].step_event_count)*block_buffer[block_index].nominal_rate;
395
+    //se; units steps/sec;
389
     if(se>high)
396
     if(se>high)
390
     {
397
     {
391
       high=se;
398
       high=se;
392
     }
399
     }
393
     block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1);
400
     block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1);
394
   }
401
   }
395
-  high_e_speed=high*axis_steps_per_unit[E_AXIS]/(1000000.0);  //so it is independent of the esteps/mm. before 
396
    
402
    
397
-  float g=AUTOTEMP_MIN+high_e_speed*AUTOTEMP_FACTOR;
398
-  float t=constrain(AUTOTEMP_MIN,g,AUTOTEMP_MAX);
403
+  float g=autotemp_min+high*autotemp_factor;
404
+  float t=constrain(autotemp_min,g,autotemp_max);
399
   setTargetHotend0(t);
405
   setTargetHotend0(t);
400
   SERIAL_ECHO_START;
406
   SERIAL_ECHO_START;
401
-  SERIAL_ECHOPAIR("highe",high_e_speed);
407
+  SERIAL_ECHOPAIR("highe",high);
402
   SERIAL_ECHOPAIR(" t",t);
408
   SERIAL_ECHOPAIR(" t",t);
403
   SERIAL_ECHOLN("");
409
   SERIAL_ECHOLN("");
404
 }
410
 }

+ 7
- 1
Marlin/planner.h View File

92
 extern float max_z_jerk;
92
 extern float max_z_jerk;
93
 extern float mintravelfeedrate;
93
 extern float mintravelfeedrate;
94
 extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
94
 extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
95
+
96
+
95
 #ifdef AUTOTEMP
97
 #ifdef AUTOTEMP
96
-extern float high_e_speed;
98
+    extern bool autotemp_enabled;
99
+    extern float autotemp_max;
100
+    extern float autotemp_min;
101
+    extern float autotemp_factor;
97
 #endif
102
 #endif
103
+
98
 #endif
104
 #endif

Loading…
Cancel
Save