Display Backlight: automatically adjust to ambient sensor reading
This registers a Task, reading the ambient light sensor and adjusting the display backlight accordingly
fixes #95
Merge request reports
Activity
added 1 commit
- f9996e22 - Display Backlight: automatically adjust to ambient sensor reading
changed milestone to %v1.8
added 3-Module 6 - Needs Review labels
added 3-Epicardium label and removed 3-Module label
- epicardium/modules/brightness.c 0 → 100644
- epicardium/modules/brightness.c 0 → 100644
5 bool _autobrightness_enabled = true; 6 7 void vAutoBrightnessTask(void *pvParameters) 8 { 9 vTaskDelay(pdMS_TO_TICKS(500)); 10 11 while (1) { 12 vTaskDelay(pdMS_TO_TICKS(60000)); 13 if (_autobrightness_enabled) { 14 unsigned short int light; 15 16 while (epic_light_sensor_run() < 0) 17 LOG_CRIT( 18 "autobrightness", 19 "Could not start ambient sensor" 20 ); - epicardium/modules/brightness.c 0 → 100644
1 #include "epicardium.h" 2 #include "modules.h" 3 #include "log.h" 4 5 bool _autobrightness_enabled = true; 6 7 void vAutoBrightnessTask(void *pvParameters) 8 { 9 vTaskDelay(pdMS_TO_TICKS(500)); 10 11 while (1) { 12 vTaskDelay(pdMS_TO_TICKS(60000)); - epicardium/modules/brightness.c 0 → 100644
28 } 29 30 epic_light_sensor_stop(); 31 32 unsigned short int brightness; 33 34 if (light > 199) 35 brightness = 100; 36 else 37 brightness = light / 2 + 1; 38 39 if (epic_disp_open() < 0) 40 continue; 41 42 epic_disp_backlight(brightness); 43 epic_disp_close(); If you solve it in the API, please think on BLE - https://git.card10.badge.events.ccc.de/card10/firmware/merge_requests/255 .
@genofire This needs to be fixed in BLE as well
Fixed in feb7a097.
done in !255
added 6 - Changes Requested label and removed 6 - Needs Review label
Another thing to consider is what happens when an app sets the backlight. With the current implementation, the backlight setting will get overwritten periodically. This is not what we want. I'd suggest that an App writing the backlight will completely disable auto-backlight until a new app is loaded.