Convert mode from struct to class, add automatic initialization

* To avoid filtering in the profile manager and to ensure that color_mode is set to MODE_COLORS_RANDOM correctly
for HW that has the mode flags

MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_PER_LED_COLOR

The values for speed_min, speed_max, colors_min and colors_max NEED to be initialised to allow for a saved
profile to load correctly in `ProfileManager::LoadDeviceFromListWithOptions`

Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
Chris 2021-06-26 14:47:34 +10:00 committed by Adam Honse
parent cdcc2995b9
commit b76265cf7d
2 changed files with 26 additions and 3 deletions

View file

@ -3,6 +3,22 @@
using namespace std::chrono_literals;
mode::mode()
{
name = "";
value = 0;
flags = 0;
speed_min = 0;
speed_max = 0;
colors_min = 1;
colors_max = 1;
}
mode::~mode()
{
colors.clear();
}
RGBController::RGBController()
{
DeviceThreadRunning = true;

View file

@ -61,10 +61,11 @@ enum
};
/*------------------------------------------------------------------*\
| Mode Type |
| Mode Class |
\*------------------------------------------------------------------*/
typedef struct
class mode
{
public:
/*--------------------------------------------------------------*\
| Mode Information |
\*--------------------------------------------------------------*/
@ -84,7 +85,13 @@ typedef struct
unsigned int color_mode; /* Mode color selection */
std::vector<RGBColor>
colors; /* mode-specific colors */
} mode;
/*--------------------------------------------------------------*\
| Mode Constructor / Destructor |
\*--------------------------------------------------------------*/
mode();
~mode();
};
typedef struct
{