Browse Source

Revert "untestest commit, so I don't loose code.. features runout prevention addons"

This reverts commit 651cde8b98.
Bernhard 13 years ago
parent
commit
f312216e97
4 changed files with 25 additions and 80 deletions
  1. 1
    1
      Marlin/Configuration.h
  2. 21
    65
      Marlin/Marlin.pde
  3. 3
    9
      Marlin/stepper.cpp
  4. 0
    5
      Marlin/temperature.cpp

+ 1
- 1
Marlin/Configuration.h View File

@@ -248,7 +248,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
248 248
 #define SLOWDOWN
249 249
 
250 250
 //default stepper release if idle
251
-#define DEFAULT_STEPPER_DEACTIVE_TIME 1200
251
+#define DEFAULT_STEPPER_DEACTIVE_TIME 60
252 252
 #define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E"  //z stays  powered
253 253
 
254 254
 

+ 21
- 65
Marlin/Marlin.pde View File

@@ -176,10 +176,8 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
176 176
 
177 177
 //Inactivity shutdown variables
178 178
 static unsigned long previous_millis_cmd = 0;
179
-static unsigned long previous_millis_runoutprevent = 0;
180
-//static unsigned long previous_millis_beep = 0;
181
-static unsigned long max_inactive_time=0;
182
-static unsigned long stepper_inactive_time = 0;
179
+static unsigned long max_inactive_time = 0;
180
+static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
183 181
 static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
184 182
 
185 183
 static unsigned long starttime=0;
@@ -245,10 +243,6 @@ void setup()
245 243
     fromsd[i] = false;
246 244
   }
247 245
   
248
-  max_inactive_time = DEFAULT_MAX_INACTIVE_TIME*1000;
249
-  stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
250
-
251
-  
252 246
   EEPROM_RetrieveSettings(); // loads data from EEPROM if available
253 247
 
254 248
   for(int8_t i=0; i < NUM_AXIS; i++)
@@ -421,7 +415,6 @@ FORCE_INLINE void get_command()
421 415
         SERIAL_ECHO_START;
422 416
         SERIAL_ECHOLN(time);
423 417
         LCD_MESSAGE(time);
424
-        st_synchronize();
425 418
         card.printingHasFinished();
426 419
         card.checkautostart(true);
427 420
         
@@ -1207,34 +1200,11 @@ void prepare_arc_move(char isclockwise) {
1207 1200
 
1208 1201
 void manage_inactivity(byte debug) 
1209 1202
 { 
1210
-  unsigned long curtime=millis();
1211
-  SERIAL_ECHO_START;
1212
-  SERIAL_ECHO("MS");
1213
-  SERIAL_ECHO(millis());
1214
-  SERIAL_ECHO(" PREV_CMD");
1215
-  SERIAL_ECHO(previous_millis_cmd);
1216
-  SERIAL_ECHO(" maxinactive");
1217
-  SERIAL_ECHOLN(max_inactive_time );
1218
-  
1219
-  if( (curtime-previous_millis_cmd) >  max_inactive_time ) 
1203
+  if( (millis()-previous_millis_cmd) >  max_inactive_time ) 
1220 1204
     if(max_inactive_time) 
1221
-    {
1222
-      LCD_MESSAGEPGM("Bored Shutdown.");
1223
-      SERIAL_ERROR_START;
1224
-      SERIAL_ERRORLNPGM("Bored Shutdown.");
1225 1205
       kill(); 
1226
-    }
1227
-    
1228
-  if( (curtime-previous_millis_cmd) >  DEFAULT_MAX_HOT_TIME*1000 ) 
1229
-    if(DEFAULT_MAX_HOT_TIME && (degHotend0()>HOTTEMP) ) 
1230
-    {
1231
-      LCD_MESSAGEPGM("Hot too long.");
1232
-      SERIAL_ECHO_START;
1233
-      SERIAL_ECHOLNPGM("Hot too long");
1234
-      disable_heater();
1235
-    }
1236 1206
   if(stepper_inactive_time)  
1237
-  if( (curtime-last_stepperdisabled_time) >  stepper_inactive_time ) 
1207
+  if( (millis()-last_stepperdisabled_time) >  stepper_inactive_time ) 
1238 1208
   {
1239 1209
     if(previous_millis_cmd>last_stepperdisabled_time)
1240 1210
       last_stepperdisabled_time=previous_millis_cmd;
@@ -1246,37 +1216,23 @@ void manage_inactivity(byte debug)
1246 1216
     }
1247 1217
   }
1248 1218
   #ifdef EXTRUDER_RUNOUT_PREVENT
1249
-    if(!blocks_queued())
1250
-    if( (curtime-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1219
+    if( (millis()-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1220
+    if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
1251 1221
     {
1252
-      if(previous_millis_cmd>previous_millis_runoutprevent)
1253
-      {
1254
-       previous_millis_runoutprevent=previous_millis_cmd; 
1255
-      }
1256
-      
1257
-      if(degHotend0()>EXTRUDER_RUNOUT_MINTEMP)
1258
-      if((curtime-previous_millis_runoutprevent) >  EXTRUDER_RUNOUT_SECONDS*1000)
1259
-      {
1260
-        bool oldstatus=READ(E_ENABLE_PIN);
1261
-        enable_e();
1262
-        float oldepos=current_position[E_AXIS];
1263
-        float oldedes=destination[E_AXIS];
1264
-        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 
1265
-                          current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], 
1266
-                          EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
1267
-        current_position[E_AXIS]=oldepos;
1268
-        destination[E_AXIS]=oldedes;
1269
-        plan_set_e_position(oldepos);
1270
-        
1271
-        while(current_block!=NULL || blocks_queued()) 
1272
-        {
1273
-          manage_heater();
1274
-          LCD_STATUS;
1275
-        }
1276
-        
1277
-        previous_millis_runoutprevent=millis();
1278
-        WRITE(E_ENABLE_PIN,oldstatus);
1279
-      }
1222
+     bool oldstatus=READ(E_ENABLE_PIN);
1223
+     enable_e();
1224
+     float oldepos=current_position[E_AXIS];
1225
+     float oldedes=destination[E_AXIS];
1226
+     plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 
1227
+                      current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], 
1228
+                      EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
1229
+     current_position[E_AXIS]=oldepos;
1230
+     destination[E_AXIS]=oldedes;
1231
+     plan_set_e_position(oldepos);
1232
+     previous_millis_cmd=millis();
1233
+     //enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
1234
+     st_synchronize();
1235
+     WRITE(E_ENABLE_PIN,oldstatus);
1280 1236
     }
1281 1237
   #endif
1282 1238
   check_axes_activity();
@@ -1291,7 +1247,7 @@ void kill()
1291 1247
   disable_z();
1292 1248
   disable_e();
1293 1249
   
1294
-  if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);  //Turn powersupply off
1250
+  if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
1295 1251
   SERIAL_ERROR_START;
1296 1252
   SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
1297 1253
   LCD_MESSAGEPGM("KILLED. ");

+ 3
- 9
Marlin/stepper.cpp View File

@@ -706,21 +706,15 @@ void st_init()
706 706
   sei();
707 707
 }
708 708
 
709
-#include "util/delay.h"
709
+
710 710
 // Block until all buffered steps are executed
711 711
 void st_synchronize()
712 712
 {
713
-    while(current_block!=NULL || blocks_queued()) {
713
+    while( blocks_queued()) {
714 714
     manage_heater();
715 715
     manage_inactivity(1);
716
-     LCD_STATUS;
717
-    //_delay_ms(100);
718
-    ;
716
+    LCD_STATUS;
719 717
   }
720
-//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
721
-//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
722
-//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
723
-//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
724 718
 }
725 719
 
726 720
 void st_set_position(const long &x, const long &y, const long &z, const long &e)

+ 0
- 5
Marlin/temperature.cpp View File

@@ -451,11 +451,6 @@ void setWatch()
451 451
 
452 452
 void disable_heater()
453 453
 {
454
-  for(int i=0;i<EXTRUDERS;i++)
455
-   setTargetHotend(0,i);
456
-  setTargetBed(0);
457
-  
458
-
459 454
   #if TEMP_0_PIN > -1
460 455
   target_raw[0]=0;
461 456
    #if HEATER_0_PIN > -1  

Loading…
Cancel
Save