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
 #define SLOWDOWN
248
 #define SLOWDOWN
249
 
249
 
250
 //default stepper release if idle
250
 //default stepper release if idle
251
-#define DEFAULT_STEPPER_DEACTIVE_TIME 1200
251
+#define DEFAULT_STEPPER_DEACTIVE_TIME 60
252
 #define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E"  //z stays  powered
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
 
176
 
177
 //Inactivity shutdown variables
177
 //Inactivity shutdown variables
178
 static unsigned long previous_millis_cmd = 0;
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
 static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
181
 static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
184
 
182
 
185
 static unsigned long starttime=0;
183
 static unsigned long starttime=0;
245
     fromsd[i] = false;
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
   EEPROM_RetrieveSettings(); // loads data from EEPROM if available
246
   EEPROM_RetrieveSettings(); // loads data from EEPROM if available
253
 
247
 
254
   for(int8_t i=0; i < NUM_AXIS; i++)
248
   for(int8_t i=0; i < NUM_AXIS; i++)
421
         SERIAL_ECHO_START;
415
         SERIAL_ECHO_START;
422
         SERIAL_ECHOLN(time);
416
         SERIAL_ECHOLN(time);
423
         LCD_MESSAGE(time);
417
         LCD_MESSAGE(time);
424
-        st_synchronize();
425
         card.printingHasFinished();
418
         card.printingHasFinished();
426
         card.checkautostart(true);
419
         card.checkautostart(true);
427
         
420
         
1207
 
1200
 
1208
 void manage_inactivity(byte debug) 
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
     if(max_inactive_time) 
1204
     if(max_inactive_time) 
1221
-    {
1222
-      LCD_MESSAGEPGM("Bored Shutdown.");
1223
-      SERIAL_ERROR_START;
1224
-      SERIAL_ERRORLNPGM("Bored Shutdown.");
1225
       kill(); 
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
   if(stepper_inactive_time)  
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
     if(previous_millis_cmd>last_stepperdisabled_time)
1209
     if(previous_millis_cmd>last_stepperdisabled_time)
1240
       last_stepperdisabled_time=previous_millis_cmd;
1210
       last_stepperdisabled_time=previous_millis_cmd;
1246
     }
1216
     }
1247
   }
1217
   }
1248
   #ifdef EXTRUDER_RUNOUT_PREVENT
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
   #endif
1237
   #endif
1282
   check_axes_activity();
1238
   check_axes_activity();
1291
   disable_z();
1247
   disable_z();
1292
   disable_e();
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
   SERIAL_ERROR_START;
1251
   SERIAL_ERROR_START;
1296
   SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
1252
   SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
1297
   LCD_MESSAGEPGM("KILLED. ");
1253
   LCD_MESSAGEPGM("KILLED. ");

+ 3
- 9
Marlin/stepper.cpp View File

706
   sei();
706
   sei();
707
 }
707
 }
708
 
708
 
709
-#include "util/delay.h"
709
+
710
 // Block until all buffered steps are executed
710
 // Block until all buffered steps are executed
711
 void st_synchronize()
711
 void st_synchronize()
712
 {
712
 {
713
-    while(current_block!=NULL || blocks_queued()) {
713
+    while( blocks_queued()) {
714
     manage_heater();
714
     manage_heater();
715
     manage_inactivity(1);
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
 void st_set_position(const long &x, const long &y, const long &z, const long &e)
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
 
451
 
452
 void disable_heater()
452
 void disable_heater()
453
 {
453
 {
454
-  for(int i=0;i<EXTRUDERS;i++)
455
-   setTargetHotend(0,i);
456
-  setTargetBed(0);
457
-  
458
-
459
   #if TEMP_0_PIN > -1
454
   #if TEMP_0_PIN > -1
460
   target_raw[0]=0;
455
   target_raw[0]=0;
461
    #if HEATER_0_PIN > -1  
456
    #if HEATER_0_PIN > -1  

Loading…
Cancel
Save