diff options
author | Chris Xiong <chirs241097@gmail.com> | 2018-07-06 21:25:39 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2018-07-06 21:25:39 +0800 |
commit | b5932d1d22d35cef95eb1cffbf489619b264442d (patch) | |
tree | 6040dc505e9b22875449bcc045fed9b0ac3f0692 /brightness_ctrl.cpp | |
parent | 61e0a974c07f38b8e42f226d68f22e2d1b26fa6d (diff) | |
download | lightsd-b5932d1d22d35cef95eb1cffbf489619b264442d.tar.xz |
Random code clean-ups to get ready for the next update.
Also tweaked the config a little bit.
Diffstat (limited to 'brightness_ctrl.cpp')
-rw-r--r-- | brightness_ctrl.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/brightness_ctrl.cpp b/brightness_ctrl.cpp index 97f0149..f8e0407 100644 --- a/brightness_ctrl.cpp +++ b/brightness_ctrl.cpp @@ -5,13 +5,13 @@ #define log10_n(x) ((x)<1?0:log10(x)) void BrightnessControl::_brightness_slide(int p) { - //TODO: mutual exclusion + std::lock_guard<std::mutex> adjust_lck(adjust_m); p+=offset; if(p>100)p=100; if(p<0)p=0; int pbr=maxbr*p/100; if(pbr<minabr)pbr=minabr; - printf("brightness adjust: %d->%d/%d\n",br,pbr,maxbr); + LOG('I',"brightness adjust: %d->%d/%d\n",br,pbr,maxbr); int d=1;if(pbr<br)d=-1;double dd=1; while(d>0&&br+round(d*dd)<=pbr||d<0&&br+round(d*dd)>=pbr) { @@ -114,7 +114,6 @@ void BrightnessControl::worker() --cur;lb=cur>0?thresh[cur-1]:0; ub=thresh[cur]; } - printf("%f lx\n",val); brightness_slide(value[cur]); } } |