Просмотр исходного кода

Merge pull request #2987 from thinkyhead/gcode_allow_no_initial_space

Fix handling of spaces in GCode
Scott Lahteine 8 лет назад
Родитель
Сommit
7f30f85602
1 измененных файлов: 3 добавлений и 2 удалений
  1. 3
    2
      Marlin/Marlin_main.cpp

+ 3
- 2
Marlin/Marlin_main.cpp Просмотреть файл

@@ -973,6 +973,7 @@ void get_command() {
973 973
 bool code_has_value() {
974 974
   int i = 1;
975 975
   char c = seen_pointer[i];
976
+  while (c == ' ') c = seen_pointer[++i];
976 977
   if (c == '-' || c == '+') c = seen_pointer[++i];
977 978
   if (c == '.') c = seen_pointer[++i];
978 979
   return (c >= '0' && c <= '9');
@@ -5691,7 +5692,7 @@ void process_next_command() {
5691 5692
 
5692 5693
   // Sanitize the current command:
5693 5694
   //  - Skip leading spaces
5694
-  //  - Bypass N[0-9][0-9]*[ ]*
5695
+  //  - Bypass N[-0-9][0-9]*[ ]*
5695 5696
   //  - Overwrite * with nul to mark the end
5696 5697
   while (*current_command == ' ') ++current_command;
5697 5698
   if (*current_command == 'N' && ((current_command[1] >= '0' && current_command[1] <= '9') || current_command[1] == '-')) {
@@ -5716,7 +5717,7 @@ void process_next_command() {
5716 5717
   // Args pointer optimizes code_seen, especially those taking XYZEF
5717 5718
   // This wastes a little cpu on commands that expect no arguments.
5718 5719
   current_command_args = current_command;
5719
-  while (*current_command_args && *current_command_args != ' ') ++current_command_args;
5720
+  while (*current_command_args >= '0' && *current_command_args <= '9') ++current_command_args;
5720 5721
   while (*current_command_args == ' ') ++current_command_args;
5721 5722
 
5722 5723
   // Interpret the code int

Загрузка…
Отмена
Сохранить