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

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2018-05-22 13:54:46 +0300
committerbubnikv <bubnikv@gmail.com>2018-06-19 19:46:37 +0300
commit1602ddd56cca7a77d3d893c49df7efca926d108b (patch)
tree8a1c77df1d454c018a977d538357b6f26377df8a /xs
parent478488972c7832c669f7ae7c47360555c95a7e7d (diff)
avrdude: Reduce retries to make timeout time more reasonable
Diffstat (limited to 'xs')
-rw-r--r--xs/src/avrdude/libavrdude.h2
-rw-r--r--xs/src/avrdude/stk500v2.c17
2 files changed, 7 insertions, 12 deletions
diff --git a/xs/src/avrdude/libavrdude.h b/xs/src/avrdude/libavrdude.h
index e8197f9c2..238f59615 100644
--- a/xs/src/avrdude/libavrdude.h
+++ b/xs/src/avrdude/libavrdude.h
@@ -737,7 +737,7 @@ extern bool cancel_flag;
#define RETURN_IF_CANCEL() \
do { \
if (cancel_flag) { \
- avrdude_message(MSG_INFO, "%s(): Cancelled, exiting...\n", __func__); \
+ avrdude_message(MSG_INFO, "avrdude: %s(): Cancelled, exiting...\n", __func__); \
return -99; \
} \
} while (0)
diff --git a/xs/src/avrdude/stk500v2.c b/xs/src/avrdude/stk500v2.c
index d3acb639c..4d62640c0 100644
--- a/xs/src/avrdude/stk500v2.c
+++ b/xs/src/avrdude/stk500v2.c
@@ -79,7 +79,7 @@
#define SERIAL_TIMEOUT 2
// Retry count
-#define RETRIES 5
+#define RETRIES 0
#if 0
#define DEBUG(...) avrdude_message(MSG_INFO, __VA_ARGS__)
@@ -745,7 +745,7 @@ static int stk500v2_recv(PROGRAMMER * pgm, unsigned char *msg, size_t maxsize) {
-static int stk500v2_getsync_internal(PROGRAMMER * pgm, int retries) {
+int stk500v2_getsync(PROGRAMMER * pgm) {
int tries = 0;
unsigned char buf[1], resp[32];
int status;
@@ -804,7 +804,7 @@ retry:
progname, pgmname[PDATA(pgm)->pgmtype]);
return 0;
} else {
- if (tries > retries) {
+ if (tries > RETRIES) {
avrdude_message(MSG_INFO, "%s: stk500v2_getsync(): can't communicate with device: resp=0x%02x\n",
progname, resp[0]);
return -6;
@@ -814,7 +814,7 @@ retry:
// or if we got a timeout
} else if (status == -1) {
- if (tries > retries) {
+ if (tries > RETRIES) {
avrdude_message(MSG_INFO, "%s: stk500v2_getsync(): timeout communicating with programmer\n",
progname);
return -1;
@@ -823,7 +823,7 @@ retry:
// or any other error
} else {
- if (tries > retries) {
+ if (tries > RETRIES) {
avrdude_message(MSG_INFO, "%s: stk500v2_getsync(): error communicating with programmer: (%d)\n",
progname,status);
} else
@@ -833,11 +833,6 @@ retry:
return 0;
}
-int stk500v2_getsync(PROGRAMMER * pgm) {
- // This is to avoid applying RETRIES exponentially
- return stk500v2_getsync_internal(pgm, RETRIES);
-}
-
static int stk500v2_command(PROGRAMMER * pgm, unsigned char * buf,
size_t len, size_t maxlen) {
int i;
@@ -947,7 +942,7 @@ retry:
}
// otherwise try to sync up again
- status = stk500v2_getsync_internal(pgm, 1);
+ status = stk500v2_getsync(pgm);
if (status != 0) {
if (tries > RETRIES) {
avrdude_message(MSG_INFO, "%s: stk500v2_command(): failed miserably to execute command 0x%02x\n",