summaryrefslogtreecommitdiffstats
path: root/uemis-downloader.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-20 22:30:04 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-20 23:28:04 -0700
commit79f15e913b9029205686ef6c080eb136ff99e0cf (patch)
tree56e7c94829f56eb118db339e98402e74f121229f /uemis-downloader.c
parent4bccee238cec25ed9053bc8605c2af4c2c9569b4 (diff)
downloadsubsurface-79f15e913b9029205686ef6c080eb136ff99e0cf.tar.gz
Uemis downloader: allow continuing download by clicking Retry
When we run out of space in the Uemis filesystem we return an error. The user could reasonably unplug the SDA, insert it again and then retry to continue the download (that's what we tell them to do). In that case we need to make sure we start at the correct dive otherwise the same dives keep getting downloaded over and over again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis-downloader.c')
-rw-r--r--uemis-downloader.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c
index 8f3549c97..7fae71f26 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -816,6 +816,13 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
return true;
}
+static int max_diveid_from_dialog;
+
+void uemis_set_max_diveid_from_dialog(int diveid)
+{
+ max_diveid_from_dialog = diveid;
+}
+
static char *uemis_get_divenr(char *deviceidstr)
{
uint32_t deviceid, maxdiveid = 0;
@@ -833,7 +840,7 @@ static char *uemis_get_divenr(char *deviceidstr)
maxdiveid = dc->diveid;
}
}
- snprintf(divenr, 10, "%d", maxdiveid);
+ snprintf(divenr, 10, "%d", maxdiveid > max_diveid_from_dialog ? maxdiveid : max_diveid_from_dialog);
return strdup(divenr);
}