|
@ -21,7 +21,7 @@ |
|
|
#define PRODUCT_ID 0x29 |
|
|
#define PRODUCT_ID 0x29 |
|
|
|
|
|
|
|
|
USBMassStorage MarlinMSC; |
|
|
USBMassStorage MarlinMSC; |
|
|
USBCompositeSerial MarlinCompositeSerial; |
|
|
MarlinUSBCompositeSerial MarlinCompositeSerial; |
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfig.h" |
|
|
#include "../../inc/MarlinConfig.h" |
|
|
|
|
|
|
|
@ -38,6 +38,17 @@ USBCompositeSerial MarlinCompositeSerial; |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(EMERGENCY_PARSER) |
|
|
|
|
|
void (*real_rx_callback)(void); |
|
|
|
|
|
|
|
|
|
|
|
void my_rx_callback(void) { |
|
|
|
|
|
real_rx_callback(); |
|
|
|
|
|
int len = MarlinCompositeSerial.available(); |
|
|
|
|
|
while (len-- > 0) // >0 because available() may return a negative value
|
|
|
|
|
|
emergency_parser.update(MarlinCompositeSerial.emergency_state, MarlinCompositeSerial.peek()); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
void MSC_SD_init() { |
|
|
void MSC_SD_init() { |
|
|
USBComposite.setProductId(PRODUCT_ID); |
|
|
USBComposite.setProductId(PRODUCT_ID); |
|
|
// Just set MarlinCompositeSerial enabled to true
|
|
|
// Just set MarlinCompositeSerial enabled to true
|
|
@ -59,6 +70,11 @@ void MSC_SD_init() { |
|
|
// Register composite Serial
|
|
|
// Register composite Serial
|
|
|
MarlinCompositeSerial.registerComponent(); |
|
|
MarlinCompositeSerial.registerComponent(); |
|
|
USBComposite.begin(); |
|
|
USBComposite.begin(); |
|
|
|
|
|
#if ENABLED(EMERGENCY_PARSER) |
|
|
|
|
|
//rx is usbSerialPart.endpoints[2]
|
|
|
|
|
|
real_rx_callback = usbSerialPart.endpoints[2].callback; |
|
|
|
|
|
usbSerialPart.endpoints[2].callback = my_rx_callback; |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // USE_USB_COMPOSITE
|
|
|
#endif // USE_USB_COMPOSITE
|
|
|