|
@@ -10,6 +10,8 @@
|
10
|
10
|
|
11
|
11
|
int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
|
12
|
12
|
|
|
13
|
+const char* pgcode_seq= NULL; /* pointer to the current line in the active sequence of commands, or NULL when none */
|
|
14
|
+
|
13
|
15
|
/* Configuration settings */
|
14
|
16
|
int plaPreheatHotendTemp;
|
15
|
17
|
int plaPreheatHPBTemp;
|
|
@@ -76,6 +78,7 @@ static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visua
|
76
|
78
|
static void menu_action_back(menuFunc_t data);
|
77
|
79
|
static void menu_action_submenu(menuFunc_t data);
|
78
|
80
|
static void menu_action_gcode(const char* pgcode);
|
|
81
|
+static void menu_action_gcode_next();
|
79
|
82
|
static void menu_action_function(menuFunc_t data);
|
80
|
83
|
static void menu_action_sdfile(const char* filename, char* longFilename);
|
81
|
84
|
static void menu_action_sddirectory(const char* filename, char* longFilename);
|
|
@@ -1164,7 +1167,37 @@ static void lcd_quick_feedback()
|
1164
|
1167
|
/** Menu action functions **/
|
1165
|
1168
|
static void menu_action_back(menuFunc_t data) { lcd_goto_menu(data); }
|
1166
|
1169
|
static void menu_action_submenu(menuFunc_t data) { lcd_goto_menu(data); }
|
1167
|
|
-static void menu_action_gcode(const char* pgcode) { enquecommand_P(pgcode); }
|
|
1170
|
+
|
|
1171
|
+static void menu_action_gcode(const char* pgcode)
|
|
1172
|
+{
|
|
1173
|
+ // No more calling enquecommand_P(pgcode) as it allows only one command!
|
|
1174
|
+ pgcode_seq= pgcode;
|
|
1175
|
+ menu_action_gcode_next();
|
|
1176
|
+}
|
|
1177
|
+
|
|
1178
|
+static void menu_action_gcode_next()
|
|
1179
|
+{
|
|
1180
|
+ // Inject the next command from the pending sequence, when not empty.
|
|
1181
|
+ char cmd[30];
|
|
1182
|
+ if(!pgcode_seq) return;
|
|
1183
|
+ // Get the next 30 chars from the sequence of gcodes to run
|
|
1184
|
+ strncpy_P(cmd, pgcode_seq, sizeof(cmd)-1);
|
|
1185
|
+ cmd[sizeof(cmd)-1]= 0;
|
|
1186
|
+ // Look for the end of line, or the end of sequence
|
|
1187
|
+ size_t i= 0;
|
|
1188
|
+ char c;
|
|
1189
|
+ while( (c= cmd[i]) && c!='\n' )
|
|
1190
|
+ ++i; // look for the end of this gcode command
|
|
1191
|
+ cmd[i]= 0;
|
|
1192
|
+ if(!enquecommand(cmd)) // buffer was full, will retry later
|
|
1193
|
+ return;
|
|
1194
|
+ if(c)
|
|
1195
|
+ pgcode_seq+= i+1; // move to next command
|
|
1196
|
+ else
|
|
1197
|
+ pgcode_seq= NULL; // mark the end of the sequence of gcodes
|
|
1198
|
+}
|
|
1199
|
+
|
|
1200
|
+
|
1168
|
1201
|
static void menu_action_function(menuFunc_t data) { (*data)(); }
|
1169
|
1202
|
static void menu_action_sdfile(const char* filename, char* longFilename)
|
1170
|
1203
|
{
|
|
@@ -1257,6 +1290,8 @@ void lcd_update()
|
1257
|
1290
|
|
1258
|
1291
|
lcd_buttons_update();
|
1259
|
1292
|
|
|
1293
|
+ menu_action_gcode_next(); // inject the next pending command in the pending sequence (if any)
|
|
1294
|
+
|
1260
|
1295
|
#if (SDCARDDETECT > 0)
|
1261
|
1296
|
if((IS_SD_INSERTED != lcd_oldcardstatus && lcd_detected()))
|
1262
|
1297
|
{
|