Indentations

This commit is contained in:
3d-gussner 2021-02-18 09:53:14 +01:00
parent 75a385d614
commit 291ee8e46d
2 changed files with 144 additions and 184 deletions

View file

@ -3841,55 +3841,41 @@ void process_commands()
- `string` - Must for M1 and optional for M0 message to display on the LCD - `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; bool hasP = false, hasS = false;
if (code_seen('P')) if (code_seen('P')) {
{
codenum = code_value(); // milliseconds to wait codenum = code_value(); // milliseconds to wait
hasP = codenum > 0; hasP = codenum > 0;
} }
if (code_seen('S')) if (code_seen('S')) {
{
codenum = code_value() * 1000; // seconds to wait codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0; hasS = codenum > 0;
} }
starpos = strchr(src, '*'); starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0'; if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src; while (*src == ' ') ++src;
custom_message_type = CustomMsg::M0Wait; custom_message_type = CustomMsg::M0Wait;
if (!hasP && !hasS && *src != '\0') if (!hasP && !hasS && *src != '\0') {
{
lcd_setstatus(src); lcd_setstatus(src);
} } else {
else
{
LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT
} }
lcd_ignore_click(); //call lcd_ignore_click aslo for else ??? lcd_ignore_click(); //call lcd_ignore_click aslo for else ???
st_synchronize(); st_synchronize();
previous_millis_cmd = _millis(); previous_millis_cmd = _millis();
if (codenum > 0) if (codenum > 0) {
{
codenum += _millis(); // keep track of when we started waiting codenum += _millis(); // keep track of when we started waiting
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
while(_millis() < codenum && !lcd_clicked()) while(_millis() < codenum && !lcd_clicked()) {
{
manage_heater(); manage_heater();
manage_inactivity(true); manage_inactivity(true);
lcd_update(0); lcd_update(0);
} }
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
lcd_ignore_click(false); lcd_ignore_click(false);
} } else {
else
{
marlin_wait_for_click(); marlin_wait_for_click();
} }
if (IS_SD_PRINTING) if (IS_SD_PRINTING)
@ -8165,8 +8151,7 @@ Sigma_Exit:
case 25: case 25:
case 601: case 601:
{ {
if (!isPrintPaused) if (!isPrintPaused) {
{
st_synchronize(); st_synchronize();
ClearToSend(); //send OK even before the command finishes executing because we want to make sure it is not skipped because of cmdqueue_pop_front(); ClearToSend(); //send OK even before the command finishes executing because we want to make sure it is not skipped because of cmdqueue_pop_front();
cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore
@ -8176,21 +8161,21 @@ Sigma_Exit:
break; break;
/*! /*!
### M602 - Resume print <a href="https://reprap.org/wiki/G-code#M602:_Resume_print">M602: Resume print</a> ### M602 - Resume print <a href="https://reprap.org/wiki/G-code#M602:_Resume_print">M602: Resume print</a>
*/ */
case 602: { case 602: {
if (isPrintPaused) if (isPrintPaused)
lcd_resume_print(); lcd_resume_print();
} }
break; break;
/*! /*!
### M603 - Stop print <a href="https://reprap.org/wiki/G-code#M603:_Stop_print">M603: Stop print</a> ### M603 - Stop print <a href="https://reprap.org/wiki/G-code#M603:_Stop_print">M603: Stop print</a>
*/ */
case 603: { case 603: {
lcd_print_stop(); lcd_print_stop();
} }
break; break;
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
/*! /*!

View file

@ -752,163 +752,138 @@ void lcdui_print_time(void)
lcd_space(8 - chars); lcd_space(8 - chars);
} }
//Print status line on status screen //! @Brief Print status line on status screen
void lcdui_print_status_line(void) void lcdui_print_status_line(void)
{ {
if (IS_SD_PRINTING) if (IS_SD_PRINTING) {
{ if (strcmp(longFilenameOLD, (card.longFilename[0] ? card.longFilename : card.filename)) != 0) {
if (strcmp(longFilenameOLD, (card.longFilename[0] ? card.longFilename : card.filename)) != 0) memset(longFilenameOLD, '\0', strlen(longFilenameOLD));
{ sprintf_P(longFilenameOLD, PSTR("%s"), (card.longFilename[0] ? card.longFilename : card.filename));
memset(longFilenameOLD, '\0', strlen(longFilenameOLD)); scrollstuff = 0;
sprintf_P(longFilenameOLD, PSTR("%s"), (card.longFilename[0] ? card.longFilename : card.filename)); }
scrollstuff = 0; }
}
}
if (heating_status) if (heating_status) { // If heating flag, show progress of heating
{ // If heating flag, show progress of heating heating_status_counter++;
heating_status_counter++; if (heating_status_counter > 13) {
if (heating_status_counter > 13) heating_status_counter = 0;
{ }
heating_status_counter = 0; lcd_set_cursor(7, 3);
} lcd_space(13);
lcd_set_cursor(7, 3);
lcd_space(13);
for (unsigned int dots = 0; dots < heating_status_counter; dots++) for (unsigned int dots = 0; dots < heating_status_counter; dots++) {
{ lcd_putc_at(7 + dots, 3, '.');
lcd_putc_at(7 + dots, 3, '.'); }
} switch (heating_status) {
switch (heating_status) case 1:
{ lcd_puts_at_P(0, 3, _T(MSG_HEATING));
case 1: break;
lcd_puts_at_P(0, 3, _T(MSG_HEATING)); case 2:
break; lcd_puts_at_P(0, 3, _T(MSG_HEATING_COMPLETE));
case 2: heating_status = 0;
lcd_puts_at_P(0, 3, _T(MSG_HEATING_COMPLETE)); heating_status_counter = 0;
heating_status = 0; break;
heating_status_counter = 0; case 3:
break; lcd_puts_at_P(0, 3, _T(MSG_BED_HEATING));
case 3: break;
lcd_puts_at_P(0, 3, _T(MSG_BED_HEATING)); case 4:
break; lcd_puts_at_P(0, 3, _T(MSG_BED_DONE));
case 4: heating_status = 0;
lcd_puts_at_P(0, 3, _T(MSG_BED_DONE)); heating_status_counter = 0;
heating_status = 0; break;
heating_status_counter = 0; default:
break; break;
default: }
break; }
} else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status)) { // If printing from SD, show what we are printing
} if(strlen(longFilenameOLD) > LCD_WIDTH) {
else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status)) int inters = 0;
{ // If printing from SD, show what we are printing int gh = scrollstuff;
if(strlen(longFilenameOLD) > LCD_WIDTH) while (((gh - scrollstuff) < LCD_WIDTH) && (inters == 0)) {
{ if (longFilenameOLD[gh] == '\0') {
int inters = 0; lcd_set_cursor(gh - scrollstuff, 3);
int gh = scrollstuff; lcd_print(longFilenameOLD[gh - 1]);
while (((gh - scrollstuff) < LCD_WIDTH) && (inters == 0)) scrollstuff = 0;
{ gh = scrollstuff;
if (longFilenameOLD[gh] == '\0') inters = 1;
{ } else {
lcd_set_cursor(gh - scrollstuff, 3); lcd_set_cursor(gh - scrollstuff, 3);
lcd_print(longFilenameOLD[gh - 1]); lcd_print(longFilenameOLD[gh - 1]);
scrollstuff = 0; gh++;
gh = scrollstuff; }
inters = 1; }
} scrollstuff++;
else } else {
{ lcd_printf_P(PSTR("%-20s"), longFilenameOLD);
lcd_set_cursor(gh - scrollstuff, 3); }
lcd_print(longFilenameOLD[gh - 1]); } else { // Otherwise check for other special events
gh++; switch (custom_message_type) {
} case CustomMsg::MsgUpdate: //Short message even while printing from SD
} case CustomMsg::Status: // Nothing special, print status message normally
scrollstuff++; case CustomMsg::M0Wait: // M0/M1 Wait command working even from SD
} lcd_print(lcd_status_message);
else break;
{ case CustomMsg::MeshBedLeveling: // If mesh bed leveling in progress, show the status
lcd_printf_P(PSTR("%-20s"), longFilenameOLD); if (custom_message_state > 10) {
} lcd_set_cursor(0, 3);
} lcd_space(20);
else lcd_puts_at_P(0, 3, _T(MSG_CALIBRATE_Z_AUTO));
{ // Otherwise check for other special events lcd_puts_P(PSTR(" : "));
switch (custom_message_type) lcd_print(custom_message_state-10);
{ } else {
case CustomMsg::MsgUpdate: //Short message even while printing from SD if (custom_message_state == 3)
case CustomMsg::Status: // Nothing special, print status message normally {
case CustomMsg::M0Wait: // M0/M1 Wait command working even from SD lcd_puts_P(_T(WELCOME_MSG));
lcd_print(lcd_status_message); lcd_setstatuspgm(_T(WELCOME_MSG));
break; custom_message_type = CustomMsg::Status;
case CustomMsg::MeshBedLeveling: // If mesh bed leveling in progress, show the status }
if (custom_message_state > 10) if (custom_message_state > 3 && custom_message_state <= 10 ) {
{ lcd_set_cursor(0, 3);
lcd_set_cursor(0, 3); lcd_space(19);
lcd_space(20); lcd_puts_at_P(0, 3, _i("Calibration done"));////MSG_HOMEYZ_DONE
lcd_puts_at_P(0, 3, _T(MSG_CALIBRATE_Z_AUTO)); custom_message_state--;
lcd_puts_P(PSTR(" : ")); }
lcd_print(custom_message_state-10); }
} break;
else case CustomMsg::FilamentLoading: // If loading filament, print status
{ lcd_print(lcd_status_message);
if (custom_message_state == 3) break;
{ case CustomMsg::PidCal: // PID tuning in progress
lcd_puts_P(_T(WELCOME_MSG)); lcd_print(lcd_status_message);
lcd_setstatuspgm(_T(WELCOME_MSG)); if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) {
custom_message_type = CustomMsg::Status; lcd_set_cursor(10, 3);
} lcd_print(itostr3(pid_cycle));
if (custom_message_state > 3 && custom_message_state <= 10 ) lcd_print('/');
{ lcd_print(itostr3left(pid_number_of_cycles));
lcd_set_cursor(0, 3); }
lcd_space(19); break;
lcd_puts_at_P(0, 3, _i("Calibration done"));////MSG_HOMEYZ_DONE case CustomMsg::TempCal: // PINDA temp calibration in progress
custom_message_state--; char statusLine[LCD_WIDTH + 1];
} sprintf_P(statusLine, PSTR("%-20S"), _T(MSG_TEMP_CALIBRATION));
} char progress[4];
break; sprintf_P(progress, PSTR("%d/6"), custom_message_state);
case CustomMsg::FilamentLoading: // If loading filament, print status memcpy(statusLine + 12, progress, sizeof(progress) - 1);
lcd_print(lcd_status_message); lcd_set_cursor(0, 3);
break; lcd_print(statusLine);
case CustomMsg::PidCal: // PID tuning in progress break;
lcd_print(lcd_status_message); case CustomMsg::TempCompPreheat: // temp compensation preheat
if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) lcd_puts_at_P(0, 3, _i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1
{ if (custom_message_state <= PINDA_HEAT_T) {
lcd_set_cursor(10, 3); lcd_puts_P(PSTR(": "));
lcd_print(itostr3(pid_cycle)); lcd_print(custom_message_state); //seconds
lcd_print('/'); lcd_print(' ');
lcd_print(itostr3left(pid_number_of_cycles)); }
} break;
break;
case CustomMsg::TempCal: // PINDA temp calibration in progress
{
char statusLine[LCD_WIDTH + 1];
sprintf_P(statusLine, PSTR("%-20S"), _T(MSG_TEMP_CALIBRATION));
char progress[4];
sprintf_P(progress, PSTR("%d/6"), custom_message_state);
memcpy(statusLine + 12, progress, sizeof(progress) - 1);
lcd_set_cursor(0, 3);
lcd_print(statusLine);
}
break;
case CustomMsg::TempCompPreheat: // temp compensation preheat
lcd_puts_at_P(0, 3, _i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1
if (custom_message_state <= PINDA_HEAT_T)
{
lcd_puts_P(PSTR(": "));
lcd_print(custom_message_state); //seconds
lcd_print(' ');
}
break;
case CustomMsg::Resuming: //Resuming case CustomMsg::Resuming: //Resuming
lcd_puts_at_P(0, 3, _T(MSG_RESUMING_PRINT)); lcd_puts_at_P(0, 3, _T(MSG_RESUMING_PRINT));
break; break;
} }
} }
// Fill the rest of line to have nice and clean output // Fill the rest of line to have nice and clean output
for(int fillspace = 0; fillspace < 20; fillspace++) for(int fillspace = 0; fillspace < 20; fillspace++)
if ((lcd_status_message[fillspace] <= 31 )) if ((lcd_status_message[fillspace] <= 31 ))
lcd_print(' '); lcd_print(' ');
} }
//! @brief Show Status Screen //! @brief Show Status Screen