-
-
Notifications
You must be signed in to change notification settings - Fork 99
Channel Selection, Bugfix #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,13 +87,31 @@ void LEDStrip::Initialize(char* ledstring) | |
|
||
void LEDStrip::InitializeHuePlus(char* ledstring) | ||
{ | ||
strcpy(led_string, ledstring); | ||
|
||
LPSTR source = NULL; | ||
LPSTR numleds = NULL; | ||
LPSTR next = NULL; | ||
|
||
source = strtok_s(ledstring, ",", &next); | ||
strcpy(led_string, ledstring); | ||
|
||
LPSTR source = NULL; | ||
LPSTR channels = NULL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's up with this alignment? :) You tried to align the first two and then gave up with the rest |
||
LPSTR numleds = NULL; | ||
LPSTR next = NULL; | ||
|
||
source = strtok_s(ledstring, ",", &next); | ||
|
||
//Check for selected channel 0=both, 1= Ch.1, 2= Ch.2 | ||
if (strlen(next)) | ||
{ | ||
channels = strtok_s(next, ",", &next); | ||
} | ||
switch (atoi(channels)) { | ||
case 0: | ||
channel = 0x00; | ||
break; | ||
case 1: | ||
channel = 0x01; | ||
break; | ||
case 2: | ||
channel = 0x02; | ||
break; | ||
} | ||
|
||
//Check for the number of LEDs, sets the corresponding variable with the counter for the fans | ||
if (strlen(next)) | ||
|
@@ -274,17 +292,17 @@ void LEDStrip::SetLEDsHuePlus(COLORREF pixels[64][256]) | |
if (serialport != NULL) | ||
{ | ||
unsigned char *serial_buf; | ||
|
||
serial_buf = new unsigned char[250]; //Size of Message always 5 XX Blocks (Mode Selection) + 3 XX for each LED (1 color) | ||
serial_buf = new unsigned char[hueSize]; //Size of Message always 5 XX Blocks (Mode Selection) + 3 XX for each LED (1 color) | ||
//-> max of 40 LEDs per Channel (or 5 Fans a 8 LEDs) -> 125 Blocks (empty LEDs are written, too) | ||
|
||
serial_buf[0] = 0x4b; | ||
serial_buf[1] = 0x00; | ||
serial_buf[2] = 0x0e; | ||
serial_buf[1] = channel; | ||
serial_buf[2] = 0x0e; | ||
serial_buf[3] = fans; | ||
serial_buf[4] = 0x00; | ||
|
||
for (int i = 5; i < 250; i++) | ||
for (int i = 5; i < hueSize; i++) | ||
{ | ||
//clearing the buf otherwise sometimes strange things are written to the COM Port | ||
serial_buf[i] = 0x00; | ||
|
@@ -299,7 +317,7 @@ void LEDStrip::SetLEDsHuePlus(COLORREF pixels[64][256]) | |
serial_buf[idx + 7] = GetBValue(color); | ||
} | ||
|
||
serialport->serial_write((char *)serial_buf,250); | ||
serialport->serial_write((char *)serial_buf,hueSize); | ||
serialport->serial_flush_tx(); | ||
|
||
delete[] serial_buf; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,6 +182,7 @@ | |
<ClCompile Include="..\KeyboardVisualizerCommon\LogitechSDK.cpp" /> | ||
<ClCompile Include="..\KeyboardVisualizerCommon\MSIKeyboard.cpp" /> | ||
<ClCompile Include="..\KeyboardVisualizerCommon\net_port.cpp" /> | ||
<ClCompile Include="..\KeyboardVisualizerCommon\PoseidonZRGBKeyboard.cpp" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this should be merged to master yet, along with the other Poseidon include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just thought could be nice cause the project can't be build unless you manually add the poseidonz files to the project. Regarding the other things. I will update my code :) |
||
<ClCompile Include="..\KeyboardVisualizerCommon\RazerChroma.cpp" /> | ||
<ClCompile Include="..\KeyboardVisualizerCommon\serial_port.cpp" /> | ||
<ClCompile Include="..\KeyboardVisualizerCommon\SteelSeriesGameSense.cpp" /> | ||
|
@@ -199,6 +200,7 @@ | |
<ClInclude Include="..\KeyboardVisualizerCommon\LogitechSDK.h" /> | ||
<ClInclude Include="..\KeyboardVisualizerCommon\MSIKeyboard.h" /> | ||
<ClInclude Include="..\KeyboardVisualizerCommon\net_port.h" /> | ||
<ClInclude Include="..\KeyboardVisualizerCommon\PoseidonZRGBKeyboard.h" /> | ||
<ClInclude Include="..\KeyboardVisualizerCommon\RazerChroma.h" /> | ||
<ClInclude Include="..\KeyboardVisualizerCommon\serial_port.h" /> | ||
<ClInclude Include="..\KeyboardVisualizerCommon\SteelSeriesGameSense.h" /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TABs instead of spaces