mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
0b29e73e2e
* Start battery stat plugin * BatteryStat & kobolight * Several minor improvements * Remove a useless function * flush settings * Some review feedbacks * Resolve review comments * Remaining Minutes -> Remaining Hours * Add dump_file * typo * realpath * realpath on folder * Remove useless os.time() * Resolve review comments * warning * Add BatteryStat.debugging flag * treat log as txt * Minor improvement * Charging hour should be positive * Use warn instead of info * onSuspend in Kobo * Charging events for kobo and kindle * More events * dumpOrLog * Warnings * Typo * More space * Singleton * slightly format change * BatteryStat singleton * Init * Remove debugging flag * sleeping percentage is still negative * Read settings * Do not need to change was_suspending and was_charging * Typo * Remove debugging flag * Not charging should happen before suspend * Resolve review comments * was_suspend and was_charging should be updated each time in onCallback()
25 lines
522 B
Lua
25 lines
522 B
Lua
local BasePowerD = require("device/generic/powerd")
|
|
local _, android = pcall(require, "android")
|
|
|
|
local AndroidPowerD = BasePowerD:new{
|
|
fl_min = 0, fl_max = 25,
|
|
fl_intensity = 10,
|
|
}
|
|
|
|
function AndroidPowerD:init()
|
|
end
|
|
|
|
function AndroidPowerD:setIntensityHW()
|
|
android.setScreenBrightness(math.floor(255 * self.fl_intensity / 25))
|
|
end
|
|
|
|
function AndroidPowerD:getCapacityHW()
|
|
return android.getBatteryLevel()
|
|
end
|
|
|
|
function AndroidPowerD:isChargingHW()
|
|
return android.isCharging()
|
|
end
|
|
|
|
return AndroidPowerD
|