brightness log 0..5 + log - release

This commit is contained in:
Philippe G
2020-05-27 17:01:33 -07:00
parent 26a2519451
commit a5a0cbc557
6 changed files with 10 additions and 9 deletions

View File

@@ -646,12 +646,13 @@ static void grfb_handler(u8_t *data, int len) {
pkt->brightness = htons(pkt->brightness);
xSemaphoreTake(displayer.mutex, portMAX_DELAY);
if (pkt->brightness < 0) {
// LMS driver sends 0..5 value, we assume driver is highly log
if (pkt->brightness <= 0) {
GDS_DisplayOff(display);
} else {
GDS_DisplayOn(display);
GDS_SetContrast(display, pkt->brightness);
GDS_SetContrast(display, 255 * powf(pkt->brightness / 5.0f, 3));
}
xSemaphoreGive(displayer.mutex);