|
@@ -11,6 +11,7 @@
|
|
#include "cardreader.h"
|
|
#include "cardreader.h"
|
|
#include "ultralcd.h"
|
|
#include "ultralcd.h"
|
|
#include "sound.h"
|
|
#include "sound.h"
|
|
|
|
+#include "printers.h"
|
|
#include <avr/pgmspace.h>
|
|
#include <avr/pgmspace.h>
|
|
|
|
|
|
#define CHECK_FINDA ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active())
|
|
#define CHECK_FINDA ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active())
|
|
@@ -20,10 +21,9 @@
|
|
#define MMU_CMD_TIMEOUT 300000ul //5min timeout for mmu commands (except P0)
|
|
#define MMU_CMD_TIMEOUT 300000ul //5min timeout for mmu commands (except P0)
|
|
#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds
|
|
#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds
|
|
|
|
|
|
-#define MMU_HWRESET
|
|
|
|
|
|
+#ifdef MMU_HWRESET
|
|
#define MMU_RST_PIN 76
|
|
#define MMU_RST_PIN 76
|
|
-
|
|
|
|
-#define MMU_REQUIRED_FW_BUILDNR 83
|
|
|
|
|
|
+#endif //MMU_HWRESET
|
|
|
|
|
|
bool mmu_enabled = false;
|
|
bool mmu_enabled = false;
|
|
|
|
|
|
@@ -93,8 +93,10 @@ int8_t mmu_rx_start(void)
|
|
//initialize mmu2 unit - first part - should be done at begining of startup process
|
|
//initialize mmu2 unit - first part - should be done at begining of startup process
|
|
void mmu_init(void)
|
|
void mmu_init(void)
|
|
{
|
|
{
|
|
|
|
+#ifdef MMU_HWRESET
|
|
digitalWrite(MMU_RST_PIN, HIGH);
|
|
digitalWrite(MMU_RST_PIN, HIGH);
|
|
pinMode(MMU_RST_PIN, OUTPUT); //setup reset pin
|
|
pinMode(MMU_RST_PIN, OUTPUT); //setup reset pin
|
|
|
|
+#endif //MMU_HWRESET
|
|
uart2_init(); //init uart2
|
|
uart2_init(); //init uart2
|
|
_delay_ms(10); //wait 10ms for sure
|
|
_delay_ms(10); //wait 10ms for sure
|
|
mmu_reset(); //reset mmu (HW or SW), do not wait for response
|
|
mmu_reset(); //reset mmu (HW or SW), do not wait for response
|
|
@@ -148,13 +150,35 @@ void mmu_loop(void)
|
|
bool version_valid = mmu_check_version();
|
|
bool version_valid = mmu_check_version();
|
|
if (!version_valid) mmu_show_warning();
|
|
if (!version_valid) mmu_show_warning();
|
|
else puts_P(PSTR("MMU version valid"));
|
|
else puts_P(PSTR("MMU version valid"));
|
|
|
|
+
|
|
|
|
+ if ((PRINTER_TYPE == PRINTER_MK3) || (PRINTER_TYPE == PRINTER_MK3_SNMM))
|
|
|
|
+ {
|
|
|
|
+#ifdef MMU_DEBUG
|
|
|
|
+ puts_P(PSTR("MMU <= 'P0'"));
|
|
|
|
+#endif //MMU_DEBUG
|
|
|
|
+ mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
|
|
|
|
+ mmu_state = -4;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+#ifdef MMU_DEBUG
|
|
|
|
+ puts_P(PSTR("MMU <= 'M1'"));
|
|
|
|
+#endif //MMU_DEBUG
|
|
|
|
+ mmu_puts_P(PSTR("M1\n")); //set mmu mode to stealth
|
|
|
|
+ mmu_state = -5;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ case -5:
|
|
|
|
+ if (mmu_rx_ok() > 0)
|
|
|
|
+ {
|
|
#ifdef MMU_DEBUG
|
|
#ifdef MMU_DEBUG
|
|
puts_P(PSTR("MMU <= 'P0'"));
|
|
puts_P(PSTR("MMU <= 'P0'"));
|
|
#endif //MMU_DEBUG
|
|
#endif //MMU_DEBUG
|
|
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
|
|
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
|
|
mmu_state = -4;
|
|
mmu_state = -4;
|
|
}
|
|
}
|
|
- return;
|
|
|
|
case -4:
|
|
case -4:
|
|
if (mmu_rx_ok() > 0)
|
|
if (mmu_rx_ok() > 0)
|
|
{
|
|
{
|