@@ -293,7 +293,7 @@ bool CRFLinkBase::WriteToHardware(const char *pdata, const unsigned char length)
293
293
// _log.Log(LOG_ERROR, "RFLink: subtype: %d", pLed->subtype); // rgbw/rgb/white?
294
294
// _log.Log(LOG_ERROR, "RFLink: id: %d", pLed->id); // id
295
295
// _log.Log(LOG_ERROR, "RFLink: unit: %d", pLed->dunit); // unit 0=All, 1=Group1,2=Group2,3=Group3,4=Group4
296
- // _log.Log(LOG_ERROR, "RFLink: command: %d", pLed->command); // command
296
+ _log.Log (LOG_ERROR, " RFLink: command: %d" , pLed->command ); // command
297
297
// _log.Log(LOG_ERROR, "RFLink: value: %d", pLed->value); // brightness/color value
298
298
299
299
const int m_LEDType = pLed->type ;
@@ -310,12 +310,8 @@ bool CRFLinkBase::WriteToHardware(const char *pdata, const unsigned char length)
310
310
break ;
311
311
case Limitless_SetRGBColour:
312
312
{
313
- // The Hue is inverted/swifted 90 degrees
314
- int iHue = ((255 - pLed->value ) + 192 ) & 0xFF ;
315
- // _log.Log(LOG_ERROR, "RFLink: hue: %d", iHue);
316
- // RGBWSetColor[1] = (unsigned char)iHue;
317
313
m_colorbright = m_colorbright & 0xff ;
318
- m_colorbright = (((unsigned char ) iHue ) << 8 ) + m_colorbright;
314
+ m_colorbright = (((unsigned char )pLed-> value ) << 8 ) + m_colorbright;
319
315
switchcmnd = " COLOR" ;
320
316
}
321
317
break ;
@@ -333,18 +329,18 @@ bool CRFLinkBase::WriteToHardware(const char *pdata, const unsigned char length)
333
329
break ;
334
330
case Limitless_SetBrightnessLevel:
335
331
{
336
- // convert brightness (0-100) to (0-50) to 0-59
337
- double dval = (59.0 / 100.0 )*float (pLed->value / 2 );
338
- int ival = round (dval);
339
- if (ival<2 )
340
- ival = 2 ;
341
- if (ival>27 )
342
- ival = 27 ;
343
- // _log.Log(LOG_ERROR, "RFLink: brightness: %d", ival);
332
+ // brightness (0-100) converted to 0x00-0xff
333
+ int m_brightness = (unsigned char )pLed->value ;
334
+ _log.Log (LOG_ERROR, " RFLink: br1: %04x" , m_brightness); // command
335
+ m_brightness = (m_brightness * 255 ) / 100 ;
336
+ _log.Log (LOG_ERROR, " RFLink: br2: %04x" , m_brightness); // command
337
+ m_brightness = m_brightness & 0xff ;
338
+ _log.Log (LOG_ERROR, " RFLink: br3: %04x" , m_brightness); // command
344
339
m_colorbright = m_colorbright & 0xff00 ;
345
- m_colorbright = m_colorbright + (unsigned char ) ival;
340
+ // m_colorbright = m_colorbright + (unsigned char)pLed->value;
341
+ m_colorbright = m_colorbright + (unsigned char )m_brightness;
342
+ _log.Log (LOG_ERROR, " RFLink: command: %04x" , m_colorbright); // command
346
343
switchcmnd = " BRIGHT" ;
347
- // RGBWSetBrightnessLevel[1] = (unsigned char)ival;
348
344
}
349
345
break ;
350
346
0 commit comments