Browse Source

Add M401 - Wait for user on LCD button press

Daid 13 years ago
parent
commit
516ec90242
3 changed files with 31 additions and 1 deletions
  1. 29
    1
      Marlin/Marlin.pde
  2. 1
    0
      Marlin/language.h
  3. 1
    0
      Marlin/ultralcd.h

+ 29
- 1
Marlin/Marlin.pde View File

@@ -107,6 +107,7 @@
107 107
 // M302 - Allow cold extrudes
108 108
 // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
109 109
 // M400 - Finish all moves
110
+// M401 - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
110 111
 // M500 - stores paramters in EEPROM
111 112
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
112 113
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
@@ -596,6 +597,7 @@ void process_commands()
596 597
       while(millis()  < codenum ){
597 598
         manage_heater();
598 599
         manage_inactivity(1);
600
+		LCD_STATUS;
599 601
       }
600 602
       break;
601 603
     case 28: //G28 Home all Axis one at a time
@@ -1259,11 +1261,37 @@ void process_commands()
1259 1261
       PID_autotune(temp);
1260 1262
     }
1261 1263
     break;
1262
-    case 400: // finish all moves
1264
+    case 400: // M400 finish all moves
1263 1265
     {
1264 1266
       st_synchronize();
1265 1267
     }
1266 1268
     break;
1269
+#ifdef ULTRA_LCD
1270
+    case 401: // M401 - Wait for user button press on LCD
1271
+    {
1272
+      LCD_MESSAGEPGM(MSG_USERWAIT);
1273
+      codenum = 0;
1274
+      if(code_seen('P')) codenum = code_value(); // milliseconds to wait
1275
+      if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
1276
+      
1277
+      st_synchronize();
1278
+      previous_millis_cmd = millis();
1279
+	  if (codenum > 0)
1280
+	  {
1281
+        codenum += millis();  // keep track of when we started waiting
1282
+        while(millis()  < codenum && buttons == 0){
1283
+          manage_heater();
1284
+          manage_inactivity(1);
1285
+		}
1286
+      }else{
1287
+        while(buttons == 0) {
1288
+          manage_heater();
1289
+          manage_inactivity(1);
1290
+		}
1291
+	  }
1292
+    }
1293
+    break;
1294
+#endif
1267 1295
     case 500: // Store settings in EEPROM
1268 1296
     {
1269 1297
         EEPROM_StoreSettings();

+ 1
- 0
Marlin/language.h View File

@@ -86,6 +86,7 @@
86 86
 	#define MSG_NO_CARD " No Card"
87 87
 	#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure."
88 88
 	#define MSG_DWELL "Sleep..."
89
+	#define MSG_USERWAIT "Wait for user..."
89 90
 	#define MSG_NO_MOVE "No move."
90 91
 	#define MSG_PART_RELEASE "Partial Release"
91 92
 	#define MSG_KILLED "KILLED. "

+ 1
- 0
Marlin/ultralcd.h View File

@@ -13,6 +13,7 @@
13 13
   #define LCD_UPDATE_INTERVAL 100
14 14
   #define STATUSTIMEOUT 15000
15 15
   extern LiquidCrystal lcd;
16
+  extern volatile char buttons=0;  //the last checked buttons in a bit array.
16 17
   
17 18
   #ifdef NEWPANEL
18 19
     #define EN_C (1<<BLEN_C)

Loading…
Cancel
Save