@@ -98,15 +98,7 @@ void CorsairCommanderCoreController::InitController()
9898 command_res_size = packet_size - 4 ;
9999 }
100100
101- /* -----------------------------------------------------*\
102- | Wake up device |
103- \*-----------------------------------------------------*/
104- command[0 ] = 0x01 ;
105- command[1 ] = 0x03 ;
106- unsigned char cmd_data[2 ] = {0x00 , 0x02 };
107- SendCommand (command, cmd_data, 2 , NULL );
108-
109- SetFanMode ();
101+ SetFanMode (false );
110102}
111103
112104std::string CorsairCommanderCoreController::GetFirmwareString ()
@@ -394,14 +386,17 @@ void CorsairCommanderCoreController::SetDirectColor
394386 }
395387}
396388
397- void CorsairCommanderCoreController::SetFanMode ()
389+ void CorsairCommanderCoreController::SetFanMode (bool external_rgb_port )
398390{
399391 controller_ready = 0 ;
400392 DeviceGuardLock _ = guard_manager_ptr->AwaitExclusiveAccess ();
401393
402- /* --------------------------------------------------------------------------------------------------*\
403- | Force controller to 6 QL fan mode to expose maximum number of LEDs per rgb port (34 LEDs per port) |
404- \*--------------------------------------------------------------------------------------------------*/
394+ /* -----------------------------------------------------*\
395+ | Force controller to 6 QL fan mode to expose maximum |
396+ | number of LEDs per rgb port (34 LEDs per port) |
397+ \*-----------------------------------------------------*/
398+ unsigned int index = 3 ;
399+ unsigned int max_index = 15 ;
405400 unsigned char endpoint[2 ] = {0x1E , 0x00 };
406401 unsigned char data_type[2 ] = {0x0D , 0x00 };
407402
@@ -415,32 +410,56 @@ void CorsairCommanderCoreController::SetFanMode()
415410 buf[0 ] = 0x07 ;
416411 if (pid == CORSAIR_COMMANDER_CORE_XT_PID)
417412 {
418- /* -----------------------------------------------------*\
419- | Commander Core XT external RGB port |
420- \*-----------------------------------------------------*/
421- buf[1 ] = 0x01 ;
422- buf[2 ] = 0x01 ;
413+ /* -------------------------------------------------*\
414+ | Commander Core XT external RGB port |
415+ \*-------------------------------------------------*/
416+ if (external_rgb_port)
417+ {
418+ /* ---------------------------------------------*\
419+ | Enable external port |
420+ \*---------------------------------------------*/
421+ buf[1 ] = 0x01 ;
422+ buf[2 ] = 0x01 ;
423+ }
424+ else
425+ {
426+ /* ---------------------------------------------*\
427+ | Shift packet start position and maximum index |
428+ \*---------------------------------------------*/
429+ buf[1 ] = 0x00 ;
430+ buf[2 ] = 0x00 ;
431+ index = 2 ;
432+ max_index = 14 ;
433+ }
423434 }
424435 else
425436 {
426- /* ----------------------------------------------------- *\
427- | Commander Core, Set AIO mode |
428- \*----------------------------------------------------- */
437+ /* -------------------------------------------------*\
438+ | Commander Core, Set AIO mode |
439+ \*-------------------------------------------------*/
429440 buf[1 ] = 0x01 ;
430441 buf[2 ] = 0x08 ;
431442 }
432443
433444 /* -----------------------------------------------------*\
434445 | SET fan modes |
435446 \*-----------------------------------------------------*/
436- for (unsigned int i = 3 ; i < 15 ; i = i + 2 )
447+ for (unsigned int i = index ; i < max_index ; i = i + 2 )
437448 {
438449 buf[i] = 0x01 ;
439450 buf[i + 1 ] = 0x06 ;
440451 }
441452
442453 WriteData (endpoint, data_type, buf, 15 );
443454 controller_ready = 1 ;
455+
456+ /* -----------------------------------------------------*\
457+ | Wake up device, needs to be done after setting fan |
458+ | mode to reinitialize device if fan mode has changed |
459+ \*-----------------------------------------------------*/
460+ unsigned char command[2 ] = {0x01 , 0x03 };
461+ unsigned char cmd_data[2 ] = {0x00 , 0x02 };
462+ SendCommand (command, cmd_data, 2 , NULL );
444463}
445464
446465void CorsairCommanderCoreController::SetLedAmount (int led_amount)
0 commit comments