Tiny Core Base > CorePlus
Battery monitor or icon?
Juanito:
updated watcher posted - thanks
On my machine (dell e7240) running tc-10.x, I get this:
--- Code: ---$ ls /sys/class/power_supply/BAT0
alarm current_now present uevent
capacity cycle_count serial_number voltage_min_design
capacity_level device status voltage_now
charge_full manufacturer subsystem
charge_full_design model_name technology
charge_now power/ type
--- End code ---
..and:
--- Code: ---$ ls /sys/class/power_supply/AC
device online power/ subsystem type uevent
--- End code ---
It looks like watcher is calculating C% from either charge_now or energy_now divided by either charge_full or energy_full.
I get 1742000/2457000=71%, but the watcher display varies slowly between 6.7% and 7.2% - i.e. a factor of 10 out?
Rich:
Hi Juanito
The calculation code looks correct:
--- Code: ---sprintf(batmsg, " %.1f%%B", (float)(batnow / batfull) * 100);
--- End code ---
BAT0 looks like the correct value to pass to watcher.
Rich:
Hi Juanito
--- Quote --- ... It looks like watcher is calculating C% from either charge_now or energy_now divided by either charge_full or energy_full. ...
--- End quote ---
You mean %B. %C is the CPU. Did you start watcher like this:
--- Code: ---watcher -bat BAT0
--- End code ---
to tell it where to find the battery?
Juanito:
doh :-[
It works now (and matches flit) - thanks
..but constantly repeats this to stdout:
--- Code: ---$ ./watcher -bat BAT0
Error opening batinfo /sys/class/power_supply/BAT0/energy_now
Error opening batinfo /sys/class/power_supply/BAT0/energy_full
--- End code ---
Rich:
Hi Juanito
Maybe I should remove that error message? It seemed like a good idea at the time but it really isn't an error unless the
fallback values (charge_now and charge_full) can't be read. It's late here but if you'd like I'll clean up the error handling
and submit an update tomorrow.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version