Logging info and adding zeroed speed initialisation to fix #1241

* Adding zeroed speed initialisation to modes that do not support speed to avoid bad save values in profile
* Bad values in saved profile will corrupt brightness calculation on load.
* Aligning profile version and header string
* Adding profile validation logging
* Adding success / failure logging for each controller when attempting to load profile

Commit amended by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
Chris 2021-04-10 23:41:46 +10:00 committed by Adam Honse
parent e08c63a3c0
commit 4ae8ea94ea
3 changed files with 24 additions and 0 deletions

View file

@ -263,6 +263,17 @@ void RGBController_MSIMysticLight162::SetupMode(const char *name, MSI_MODE mod,
Mode.speed_max = MSI_SPEED_HIGH;
Mode.speed_min = MSI_SPEED_LOW;
}
else
{
/*---------------------------------------------------------*\
| For modes without speed this needs to be set to avoid |
| bad values in the saved profile which in turn corrupts |
| the brightness calculation when loading the profile |
\*---------------------------------------------------------*/
Mode.speed = 0;
Mode.speed_max = 0;
Mode.speed_min = 0;
}
modes.push_back(Mode);
}

View file

@ -271,6 +271,17 @@ void RGBController_MSIMysticLight185::SetupMode(const char *name, MSI_MODE mod,
Mode.speed_max = MSI_SPEED_HIGH;
Mode.speed_min = MSI_SPEED_LOW;
}
else
{
/*---------------------------------------------------------*\
| For modes without speed this needs to be set to avoid |
| bad values in the saved profile which in turn corrupts |
| the brightness calculation when loading the profile |
\*---------------------------------------------------------*/
Mode.speed = 0;
Mode.speed_max = 0;
Mode.speed_min = 0;
}
modes.push_back(Mode);
}

View file

@ -654,10 +654,12 @@ bool OptionProfile(std::string argument, std::vector<RGBController *> &rgb_contr
RGBController* device = rgb_controllers[controller_idx];
device->DeviceUpdateMode();
LOG_DEBUG("Updating mode for %s to %i", device->name.c_str(), device->active_mode);
if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED)
{
device->DeviceUpdateLEDs();
LOG_DEBUG("Mode uses per-LED color, also updating LEDs");
}
}