@@ -34,8 +34,11 @@ RGBController_Sinowealth::RGBController_Sinowealth(SinowealthController* control
3434 version = controller->GetFirmwareVersion ();
3535
3636 mode Static;
37- Static.name = " Static" ;
38- Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
37+ Static.name = " Custom" ;
38+ Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE;
39+ Static.brightness_min = GLORIOUS_BRIGHTNESS_LOW;
40+ Static.brightness = GLORIOUS_BRIGHTNESS_NORMAL;
41+ Static.brightness_max = GLORIOUS_BRIGHTNESS_HIGH;
3942 Static.color_mode = MODE_COLORS_PER_LED;
4043 Static.value = GLORIOUS_MODE_STATIC;
4144 modes.push_back (Static);
@@ -48,7 +51,7 @@ RGBController_Sinowealth::RGBController_Sinowealth(SinowealthController* control
4851 modes.push_back (Off);
4952
5053 mode Rainbow;
51- Rainbow.name = " Glorious Mode " ;
54+ Rainbow.name = " Rainbow " ;
5255 Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_AUTOMATIC_SAVE;
5356 Rainbow.speed_min = GLORIOUS_SPEED_SLOW;
5457 Rainbow.speed = GLORIOUS_SPEED_NORMAL;
@@ -73,10 +76,13 @@ RGBController_Sinowealth::RGBController_Sinowealth(SinowealthController* control
7376
7477 mode Chase;
7578 Chase.name = " Tail" ;
76- Chase.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
79+ Chase.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE;
7780 Chase.speed_min = GLORIOUS_SPEED_SLOW;
7881 Chase.speed = GLORIOUS_SPEED_NORMAL;
7982 Chase.speed_max = GLORIOUS_SPEED_FAST;
83+ Chase.brightness_min = GLORIOUS_BRIGHTNESS_LOW;
84+ Chase.brightness = GLORIOUS_BRIGHTNESS_NORMAL;
85+ Chase.brightness_max = GLORIOUS_BRIGHTNESS_HIGH;
8086 Chase.color_mode = MODE_COLORS_NONE;
8187 Chase.value = GLORIOUS_MODE_TAIL;
8288 modes.push_back (Chase);
@@ -93,10 +99,13 @@ RGBController_Sinowealth::RGBController_Sinowealth(SinowealthController* control
9399
94100 mode Flashing;
95101 Flashing.name = " Rave" ;
96- Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
102+ Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
97103 Flashing.speed_min = GLORIOUS_SPEED_SLOW;
98104 Flashing.speed = GLORIOUS_SPEED_NORMAL;
99105 Flashing.speed_max = GLORIOUS_SPEED_FAST;
106+ Flashing.brightness_min = GLORIOUS_BRIGHTNESS_LOW;
107+ Flashing.brightness = GLORIOUS_BRIGHTNESS_NORMAL;
108+ Flashing.brightness_max = GLORIOUS_BRIGHTNESS_HIGH;
100109 Flashing.colors_min = 2 ;
101110 Flashing.colors_max = 2 ;
102111 Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
@@ -111,22 +120,25 @@ RGBController_Sinowealth::RGBController_Sinowealth(SinowealthController* control
111120 Epilepsy.value = GLORIOUS_MODE_EPILEPSY;
112121 modes.push_back (Epilepsy);
113122
114- mode RainbowSlow;
115- RainbowSlow.name = " Wave" ;
116- RainbowSlow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_AUTOMATIC_SAVE;
117- RainbowSlow.speed_min = GLORIOUS_SPEED_SLOW;
118- RainbowSlow.speed = GLORIOUS_SPEED_NORMAL;
119- RainbowSlow.speed_max = GLORIOUS_SPEED_FAST;
120- RainbowSlow.color_mode = MODE_COLORS_NONE;
121- RainbowSlow.value = GLORIOUS_MODE_WAVE;
122- modes.push_back (RainbowSlow);
123+ mode Wave;
124+ Wave.name = " Wave" ;
125+ Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE;
126+ Wave.speed_min = GLORIOUS_SPEED_SLOW;
127+ Wave.speed = GLORIOUS_SPEED_NORMAL;
128+ Wave.speed_max = GLORIOUS_SPEED_FAST;
129+ Wave.brightness_min = GLORIOUS_BRIGHTNESS_LOW;
130+ Wave.brightness = GLORIOUS_BRIGHTNESS_NORMAL;
131+ Wave.brightness_max = GLORIOUS_BRIGHTNESS_HIGH;
132+ Wave.color_mode = MODE_COLORS_NONE;
133+ Wave.value = GLORIOUS_MODE_WAVE;
134+ modes.push_back (Wave);
123135
124136 mode Breathing;
125137 Breathing.name = " Breathing" ;
126138 Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
127- Breathing.speed_min = GLORIOUS_MODE_BREATING_SLOW ;
128- Breathing.speed = GLORIOUS_MODE_BREATING_NORMAL ;
129- Breathing.speed_max = GLORIOUS_MODE_BREATING_FAST ;
139+ Breathing.speed_min = GLORIOUS_SPEED_SLOW ;
140+ Breathing.speed = GLORIOUS_SPEED_NORMAL ;
141+ Breathing.speed_max = GLORIOUS_SPEED_FAST ;
130142 Breathing.colors_min = 1 ;
131143 Breathing.colors_max = 1 ;
132144 Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
@@ -178,7 +190,7 @@ void RGBController_Sinowealth::ResizeZone(int /*zone*/, int /*new_size*/)
178190
179191void RGBController_Sinowealth::DeviceUpdateLEDs ()
180192{
181- controller-> SetLEDColor (&colors[ 0 ] );
193+ DeviceUpdateMode ( );
182194}
183195
184196void RGBController_Sinowealth::UpdateZoneLEDs (int /* zone*/ )
@@ -194,51 +206,44 @@ void RGBController_Sinowealth::UpdateSingleLED(int /*led*/)
194206void RGBController_Sinowealth::DeviceUpdateMode ()
195207{
196208 unsigned int direction = 0 ;
197- unsigned int speed = GLORIOUS_SPEED_NORMAL;
209+ unsigned int speed = GLORIOUS_SPEED_FAST;
210+ unsigned int brightness = GLORIOUS_BRIGHTNESS_HIGH;
198211
199- if (modes[active_mode].value == GLORIOUS_MODE_STATIC )
212+ if (modes[active_mode].flags & MODE_FLAG_HAS_SPEED )
200213 {
214+ speed = modes[active_mode].speed ;
215+ }
201216
217+ if (modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS)
218+ {
219+ brightness = modes[active_mode].brightness ;
202220 }
203- else
221+
222+ if ((modes[active_mode].flags & MODE_FLAG_HAS_DIRECTION_LR) ||
223+ (modes[active_mode].flags & MODE_FLAG_HAS_DIRECTION_UD) ||
224+ (modes[active_mode].flags & MODE_FLAG_HAS_DIRECTION_HV))
204225 {
205226 if (modes[active_mode].direction == MODE_DIRECTION_UP)
206- {
207- direction = GLORIOUS_DIRECTION_DOWN;
208- }
209- else
210227 {
211228 direction = GLORIOUS_DIRECTION_UP;
212229 }
213-
214- if ((modes[active_mode].speed == GLORIOUS_SPEED_FAST) ||
215- (modes[active_mode].speed == GLORIOUS_SPEED_SLOW) ||
216- (modes[active_mode].speed == GLORIOUS_SPEED_NORMAL))
217- {
218- speed = modes[active_mode].speed ;
219- }
220230 else
221231 {
222- if ((modes[active_mode].speed == GLORIOUS_MODE_BREATING_FAST) ||
223- (modes[active_mode].speed == GLORIOUS_MODE_BREATING_SLOW) ||
224- (modes[active_mode].speed == GLORIOUS_MODE_BREATING_NORMAL))
225- {
226- speed = modes[active_mode].speed ;
227- }
228- else
229- {
230- speed = GLORIOUS_SPEED_NORMAL;
231- }
232+ direction = GLORIOUS_DIRECTION_DOWN;
232233 }
234+ }
233235
234- if (modes[active_mode].color_mode == MODE_COLORS_NONE)
235- {
236- controller->SetMode (modes[active_mode].value , speed, direction, 0 );
237- }
238- else
239- {
240- controller->SetMode (modes[active_mode].value , speed, direction, &modes[active_mode].colors [0 ]);
241- }
236+ if (modes[active_mode].color_mode == MODE_COLORS_NONE)
237+ {
238+ controller->SetMode (modes[active_mode].value , speed, brightness, direction, 0 );
239+ }
240+ else if (modes[active_mode].color_mode == MODE_COLORS_PER_LED)
241+ {
242+ controller->SetMode (modes[active_mode].value , speed, brightness, direction, &colors[0 ]);
243+ }
244+ else
245+ {
246+ controller->SetMode (modes[active_mode].value , speed, brightness, direction, &modes[active_mode].colors [0 ]);
242247 }
243248}
244249
0 commit comments