From 32317510ad4450d35f6d9d7e1dbd9956b061bae7 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 10 Sep 2021 16:06:58 +0200 Subject: [PATCH] wip --- slsDetectorServers/slsDetectorServer/src/common.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index 7c8168df0..e59b08801 100644 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -258,8 +258,17 @@ int verifyChecksumFromFlash(char *mess, char *clientChecksum, char *fname, // the first time, extra bytes are read ssize_t totalBytesRead = bytes - 1; char lastByte = buf[0]; - // bytes = 128 + int oldProgress = 0; + while (bytes > 0) { + + int progress = (int)(((double)(totalBytesRead) / fsize) * 100); + if (oldProgress != progress) { + printf("%d%%\r", progress); + fflush(stdout); + oldProgress = progress; + } + buf[0] = lastByte; // shift by 4 bits to the left for (int i = 0; i < bytes; ++i) {