Fix binary protocol with one serial port (#13270)

- The `sdcard.transfer_port` variable is Marlin's internal serial port index, not the physical serial port number.
- Added packet number to "ok" response so hosts don't need to wait for the ACK.
- Renamed feature to `BINARY_FILE_TRANSFER`, as the speed up is only consequential to the ability to transfer binaries over serial.
This commit is contained in:
Chris Pepper 2019-02-28 01:57:48 +00:00 committed by Scott Lahteine
parent ab781de5a0
commit 4ab433d391
78 changed files with 124 additions and 121 deletions

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -834,7 +834,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -839,7 +839,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -834,7 +834,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -843,7 +843,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -834,7 +834,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -839,7 +839,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -840,7 +840,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -836,7 +836,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -848,7 +848,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -836,7 +836,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -837,7 +837,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -835,7 +835,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -836,7 +836,7 @@
#endif #endif
// Add an optimized binary file transfer mode, initiated with 'M28 B1' // Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define FAST_FILE_TRANSFER //#define BINARY_FILE_TRANSFER
#endif // SDSUPPORT #endif // SDSUPPORT

View file

@ -52,6 +52,13 @@ void GcodeSuite::M115() {
#endif #endif
); );
// BINARY_FILE_TRANSFER (M28 B1)
cap_line(PSTR("BINARY_FILE_TRANSFER")
#if ENABLED(BINARY_FILE_TRANSFER)
, true
#endif
);
// EEPROM (M500, M501) // EEPROM (M500, M501)
cap_line(PSTR("EEPROM") cap_line(PSTR("EEPROM")
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)

View file

@ -282,7 +282,7 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
serial_count[port] = 0; serial_count[port] = 0;
} }
#if ENABLED(FAST_FILE_TRANSFER) #if ENABLED(BINARY_FILE_TRANSFER)
inline bool serial_data_available(const uint8_t index) { inline bool serial_data_available(const uint8_t index) {
switch (index) { switch (index) {
@ -398,16 +398,12 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
stream_state = StreamState::PACKET_RESET; stream_state = StreamState::PACKET_RESET;
bytes_received = 0; bytes_received = 0;
time_stream_start = millis(); time_stream_start = millis();
SERIAL_ECHO("echo: Datastream initialized ("); SERIAL_ECHOPAIR("echo: Datastream initialized (", stream_header.filesize);
SERIAL_ECHO(stream_header.filesize); SERIAL_ECHOLNPGM(" bytes expected)");
SERIAL_ECHOLN("Bytes expected)"); SERIAL_ECHOLNPAIR("so", buffer_size); // confirm active stream and the maximum block size supported
SERIAL_ECHO("so"); // confirm active stream and the maximum block size supported
SERIAL_CHAR(static_cast<uint8_t>(buffer_size & 0xFF));
SERIAL_CHAR(static_cast<uint8_t>((buffer_size >> 8) & 0xFF));
SERIAL_CHAR('\n');
} }
else { else {
SERIAL_ECHOLN("echo: Datastream initialization error (invalid token)"); SERIAL_ECHO_MSG("Datastream init error (invalid token)");
stream_state = StreamState::STREAM_FAILED; stream_state = StreamState::STREAM_FAILED;
} }
buffer_next_index = 0; buffer_next_index = 0;
@ -423,7 +419,7 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
stream_state = StreamState::PACKET_DATA; stream_state = StreamState::PACKET_DATA;
} }
else { else {
SERIAL_ECHO("echo: Datastream packet out of order"); SERIAL_ECHO_MSG("Datastream packet out of order");
stream_state = StreamState::PACKET_FLUSHRX; stream_state = StreamState::PACKET_FLUSHRX;
} }
} }
@ -431,61 +427,60 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
case StreamState::PACKET_DATA: case StreamState::PACKET_DATA:
if (!stream_read(data)) break; if (!stream_read(data)) break;
if (buffer_next_index < buffer_size) { if (buffer_next_index < buffer_size)
buffer[buffer_next_index] = data; buffer[buffer_next_index] = data;
}
else { else {
SERIAL_ECHO("echo: Datastream packet data buffer overrun"); SERIAL_ECHO_MSG("Datastream packet data buffer overrun");
stream_state = StreamState::STREAM_FAILED; stream_state = StreamState::STREAM_FAILED;
break; break;
} }
packet.checksum = checksum(packet.checksum, data); packet.checksum = checksum(packet.checksum, data);
packet.bytes_received ++; packet.bytes_received++;
buffer_next_index ++; buffer_next_index++;
if (packet.bytes_received == packet.header.size) { if (packet.bytes_received == packet.header.size)
stream_state = StreamState::PACKET_VALIDATE; stream_state = StreamState::PACKET_VALIDATE;
}
break; break;
case StreamState::PACKET_VALIDATE: case StreamState::PACKET_VALIDATE:
if (packet.header.checksum == packet.checksum) { if (packet.header.checksum == packet.checksum) {
packet_retries = 0; packet_retries = 0;
packets_received ++; packets_received++;
bytes_received += packet.header.size; bytes_received += packet.header.size;
if (packet.header.id == 0) { // id 0 is always the stream descriptor if (packet.header.id == 0) // id 0 is always the stream descriptor
stream_state = StreamState::STREAM_HEADER; // defer packet confirmation to STREAM_HEADER state stream_state = StreamState::STREAM_HEADER; // defer packet confirmation to STREAM_HEADER state
}
else { else {
if (bytes_received < stream_header.filesize) { if (bytes_received < stream_header.filesize) {
stream_state = StreamState::PACKET_RESET; // reset and receive next packet stream_state = StreamState::PACKET_RESET; // reset and receive next packet
SERIAL_ECHOLN("ok"); // transmit confirm packet received and valid token SERIAL_ECHOLNPGM("ok"); // transmit confirm packet received and valid token
SERIAL_ECHOLN(packet.header.id);
} }
else { else
stream_state = StreamState::STREAM_COMPLETE; // no more data required stream_state = StreamState::STREAM_COMPLETE; // no more data required
}
if (card.write(buffer, buffer_next_index) < 0) { if (card.write(buffer, buffer_next_index) < 0) {
stream_state = StreamState::STREAM_FAILED; stream_state = StreamState::STREAM_FAILED;
SERIAL_ECHO("echo: IO ERROR"); SERIAL_ECHO_MSG("SDCard IO Error");
break; break;
}; };
} }
} }
else { else {
SERIAL_ECHO("echo: Block("); SERIAL_ECHO_START();
SERIAL_ECHO(packet.header.id); SERIAL_ECHOPAIR("Block(", packet.header.id);
SERIAL_ECHOLN(") Corrupt"); SERIAL_ECHOLNPGM(") Corrupt");
stream_state = StreamState::PACKET_FLUSHRX; stream_state = StreamState::PACKET_FLUSHRX;
} }
break; break;
case StreamState::PACKET_RESEND: case StreamState::PACKET_RESEND:
if (packet_retries < MAX_RETRIES) { if (packet_retries < MAX_RETRIES) {
packet_retries ++; packet_retries++;
stream_state = StreamState::PACKET_RESET; stream_state = StreamState::PACKET_RESET;
SERIAL_ECHO("echo: Resend request "); SERIAL_ECHO_START();
SERIAL_ECHOLN(packet_retries); SERIAL_ECHOLNPAIR("Resend request ", int(packet_retries));
SERIAL_ECHOLN("rs"); // transmit resend packet token SERIAL_ECHOLNPAIR("rs", packet.header.id); // transmit resend packet token
} }
else { else {
stream_state = StreamState::STREAM_FAILED; stream_state = StreamState::STREAM_FAILED;
@ -501,27 +496,28 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
packet.timeout = millis() + STREAM_MAX_WAIT; packet.timeout = millis() + STREAM_MAX_WAIT;
break; break;
case StreamState::PACKET_TIMEOUT: case StreamState::PACKET_TIMEOUT:
SERIAL_ECHOLN("echo: Datastream timeout"); SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Datastream timeout");
stream_state = StreamState::PACKET_RESEND; stream_state = StreamState::PACKET_RESEND;
break; break;
case StreamState::STREAM_COMPLETE: case StreamState::STREAM_COMPLETE:
stream_state = StreamState::STREAM_RESET; stream_state = StreamState::STREAM_RESET;
card.flag.binary_mode = false; card.flag.binary_mode = false;
card.closefile(); SERIAL_ECHO_START();
SERIAL_ECHO("echo: ");
SERIAL_ECHO(card.filename); SERIAL_ECHO(card.filename);
SERIAL_ECHO(" transfer completed @ "); SERIAL_ECHOPAIR(" transfer completed @ ", ((bytes_received / (millis() - time_stream_start) * 1000) / 1024));
SERIAL_ECHO(((bytes_received / (millis() - time_stream_start) * 1000) / 1024 )); SERIAL_ECHOLNPGM("KiB/s");
SERIAL_ECHOLN("KiB/s"); SERIAL_ECHOLNPGM("sc"); // transmit stream complete token
SERIAL_ECHOLN("sc"); // transmit stream complete token card.closefile();
return; return;
case StreamState::STREAM_FAILED: case StreamState::STREAM_FAILED:
stream_state = StreamState::STREAM_RESET; stream_state = StreamState::STREAM_RESET;
card.flag.binary_mode = false; card.flag.binary_mode = false;
card.closefile(); card.closefile();
card.removeFile(card.filename); card.removeFile(card.filename);
SERIAL_ECHOLN("echo: File transfer failed"); SERIAL_ECHO_START();
SERIAL_ECHOLN("sf"); // transmit stream failed token SERIAL_ECHOLNPGM("File transfer failed");
SERIAL_ECHOLNPGM("sf"); // transmit stream failed token
return; return;
} }
} }
@ -536,7 +532,7 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
} binaryStream{}; } binaryStream{};
#endif // FAST_FILE_TRANSFER #endif // BINARY_FILE_TRANSFER
FORCE_INLINE bool is_M29(const char * const cmd) { FORCE_INLINE bool is_M29(const char * const cmd) {
return cmd[0] == 'M' && cmd[1] == '2' && cmd[2] == '9' && !WITHIN(cmd[3], '0', '9'); return cmd[0] == 'M' && cmd[1] == '2' && cmd[2] == '9' && !WITHIN(cmd[3], '0', '9');
@ -555,7 +551,7 @@ inline void get_serial_commands() {
#endif #endif
; ;
#if ENABLED(FAST_FILE_TRANSFER) #if ENABLED(BINARY_FILE_TRANSFER)
if (card.flag.saving && card.flag.binary_mode) { if (card.flag.saving && card.flag.binary_mode) {
/** /**
* For binary stream file transfer, use serial_line_buffer as the working * For binary stream file transfer, use serial_line_buffer as the working

View file

@ -175,7 +175,7 @@ void GcodeSuite::M27() {
*/ */
void GcodeSuite::M28() { void GcodeSuite::M28() {
#if ENABLED(FAST_FILE_TRANSFER) #if ENABLED(BINARY_FILE_TRANSFER)
bool binary_mode = false; bool binary_mode = false;
char *p = parser.string_arg; char *p = parser.string_arg;

View file

@ -51,7 +51,7 @@ card_flags_t CardReader::flag;
char CardReader::filename[FILENAME_LENGTH], CardReader::longFilename[LONG_FILENAME_LENGTH]; char CardReader::filename[FILENAME_LENGTH], CardReader::longFilename[LONG_FILENAME_LENGTH];
int8_t CardReader::autostart_index; int8_t CardReader::autostart_index;
#if ENABLED(FAST_FILE_TRANSFER) && NUM_SERIAL > 1 #if ENABLED(BINARY_FILE_TRANSFER) && NUM_SERIAL > 1
int8_t CardReader::transfer_port; int8_t CardReader::transfer_port;
#endif #endif

View file

@ -42,7 +42,7 @@ typedef struct {
detected:1, detected:1,
filenameIsDir:1, filenameIsDir:1,
abort_sd_printing:1 abort_sd_printing:1
#if ENABLED(FAST_FILE_TRANSFER) #if ENABLED(BINARY_FILE_TRANSFER)
, binary_mode:1 , binary_mode:1
#endif #endif
; ;
@ -145,11 +145,11 @@ public:
static char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH]; static char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
static int8_t autostart_index; static int8_t autostart_index;
#if ENABLED(FAST_FILE_TRANSFER) #if ENABLED(BINARY_FILE_TRANSFER)
#if NUM_SERIAL > 1 #if NUM_SERIAL > 1
static int8_t transfer_port; static int8_t transfer_port;
#else #else
static constexpr int8_t transfer_port = SERIAL_PORT; static constexpr int8_t transfer_port = 0;
#endif #endif
#endif #endif

View file

@ -36,7 +36,7 @@ opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING \
AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \ SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \
FWRETRACT ARC_P_CIRCLES ADVANCED_PAUSE_FEATURE CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ FWRETRACT ARC_P_CIRCLES ADVANCED_PAUSE_FEATURE CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \
POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE FAST_FILE_TRANSFER \ POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE BINARY_FILE_TRANSFER \
LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST PINS_DEBUGGING \ LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST PINS_DEBUGGING \
MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CODEPENDENT_XY_HOMING BACKLASH_COMPENSATION BACKLASH_GCODE MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CODEPENDENT_XY_HOMING BACKLASH_COMPENSATION BACKLASH_GCODE
opt_set FANMUX0_PIN 53 opt_set FANMUX0_PIN 53