bitcraze / crazyflie2-ios-client

The Crazyflie 2.0 iOS client
36 stars 36 forks source link

Prevent auto-lock during firmware update #3

Closed cstanke closed 5 years ago

cstanke commented 8 years ago

If the iPhone is set to auto-lock (possible settings are from 30 seconds to 5 minutes), and a user doesn't actively tap the screen periodically to keep the iPhone awake, updating may fail due to BLE disconnect.

At 2 to 4 minutes nRF51 will be broken. 4 to 5 minutes the STM32F will be broken. Preventing auto-lock will alleviate this issue. See forum thread here.

Also, it might be a good idea to recommend plugging the phone into a power source (maybe if charge is less than 50% or something) to prevent a disconnect from battery exhaustion.

ataffanel commented 8 years ago

Thanks, this is a good input. We can prevent sleep and put a warning for the battery.

I cannot work on the ios app right now (the mac is at the office ...) so the rest is a bookmark:

Apparently preventing sleep is done with the idleTimerDisabled property: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/#//apple_ref/occ/instp/UIApplication/idleTimerDisabled

Reading the battery level with UIDevice: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/batteryLevel

matthewspear commented 5 years ago

@ataffanel given #24 was closed merged – I think this can be closed?

ataffanel commented 5 years ago

Yes this can be closed now. Thanks!