Merge pull request #1966 from thinkyhead/g4_dwell_message

G4 shows status message only if no message is set already
This commit is contained in:
Scott Lahteine
2015-04-24 22:02:37 -07:00
4 changed files with 22 additions and 14 deletions

View File

@ -890,8 +890,11 @@ void get_command() {
}
bool code_has_value() {
char c = strchr_pointer[1];
return (c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.';
int i = 1;
char c = strchr_pointer[i];
if (c == '-' || c == '+') c = strchr_pointer[++i];
if (c == '.') c = strchr_pointer[++i];
return (c >= '0' && c <= '9');
}
float code_value() {
@ -1744,14 +1747,15 @@ inline void gcode_G2_G3(bool clockwise) {
inline void gcode_G4() {
millis_t codenum = 0;
LCD_MESSAGEPGM(MSG_DWELL);
if (code_seen('P')) codenum = code_value_long(); // milliseconds to wait
if (code_seen('S')) codenum = code_value_long() * 1000; // seconds to wait
st_synchronize();
refresh_cmd_timeout();
codenum += previous_cmd_ms; // keep track of when we started waiting
if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
while (millis() < codenum) {
manage_heater();
manage_inactivity();