summaryrefslogtreecommitdiff
path: root/Sprinter
diff options
context:
space:
mode:
authorNathan Zadoks <nathan@nathan7.eu>2011-12-04 13:03:20 +0100
committerNathan Zadoks <nathan@nathan7.eu>2011-12-04 13:03:20 +0100
commitf201ccb55b9d518c728d5c8aaa0cf3206b69801f (patch)
treeac8ef04bf67d614232d78a30851747a738dffedd /Sprinter
parent67199da50919088a67d0218103be6244f8cbb9d7 (diff)
Added an option to make init.g on SD run on boot.
Diffstat (limited to 'Sprinter')
-rw-r--r--Sprinter/Configuration.h2
-rw-r--r--Sprinter/Sprinter.pde13
2 files changed, 13 insertions, 2 deletions
diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h
index df52a08..d594094 100644
--- a/Sprinter/Configuration.h
+++ b/Sprinter/Configuration.h
@@ -49,6 +49,8 @@ const bool Z_ENDSTOP_INVERT = false;
// Comment out (using // at the start of the line) to disable SD support:
#define SDSUPPORT
+// Uncomment to make Sprinter run init.g from SD on boot
+//#define SDINITFILE
//// ADVANCED SETTINGS - to tweak parameters
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index 657efed..e3126b8 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -176,8 +176,17 @@ unsigned long stepper_inactive_time = 0;
Serial.println("volume.init failed");
else if (!root.openRoot(&volume))
Serial.println("openRoot failed");
- else
- sdactive = true;
+ else{
+ sdactive = true;
+ #ifdef SDINITFILE
+ file.close();
+ if(file.open(&root, "init.g", O_READ)){
+ sdpos = 0;
+ filesize = file.fileSize();
+ sdmode = true;
+ }
+ #endif
+ }
#endif
}