Fix serial port issues on Linux and add proper Direct mode to NZXT Hue+
This commit is contained in:
parent
e7dc95313f
commit
18aa3d35cb
4 changed files with 7 additions and 4 deletions
|
|
@ -169,7 +169,7 @@ void HuePlusController::SetChannelLEDs
|
|||
/*-----------------------------------------------------*\
|
||||
| Send color data |
|
||||
\*-----------------------------------------------------*/
|
||||
SendPacket(channel, HUE_PLUS_MODE_FIXED, false, 0, 0, num_colors, &color_data[0]);
|
||||
SendPacket(channel, HUE_PLUS_MODE_DIRECT, false, 0, 0, num_colors, &color_data[0]);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
|
|
@ -187,7 +187,7 @@ void HuePlusController::SendPacket
|
|||
unsigned char* color_data
|
||||
)
|
||||
{
|
||||
unsigned char serial_buf[125];
|
||||
unsigned char serial_buf[HUE_PLUS_PACKET_SIZE];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
|
|
@ -233,5 +233,5 @@ void HuePlusController::SendPacket
|
|||
/*-----------------------------------------------------*\
|
||||
| Delay to allow Hue+ device to ready for next packet |
|
||||
\*-----------------------------------------------------*/
|
||||
std::this_thread::sleep_for(20ms);
|
||||
std::this_thread::sleep_for(5ms);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ enum
|
|||
HUE_PLUS_MODE_CANDLELIGHT = 0x09, /* Candlelight mode */
|
||||
HUE_PLUS_MODE_WINGS = 0x0C, /* Wings mode */
|
||||
HUE_PLUS_MODE_WAVE = 0x0D, /* Wave mode */
|
||||
HUE_PLUS_MODE_DIRECT = 0x0E, /* Direct mode */
|
||||
};
|
||||
|
||||
class HuePlusController
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ RGBController_HuePlus::RGBController_HuePlus(HuePlusController* hueplus_ptr)
|
|||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = HUE_PLUS_MODE_FIXED;
|
||||
Direct.value = HUE_PLUS_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,9 @@ int serial_port::serial_write(char * buffer, int length)
|
|||
#ifdef __linux__
|
||||
|
||||
int byteswritten;
|
||||
tcdrain(file_descriptor);
|
||||
byteswritten = write(file_descriptor, buffer, length);
|
||||
tcdrain(file_descriptor);
|
||||
return byteswritten;
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue