Add M30 -- Delete SD file, using rm_command
authorChris George <topher.m.george@gmail.com>
Tue, 5 Nov 2013 00:59:01 +0000 (19:59 -0500)
committerChris George <topher.m.george@gmail.com>
Tue, 5 Nov 2013 00:59:01 +0000 (19:59 -0500)
src/modules/utils/simpleshell/SimpleShell.cpp

index da49365..4071ce4 100644 (file)
@@ -133,6 +133,7 @@ void SimpleShell::on_second_tick(void *)
 void SimpleShell::on_gcode_received(void *argument)
 {
     Gcode *gcode = static_cast<Gcode *>(argument);
+    string args= get_arguments(gcode->command);
 
     if (gcode->has_m) {
         if (gcode->m == 20) { // list sd card
@@ -141,6 +142,10 @@ void SimpleShell::on_gcode_received(void *argument)
             ls_command("/sd", gcode->stream);
             gcode->stream->printf("End file list\r\n");
         }
+        else if (gcode->m == 30) { // remove file
+            gcode->mark_as_taken();
+            rm_command("/sd/" + args, gcode->stream);
+        }
     }
 }