diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8c91f4bb..8ac1aaf5 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3392,8 +3392,15 @@ void process_commands() if (fan_check_error){ if( fan_check_error == EFCE_DETECTED ){ fan_check_error = EFCE_REPORTED; - lcd_pause_print(); - } // otherwise it has already been reported, so just ignore further processing + + if(is_usb_printing){ + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); + } + else{ + lcd_pause_print(); + } + + } // otherwise it has already been reported, so just ignore further processing return; } #endif @@ -6733,6 +6740,10 @@ Sigma_Exit: } break; + case 603: { //! M603 - Stop print + lcd_print_stop(); + } + #ifdef PINDA_THERMISTOR case 860: // M860 - Wait for PINDA thermistor to reach target temperature. { @@ -9427,7 +9438,6 @@ void stop_and_save_print_to_ram(float z_move, float e_move) if(!saved_extruder_relative_mode){ enquecommand(PSTR("M83"), true); } - //retract 45mm/s // A single sprintf may not be faster, but is definitely 20B shorter // than a sequence of commands building the string piece by piece @@ -9511,7 +9521,6 @@ void restore_print_from_ram_and_continue(float e_move) card.setIndex(saved_sdpos); sdpos_atomic = saved_sdpos; card.sdprinting = true; - printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this } else if (saved_printing_type == PRINTING_TYPE_USB) { //was usb printing gcode_LastN = saved_sdpos; //saved_sdpos was reused for storing line number when usb printing @@ -9521,6 +9530,7 @@ void restore_print_from_ram_and_continue(float e_move) else { //not sd printing nor usb printing } + printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this lcd_setstatuspgm(_T(WELCOME_MSG)); saved_printing = false; } diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index b2f90c6c..1f4e6e2f 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -196,8 +196,21 @@ static void lcd_putchar(char c, FILE *) void lcd_init(void) { + WRITE(LCD_PINS_ENABLE,LOW); SET_OUTPUT(LCD_PINS_RS); SET_OUTPUT(LCD_PINS_ENABLE); + +#ifdef LCD_8BIT + SET_OUTPUT(LCD_PINS_D0); + SET_OUTPUT(LCD_PINS_D1); + SET_OUTPUT(LCD_PINS_D2); + SET_OUTPUT(LCD_PINS_D3); +#endif + SET_OUTPUT(LCD_PINS_D4); + SET_OUTPUT(LCD_PINS_D5); + SET_OUTPUT(LCD_PINS_D6); + SET_OUTPUT(LCD_PINS_D7); + #ifdef LCD_8BIT lcd_displayfunction |= LCD_8BITMODE; #endif diff --git a/Firmware/messages.c b/Firmware/messages.c index 0a750612..1c36e43c 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -84,6 +84,7 @@ const char MSG_SELFTEST_MOTOR[] PROGMEM_I1 = ISTR("Motor"); //// const char MSG_SELFTEST_FILAMENT_SENSOR[] PROGMEM_I1 = ISTR("Filament sensor"); ////c=17 const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); //// const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); //// +const char MSG_HW_SETUP[] PROGMEM_I1 = ISTR("HW Setup"); //// const char MSG_SILENT_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [high power]"); //// const char MSG_SILENT_MODE_ON[] PROGMEM_I1 = ISTR("Mode [silent]"); //// const char MSG_STEALTH_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [Normal]"); //// @@ -128,3 +129,4 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// +const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index 6260e0d3..b48337ef 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -84,6 +84,7 @@ extern const char MSG_SELFTEST_MOTOR[]; extern const char MSG_SELFTEST_FILAMENT_SENSOR[]; extern const char MSG_SELFTEST_WIRINGERROR[]; extern const char MSG_SETTINGS[]; +extern const char MSG_HW_SETUP[]; extern const char MSG_SILENT_MODE_OFF[]; extern const char MSG_SILENT_MODE_ON[]; extern const char MSG_STEALTH_MODE_OFF[]; @@ -129,6 +130,7 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; +extern const char MSG_OCTOPRINT_PAUSE[]; #if defined(__cplusplus) } diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index 7b965a2d..b01285a5 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -61,17 +61,18 @@ switch(eSoundMode) Sound_SaveMode(); } +//if critical is true then silend and once mode is ignored void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ if (!critical){ if (eSoundMode != e_SOUND_MODE_SILENT){ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + _delay(ms); WRITE(BEEPER, LOW); } else{ _tone(BEEPER, tone_); - delayMicroseconds(ms); + _delay(ms); _noTone(BEEPER); } } @@ -79,13 +80,13 @@ void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ else{ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + _delay(ms); WRITE(BEEPER, LOW); - delayMicroseconds(100); + _delay(ms); } else{ _tone(BEEPER, tone_); - delayMicroseconds(ms); + _delay(ms); _noTone(BEEPER); } } @@ -134,10 +135,10 @@ switch(eSoundMode) static void Sound_DoSound_Blind_Alert(void) { - _tone(BEEPER,100); - delayMicroseconds(50); + _tone(BEEPER,300); + _delay_ms(75); _noTone(BEEPER); - delayMicroseconds(200); + _delay_ms(75); } static void Sound_DoSound_Encoder_Move(void) @@ -169,7 +170,7 @@ for(nI=0;nI<10;nI++) static void Sound_DoSound_Prompt(void) { WRITE(BEEPER,HIGH); -delayMicroseconds(500); +_delay_ms(500); WRITE(BEEPER,LOW); } diff --git a/Firmware/sound.h b/Firmware/sound.h index 2c14dfee..bdd32ec8 100644 --- a/Firmware/sound.h +++ b/Firmware/sound.h @@ -6,7 +6,7 @@ #define MSG_SOUND_MODE_LOUD "Sound [loud]" #define MSG_SOUND_MODE_ONCE "Sound [once]" #define MSG_SOUND_MODE_SILENT "Sound [silent]" -#define MSG_SOUND_MODE_BLIND "Sound [blind]" +#define MSG_SOUND_MODE_BLIND "Sound [blind]" #define e_SOUND_MODE_NULL 0xFF diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 70cf0eac..42d294c4 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -40,7 +40,7 @@ #include <avr/wdt.h> #include "adc.h" #include "ConfigurationStore.h" - +#include "messages.h" #include "Timer.h" #include "Configuration_prusa.h" @@ -525,6 +525,8 @@ void checkFanSpeed() fan_speed_errors[1] = 0; fanSpeedError(1); //print fan } + + SERIAL_PROTOCOLLNRPGM(MSG_OK); //for octoprint } //! Prints serialMsg to serial port, displays lcdMsg onto the LCD and beeps. @@ -542,18 +544,17 @@ static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){ void fanSpeedError(unsigned char _fan) { if (get_message_level() != 0 && isPrintPaused) return; //to ensure that target temp. is not set to zero in case taht we are resuming print - if (card.sdprinting) { + if (card.sdprinting || is_usb_printing) { if (heating_status != 0) { lcd_print_stop(); } else { fan_check_error = EFCE_DETECTED; - } } else { + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //for octoprint setTargetHotend0(0); - SERIAL_ECHOLNPGM("// action:pause"); //for octoprint heating_status = 0; fan_check_error = EFCE_REPORTED; } @@ -565,6 +566,7 @@ void fanSpeedError(unsigned char _fan) { fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") ); break; } + SERIAL_PROTOCOLLNRPGM(MSG_OK); } #endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b28534f9..59489b06 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -307,7 +307,7 @@ bool wait_for_unclick; #endif bool bMain; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function -bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function +bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function @@ -1658,6 +1658,7 @@ void lcd_pause_print() { lcd_commands_type = LcdCommands::LongPause; } + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint } @@ -5505,18 +5506,27 @@ do\ }\ while (0) -//-//static void lcd_checking_menu() -void lcd_checking_menu() +static void lcd_checking_menu(void) { MENU_BEGIN(); -MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch -SETTINGS_NOZZLE; -MENU_ITEM_TEXT_P(STR_SEPARATOR); -MENU_ITEM_TEXT_P(_i("Checks:")); +MENU_ITEM_BACK_P(_T(MSG_HW_SETUP)); SETTINGS_MODE; SETTINGS_MODEL; SETTINGS_VERSION; -SETTINGS_GCODE; +//-// temporarily disabled +//SETTINGS_GCODE; +MENU_END(); +} + +void lcd_hw_setup_menu(void) // can not be "static" +{ +MENU_BEGIN(); +MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch +if(!farm_mode) + SETTINGS_NOZZLE; +// ... a sem prijdou 'plechy' +if(!farm_mode) + MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); MENU_END(); } @@ -5544,6 +5554,10 @@ static void lcd_settings_menu() MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1 SETTINGS_SILENT_MODE; + + bSettings=true; // flag ('fake parameter') for 'lcd_hw_setup_menu()' function + MENU_ITEM_SUBMENU_P(_i("HW Setup"), lcd_hw_setup_menu);////MSG_HW_SETUP + SETTINGS_MMU_MODE; MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_MBL_SETTINGS c=18 r=1 @@ -5571,12 +5585,6 @@ static void lcd_settings_menu() MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT #endif //(LANG_MODE != 0) - if (!farm_mode) - { - bSettings=true; // flag ('fake parameter') for 'lcd_checking_menu()' function - MENU_ITEM_SUBMENU_P(_i("Print checking"), lcd_checking_menu); - } - SETTINGS_SD; SETTINGS_SOUND; @@ -6963,7 +6971,6 @@ void lcd_print_stop() if(!card.sdprinting) { SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint - return; } saved_printing = false; cancel_heatup = true; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index a8070eca..2c57c944 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -140,7 +140,8 @@ void lcd_ignore_click(bool b=true); void lcd_commands(); -extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function +extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function +void lcd_hw_setup_menu(void); // NOT static due to using inside "util" module ("nozzle_diameter_check()") void change_extr(int extr); diff --git a/Firmware/util.cpp b/Firmware/util.cpp index fc6b0f0b..05cbf994 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -324,7 +324,7 @@ void update_current_firmware_version_to_eeprom() //-// -void lcd_checking_menu(void); +#define MSG_PRINT_CHECKING_FAILED_TIMEOUT 30 ClNozzleDiameter oNozzleDiameter=ClNozzleDiameter::_Diameter_400; ClCheckMode oCheckMode=ClCheckMode::_None; @@ -379,7 +379,7 @@ nDiameter_um=eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM); if(nDiameter==nDiameter_um) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("Nozzle diameter doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer nozzle diameter differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN((float)(nDiameter_um/1000.0)); //SERIAL_ECHOPGM("expected: "); @@ -387,18 +387,22 @@ if(nDiameter==nDiameter_um) switch(oCheckMode) { case ClCheckMode::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer nozzle diameter differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer nozzle diameter differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckMode::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; case ClCheckMode::_None: case ClCheckMode::_Undef: break; } -bSettings=false; // flag ('fake parameter') for 'lcd_checking_menu()' function -menu_submenu(lcd_checking_menu); +bSettings=false; // flag ('fake parameter') for 'lcd_hw_setup_menu()' function +menu_submenu(lcd_hw_setup_menu); } void printer_model_check(uint16_t nPrinterModel) @@ -408,7 +412,7 @@ if(oCheckModel==ClCheckModel::_None) if(nPrinterModel==nPrinterType) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("Printer model doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer model differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN(nPrinterType); //SERIAL_ECHOPGM("expected: "); @@ -416,10 +420,14 @@ if(nPrinterModel==nPrinterType) switch(oCheckModel) { case ClCheckModel::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer model differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckModel::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; case ClCheckModel::_None: @@ -454,7 +462,7 @@ if(nCompareValueResult==COMPARE_VALUE_EQUAL) if((nCompareValueResult<COMPARE_VALUE_EQUAL)&&oCheckVersion==ClCheckVersion::_Warn) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("FW version doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer FW version differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN(FW_VERSION); //SERIAL_ECHOPGM("expected: "); @@ -462,10 +470,14 @@ if((nCompareValueResult<COMPARE_VALUE_EQUAL)&&oCheckVersion==ClCheckVersion::_Wa switch(oCheckVersion) { case ClCheckVersion::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("FW version doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer FW version differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer FW version differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckVersion::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("FW version doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer FW version differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; case ClCheckVersion::_None: @@ -483,7 +495,7 @@ if(nGcodeLevel==(uint16_t)GCODE_LEVEL) if((nGcodeLevel<(uint16_t)GCODE_LEVEL)&&(oCheckGcode==ClCheckGcode::_Warn)) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("G-code level doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer G-code level differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN(GCODE_LEVEL); //SERIAL_ECHOPGM("expected: "); @@ -491,10 +503,14 @@ if((nGcodeLevel<(uint16_t)GCODE_LEVEL)&&(oCheckGcode==ClCheckGcode::_Warn)) switch(oCheckGcode) { case ClCheckGcode::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("G-code level doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer G-code level differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer G-code level differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckGcode::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("G-code level doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer G-code level differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; case ClCheckGcode::_None: @@ -543,7 +559,7 @@ if(pResult!=NULL) return; } //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("Printer model doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer model differs from the G-code ..."); //SERIAL_ECHOPGM("actual : \""); //serialprintPGM(::sPrinterName); //SERIAL_ECHOLNPGM("\""); @@ -553,10 +569,14 @@ if(pResult!=NULL) switch(oCheckModel) { case ClCheckModel::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer model differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckModel::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; case ClCheckModel::_None: diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 74bf63d0..d4606d56 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -828,7 +828,7 @@ # "Press the knob" -"Stisknete hl. tlacitko" +"Stisknete tlacitko" #MSG_PRINT_PAUSED c=20 r=1 "Print paused"