fixed indentation issues
This commit is contained in:
parent
57ae1fbbed
commit
35ac14a0ea
3 changed files with 28 additions and 15 deletions
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
[*.{c,cpp,cxx,h,hh}]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.py]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
ambientd
|
ambientd
|
||||||
|
.ccls-cache
|
||||||
|
|
|
||||||
21
ambientd.c
21
ambientd.c
|
|
@ -130,15 +130,15 @@ int main (void)
|
||||||
brightness_delta = ABS((float)(brightness_target - brightness_old)/brightness_old);
|
brightness_delta = ABS((float)(brightness_target - brightness_old)/brightness_old);
|
||||||
|
|
||||||
// if the brightness changes by more than 10% reduce the user offset, scaling
|
// if the brightness changes by more than 10% reduce the user offset, scaling
|
||||||
// with the delta, this accounts for large changes in brightness no longer
|
// with the delta, this accounts for large changes in brightness no longer
|
||||||
// corresponding to the adjustments that the user made to the brightness
|
// corresponding to the adjustments that the user made to the brightness
|
||||||
if (brightness_delta > 0.1) {
|
if (brightness_delta > 0.1) {
|
||||||
user_offset = user_offset * MAX(MIN(1-(brightness_delta*1.2), 1), 0);
|
user_offset = user_offset * MAX(MIN(1-(brightness_delta*1.2), 1), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
brightness_adjusted = MIN(MAX(brightness_target + user_offset, min_brightness), max_brightness);
|
brightness_adjusted = MIN(MAX(brightness_target + user_offset, min_brightness), max_brightness);
|
||||||
// TODO: put this in write_int() function
|
// TODO: put this in write_int() function
|
||||||
x = snprintf(STR_BUFFER, sizeof(STR_BUFFER), "%d", brightness_adjusted);
|
x = snprintf(STR_BUFFER, sizeof(STR_BUFFER), "%d", brightness_adjusted);
|
||||||
if (x <= 0) {
|
if (x <= 0) {
|
||||||
fprintf(stderr, "Error in snprintf(): %s\n", strerror(errno));
|
fprintf(stderr, "Error in snprintf(): %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
@ -159,13 +159,12 @@ int main (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
off = actual_brightness - brightness_target;
|
off = actual_brightness - brightness_target;
|
||||||
if (brightness_target != max_brightness || off < 0){
|
if (brightness_target != max_brightness || off < 0){
|
||||||
user_offset = off;
|
user_offset = off;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: option to turn off logging
|
// TODO: option to turn off logging
|
||||||
printf("brightness target: %d; user offset: %d; brightness adjusted: %d\n", brightness_target, user_offset, brightness_adjusted);
|
printf("brightness target: %d; user offset: %d; brightness adjusted: %d\n", brightness_target, user_offset, brightness_adjusted);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue