Browse Source

Fix missing start on MK3/S

Alex Voinea 4 years ago
parent
commit
4ffa4dd8fd
3 changed files with 12 additions and 8 deletions
  1. 7 3
      Firmware/Marlin_main.cpp
  2. 4 4
      Firmware/optiboot_w25x20cl.cpp
  3. 1 1
      Firmware/optiboot_w25x20cl.h

+ 7 - 3
Firmware/Marlin_main.cpp

@@ -1016,9 +1016,10 @@ void setup()
 
 #ifdef W25X20CL
     bool w25x20cl_success = w25x20cl_init();
+	uint8_t optiboot_status = 1;
 	if (w25x20cl_success)
 	{
-	    optiboot_w25x20cl_enter();
+		optiboot_status = optiboot_w25x20cl_enter();
 #if (LANG_MODE != 0) //secondary language support
         update_sec_lang_from_external_flash();
 #endif //(LANG_MODE != 0)
@@ -1064,9 +1065,12 @@ void setup()
 	}
 	MYSERIAL.begin(BAUDRATE);
 	fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
-#ifndef W25X20CL
+#if !((LANG_MODE == 1) && defined(W25X20CL)) || (LANG_MODE == 0)
 	SERIAL_PROTOCOLLNPGM("start");
-#endif //W25X20CL
+#else
+	if (optiboot_status == 1)
+		SERIAL_PROTOCOLLNPGM("start");
+#endif
 	stdout = uartout;
 	SERIAL_ECHO_START;
 	printf_P(PSTR(" " FW_VERSION_FULL "\n"));

+ 4 - 4
Firmware/optiboot_w25x20cl.cpp

@@ -99,9 +99,9 @@ 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()
+uint8_t optiboot_w25x20cl_enter()
 {
-  if (boot_app_flags & BOOT_APP_FLG_USER0) return;
+  if (boot_app_flags & BOOT_APP_FLG_USER0) return 1;
   uint8_t ch;
   uint8_t rampz = 0;
   register uint16_t address = 0;
@@ -144,12 +144,12 @@ void optiboot_w25x20cl_enter()
         delayMicroseconds(1);
         if (++ boot_timer > boot_timeout)
           // Timeout expired, continue with the application.
-          return;
+          return 0;
       }
       ch = UDR0;
       if (pgm_read_byte(ptr ++) != ch)
           // Magic was not received correctly, continue with the application
-          return;
+          return 0;
       watchdogReset();
     }
     // Send the cfm magic string.

+ 1 - 1
Firmware/optiboot_w25x20cl.h

@@ -1,6 +1,6 @@
 #ifndef OPTIBOOT_W25X20CL_H
 #define OPTIBOOT_W25X20CL_H
 
-extern void optiboot_w25x20cl_enter();
+extern uint8_t optiboot_w25x20cl_enter();
 
 #endif /* OPTIBOOT_W25X20CL_H */