From 31e02655f218443c19a9473c35d66a0643f5cda1 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Thu, 5 Oct 2023 19:24:40 -0500 Subject: [PATCH] Limit HYTE CNVS brightness to 72% of maximum brightness according to V1.1 of protocol documentation. It could be reworked in the future to only limit brightness when the sum exceeds the value, but that would require significantly more math during update --- .../HYTEMousematController/HYTEMousematController.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Controllers/HYTEMousematController/HYTEMousematController.cpp b/Controllers/HYTEMousematController/HYTEMousematController.cpp index ff0ddb551..a0a8f86d7 100644 --- a/Controllers/HYTEMousematController/HYTEMousematController.cpp +++ b/Controllers/HYTEMousematController/HYTEMousematController.cpp @@ -48,6 +48,7 @@ void HYTEMousematController::FirmwareAnimationControl(bool enabled) void HYTEMousematController::StreamingCommand(RGBColor* colors) { unsigned char serial_buf[157]; + unsigned int max_brightness = 72; memset(serial_buf, 0, sizeof(serial_buf)); @@ -61,9 +62,9 @@ void HYTEMousematController::StreamingCommand(RGBColor* colors) for(unsigned int color_idx = 0; color_idx < 50; color_idx++) { - serial_buf[7 + (color_idx * 3)] = RGBGetGValue(colors[color_idx]); - serial_buf[8 + (color_idx * 3)] = RGBGetRValue(colors[color_idx]); - serial_buf[9 + (color_idx * 3)] = RGBGetBValue(colors[color_idx]); + serial_buf[7 + (color_idx * 3)] = ( max_brightness * RGBGetGValue(colors[color_idx]) ) / 100; + serial_buf[8 + (color_idx * 3)] = ( max_brightness * RGBGetRValue(colors[color_idx]) ) / 100; + serial_buf[9 + (color_idx * 3)] = ( max_brightness * RGBGetBValue(colors[color_idx]) ) / 100; } serialport->serial_write((char *)serial_buf, sizeof(serial_buf));