From f201ccb55b9d518c728d5c8aaa0cf3206b69801f Mon Sep 17 00:00:00 2001 From: Nathan Zadoks Date: Sun, 4 Dec 2011 13:03:20 +0100 Subject: Added an option to make init.g on SD run on boot. --- Sprinter/Configuration.h | 2 ++ Sprinter/Sprinter.pde | 13 +++++++++++-- 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 } -- cgit v1.2.1