Преглед изворни кода

trying to get autotemp to work.

Bernhard Kubicek пре 13 година
родитељ
комит
8a08b8e07e
3 измењених фајлова са 30 додато и 8 уклоњено
  1. 10
    0
      Marlin/Marlin.pde
  2. 13
    7
      Marlin/planner.cpp
  3. 7
    1
      Marlin/planner.h

+ 10
- 0
Marlin/Marlin.pde Прегледај датотеку

@@ -695,7 +695,17 @@ inline void process_commands()
695 695
     case 109: 
696 696
     {// M109 - Wait for extruder heater to reach target.
697 697
         LCD_MESSAGEPGM("Heating...");
698
+        autotemp_enabled=false;
698 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 710
         setWatch();
701 711
         codenum = millis(); 

+ 13
- 7
Marlin/planner.cpp Прегледај датотеку

@@ -87,7 +87,10 @@ static float previous_speed[4]; // Speed of previous path line segment
87 87
 static float previous_nominal_speed; // Nominal speed of previous path line segment
88 88
 
89 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 94
 #endif
92 95
 
93 96
 
@@ -379,26 +382,29 @@ block_t *plan_get_current_block() {
379 382
 #ifdef AUTOTEMP
380 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 388
     return; //do nothing
389
+  
384 390
   float high=0;
385 391
   char block_index = block_buffer_tail;
386 392
   
387 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 396
     if(se>high)
390 397
     {
391 398
       high=se;
392 399
     }
393 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 405
   setTargetHotend0(t);
400 406
   SERIAL_ECHO_START;
401
-  SERIAL_ECHOPAIR("highe",high_e_speed);
407
+  SERIAL_ECHOPAIR("highe",high);
402 408
   SERIAL_ECHOPAIR(" t",t);
403 409
   SERIAL_ECHOLN("");
404 410
 }

+ 7
- 1
Marlin/planner.h Прегледај датотеку

@@ -92,7 +92,13 @@ extern float max_xy_jerk; //speed than can be stopped at once, if i understand c
92 92
 extern float max_z_jerk;
93 93
 extern float mintravelfeedrate;
94 94
 extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
95
+
96
+
95 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 102
 #endif
103
+
98 104
 #endif

Loading…
Откажи
Сачувај