+ pnd_device_set_charger_enable ( bc_charge_devices, 1 );
+ }
+
+ // for some unknown reason it just stops charging randomly (happens once per week or so),
+ // and does not restart, resulting in a flat battery if machine is unattended.
+ // What seems to help here is writing to chip registers, we can do it here indirectly
+ // by writing to enable. Doing it occasionally should do no harm even with missing charger.
+ if ( batlevel <= bc_startcap && (unsigned int)(now - last_charge_worka) > 20*60 ) {
+ pnd_log ( pndn_debug, "Charge workaround trigger\n" );
+ pnd_device_set_charger_enable ( bc_charge_devices, 1 );
+ last_charge_worka = now;