Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs/src
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2018-06-20 15:08:41 +0300
committerVojtech Kral <vojtech@kral.hk>2018-06-20 18:31:29 +0300
commitf8bbfad1523e2630a7f34de969c02f45c0bd5e06 (patch)
treea9585c550528085a1d362af61d4521a6e04ff0c6 /xs/src
parentcea5b97cad63e8e5af7f32f4bfba053f60a5efe6 (diff)
avrdude: Line noise prevention on MK3 xflash boot
Diffstat (limited to 'xs/src')
-rw-r--r--xs/src/avrdude/arduino.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/xs/src/avrdude/arduino.c b/xs/src/avrdude/arduino.c
index fc9f4571f..5a9cb465e 100644
--- a/xs/src/avrdude/arduino.c
+++ b/xs/src/avrdude/arduino.c
@@ -99,7 +99,7 @@ static int prusa_init_external_flash(PROGRAMMER * pgm)
avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer did not boot up on time or serial communication failed\n", progname);
return -1;
} else if (strncmp(buffer, entry_magic_send, recv_size) != 0) {
- avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer emitted incorrect start code\n", progname);
+ avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer emitted incorrect start code: `%*s`\n", progname, recv_size, buffer);
return -1;
}
@@ -116,7 +116,7 @@ static int prusa_init_external_flash(PROGRAMMER * pgm)
avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer did not boot up on time or serial communication failed\n", progname);
return -1;
} else if (strncmp(buffer, entry_magic_cfm, recv_size) != 0) {
- avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer emitted incorrect start code\n", progname);
+ avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer emitted incorrect cfm code: `%*s`\n", progname, recv_size, buffer);
return -1;
}
@@ -140,6 +140,13 @@ static int arduino_open(PROGRAMMER * pgm, char * port)
serial_set_dtr_rts(&pgm->fd, 1);
usleep(50*1000);
+ // Sometimes there may be line noise generating input on the printer's USB-to-serial IC
+ // Here we try to clean its input buffer with a sequence of newlines (a minimum of 9 is needed):
+ const char cleanup_newlines[] = "\n\n\n\n\n\n\n\n\n\n";
+ if (serial_send(&pgm->fd, cleanup_newlines, sizeof(cleanup_newlines) - 1) < 0) {
+ return -1;
+ }
+
/*
* drain any extraneous input
*/