Do not kill printer if External SPI flash W25X20CL is not responding.

Remove internationalization macro for this message. It has no sense to be translated as internationalization in most cases doesn't work if it is not responding.
Show this message instead of splash screen if the error is encountered.
There is no additional delay or wait for click, as such functions doesn't work in setup function.
This commit is contained in:
Marek Bel 2019-04-16 22:20:53 +02:00
parent 8a33663f64
commit 75fac9dab2
3 changed files with 34 additions and 23 deletions

View File

@ -977,6 +977,12 @@ void list_sec_lang_from_external_flash()
#endif //(LANG_MODE != 0)
static void w25x20cl_err_msg()
{
lcd_puts_P(_n(ESC_2J ESC_H(0,0) "External SPI flash" ESC_H(0,1) "W25X20CL is not res-"
ESC_H(0,2) "ponding. Language" ESC_H(0,3) "switch unavailable."));
}
// "Setup" function is called by the Arduino framework on startup.
// Before startup, the Timers-functions (PWM)/Analog RW and HardwareSerial provided by the Arduino-code
// are initialized by the main() routine provided by the Arduino framework.
@ -996,18 +1002,22 @@ void setup()
Sound_Init(); // also guarantee "SET_OUTPUT(BEEPER)"
#ifdef W25X20CL
if (!w25x20cl_init())
kill(_i("External SPI flash W25X20CL not responding."));
// Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory.
bool w25x20cl_success = w25x20cl_init();
if (w25x20cl_success)
{
optiboot_w25x20cl_enter();
#endif
#if (LANG_MODE != 0) //secondary language support
#ifdef W25X20CL
if (w25x20cl_init())
update_sec_lang_from_external_flash();
#endif //W25X20CL
#endif //(LANG_MODE != 0)
}
else
{
w25x20cl_err_msg();
}
#else
const bool w25x20cl_success = true;
#endif //W25X20CL
setup_killpin();
setup_powerhold();
@ -1213,7 +1223,12 @@ void setup()
tp_init(); // Initialize temperature loop
lcd_splash(); // we need to do this again, because tp_init() kills lcd
if (w25x20cl_success) lcd_splash(); // we need to do this again, because tp_init() kills lcd
else
{
w25x20cl_err_msg();
printf_P(_n("W25X20CL not responding.\n"));
}
plan_init(); // Initialize planner;

View File

@ -64,23 +64,17 @@ extern void lcd_print(long, int = 10);
extern void lcd_print(unsigned long, int = 10);
extern void lcd_print(double, int = 2);
//! @brief Clear screen
#define ESC_2J "\x1b[2J"
#define ESC_25h "\x1b[?25h"
#define ESC_25l "\x1b[?25l"
//! @brief Set cursor to
//! @param c column
//! @param r row
#define ESC_H(c,r) "\x1b["#r";"#c"H"
#define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 30000ul //!< Generic timeout to status screen in ms, when no user action.
#define LCD_TIMEOUT_TO_STATUS_BABYSTEP_Z 90000ul //!< Specific timeout for lcd_babystep_z screen in ms.

View File

@ -1,3 +1,4 @@
//! @file
// Based on the OptiBoot project
// https://github.com/Optiboot/optiboot
// Licence GLP 2 or later.
@ -97,6 +98,7 @@ static const char entry_magic_cfm [] PROGMEM = "w25x20cl_cfm\n";
struct block_t;
extern struct block_t *block_buffer;
//! @brief Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory.
void optiboot_w25x20cl_enter()
{
if (boot_app_flags & BOOT_APP_FLG_USER0) return;