1.2-legacy
Kevin Hester 2021-03-23 13:05:50 +08:00
rodzic 278d82e99a
commit 518241c3c9
2 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -325,7 +325,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
if (newWork.timeoutMillis != 0L) { if (newWork.timeoutMillis != 0L) {
activeTimeout = serviceScope.launch { activeTimeout = serviceScope.launch {
debug("Starting failsafe timer ${newWork.timeoutMillis}") // debug("Starting failsafe timer ${newWork.timeoutMillis}")
delay(newWork.timeoutMillis) delay(newWork.timeoutMillis)
errormsg("Failsafe BLE timer expired!") errormsg("Failsafe BLE timer expired!")
completeWork( completeWork(
@ -415,7 +415,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
if (work == null) if (work == null)
warn("wor completed, but we already killed it via failsafetimer? status=$status, res=$res") warn("wor completed, but we already killed it via failsafetimer? status=$status, res=$res")
else { else {
debug("work ${work.tag} is completed, resuming status=$status, res=$res") // debug("work ${work.tag} is completed, resuming status=$status, res=$res")
if (status != 0) if (status != 0)
work.completion.resumeWithException( work.completion.resumeWithException(
BLEStatusException( BLEStatusException(

Wyświetl plik

@ -374,13 +374,17 @@ class SoftwareUpdateService : JobIntentService(), Logging {
throw DeviceRejectedException() throw DeviceRejectedException()
// Send all the blocks // Send all the blocks
var oldProgress = -1 // used to limit # of log spam
while (firmwareNumSent < firmwareSize) { while (firmwareNumSent < firmwareSize) {
// If we are doing the spiffs partition, we limit progress to a max of 50%, so that the user doesn't think we are done // If we are doing the spiffs partition, we limit progress to a max of 50%, so that the user doesn't think we are done
// yet // yet
val maxProgress = if(flashRegion != FLASH_REGION_APPLOAD) val maxProgress = if(flashRegion != FLASH_REGION_APPLOAD)
50 else 100 50 else 100
sendProgress(context, firmwareNumSent * maxProgress / firmwareSize, isAppload) sendProgress(context, firmwareNumSent * maxProgress / firmwareSize, isAppload)
debug("sending block ${progress}%") if(progress != oldProgress) {
debug("sending block ${progress}%")
oldProgress = progress;
}
var blockSize = 512 - 3 // Max size MTU excluding framing var blockSize = 512 - 3 // Max size MTU excluding framing
if (blockSize > firmwareStream.available()) if (blockSize > firmwareStream.available())