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