Skip to content

Commit

Permalink
ddp sets brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Dec 6, 2024
1 parent 37a7c7a commit 2cf3c37
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/cmnds/cmd_newLEDDriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,11 @@ void LED_NextDimmerHold() {
void LED_SetDimmerForDisplayOnly(int iVal) {
g_brightness0to100 = iVal;
}
void LED_SetDimmerIfChanged(int iVal) {
if (g_brightness0to100 != iVal) {
LED_SetDimmer(iVal);
}
}
void LED_SetDimmer(int iVal) {

g_brightness0to100 = iVal;
Expand Down
1 change: 1 addition & 0 deletions src/cmnds/cmd_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void LED_SetTemperature(int tmpInteger, bool bApply);
float LED_GetTemperature0to1Range();
void LED_SetTemperature0to1Range(float f);
void LED_SetDimmer(int iVal);
void LED_SetDimmerIfChanged(int iVal);
void LED_SetDimmerForDisplayOnly(int iVal);
commandResult_t LED_SetBaseColor(const void* context, const char* cmd, const char* args, int bAll);
void LED_SetFinalCW(byte c, byte w);
Expand Down
1 change: 1 addition & 0 deletions src/driver/drv_ddp.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void DDP_Parse(byte *data, int len) {
} else
#endif
{
LED_SetDimmerIfChanged(100);
if (data[9] == 4) {
LED_SetFinalRGBW(r, g, b, data[13]);
}
Expand Down
10 changes: 9 additions & 1 deletion src/selftest/selftest_led.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,14 +622,22 @@ void Test_LEDDriver_RGB(int firstChannel) {
SELFTEST_ASSERT_CHANNEL(firstChannel+1, 0);
SELFTEST_ASSERT_CHANNEL(firstChannel+2, 79);

// set 100% brightness - FIXME
// set 100% brightness
CMD_ExecuteCommand("led_dimmer 100", 0);
// Added for https://www.elektroda.com/rtvforum/viewtopic.php?p=21335096#21335096
DDP_SimulatePacket("41030001000000000003FFFFFF");
SELFTEST_ASSERT_CHANNEL(firstChannel, 100);
SELFTEST_ASSERT_CHANNEL(firstChannel + 1, 100);
SELFTEST_ASSERT_CHANNEL(firstChannel + 2, 100);

// set 50% brightness - DDP shall reset it to 100
CMD_ExecuteCommand("led_dimmer 50", 0);
// Added for https://www.elektroda.com/rtvforum/viewtopic.php?p=21335096#21335096
DDP_SimulatePacket("41030001000000000003FFFFFF");
SELFTEST_ASSERT_CHANNEL(firstChannel, 100);
SELFTEST_ASSERT_CHANNEL(firstChannel + 1, 100);
SELFTEST_ASSERT_CHANNEL(firstChannel + 2, 100);

DDP_SimulatePacket("41030001000000000003FFFF00");
SELFTEST_ASSERT_CHANNEL(firstChannel, 100);
SELFTEST_ASSERT_CHANNEL(firstChannel + 1, 100);
Expand Down

0 comments on commit 2cf3c37

Please sign in to comment.