FS#12506 - Attempt to emulate the charge/ discharge cycle more completely.
Attached to Project:
Rockbox
Opened by Nick Peskett (nickp) - Tuesday, 03 January 2012, 08:56 GMT
Last edited by Nick Peskett (nickp) - Sunday, 08 January 2012, 12:20 GMT
Opened by Nick Peskett (nickp) - Tuesday, 03 January 2012, 08:56 GMT
Last edited by Nick Peskett (nickp) - Sunday, 08 January 2012, 12:20 GMT
|
DetailsCurrently the simulator only emulates cycling the battery level without setting the charger states.
In addition, this cycling was only advanced when battery_status_update is called. This patch sets up an independent mock battery thread which handles continually discharging the battery, emulating a charger being attached, charging the battery and then trickle charging for a defined period (if CONFIG_CHARGING is defined and high enough). The motivation for this change was to enable all battery/power states to be tested when designing skins. |
This task depends upon
Closed by Nick Peskett (nickp)
Sunday, 08 January 2012, 12:20 GMT
Reason for closing: Accepted
Additional comments about closing: r31635
Sunday, 08 January 2012, 12:20 GMT
Reason for closing: Accepted
Additional comments about closing: r31635
FS#12502supersedes this.I couldn't see any emulation of chargers in there, so thought the two patches were fairly unrelated and could co-exist.
At the moment I'm having problems compiling
FS#12502for a sim though, I left a comment.Try it for yourself: Build a Clip+ sim, watch the battery icon until it's empty, when it starts charging again there ought to be a power plug icon (charger attached). Ideally, when full, it would then spend some time "trickle" charging when complete so you can also see the external power attached icon.
I'd prefer to keep this patch open until there's something in trunk that makes it possible to test theme charging icons using the simulator.
Is there something about the implementation that makes you keen to close it? I'm going to have to resync anyway, is there something you'd like changed?
I think the thread-based battery discharger/ charger is a cleaner solution than hacking battery_status_update, after all it's simulating something that is a sort of external thread IRL (i.e the battery itself and the hand plugging in a charger).
This approach also makes the trickle charge phase easier to implement too.
I've tested it with a few targets now and it seems ok, is there anything that might cause problems with RaaA?
FWIW, I don't think another thread is needed. The power thread calls battery_update_status() periodically so I don't see the need for another thread. But even then, there's the "sim_tasks" thread which exists explicitly to drive some simulation functionalities so that could be used as well.
Also, abusing storage_init() is nasty. We don't want that.