summaryrefslogtreecommitdiff
path: root/Sprinter
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2011-12-05 01:48:36 -0800
committerkliment <kliment.yanev@gmail.com>2011-12-05 01:48:36 -0800
commit2550e6c56693c1d3a50493ca90f030c785b8c747 (patch)
treeac8ef04bf67d614232d78a30851747a738dffedd /Sprinter
parent67199da50919088a67d0218103be6244f8cbb9d7 (diff)
parentf201ccb55b9d518c728d5c8aaa0cf3206b69801f (diff)
Merge pull request #123 from FrozenFire/master
Allow running a specifically-named file from SD on startup if found.
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
}