Indentations

This commit is contained in:
3d-gussner 2021-02-16 12:31:23 +01:00
parent d6c6517fcd
commit 66ea1bdfba
1 changed files with 81 additions and 70 deletions

View File

@ -3799,92 +3799,103 @@ void process_commands()
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
int8_t SilentMode;
#endif
/*!
---------------------------------------------------------------------------------
### M117 - Display Message <a href="https://reprap.org/wiki/G-code#M117:_Display_Message">M117: Display Message</a>
This causes the given message to be shown in the status line on an attached LCD.
It is processed early as to allow printing messages that contain G, M, N or T.
---------------------------------------------------------------------------------
### Special internal commands
These are used by internal functions to process certain actions in the right order. Some of these are also usable by the user.
They are processed early as the commands are complex (strings).
These are only available on the MK3(S) as these require TMC2130 drivers:
- CRASH DETECTED
- CRASH RECOVER
- CRASH_CANCEL
- TMC_SET_WAVE
- TMC_SET_STEP
- TMC_SET_CHOP
*/
if (code_seen_P(PSTR("M117"))) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^"
starpos = (strchr(strchr_pointer + 5, '*'));
if (starpos != NULL)
*(starpos) = '\0';
lcd_setstatus(strchr_pointer + 5);
custom_message_type = CustomMsg::MsgUpdate;
}
/*!
---------------------------------------------------------------------------------
### M117 - Display Message <a href="https://reprap.org/wiki/G-code#M117:_Display_Message">M117: Display Message</a>
This causes the given message to be shown in the status line on an attached LCD.
It is processed early as to allow printing messages that contain G, M, N or T.
---------------------------------------------------------------------------------
### Special internal commands
These are used by internal functions to process certain actions in the right order. Some of these are also usable by the user.
They are processed early as the commands are complex (strings).
These are only available on the MK3(S) as these require TMC2130 drivers:
- CRASH DETECTED
- CRASH RECOVER
- CRASH_CANCEL
- TMC_SET_WAVE
- TMC_SET_STEP
- TMC_SET_CHOP
*/
if (code_seen_P(PSTR("M117"))) //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^"
{
starpos = (strchr(strchr_pointer + 5, '*'));
if (starpos != NULL)
*(starpos) = '\0';
lcd_setstatus(strchr_pointer + 5);
custom_message_type = CustomMsg::MsgUpdate;
}
/*!
### M0, M1 - Stop the printer <a href="https://reprap.org/wiki/G-code#M0:_Stop_or_Unconditional_stop">M0: Stop or Unconditional stop</a>
#### Usage
### M0, M1 - Stop the printer <a href="https://reprap.org/wiki/G-code#M0:_Stop_or_Unconditional_stop">M0: Stop or Unconditional stop</a>
#### Usage
M0 [P<ms<] [S<sec>] [string]
M1 [P<ms>] [S<sec>] [string]
#### Parameters
#### Parameters
- `P<ms>` - Expire time, in milliseconds
- `S<sec>` - Expire time, in seconds
- `string` - Must for M1 and optional for M0 message to display on the LCD
*/
else if (code_seen_P(PSTR("M0")) || code_seen_P(PSTR("M1 "))) { // M0 and M1 - (Un)conditional stop - Wait for user button press on LCD
else if (code_seen_P(PSTR("M0")) || code_seen_P(PSTR("M1 "))) // M0 and M1 - (Un)conditional stop - Wait for user button press on LCD
{
char *src = strchr_pointer + 2;
char *src = strchr_pointer + 2;
codenum = 0;
codenum = 0;
bool hasP = false, hasS = false;
if (code_seen('P')) {
codenum = code_value(); // milliseconds to wait
hasP = codenum > 0;
}
if (code_seen('S')) {
codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0;
}
starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src;
custom_message_type = CustomMsg::M0Wait;
if (!hasP && !hasS && *src != '\0') {
lcd_setstatus(src);
} else {
LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT
}
lcd_ignore_click(); //call lcd_ignore_click aslo for else ???
st_synchronize();
previous_millis_cmd = _millis();
if (codenum > 0){
codenum += _millis(); // keep track of when we started waiting
KEEPALIVE_STATE(PAUSED_FOR_USER);
while(_millis() < codenum && !lcd_clicked()){
manage_heater();
manage_inactivity(true);
lcd_update(0);
bool hasP = false, hasS = false;
if (code_seen('P'))
{
codenum = code_value(); // milliseconds to wait
hasP = codenum > 0;
}
KEEPALIVE_STATE(IN_HANDLER);
lcd_ignore_click(false);
}else{
marlin_wait_for_click();
}
if (IS_SD_PRINTING)
custom_message_type = CustomMsg::Status;
else
LCD_MESSAGERPGM(_T(WELCOME_MSG));
if (code_seen('S'))
{
codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0;
}
starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src;
custom_message_type = CustomMsg::M0Wait;
if (!hasP && !hasS && *src != '\0')
{
lcd_setstatus(src);
}
else
{
LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT
}
lcd_ignore_click(); //call lcd_ignore_click aslo for else ???
st_synchronize();
previous_millis_cmd = _millis();
if (codenum > 0)
{
codenum += _millis(); // keep track of when we started waiting
KEEPALIVE_STATE(PAUSED_FOR_USER);
while(_millis() < codenum && !lcd_clicked())
{
manage_heater();
manage_inactivity(true);
lcd_update(0);
}
KEEPALIVE_STATE(IN_HANDLER);
lcd_ignore_click(false);
}
else
{
marlin_wait_for_click();
}
if (IS_SD_PRINTING)
custom_message_type = CustomMsg::Status;
else
LCD_MESSAGERPGM(_T(WELCOME_MSG));
}
#ifdef TMC2130