Merge pull request #700 from wolfmanjm/upstreamedge
[clinton/Smoothieware.git] / src / modules / utils / simpleshell / SimpleShell.cpp
1 /*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8
9 #include "SimpleShell.h"
10 #include "libs/Kernel.h"
11 #include "libs/nuts_bolts.h"
12 #include "libs/utils.h"
13 #include "libs/SerialMessage.h"
14 #include "libs/StreamOutput.h"
15 #include "modules/robot/Conveyor.h"
16 #include "DirHandle.h"
17 #include "mri.h"
18 #include "version.h"
19 #include "PublicDataRequest.h"
20 #include "AppendFileStream.h"
21 #include "FileStream.h"
22 #include "checksumm.h"
23 #include "PublicData.h"
24 #include "Gcode.h"
25 //#include "StepTicker.h"
26
27 #include "modules/tools/temperaturecontrol/TemperatureControlPublicAccess.h"
28 #include "modules/robot/RobotPublicAccess.h"
29 #include "NetworkPublicAccess.h"
30 #include "platform_memory.h"
31 #include "SwitchPublicAccess.h"
32 #include "SDFAT.h"
33 #include "Thermistor.h"
34
35 #include "system_LPC17xx.h"
36 #include "LPC17xx.h"
37
38 #include "mbed.h" // for wait_ms()
39
40 extern unsigned int g_maximumHeapAddress;
41
42 #include <malloc.h>
43 #include <mri.h>
44 #include <stdio.h>
45 #include <stdint.h>
46
47 extern "C" uint32_t __end__;
48 extern "C" uint32_t __malloc_free_list;
49 extern "C" uint32_t _sbrk(int size);
50
51 // command lookup table
52 const SimpleShell::ptentry_t SimpleShell::commands_table[] = {
53 {"ls", SimpleShell::ls_command},
54 {"cd", SimpleShell::cd_command},
55 {"pwd", SimpleShell::pwd_command},
56 {"cat", SimpleShell::cat_command},
57 {"rm", SimpleShell::rm_command},
58 {"mv", SimpleShell::mv_command},
59 {"upload", SimpleShell::upload_command},
60 {"reset", SimpleShell::reset_command},
61 {"dfu", SimpleShell::dfu_command},
62 {"break", SimpleShell::break_command},
63 {"help", SimpleShell::help_command},
64 {"?", SimpleShell::help_command},
65 {"version", SimpleShell::version_command},
66 {"mem", SimpleShell::mem_command},
67 {"get", SimpleShell::get_command},
68 {"set_temp", SimpleShell::set_temp_command},
69 {"switch", SimpleShell::switch_command},
70 {"net", SimpleShell::net_command},
71 {"load", SimpleShell::load_command},
72 {"save", SimpleShell::save_command},
73 {"remount", SimpleShell::remount_command},
74 {"calc_thermistor", SimpleShell::calc_thermistor_command},
75 {"thermistors", SimpleShell::print_thermistors_command},
76
77 // unknown command
78 {NULL, NULL}
79 };
80
81 int SimpleShell::reset_delay_secs = 0;
82
83 // Adam Greens heap walk from http://mbed.org/forum/mbed/topic/2701/?page=4#comment-22556
84 static uint32_t heapWalk(StreamOutput *stream, bool verbose)
85 {
86 uint32_t chunkNumber = 1;
87 // The __end__ linker symbol points to the beginning of the heap.
88 uint32_t chunkCurr = (uint32_t)&__end__;
89 // __malloc_free_list is the head pointer to newlib-nano's link list of free chunks.
90 uint32_t freeCurr = __malloc_free_list;
91 // Calling _sbrk() with 0 reserves no more memory but it returns the current top of heap.
92 uint32_t heapEnd = _sbrk(0);
93 // accumulate totals
94 uint32_t freeSize = 0;
95 uint32_t usedSize = 0;
96
97 stream->printf("Used Heap Size: %lu\n", heapEnd - chunkCurr);
98
99 // Walk through the chunks until we hit the end of the heap.
100 while (chunkCurr < heapEnd) {
101 // Assume the chunk is in use. Will update later.
102 int isChunkFree = 0;
103 // The first 32-bit word in a chunk is the size of the allocation. newlib-nano over allocates by 8 bytes.
104 // 4 bytes for this 32-bit chunk size and another 4 bytes to allow for 8 byte-alignment of returned pointer.
105 uint32_t chunkSize = *(uint32_t *)chunkCurr;
106 // The start of the next chunk is right after the end of this one.
107 uint32_t chunkNext = chunkCurr + chunkSize;
108
109 // The free list is sorted by address.
110 // Check to see if we have found the next free chunk in the heap.
111 if (chunkCurr == freeCurr) {
112 // Chunk is free so flag it as such.
113 isChunkFree = 1;
114 // The second 32-bit word in a free chunk is a pointer to the next free chunk (again sorted by address).
115 freeCurr = *(uint32_t *)(freeCurr + 4);
116 }
117
118 // Skip past the 32-bit size field in the chunk header.
119 chunkCurr += 4;
120 // 8-byte align the data pointer.
121 chunkCurr = (chunkCurr + 7) & ~7;
122 // newlib-nano over allocates by 8 bytes, 4 bytes for the 32-bit chunk size and another 4 bytes to allow for 8
123 // byte-alignment of the returned pointer.
124 chunkSize -= 8;
125 if (verbose)
126 stream->printf(" Chunk: %lu Address: 0x%08lX Size: %lu %s\n", chunkNumber, chunkCurr, chunkSize, isChunkFree ? "CHUNK FREE" : "");
127
128 if (isChunkFree) freeSize += chunkSize;
129 else usedSize += chunkSize;
130
131 chunkCurr = chunkNext;
132 chunkNumber++;
133 }
134 stream->printf("Allocated: %lu, Free: %lu\r\n", usedSize, freeSize);
135 return freeSize;
136 }
137
138
139 void SimpleShell::on_module_loaded()
140 {
141 this->register_for_event(ON_CONSOLE_LINE_RECEIVED);
142 this->register_for_event(ON_GCODE_RECEIVED);
143 this->register_for_event(ON_SECOND_TICK);
144
145 reset_delay_secs = 0;
146 }
147
148 void SimpleShell::on_second_tick(void *)
149 {
150 // we are timing out for the reset
151 if (reset_delay_secs > 0) {
152 if (--reset_delay_secs == 0) {
153 system_reset(false);
154 }
155 }
156 }
157
158 void SimpleShell::on_gcode_received(void *argument)
159 {
160 Gcode *gcode = static_cast<Gcode *>(argument);
161 string args = get_arguments(gcode->get_command());
162
163 if (gcode->has_m) {
164 if (gcode->m == 20) { // list sd card
165 gcode->stream->printf("Begin file list\r\n");
166 ls_command("/sd", gcode->stream);
167 gcode->stream->printf("End file list\r\n");
168
169 } else if (gcode->m == 30) { // remove file
170 rm_command("/sd/" + args, gcode->stream);
171
172 } else if(gcode->m == 501) { // load config override
173 if(args.empty()) {
174 load_command("/sd/config-override", gcode->stream);
175 } else {
176 load_command("/sd/config-override." + args, gcode->stream);
177 }
178
179 } else if(gcode->m == 504) { // save to specific config override file
180 if(args.empty()) {
181 save_command("/sd/config-override", gcode->stream);
182 } else {
183 save_command("/sd/config-override." + args, gcode->stream);
184 }
185 }
186 }
187 }
188
189 bool SimpleShell::parse_command(const char *cmd, string args, StreamOutput *stream)
190 {
191 for (const ptentry_t *p = commands_table; p->command != NULL; ++p) {
192 if (strncasecmp(cmd, p->command, strlen(p->command)) == 0) {
193 p->func(args, stream);
194 return true;
195 }
196 }
197
198 return false;
199 }
200
201 // When a new line is received, check if it is a command, and if it is, act upon it
202 void SimpleShell::on_console_line_received( void *argument )
203 {
204 SerialMessage new_message = *static_cast<SerialMessage *>(argument);
205
206 // ignore comments and blank lines and if this is a G code then also ignore it
207 char first_char = new_message.message[0];
208 if(strchr(";( \n\rGMTN", first_char) != NULL) return;
209
210 string possible_command = new_message.message;
211
212 //new_message.stream->printf("Received %s\r\n", possible_command.c_str());
213 string cmd = shift_parameter(possible_command);
214
215 // find command and execute it
216 parse_command(cmd.c_str(), possible_command, new_message.stream);
217 }
218
219 // Act upon an ls command
220 // Convert the first parameter into an absolute path, then list the files in that path
221 void SimpleShell::ls_command( string parameters, StreamOutput *stream )
222 {
223 string path, opts;
224 while(!parameters.empty()) {
225 string s = shift_parameter( parameters );
226 if(s.front() == '-') {
227 opts.append(s);
228 } else {
229 path = s;
230 if(!parameters.empty()) {
231 path.append(" ");
232 path.append(parameters);
233 }
234 break;
235 }
236 }
237
238 path = absolute_from_relative(path);
239
240 DIR *d;
241 struct dirent *p;
242 d = opendir(path.c_str());
243 if (d != NULL) {
244 while ((p = readdir(d)) != NULL) {
245 stream->printf("%s", lc(string(p->d_name)).c_str());
246 if(p->d_isdir) {
247 stream->printf("/");
248 } else if(opts.find("-s", 0, 2) != string::npos) {
249 stream->printf(" %d", p->d_fsize);
250 }
251 stream->printf("\r\n");
252 }
253 closedir(d);
254 } else {
255 stream->printf("Could not open directory %s\r\n", path.c_str());
256 }
257 }
258
259 extern SDFAT mounter;
260
261 void SimpleShell::remount_command( string parameters, StreamOutput *stream )
262 {
263 mounter.remount();
264 stream->printf("remounted\r\n");
265 }
266
267 // Delete a file
268 void SimpleShell::rm_command( string parameters, StreamOutput *stream )
269 {
270 const char *fn = absolute_from_relative(shift_parameter( parameters )).c_str();
271 int s = remove(fn);
272 if (s != 0) stream->printf("Could not delete %s \r\n", fn);
273 }
274
275 // Rename a file
276 void SimpleShell::mv_command( string parameters, StreamOutput *stream )
277 {
278 string from = absolute_from_relative(shift_parameter( parameters ));
279 string to = absolute_from_relative(shift_parameter(parameters));
280 int s = rename(from.c_str(), to.c_str());
281 if (s != 0) stream->printf("Could not rename %s to %s\r\n", from.c_str(), to.c_str());
282 else stream->printf("renamed %s to %s\r\n", from.c_str(), to.c_str());
283 }
284
285 // Change current absolute path to provided path
286 void SimpleShell::cd_command( string parameters, StreamOutput *stream )
287 {
288 string folder = absolute_from_relative( parameters );
289
290 DIR *d;
291 d = opendir(folder.c_str());
292 if (d == NULL) {
293 stream->printf("Could not open directory %s \r\n", folder.c_str() );
294 } else {
295 THEKERNEL->current_path = folder;
296 closedir(d);
297 }
298 }
299
300 // Responds with the present working directory
301 void SimpleShell::pwd_command( string parameters, StreamOutput *stream )
302 {
303 stream->printf("%s\r\n", THEKERNEL->current_path.c_str());
304 }
305
306 // Output the contents of a file, first parameter is the filename, second is the limit ( in number of lines to output )
307 void SimpleShell::cat_command( string parameters, StreamOutput *stream )
308 {
309 // Get parameters ( filename and line limit )
310 string filename = absolute_from_relative(shift_parameter( parameters ));
311 string limit_paramater = shift_parameter( parameters );
312 int limit = -1;
313 if ( limit_paramater != "" ) {
314 char *e = NULL;
315 limit = strtol(limit_paramater.c_str(), &e, 10);
316 if (e <= limit_paramater.c_str())
317 limit = -1;
318 }
319
320 // Open file
321 FILE *lp = fopen(filename.c_str(), "r");
322 if (lp == NULL) {
323 stream->printf("File not found: %s\r\n", filename.c_str());
324 return;
325 }
326 string buffer;
327 int c;
328 int newlines = 0;
329 int linecnt = 0;
330 // Print each line of the file
331 while ((c = fgetc (lp)) != EOF) {
332 buffer.append((char *)&c, 1);
333 if ( char(c) == '\n' || ++linecnt > 80) {
334 newlines++;
335 stream->puts(buffer.c_str());
336 buffer.clear();
337 if(linecnt > 80) linecnt = 0;
338 }
339 if ( newlines == limit ) {
340 break;
341 }
342 };
343 fclose(lp);
344 }
345
346 void SimpleShell::upload_command( string parameters, StreamOutput *stream )
347 {
348 // this needs to be a hack. it needs to read direct from serial and not allow on_main_loop run until done
349 // NOTE this will block all operation until the upload is complete, so do not do while printing
350 if(!THEKERNEL->conveyor->is_queue_empty()) {
351 stream->printf("upload not allowed while printing or busy\n");
352 return;
353 }
354
355 // open file to upload to
356 string upload_filename = absolute_from_relative( parameters );
357 FILE *fd = fopen(upload_filename.c_str(), "w");
358 if(fd != NULL) {
359 stream->printf("uploading to file: %s, send control-D or control-Z to finish\r\n", upload_filename.c_str());
360 } else {
361 stream->printf("failed to open file: %s.\r\n", upload_filename.c_str());
362 return;
363 }
364
365 int cnt = 0;
366 bool uploading = true;
367 while(uploading) {
368 if(!stream->ready()) {
369 // we need to kick things or they die
370 THEKERNEL->call_event(ON_IDLE);
371 continue;
372 }
373
374 char c = stream->_getc();
375 if( c == 4 || c == 26) { // ctrl-D or ctrl-Z
376 uploading = false;
377 // close file
378 fclose(fd);
379 stream->printf("uploaded %d bytes\n", cnt);
380 return;
381
382 } else {
383 // write character to file
384 cnt++;
385 if(fputc(c, fd) != c) {
386 // error writing to file
387 stream->printf("error writing to file. ignoring all characters until EOF\r\n");
388 fclose(fd);
389 fd = NULL;
390 uploading= false;
391
392 } else {
393 if ((cnt%400) == 0) {
394 // HACK ALERT to get around fwrite corruption close and re open for append
395 fclose(fd);
396 fd = fopen(upload_filename.c_str(), "a");
397 }
398 }
399 }
400 }
401 // we got an error so ignore everything until EOF
402 char c;
403 do {
404 if(stream->ready()) {
405 c= stream->_getc();
406 }else{
407 THEKERNEL->call_event(ON_IDLE);
408 c= 0;
409 }
410 } while(c != 4 && c != 26);
411 }
412
413 // loads the specified config-override file
414 void SimpleShell::load_command( string parameters, StreamOutput *stream )
415 {
416 // Get parameters ( filename )
417 string filename = absolute_from_relative(parameters);
418 if(filename == "/") {
419 filename = THEKERNEL->config_override_filename();
420 }
421
422 FILE *fp = fopen(filename.c_str(), "r");
423 if(fp != NULL) {
424 char buf[132];
425 stream->printf("Loading config override file: %s...\n", filename.c_str());
426 while(fgets(buf, sizeof buf, fp) != NULL) {
427 stream->printf(" %s", buf);
428 if(buf[0] == ';') continue; // skip the comments
429 struct SerialMessage message = {&(StreamOutput::NullStream), buf};
430 THEKERNEL->call_event(ON_CONSOLE_LINE_RECEIVED, &message);
431 }
432 stream->printf("config override file executed\n");
433 fclose(fp);
434
435 } else {
436 stream->printf("File not found: %s\n", filename.c_str());
437 }
438 }
439
440 // saves the specified config-override file
441 void SimpleShell::save_command( string parameters, StreamOutput *stream )
442 {
443 // Get parameters ( filename )
444 string filename = absolute_from_relative(parameters);
445 if(filename == "/") {
446 filename = THEKERNEL->config_override_filename();
447 }
448
449 THEKERNEL->conveyor->wait_for_empty_queue(); //just to be safe as it can take a while to run
450
451 //remove(filename.c_str()); // seems to cause a hang every now and then
452 {
453 FileStream fs(filename.c_str());
454 fs.printf("; DO NOT EDIT THIS FILE\n");
455 // this also will truncate the existing file instead of deleting it
456 }
457
458 // stream that appends to file
459 AppendFileStream *gs = new AppendFileStream(filename.c_str());
460 // if(!gs->is_open()) {
461 // stream->printf("Unable to open File %s for write\n", filename.c_str());
462 // return;
463 // }
464
465 __disable_irq();
466 // issue a M500 which will store values in the file stream
467 Gcode *gcode = new Gcode("M500", gs);
468 THEKERNEL->call_event(ON_GCODE_RECEIVED, gcode );
469 delete gs;
470 delete gcode;
471 __enable_irq();
472
473 stream->printf("Settings Stored to %s\r\n", filename.c_str());
474 }
475
476 // show free memory
477 void SimpleShell::mem_command( string parameters, StreamOutput *stream)
478 {
479 bool verbose = shift_parameter( parameters ).find_first_of("Vv") != string::npos ;
480 unsigned long heap = (unsigned long)_sbrk(0);
481 unsigned long m = g_maximumHeapAddress - heap;
482 stream->printf("Unused Heap: %lu bytes\r\n", m);
483
484 uint32_t f = heapWalk(stream, verbose);
485 stream->printf("Total Free RAM: %lu bytes\r\n", m + f);
486
487 stream->printf("Free AHB0: %lu, AHB1: %lu\r\n", AHB0.free(), AHB1.free());
488 if (verbose) {
489 AHB0.debug(stream);
490 AHB1.debug(stream);
491 }
492 }
493
494 static uint32_t getDeviceType()
495 {
496 #define IAP_LOCATION 0x1FFF1FF1
497 uint32_t command[1];
498 uint32_t result[5];
499 typedef void (*IAP)(uint32_t *, uint32_t *);
500 IAP iap = (IAP) IAP_LOCATION;
501
502 __disable_irq();
503
504 command[0] = 54;
505 iap(command, result);
506
507 __enable_irq();
508
509 return result[1];
510 }
511
512 // get network config
513 void SimpleShell::net_command( string parameters, StreamOutput *stream)
514 {
515 void *returned_data;
516 bool ok = PublicData::get_value( network_checksum, get_ipconfig_checksum, &returned_data );
517 if(ok) {
518 char *str = (char *)returned_data;
519 stream->printf("%s\r\n", str);
520 free(str);
521
522 } else {
523 stream->printf("No network detected\n");
524 }
525 }
526
527 // print out build version
528 void SimpleShell::version_command( string parameters, StreamOutput *stream)
529 {
530 Version vers;
531 uint32_t dev = getDeviceType();
532 const char *mcu = (dev & 0x00100000) ? "LPC1769" : "LPC1768";
533 stream->printf("Build version: %s, Build date: %s, MCU: %s, System Clock: %ldMHz\r\n", vers.get_build(), vers.get_build_date(), mcu, SystemCoreClock / 1000000);
534 }
535
536 // Reset the system
537 void SimpleShell::reset_command( string parameters, StreamOutput *stream)
538 {
539 stream->printf("Smoothie out. Peace. Rebooting in 5 seconds...\r\n");
540 reset_delay_secs = 5; // reboot in 5 seconds
541 }
542
543 // go into dfu boot mode
544 void SimpleShell::dfu_command( string parameters, StreamOutput *stream)
545 {
546 stream->printf("Entering boot mode...\r\n");
547 system_reset(true);
548 }
549
550 // Break out into the MRI debugging system
551 void SimpleShell::break_command( string parameters, StreamOutput *stream)
552 {
553 stream->printf("Entering MRI debug mode...\r\n");
554 __debugbreak();
555 }
556
557 // used to test out the get public data events
558 void SimpleShell::get_command( string parameters, StreamOutput *stream)
559 {
560 string what = shift_parameter( parameters );
561 void *returned_data;
562
563 if (what == "temp") {
564 string type = shift_parameter( parameters );
565 bool ok = PublicData::get_value( temperature_control_checksum, get_checksum(type), current_temperature_checksum, &returned_data );
566
567 if (ok) {
568 struct pad_temperature temp = *static_cast<struct pad_temperature *>(returned_data);
569 stream->printf("%s temp: %f/%f @%d\r\n", type.c_str(), temp.current_temperature, temp.target_temperature, temp.pwm);
570 } else {
571 stream->printf("%s is not a known temperature device\r\n", type.c_str());
572 }
573
574 } else if (what == "pos") {
575 bool ok = PublicData::get_value( robot_checksum, current_position_checksum, &returned_data );
576
577 if (ok) {
578 float *pos = static_cast<float *>(returned_data);
579 stream->printf("Position X: %f, Y: %f, Z: %f\r\n", pos[0], pos[1], pos[2]);
580
581 } else {
582 stream->printf("get pos command failed\r\n");
583 }
584 }
585 }
586
587 // used to test out the get public data events
588 void SimpleShell::set_temp_command( string parameters, StreamOutput *stream)
589 {
590 string type = shift_parameter( parameters );
591 string temp = shift_parameter( parameters );
592 float t = temp.empty() ? 0.0 : strtof(temp.c_str(), NULL);
593 bool ok = PublicData::set_value( temperature_control_checksum, get_checksum(type), &t );
594
595 if (ok) {
596 stream->printf("%s temp set to: %3.1f\r\n", type.c_str(), t);
597 } else {
598 stream->printf("%s is not a known temperature device\r\n", type.c_str());
599 }
600 }
601
602 void SimpleShell::print_thermistors_command( string parameters, StreamOutput *stream)
603 {
604 Thermistor::print_predefined_thermistors(stream);
605 }
606
607 void SimpleShell::calc_thermistor_command( string parameters, StreamOutput *stream)
608 {
609 string s = shift_parameter( parameters );
610 int saveto= -1;
611 // see if we have -sn as first argument
612 if(s.find("-s", 0, 2) != string::npos) {
613 // save the results to thermistor n
614 saveto= strtol(s.substr(2).c_str(), nullptr, 10);
615 }else{
616 parameters= s;
617 }
618
619 std::vector<float> trl= parse_number_list(parameters.c_str());
620 if(trl.size() == 6) {
621 // calculate the coefficients
622 float c1, c2, c3;
623 std::tie(c1, c2, c3) = Thermistor::calculate_steinhart_hart_coefficients(trl[0], trl[1], trl[2], trl[3], trl[4], trl[5]);
624 stream->printf("Steinhart Hart coefficients: I%1.18f J%1.18f K%1.18f\n", c1, c2, c3);
625 if(saveto == -1) {
626 stream->printf(" Paste the above in the M305 S0 command, then save with M500\n");
627 }else{
628 char buf[80];
629 int n = snprintf(buf, sizeof(buf), "M305 S%d I%1.18f J%1.18f K%1.18f", saveto, c1, c2, c3);
630 string g(buf, n);
631 Gcode gcode(g, &(StreamOutput::NullStream));
632 THEKERNEL->call_event(ON_GCODE_RECEIVED, &gcode );
633 stream->printf(" Setting Thermistor %d to those settings, save with M500\n", saveto);
634 }
635
636 }else{
637 // give help
638 stream->printf("Usage: calc_thermistor T1,R1,T2,R2,T3,R3\n");
639 }
640 }
641
642 // used to test out the get public data events for switch
643 void SimpleShell::switch_command( string parameters, StreamOutput *stream)
644 {
645 string type = shift_parameter( parameters );
646 string value = shift_parameter( parameters );
647 bool ok = false;
648 if(value == "on" || value == "off") {
649 bool b = value == "on";
650 ok = PublicData::set_value( switch_checksum, get_checksum(type), state_checksum, &b );
651 } else {
652 float v = strtof(value.c_str(), NULL);
653 ok = PublicData::set_value( switch_checksum, get_checksum(type), value_checksum, &v );
654 }
655 if (ok) {
656 stream->printf("switch %s set to: %s\r\n", type.c_str(), value.c_str());
657 } else {
658 stream->printf("%s is not a known switch device\r\n", type.c_str());
659 }
660 }
661
662 void SimpleShell::help_command( string parameters, StreamOutput *stream )
663 {
664 stream->printf("Commands:\r\n");
665 stream->printf("version\r\n");
666 stream->printf("mem [-v]\r\n");
667 stream->printf("ls [-s] [folder]\r\n");
668 stream->printf("cd folder\r\n");
669 stream->printf("pwd\r\n");
670 stream->printf("cat file [limit]\r\n");
671 stream->printf("rm file\r\n");
672 stream->printf("mv file newfile\r\n");
673 stream->printf("remount\r\n");
674 stream->printf("play file [-v]\r\n");
675 stream->printf("progress - shows progress of current play\r\n");
676 stream->printf("abort - abort currently playing file\r\n");
677 stream->printf("reset - reset smoothie\r\n");
678 stream->printf("dfu - enter dfu boot loader\r\n");
679 stream->printf("break - break into debugger\r\n");
680 stream->printf("config-get [<configuration_source>] <configuration_setting>\r\n");
681 stream->printf("config-set [<configuration_source>] <configuration_setting> <value>\r\n");
682 stream->printf("get temp [bed|hotend]\r\n");
683 stream->printf("set_temp bed|hotend 185\r\n");
684 stream->printf("get pos\r\n");
685 stream->printf("net\r\n");
686 stream->printf("load [file] - loads a configuration override file from soecified name or config-override\r\n");
687 stream->printf("save [file] - saves a configuration override file as specified filename or as config-override\r\n");
688 stream->printf("upload filename - saves a stream of text to the named file\r\n");
689 stream->printf("calc_thermistor [-s0] T1,R1,T2,R2,T3,R3 - calculate the Steinhart Hart coefficients for a thermistor\r\n");
690 stream->printf("thermistors - print out the predefined thermistors\r\n");
691 }
692