Remove hard coded list of Polychrome firmware versions as it seems all firmwares 1.x and 2.x use ASR LED protocol and 3.x+ use Polychrome

This commit is contained in:
Adam Honse 2020-05-12 14:46:11 -05:00
parent 70e83c13cc
commit cad356efca
2 changed files with 18 additions and 69 deletions

View file

@ -15,65 +15,25 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
this->bus = bus;
this->dev = dev;
switch (GetFirmwareVersion())
unsigned short fw_version = GetFirmwareVersion();
/*-----------------------------------------------------*\
| Determine whether the device uses ASR LED or |
| Polychrome protocol by checking firmware version. |
| Versions 1.xx and 2.xx use ASR LED, 3.xx uses |
| Polychrome |
\*-----------------------------------------------------*/
if((fw_version >> 8) < 0x03)
{
case FIRMWARE_VER_1_PT_5:
led_count = 1;
asr_led = true;
strcpy(device_name, "ASRock ASR LED FW 1.5");
break;
case FIRMWARE_VER_1_PT_10:
led_count = 1;
asr_led = true;
strcpy(device_name, "ASRock ASR LED FW 1.10");
break;
case FIRMWARE_VER_2_PT_00:
led_count = 1;
asr_led = true;
strcpy(device_name, "ASRock ASR LED FW 2.00");
break;
case FIRMWARE_VER_2_PT_08:
led_count = 1;
asr_led = true;
strcpy(device_name, "ASRock ASR LED FW 2.08");
break;
case FIRMWARE_VER_2_PT_10:
led_count = 1;
asr_led = true;
strcpy(device_name, "ASRock ASR LED FW 2.10");
break;
case FIRMWARE_VER_3_PT_00:
led_count = 1;
asr_led = false;
strcpy(device_name, "ASRock Polychrome FW 3.00");
break;
case FIRMWARE_VER_3_PT_04:
led_count = 1;
asr_led = false;
strcpy(device_name, "ASRock Polychrome FW 3.04");
break;
default:
unsigned short fw_version = GetFirmwareVersion();
printf("Polychrome FW Version: %04X\r\n", fw_version);
led_count = 1;
strcpy(device_name, "ASRock ASR LED/Polychrome Device");
if((fw_version >> 8) < 0x03)
{
asr_led = true;
}
else
{
asr_led = false;
}
break;
snprintf(device_name, 32, "ASRock ASR LED FW %d.%02d", (fw_version >> 8), (fw_version & 0xFF));
led_count = 1;
asr_led = true;
}
else
{
snprintf(device_name, 32, "ASRock Polychrome FW %d.%02d", (fw_version >> 8), (fw_version & 0xFF));
led_count = 1;
asr_led = false;
}
}