@@ -52,18 +52,27 @@ extern "C" void app_main(void) {
5252 // enable fading and exponential dimming on all channels
5353 using Ch = espp::Lp5817::Channel;
5454 for (auto ch : {Ch::OUT0, Ch::OUT1, Ch::OUT2}) {
55+ // enable output on the channel
56+ if (!lp.set_output_enable (ch, true , ec)) {
57+ logger.error (" Failed to enable output on channel {}: {}" , ch, ec.message ());
58+ return ;
59+ }
60+ // set the dot current (DC) according to how much current you want to drive
61+ uint8_t dc_value = 0x50 ; // about 80/255 of max current
62+ if (!lp.set_dot_current (ch, dc_value, ec)) {
63+ logger.error (" Failed to set dot-current on channel {}: {}" , ch, ec.message ());
64+ return ;
65+ }
66+ // enable fading on the channel
5567 if (!lp.set_fade_enable (ch, true , ec)) {
5668 logger.error (" Failed to enable fading on channel {}: {}" , ch, ec.message ());
5769 return ;
5870 }
71+ // enable exponential dimming on the channel
5972 if (!lp.set_exponential_dimming_enable (ch, true , ec)) {
6073 logger.error (" Failed to enable exponential dimming on channel {}: {}" , ch, ec.message ());
6174 return ;
6275 }
63- if (!lp.set_output_enable (ch, true , ec)) {
64- logger.error (" Failed to enable output on channel {}: {}" , ch, ec.message ());
65- return ;
66- }
6776 }
6877
6978 // Latch the settings (update)
0 commit comments