Fix a bug in Nollie1

This commit is contained in:
诺诺 2024-08-05 16:21:04 +00:00 committed by Adam Honse
parent b398dcdcf9
commit 4bc14630e9
3 changed files with 21 additions and 1 deletions

View file

@ -45,6 +45,20 @@ unsigned short NollieController::GetUSBPID()
return(usb_pid);
}
void NollieController::InitChLEDs(int *led_num_list,int ch_num)
{
unsigned char usb_buf[65];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[1] = 0xFE;
usb_buf[2] = 0x03;
for(int i = 0; i < ch_num; i++)
{
usb_buf[3+(i*2)] = led_num_list[i]& 0xFF;
usb_buf[4+(i*2)] = (led_num_list[i] >> 8) & 0xFF;
}
hid_write(dev, usb_buf, 65);
}
void NollieController::SetMos(bool mos)
{
unsigned char usb_buf[65];

View file

@ -57,6 +57,7 @@ public:
std::string GetSerialString();
unsigned short GetUSBPID();
void SetMos(bool mos);
void InitChLEDs(int *led_num_list,int ch_num);
void SendUpdate();
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
private:

View file

@ -165,7 +165,12 @@ void RGBController_Nollie::ResizeZone(int zone, int new_size)
controller->SetMos(true);
}
}
// Nollie1 needs to report the number of LEDs
if(controller->GetUSBPID() == NOLLIE1_PID)
{
controller->InitChLEDs(&new_size,NOLLIE1_CHANNELS_NUM);
}
if((size_t) zone >= zones.size())
{
return;