Almost stable

The daemon is now almost stable, in a few days I should be able to run every needed test on the functions and hopefully clean a bit the code.

I changed a few things on command execution, as daemon start/stop usage remained almost the same:
usage: calised {start [-p NAME], stop, restart, check, version}
 
optional arguments:
-p NAME, --profile NAME use the selected profile

The client-like part uses a completely different syntax layout:
[-h] [-x] [-c] [--restart] [--pause] [--resume] [-s]
[-g info [info ...]] [--grab info [info ...]]
 
optional arguments:
-h, --help show this help message and exit
-x, --start starts the capture thread (if not already started)
-c, --stop stops the capture thread
-s, --set calculate and automatically set backlight step.
Doesn't needs the capture thread to be executed and
if the thread is alive, stops it, captures and then
reloads it
--restart restarts the capture thread
--pause pauses the capture thread
--resume resumes the capture thread
-g info [info ...], --get info [info ...]
for a full list of available informations type: help
(eg. calised --get help)
--grab info [info ...] for a full list of available informations type: help
(eg. calised --grab help)

And finally these are the informations that can be obtained from the daemon:
Available informations:
 
amb|ambient-brightness|brightness Ambient brightness in /255
scr|screen-brightness|screen Screen Brightness in /255
pct|percentage Ambient brightness in percentage
cbs|current-step Current backlight step (real)
stp|bls|step|backlight-step Suggested backlight step
cts|capture-timestamp|timestamp Current/latest capture timestamp
sun|current-sun-state|sun-state Current sun state (dawn,day,...)
nss|next-sun-state Seconds before next sun state

 
And now that you can run your daemon I would like to make a little (verbose) changelog.
I’ve managed to fix the bug that afflicted systems with multiple sysfs backlight directories (most were on Intel chipsets) on “calibration.py” and I added a step to specify local coordinates (latitude and longitude). I also took the opportunity to clean the and fix some imprecisions or minor errors in calibration code (that it’s one of the worst of the project… needs a rewrite soon).

Although the daemon creation started in a quite hackish way (I coded everything from lunch to ehm almost breakfast), I’ve managed to clean it out a bit and now it doesn’t look that bad.
The daemon uses pyephem module to calculate the position of the sun on the horizon, dawn/sunsets and so on; these informations are really useful because with them the program knowns when ambient brightness likely changes more often (dawn/sunset) and so it can be almost nullweight on the system (actually, considering total dawn>day>sunset execution cpu time usage is ~0.01%, considering only dawn/sunset time ~0.09%).
The program considers dawn/sunset time when the sun is between 0° and 15° above the horizon with an average backlight power (my laptop’s is the worst ever…) 15° should be a good value, it’s probable that someone from equator or somewhere near would like to have higher angles, but as I said, backlight power won’t go through its max and so, for example, if ambient brightness at 9.00 is 180 (which probabily corresponds to the max backlight step), even if at 13.00 the brightness reaches 220 the backlight won’t go any further…
And why forgetting about our polar circle / antartic friends…? I’ve created exceptions for the places were the sun never rises or never sets.

This entry was posted in Update and tagged , , , , . Bookmark the permalink.

Comments are closed.