From fd59f8355668d89c3a8d0822ee5ef2a134718278 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Wed, 12 Feb 2020 14:51:07 -0600 Subject: [PATCH] Update Crucial controller to new RGBController format --- .../CrucialControllerDetect.cpp | 2 +- RGBController/RGBController_Crucial.cpp | 74 +++++++++---------- RGBController/RGBController_Crucial.h | 6 +- 3 files changed, 38 insertions(+), 44 deletions(-) diff --git a/Controllers/CrucialController/CrucialControllerDetect.cpp b/Controllers/CrucialController/CrucialControllerDetect.cpp index 09ab18cbe..c8ca80947 100644 --- a/Controllers/CrucialController/CrucialControllerDetect.cpp +++ b/Controllers/CrucialController/CrucialControllerDetect.cpp @@ -16,7 +16,7 @@ static const unsigned char crucial_addresses[] = 0x20, 0x21, 0x22, - 0x22 + 0x23 }; diff --git a/RGBController/RGBController_Crucial.cpp b/RGBController/RGBController_Crucial.cpp index fe7ade612..a031cc39f 100644 --- a/RGBController/RGBController_Crucial.cpp +++ b/RGBController/RGBController_Crucial.cpp @@ -9,22 +9,6 @@ #include "RGBController_Crucial.h" -int RGBController_Crucial::GetMode() -{ - return 0; -} - -void RGBController_Crucial::SetMode(int mode) -{ - mode = ((mode+1) << 4) | 0x0F; - crucial->SetMode(mode); -} - -void RGBController_Crucial::SetCustomMode() -{ - -} - void RGBController_Crucial::UpdateLEDs() { crucial->SetAllColorsDirect(&colors[0]); @@ -50,74 +34,74 @@ RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr) mode Shift; Shift.name = "Shift"; - //Shift.value = CRUCIAL_MODE_SHIFT; - //Shift.flags = 0; + Shift.value = CRUCIAL_MODE_SHIFT; + Shift.flags = 0; modes.push_back(Shift); mode GradientShift; GradientShift.name = "Gradient Shift"; - //GradientShift.value = CRUCIAL_MODE_GRADIENT_SHIFT; - //GradientShift.flags = 0; + GradientShift.value = CRUCIAL_MODE_GRADIENT_SHIFT; + GradientShift.flags = 0; modes.push_back(GradientShift); mode Fill; Fill.name = "Fill"; - //Fill.value = CRUCIAL_MODE_FILL; - //Fill.flags = 0; + Fill.value = CRUCIAL_MODE_FILL; + Fill.flags = 0; modes.push_back(Fill); mode Stack; Stack.name = "Stack"; - //Stack.value = CRUCIAL_MODE_STACK; - //Stack.flags = 0; + Stack.value = CRUCIAL_MODE_STACK; + Stack.flags = 0; modes.push_back(Stack); mode DoubleStack; DoubleStack.name = "Double Stack"; - //DoubleStack.value = CRUCIAL_MODE_DOUBLE_STACK; - //DoubleStack.flags = 0; + DoubleStack.value = CRUCIAL_MODE_DOUBLE_STACK; + DoubleStack.flags = 0; modes.push_back(DoubleStack); mode Breathing; Breathing.name = "Breathing"; - //Breathing.value = CRUCIAL_MODE_BREATHING; - //Breathing.flags = 0; + Breathing.value = CRUCIAL_MODE_BREATHING; + Breathing.flags = 0; modes.push_back(Breathing); mode MotionPoint; MotionPoint.name = "Motion Point"; - //MotionPoint.value = CRUCIAL_MODE_MOTION_POINT; - //MotionPoint.flags = 0; + MotionPoint.value = CRUCIAL_MODE_MOTION_POINT; + MotionPoint.flags = 0; modes.push_back(MotionPoint); mode InsideOut; InsideOut.name = "Inside Out"; - //InsideOut.value = CRUCIAL_MODE_INSIDE_OUT; - //InsideOut.flags = 0; + InsideOut.value = CRUCIAL_MODE_INSIDE_OUT; + InsideOut.flags = 0; modes.push_back(InsideOut); mode ColorStep; ColorStep.name = "Color Step"; - //ColorStep.value = CRUCIAL_MODE_COLOR_STEP; - //ColorStep.flags = 0; + ColorStep.value = CRUCIAL_MODE_COLOR_STEP; + ColorStep.flags = 0; modes.push_back(ColorStep); mode WaterWave; WaterWave.name = "Water Wave (Color Blending)"; - //WaterWave.value = CRUCIAL_MODE_WATER_WAVE; - //WaterWave.flags = 0; + WaterWave.value = CRUCIAL_MODE_WATER_WAVE; + WaterWave.flags = 0; modes.push_back(WaterWave); mode Flashing; Flashing.name = "Flashing"; - //Flashing.value = CRUCIAL_MODE_FLASHING; - //Flashing.flags = 0; + Flashing.value = CRUCIAL_MODE_FLASHING; + Flashing.flags = 0; modes.push_back(Flashing); mode Static; Static.name = "Static"; - //Static.value = CRUCIAL_MODE_STATIC; - //Static.flags = 0; + Static.value = CRUCIAL_MODE_STATIC; + Static.flags = 0; modes.push_back(Static); zone new_zone; @@ -141,3 +125,13 @@ RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr) zones.push_back(new_zone); } + +void RGBController_Crucial::SetCustomMode() +{ + active_mode = 0; +} + +void RGBController_Crucial::UpdateMode() +{ + crucial->SetMode(modes[active_mode].value); +} \ No newline at end of file diff --git a/RGBController/RGBController_Crucial.h b/RGBController/RGBController_Crucial.h index f19d74b41..ddcb8aed2 100644 --- a/RGBController/RGBController_Crucial.h +++ b/RGBController/RGBController_Crucial.h @@ -16,13 +16,13 @@ class RGBController_Crucial : public RGBController { public: RGBController_Crucial(CrucialController* crucial_ptr); - int GetMode(); - void SetMode(int mode); - void SetCustomMode(); void UpdateLEDs(); void UpdateZoneLEDs(int zone); void UpdateSingleLED(int led); + void SetCustomMode(); + void UpdateMode(); + private: CrucialController* crucial; };