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-30 07:42:42 -0700
commit8bbb3dfe4241b200cc37420ed45d7303a99c8b27 (patch)
treeab70c58fc1510216da37f53932d16939f3d77f52 /uemis-downloader.c
parente9ba8f0ff60144dd71bfb4e305a3a41dde2722f5 (diff)
downloadsubsurface-8bbb3dfe4241b200cc37420ed45d7303a99c8b27.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 adf555a7c..64fb1c6da 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -814,6 +814,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;
@@ -831,7 +838,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);
}