Fix incorrect speed calculation
This commit is contained in:
parent
2094aebfa8
commit
295caf58ef
1 changed files with 2 additions and 2 deletions
|
@ -81,7 +81,7 @@ abstract class UsbWriteService(name: String) : IntentService(name) {
|
||||||
if (time <= prevTime + 1000)
|
if (time <= prevTime + 1000)
|
||||||
return
|
return
|
||||||
|
|
||||||
val speed = ((bytes - prevBytes).toDouble() / (time - prevTime).toDouble()).toHRSize()
|
val speed = ((bytes - prevBytes).toDouble() / (time - prevTime).toDouble() * 1000).toHRSize()
|
||||||
prevTime = time
|
prevTime = time
|
||||||
prevBytes = bytes
|
prevBytes = bytes
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ abstract class UsbWriteService(name: String) : IntentService(name) {
|
||||||
.setContentText("$usbDevice may have been unplugged while writing.")
|
.setContentText("$usbDevice may have been unplugged while writing.")
|
||||||
.setSubText(dt.toHRTime())
|
.setSubText(dt.toHRTime())
|
||||||
else {
|
else {
|
||||||
val speed = (dt.toDouble() / bytes.toDouble()).toHRSize() + "/s"
|
val speed = (bytes.toDouble() / dt.toDouble() * 1000).toHRSize() + "/s"
|
||||||
b.setContentTitle("Write finished")
|
b.setContentTitle("Write finished")
|
||||||
.setContentText("$filename successfully written to $usbDevice")
|
.setContentText("$filename successfully written to $usbDevice")
|
||||||
.setSubText("${dt.toHRTime()} • ${bytes.toHRSize()} • $speed")
|
.setSubText("${dt.toHRTime()} • ${bytes.toHRSize()} • $speed")
|
||||||
|
|
Loading…
Reference in a new issue