From 1403f91b3a1cb217b79513b74cc7a71fd733dec0 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Tue, 23 Sep 2025 20:38:37 -0500 Subject: [PATCH] RGBController API Overhaul * Reorganize and clean up RGBController API functions * Add functions to get protected RGBController member values * Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members * Protected previously-public RGBController members * Information strings (name, vendor, description, version, serial location) * Device type * Active mode * Flags * LEDs vector * LED alternate names vector * Modes vector * Colors vector * Zones vector * Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI * Add update reason codes to RGBController update callback and signal updates on more RGBController events * Add loop zone types and segmented zone type * Add matrix map field to segments * Rework matrix_map_type from using pointers to vector to prevent memory leaks * Rework KeyboardLayoutManager to return new matrix_map_type * Add access mutex to RGBController API * Add per-zone modes ot RGBController API * Add JSON description functions to RGBController API --- .../RGBController_BloodyB820R.cpp | 18 +- .../RGBController_BloodyB820R.h | 5 +- .../RGBController_BloodyMouse.cpp | 12 +- .../RGBController_BloodyMouse.h | 5 +- .../AMBXController/RGBController_AMBX.cpp | 11 +- .../AMBXController/RGBController_AMBX.h | 5 +- .../RGBController_AMDWraithPrism.cpp | 14 +- .../RGBController_AMDWraithPrism.h | 6 +- .../RGBController_AOCKeyboard.cpp | 39 +- .../RGBController_AOCKeyboard.h | 6 +- .../RGBController_AOCMouse.cpp | 13 +- .../RGBController_AOCMouse.h | 6 +- .../RGBController_AOCMousemat.cpp | 12 +- .../RGBController_AOCMousemat.h | 6 +- .../ASRockPolychromeUSBController.cpp | 2 +- .../ASRockPolychromeUSBController.h | 2 +- .../RGBController_ASRockPolychromeUSB.cpp | 10 +- .../RGBController_ASRockPolychromeUSB.h | 6 +- .../RGBController_ASRockASRRGBSMBus.cpp | 9 +- .../RGBController_ASRockASRRGBSMBus.h | 6 +- .../RGBController_ASRockPolychromeV1SMBus.cpp | 17 +- .../RGBController_ASRockPolychromeV1SMBus.h | 6 +- .../RGBController_ASRockPolychromeV2SMBus.cpp | 10 +- .../RGBController_ASRockPolychromeV2SMBus.h | 6 +- .../RGBController_Alienware.cpp | 14 +- .../RGBController_Alienware.h | 6 +- .../AlienwareAW410KController.cpp | 2 +- .../AlienwareAW410KController.h | 2 +- .../RGBController_AlienwareAW410K.cpp | 35 +- .../RGBController_AlienwareAW410K.h | 6 +- .../AlienwareAW510KController.cpp | 2 +- .../AlienwareAW510KController.h | 2 +- .../RGBController_AlienwareAW510K.cpp | 35 +- .../RGBController_AlienwareAW510K.h | 6 +- .../RGBController_AlienwareAW3423DWF.cpp | 13 +- .../RGBController_AlienwareAW3423DWF.h | 5 +- .../RGBController_AlienwareMonitor.cpp | 14 +- .../RGBController_AlienwareMonitor.h | 5 +- .../RGBController_AnnePro2.cpp | 20 +- .../RGBController_AnnePro2.h | 5 +- .../ArcticController/RGBController_Arctic.cpp | 14 +- .../ArcticController/RGBController_Arctic.h | 6 +- .../AresonController/RGBController_Areson.cpp | 12 +- .../AresonController/RGBController_Areson.h | 5 +- .../RGBController_AsusAuraCore.cpp | 19 +- .../RGBController_AsusAuraCore.h | 6 +- .../AsusAuraCoreControllerDetect.cpp | 2 +- .../RGBController_AsusAuraCoreLaptop.cpp | 26 +- .../RGBController_AsusAuraCoreLaptop.h | 5 +- .../RGBController_AsusAuraGPU.cpp | 14 +- .../RGBController_AsusAuraGPU.h | 6 +- .../RGBController_AsusAuraHeadsetStand.cpp | 13 +- .../RGBController_AsusAuraHeadsetStand.h | 6 +- .../RGBController_AsusAuraKeyboard.cpp | 37 +- .../RGBController_AsusAuraKeyboard.h | 6 +- .../RGBController_AsusAuraMonitor.cpp | 12 +- .../RGBController_AsusAuraMonitor.h | 6 +- .../RGBController_AsusAuraMouse.cpp | 12 +- .../RGBController_AsusAuraMouse.h | 6 +- .../RGBController_AsusROGSpatha.cpp | 18 +- .../RGBController_AsusROGSpatha.h | 6 +- .../RGBController_AsusROGStrixEvolve.cpp | 14 +- .../RGBController_AsusROGStrixEvolve.h | 6 +- .../RGBController_AsusAuraMousemat.cpp | 12 +- .../RGBController_AsusAuraMousemat.h | 6 +- .../RGBController_AsusAuraRyuoAIO.cpp | 15 +- .../RGBController_AsusAuraRyuoAIO.h | 5 +- .../RGBController_AsusAuraTUFKeyboard.cpp | 14 +- .../RGBController_AsusAuraTUFKeyboard.h | 6 +- .../RGBController_AsusAuraUSB.cpp | 8 +- .../RGBController_AsusAuraUSB.h | 6 +- .../RGBController_AsusROGAlly.cpp | 13 +- .../RGBController_AsusROGAlly.h | 6 +- .../RGBController_AsusROGStrixLC.cpp | 15 +- .../RGBController_AsusROGStrixLC.h | 5 +- .../RGBController_AsusCerberusKeyboard.cpp | 14 +- .../RGBController_AsusCerberusKeyboard.h | 6 +- .../RGBController_AsusSagarisKeyboard.cpp | 10 +- .../RGBController_AsusSagarisKeyboard.h | 6 +- .../RGBController_AsusStrixClaw.cpp | 11 +- .../RGBController_AsusStrixClaw.h | 6 +- .../RGBController_AsusMonitor.cpp | 13 +- .../RGBController_AsusMonitor.h | 5 +- .../RGBController_AsusTUFLaptop_Linux.cpp | 12 +- .../RGBController_AsusTUFLaptop_Linux.h | 12 +- .../RGBController_AsusTUFLaptop_Windows.cpp | 12 +- .../RGBController_AsusTUFLaptop_Windows.h | 6 +- .../RGBController_BlinkyTape.cpp | 9 +- .../RGBController_BlinkyTape.h | 6 +- .../RGBController_CherryKeyboard.cpp | 27 +- .../RGBController_CherryKeyboard.h | 6 +- .../ClevoKeyboardControllerDetect.cpp | 3 +- .../RGBController_ClevoKeyboard.cpp | 33 +- .../RGBController_ClevoKeyboard.h | 6 +- .../ClevoLightbarControllerDetect.cpp | 1 - .../RGBController_ClevoLightbar.cpp | 12 +- .../RGBController_ClevoLightbar.h | 5 +- .../RGBController_ColorfulGPU.cpp | 10 +- .../RGBController_ColorfulGPU.h | 5 +- .../RGBController_ColorfulTuringGPU.cpp | 10 +- .../RGBController_ColorfulTuringGPU.h | 7 +- .../RGBController_CMARGBController.cpp | 11 +- .../RGBController_CMARGBController.h | 6 +- .../RGBController_CMARGBGen2A1Controller.cpp | 7 +- .../RGBController_CMARGBGen2A1Controller.h | 7 +- .../RGBController_CMGD160Controller.cpp | 13 +- .../RGBController_CMGD160Controller.h | 8 +- .../RGBController_CMKeyboardController.cpp | 43 +- .../RGBController_CMKeyboardController.h | 6 +- .../RGBController_CMMM711Controller.cpp | 12 +- .../RGBController_CMMM711Controller.h | 5 +- .../RGBController_CMMM712Controller.cpp | 12 +- .../RGBController_CMMM712Controller.h | 5 +- .../RGBController_CMMMController.cpp | 12 +- .../RGBController_CMMMController.h | 5 +- .../RGBController_CMMP750Controller.cpp | 14 +- .../RGBController_CMMP750Controller.h | 5 +- .../RGBController_CMMonitorController.cpp | 12 +- .../RGBController_CMMonitorController.h | 6 +- .../RGBController_CMR6000Controller.cpp | 12 +- .../RGBController_CMR6000Controller.h | 6 +- .../RGBController_CMRGBController.cpp | 13 +- .../RGBController_CMRGBController.h | 5 +- .../RGBController_CMSmallARGBController.cpp | 11 +- .../RGBController_CMSmallARGBController.h | 6 +- .../RGBController_CorsairCommanderCore.cpp | 16 +- .../RGBController_CorsairCommanderCore.h | 6 +- ...RGBController_CorsairDominatorPlatinum.cpp | 12 +- .../RGBController_CorsairDominatorPlatinum.h | 6 +- .../RGBController_CorsairHydro2.cpp | 13 +- .../RGBController_CorsairHydro2.h | 6 +- .../RGBController_CorsairHydro.cpp | 13 +- .../RGBController_CorsairHydro.h | 6 +- .../RGBController_CorsairHydroPlatinum.cpp | 12 +- .../RGBController_CorsairHydroPlatinum.h | 6 +- .../RGBController_CorsairICueLink.cpp | 13 +- .../RGBController_CorsairICueLink.h | 5 +- .../CorsairLightingNodeController.h | 1 + .../RGBController_CorsairLightingNode.cpp | 517 ++- .../RGBController_CorsairLightingNode.h | 8 +- .../RGBController_CorsairK55RGBPROXT.cpp | 17 +- .../RGBController_CorsairK55RGBPROXT.h | 5 +- .../RGBController_CorsairK65Mini.cpp | 24 +- .../RGBController_CorsairK65Mini.h | 5 +- .../RGBController_CorsairPeripheral.cpp | 67 +- .../RGBController_CorsairPeripheral.h | 6 +- .../RGBController_CorsairV2Hardware.cpp | 36 +- .../RGBController_CorsairV2Hardware.h | 5 +- .../RGBController_CorsairV2Software.cpp | 36 +- .../RGBController_CorsairV2Software.h | 6 +- .../RGBController_CorsairVengeance.cpp | 12 +- .../RGBController_CorsairVengeance.h | 6 +- .../RGBController_CorsairVengeancePro.cpp | 12 +- .../RGBController_CorsairVengeancePro.h | 6 +- .../RGBController_CorsairWireless.cpp | 31 +- .../RGBController_CorsairWireless.h | 6 +- .../RGBController_CougarKeyboard.cpp | 17 +- .../RGBController_CougarKeyboard.h | 5 +- .../RGBController_CougarRevengerST.cpp | 16 +- .../RGBController_CougarRevengerST.h | 5 +- ...roller_CreativeSoundBlasterAE5_Windows.cpp | 8 +- ...ntroller_CreativeSoundBlasterAE5_Windows.h | 8 +- .../RGBController_CreativeSoundBlasterXG6.cpp | 12 +- .../RGBController_CreativeSoundBlasterXG6.h | 6 +- .../RGBController_Crucial.cpp | 12 +- .../CrucialController/RGBController_Crucial.h | 6 +- .../RGBController_CryorigH7QuadLumi.cpp | 130 +- .../RGBController_CryorigH7QuadLumi.h | 8 +- .../DDPController/RGBController_DDP.cpp | 9 +- Controllers/DDPController/RGBController_DDP.h | 5 +- .../DMXController/RGBController_DMX.cpp | 31 +- Controllers/DMXController/RGBController_DMX.h | 6 +- .../DRGBController/RGBController_DRGB.cpp | 8 +- .../DRGBController/RGBController_DRGB.h | 6 +- .../RGBController_DarkProjectKeyboard.cpp | 18 +- .../RGBController_DarkProjectKeyboard.h | 5 +- .../RGBController_DasKeyboard.cpp | 32 +- .../RGBController_DasKeyboard.h | 5 +- .../DebugController/RGBController_Debug.cpp | 49 +- .../DebugController/RGBController_Debug.h | 8 +- .../RGBController_DreamCheeky.cpp | 12 +- .../RGBController_DreamCheeky.h | 6 +- .../RGBController_DuckyKeyboard.cpp | 27 +- .../RGBController_DuckyKeyboard.h | 6 +- .../RGBController_DygmaRaise.cpp | 21 +- .../RGBController_DygmaRaise.h | 5 +- .../E131Controller/RGBController_E131.cpp | 87 +- .../E131Controller/RGBController_E131.h | 6 +- .../RGBController_EKController.cpp | 9 +- .../EKController/RGBController_EKController.h | 6 +- .../RGBController_ENESMBus.cpp | 19 +- .../RGBController_ENESMBus.h | 6 +- .../RGBController_EVGAGPUv3.cpp | 7 +- .../RGBController_EVGAGPUv3.h | 6 +- .../RGBController_EVGAGP102.cpp | 14 +- .../RGBController_EVGAGP102.h | 6 +- .../RGBController_EVGAGPUv1.cpp | 12 +- .../RGBController_EVGAGPUv1.h | 6 +- .../RGBController_EVGAACX30SMBus.cpp | 14 +- .../RGBController_EVGAACX30SMBus.h | 6 +- .../RGBController_EVGAGPUv2.cpp | 12 +- .../RGBController_EVGAGPUv2.h | 6 +- .../RGBController_EVGAKeyboard.cpp | 22 +- .../RGBController_EVGAKeyboard.h | 5 +- .../RGBController_EVGAMouse.cpp | 14 +- .../RGBController_EVGAMouse.h | 5 +- .../RGBController_EVisionKeyboard.cpp | 27 +- .../RGBController_EVisionKeyboard.h | 6 +- .../RGBController_EVisionV2Keyboard.cpp | 18 +- .../RGBController_EVisionV2Keyboard.h | 13 +- .../RGBController_ElgatoKeyLight.cpp | 12 +- .../RGBController_ElgatoKeyLight.h | 6 +- .../RGBController_ElgatoLightStrip.cpp | 12 +- .../RGBController_ElgatoLightStrip.h | 6 +- .../RGBController_EpomakerController.cpp | 13 +- .../RGBController_EpomakerController.h | 6 +- .../RGBController_Espurna.cpp | 12 +- .../EspurnaController/RGBController_Espurna.h | 6 +- .../FanBusController/RGBController_FanBus.cpp | 12 +- .../FanBusController/RGBController_FanBus.h | 6 +- .../RGBController_Faustus_Linux.cpp | 12 +- .../RGBController_Faustus_Linux.h | 6 +- .../RGBController_FnaticStreak.cpp | 27 +- .../RGBController_FnaticStreak.h | 6 +- .../RGBController_GaiZhongGai.cpp | 52 +- .../RGBController_GaiZhongGai.h | 6 +- .../RGBController_GainwardGPUv1.cpp | 12 +- .../RGBController_GainwardGPUv1.h | 6 +- .../RGBController_GainwardGPUv2.cpp | 12 +- .../RGBController_GainwardGPUv2.h | 6 +- .../RGBController_GalaxGPUv1.cpp | 14 +- .../RGBController_GalaxGPUv1.h | 6 +- .../RGBController_GalaxGPUv2.cpp | 12 +- .../RGBController_GalaxGPUv2.h | 6 +- .../RGBController_AorusATC800.cpp | 19 +- .../RGBController_AorusATC800.h | 6 +- .../RGBController_GigabyteAorusLaptop.cpp | 23 +- .../RGBController_GigabyteAorusLaptop.h | 5 +- .../RGBController_GigabyteAorusMouse.cpp | 12 +- .../RGBController_GigabyteAorusMouse.h | 5 +- .../RGBController_GigabyteAorusPCCase.cpp | 12 +- .../RGBController_GigabyteAorusPCCase.h | 6 +- ...oller_GigabyteRGBFusion2AorusMasterGPU.cpp | 13 +- ...troller_GigabyteRGBFusion2AorusMasterGPU.h | 6 +- ...troller_GigabyteRGBFusion2BlackwellGPU.cpp | 15 +- ...ontroller_GigabyteRGBFusion2BlackwellGPU.h | 6 +- .../RGBController_GigabyteRGBFusion2DRAM.cpp | 11 +- .../RGBController_GigabyteRGBFusion2DRAM.h | 6 +- .../RGBController_GigabyteRGBFusion2GPU.cpp | 12 +- .../RGBController_GigabyteRGBFusion2GPU.h | 6 +- .../RGBController_GigabyteRGBFusion2SMBus.cpp | 13 +- .../RGBController_GigabyteRGBFusion2SMBus.h | 6 +- .../RGBController_GigabyteRGBFusion2USB.cpp | 9 +- .../RGBController_GigabyteRGBFusion2USB.h | 6 +- .../RGBController_GigabyteRGBFusion.cpp | 14 +- .../RGBController_GigabyteRGBFusion.h | 6 +- .../RGBController_GigabyteRGBFusionGPU.cpp | 12 +- .../RGBController_GigabyteRGBFusionGPU.h | 6 +- .../RGBController_GigabyteSuperIORGB.cpp | 10 +- .../RGBController_GigabyteSuperIORGB.h | 5 +- .../GoveeController/RGBController_Govee.cpp | 7 +- .../GoveeController/RGBController_Govee.h | 6 +- .../RGBController_HPOmen30L.cpp | 20 +- .../RGBController_HPOmen30L.h | 6 +- .../RGBController_HPOmenLaptopWMI_Windows.cpp | 12 +- .../RGBController_HPOmenLaptopWMI_Windows.h | 6 +- .../RGBController_HYTEKeyboard.cpp | 42 +- .../RGBController_HYTEKeyboard.h | 5 +- .../RGBController_HYTEMousemat.cpp | 10 +- .../RGBController_HYTEMousemat.h | 5 +- .../RGBController_HYTENexus.cpp | 36 +- .../RGBController_HYTENexus.h | 5 +- .../RGBController_HoltekA070.cpp | 12 +- .../RGBController_HoltekA070.h | 5 +- .../RGBController_HoltekA1FA.cpp | 12 +- .../RGBController_HoltekA1FA.h | 5 +- .../RGBController_HyperXDRAM.cpp | 12 +- .../RGBController_HyperXDRAM.h | 6 +- .../RGBController_HyperXAlloyElite2.cpp | 33 +- .../RGBController_HyperXAlloyElite2.h | 6 +- .../RGBController_HyperXAlloyElite.cpp | 33 +- .../RGBController_HyperXAlloyElite.h | 6 +- .../RGBController_HyperXAlloyFPS.cpp | 33 +- .../RGBController_HyperXAlloyFPS.h | 6 +- ...GBController_HyperXAlloyOrigins60and65.cpp | 36 +- .../RGBController_HyperXAlloyOrigins60and65.h | 6 +- .../RGBController_HyperXAlloyOrigins.cpp | 33 +- .../RGBController_HyperXAlloyOrigins.h | 6 +- .../RGBController_HyperXAlloyOriginsCore.cpp | 35 +- .../RGBController_HyperXAlloyOriginsCore.h | 6 +- .../RGBController_HyperXMicrophone.cpp | 18 +- .../RGBController_HyperXMicrophone.h | 6 +- .../RGBController_HyperXMicrophoneV2.cpp | 58 +- .../RGBController_HyperXMicrophoneV2.h | 6 +- .../RGBController_HyperXPulsefireDart.cpp | 13 +- .../RGBController_HyperXPulsefireDart.h | 6 +- .../RGBController_HyperXPulsefireFPSPro.cpp | 14 +- .../RGBController_HyperXPulsefireFPSPro.h | 6 +- .../RGBController_HyperXPulsefireHaste.cpp | 14 +- .../RGBController_HyperXPulsefireHaste.h | 6 +- .../RGBController_HyperXPulsefireRaid.cpp | 16 +- .../RGBController_HyperXPulsefireRaid.h | 5 +- .../RGBController_HyperXPulsefireSurge.cpp | 15 +- .../RGBController_HyperXPulsefireSurge.h | 6 +- .../RGBController_HyperXMousemat.cpp | 15 +- .../RGBController_HyperXMousemat.h | 6 +- .../RGBController_InstantMouse.cpp | 12 +- .../RGBController_InstantMouse.h | 5 +- .../RGBController_IntelArcA770LE.cpp | 16 +- .../RGBController_IntelArcA770LE.h | 6 +- .../IonicoControllerDetect.cpp | 8 - .../IonicoController/RGBController_Ionico.cpp | 22 +- .../IonicoController/RGBController_Ionico.h | 9 +- .../RGBController_JGINYUEInternalUSB.cpp | 12 +- .../RGBController_JGINYUEInternalUSB.h | 6 +- .../RGBController_JGINYUEInternalUSBV2.cpp | 11 +- .../RGBController_JGINYUEInternalUSBV2.h | 6 +- .../RGBController_KasaSmart.cpp | 12 +- .../RGBController_KasaSmart.h | 6 +- .../RGBController_KeychronKeyboard.cpp | 31 +- .../RGBController_KeychronKeyboard.h | 5 +- .../RGBController_KingstonFuryDRAM.cpp | 14 +- .../RGBController_KingstonFuryDRAM.h | 6 +- .../RGBController_LEDStrip.cpp | 12 +- .../RGBController_LEDStrip.h | 6 +- .../RGBController_LGMonitor.cpp | 14 +- .../RGBController_LGMonitor.h | 7 +- .../LIFXController/RGBController_LIFX.cpp | 13 +- .../LIFXController/RGBController_LIFX.h | 6 +- .../RGBController_LaviewTechnology.cpp | 9 +- .../RGBController_LaviewTechnology.h | 5 +- ...RGBController_LegoDimensionsToypadBase.cpp | 16 +- .../RGBController_LegoDimensionsToypadBase.h | 5 +- .../RGBController_Lenovo4ZoneUSB.cpp | 14 +- .../RGBController_Lenovo4ZoneUSB.h | 5 +- .../RGBController_LenovoK510.cpp | 10 +- .../RGBController_LenovoK510.h | 5 +- .../RGBController_LenovoM300.cpp | 10 +- .../RGBController_LenovoM300.h | 5 +- .../RGBController_LenovoUSB.cpp | 20 +- .../RGBController_LenovoUSB.h | 5 +- .../RGBController_Lenovo_Gen7_8.cpp | 22 +- .../RGBController_Lenovo_Gen7_8.h | 6 +- .../RGBController_LenovoMotherboard.cpp | 13 +- .../RGBController_LenovoMotherboard.h | 5 +- .../RGBController_LexipMouse.cpp | 18 +- .../RGBController_LexipMouse.h | 5 +- .../RGBController_LianLiGAIITrinity.cpp | 12 +- .../RGBController_LianLiGAIITrinity.h | 6 +- .../RGBController_LianLiStrimerLConnect.cpp | 17 +- .../RGBController_LianLiStrimerLConnect.h | 5 +- .../RGBController_LianLiUniHubAL.cpp | 22 +- .../RGBController_LianLiUniHubAL.h | 6 +- .../RGBController_LianLiUniHub.cpp | 8 +- .../RGBController_LianLiUniHub.h | 6 +- .../LianLiUniHubSLController.cpp | 4 +- .../LianLiUniHubSLController.h | 6 +- .../RGBController_LianLiUniHubSL.cpp | 9 +- .../RGBController_LianLiUniHubSL.h | 6 +- .../RGBController_LianLiUniHubSLInfinity.cpp | 6 +- .../RGBController_LianLiUniHubSLInfinity.h | 6 +- .../RGBController_LianLiUniHubSLV2.cpp | 6 +- .../RGBController_LianLiUniHubSLV2.h | 6 +- .../RGBController_LianLiUniHub_AL10.cpp | 8 +- .../RGBController_LianLiUniHub_AL10.h | 6 +- .../RGBController_LianLiUniversalScreen.cpp | 10 +- .../RGBController_LianLiUniversalScreen.h | 5 +- .../RGBController_LightSalt.cpp | 28 +- .../RGBController_LightSalt.h | 5 +- .../RGBController_LinuxLED_Linux.cpp | 12 +- .../RGBController_LinuxLED_Linux.h | 6 +- .../RGBController_LogitechG203L.cpp | 12 +- .../RGBController_LogitechG203L.h | 6 +- .../RGBController_LogitechG213.cpp | 16 +- .../RGBController_LogitechG213.h | 6 +- .../RGBController_LogitechG560.cpp | 15 +- .../RGBController_LogitechG560.h | 6 +- .../RGBController_LogitechG600.cpp | 18 +- .../RGBController_LogitechG600.h | 6 +- .../RGBController_LogitechG810.cpp | 33 +- .../RGBController_LogitechG810.h | 6 +- .../RGBController_LogitechG815.cpp | 31 +- .../RGBController_LogitechG815.h | 6 +- .../RGBController_LogitechG910.cpp | 33 +- .../RGBController_LogitechG910.h | 6 +- .../RGBController_LogitechG915.cpp | 35 +- .../RGBController_LogitechG915.h | 6 +- .../RGBController_LogitechG933.cpp | 13 +- .../RGBController_LogitechG933.h | 6 +- .../RGBController_LogitechGLightsync.cpp | 19 +- .../RGBController_LogitechGLightsync.h | 6 +- .../RGBController_LogitechGLightsync1zone.cpp | 16 +- .../RGBController_LogitechGLightsync1zone.h | 6 +- .../RGBController_LogitechGPowerPlay.cpp | 16 +- .../RGBController_LogitechGPowerPlay.h | 6 +- .../RGBController_LogitechGProKeyboard.cpp | 33 +- .../RGBController_LogitechGProKeyboard.h | 6 +- .../RGBController_LogitechLightspeed.cpp | 16 +- .../RGBController_LogitechLightspeed.h | 6 +- .../RGBController_LogitechX56.cpp | 12 +- .../RGBController_LogitechX56.h | 6 +- .../RGBController_Luxafor.cpp | 17 +- .../LuxaforController/RGBController_Luxafor.h | 6 +- .../RGBController_MNTKeyboard.cpp | 15 +- .../RGBController_MNTKeyboard.h | 18 +- .../RGBController_MSI3Zone.cpp | 13 +- .../RGBController_MSI3Zone.h | 6 +- .../MSIGPUController/RGBController_MSIGPU.cpp | 16 +- .../MSIGPUController/RGBController_MSIGPU.h | 7 +- .../RGBController_MSIGPUv2.cpp | 12 +- .../RGBController_MSIGPUv2.h | 5 +- .../RGBController_MSIMysticLightKB.cpp | 12 +- .../RGBController_MSIMysticLightKB.h | 5 +- .../RGBController_MSIMysticLight112.cpp | 13 +- .../RGBController_MSIMysticLight112.h | 5 +- .../RGBController_MSIMysticLight162.cpp | 13 +- .../RGBController_MSIMysticLight162.h | 5 +- .../RGBController_MSIMysticLight185.cpp | 8 +- .../RGBController_MSIMysticLight185.h | 6 +- .../RGBController_MSIMysticLight64.cpp | 13 +- .../RGBController_MSIMysticLight64.h | 5 +- .../RGBController_MSIMysticLight761.cpp | 8 +- .../RGBController_MSIMysticLight761.h | 6 +- .../RGBController_MSIOptix.cpp | 16 +- .../RGBController_MSIOptix.h | 5 +- .../MSIRGBController/RGBController_MSIRGB.cpp | 10 +- .../MSIRGBController/RGBController_MSIRGB.h | 5 +- .../RGBController_MSIVigorGK30.cpp | 16 +- .../RGBController_MSIVigorGK30.h | 5 +- .../RGBController_MadCatzCyborg.cpp | 10 +- .../RGBController_MadCatzCyborg.h | 5 +- .../RGBController_ManliGPU.cpp | 12 +- .../RGBController_ManliGPU.h | 6 +- .../RGBController_MintakaKeyboard.cpp | 47 +- .../RGBController_MintakaKeyboard.h | 5 +- .../RGBController_Mountain60Keyboard.cpp | 30 +- .../RGBController_Mountain60Keyboard.h | 6 +- .../RGBController_MountainKeyboard.cpp | 28 +- .../RGBController_MountainKeyboard.h | 6 +- .../N5312AController/RGBController_N5312A.cpp | 16 +- .../N5312AController/RGBController_N5312A.h | 5 +- ...oller_NVIDIAIllumination_Windows_Linux.cpp | 12 +- ...troller_NVIDIAIllumination_Windows_Linux.h | 5 +- .../RGBController_NZXTHue1.cpp | 9 +- .../RGBController_NZXTHue1.h | 5 +- .../NZXTHue2Controller/NZXTHue2Controller.h | 10 +- .../RGBController_NZXTHue2.cpp | 155 +- .../RGBController_NZXTHue2.h | 9 +- .../RGBController_NZXTHuePlus.cpp | 297 +- .../RGBController_NZXTHuePlus.h | 9 +- .../RGBController_NZXTKraken.cpp | 15 +- .../RGBController_NZXTKraken.h | 5 +- .../RGBController_NZXTMouse.cpp | 11 +- .../RGBController_NZXTMouse.h | 5 +- .../RGBController_Nanoleaf.cpp | 12 +- .../RGBController_Nanoleaf.h | 6 +- .../NollieController/RGBController_Nollie.cpp | 8 +- .../NollieController/RGBController_Nollie.h | 6 +- .../RGBController_NvidiaESA.cpp | 16 +- .../RGBController_NvidiaESA.h | 5 +- .../RGBController_OKSKeyboard.cpp | 31 +- .../OKSController/RGBController_OKSKeyboard.h | 6 +- .../RGBController_PNYARGBEpicXGPU.cpp | 18 +- .../RGBController_PNYARGBEpicXGPU.h | 6 +- .../PNYGPUController/RGBController_PNYGPU.cpp | 12 +- .../PNYGPUController/RGBController_PNYGPU.h | 5 +- .../RGBController_PNYLovelaceGPU.cpp | 16 +- .../RGBController_PNYLovelaceGPU.h | 5 +- .../RGBController_PalitGPU.cpp | 12 +- .../RGBController_PalitGPU.h | 5 +- .../RGBController_PatriotViper.cpp | 12 +- .../RGBController_PatriotViper.h | 5 +- .../RGBController_PatriotViperMouse.cpp | 14 +- .../RGBController_PatriotViperMouse.h | 6 +- .../RGBController_PatriotViperSteel.cpp | 12 +- .../RGBController_PatriotViperSteel.h | 5 +- .../PhilipsHueControllerDetect.cpp | 2 +- .../RGBController_PhilipsHue.cpp | 12 +- .../RGBController_PhilipsHue.h | 5 +- .../RGBController_PhilipsHueEntertainment.cpp | 18 +- .../RGBController_PhilipsHueEntertainment.h | 5 +- .../RGBController_PhilipsWiz.cpp | 12 +- .../RGBController_PhilipsWiz.h | 5 +- .../RGBController_PowerColorRedDevilV1.cpp | 12 +- .../RGBController_PowerColorRedDevilV1.h | 6 +- .../RGBController_PowerColorRedDevilV2.cpp | 19 +- .../RGBController_PowerColorRedDevilV2.h | 6 +- .../RGBController_QMKOpenRGBRev9.cpp | 29 +- .../RGBController_QMKOpenRGBRev9.h | 5 +- .../RGBController_QMKOpenRGBRevB.cpp | 29 +- .../RGBController_QMKOpenRGBRevB.h | 5 +- .../RGBController_QMKOpenRGBRevD.cpp | 29 +- .../RGBController_QMKOpenRGBRevD.h | 5 +- .../RGBController_QMKOpenRGBRevE.cpp | 29 +- .../RGBController_QMKOpenRGBRevE.h | 5 +- .../RGBController_QMKVialRGB.cpp | 24 +- .../RGBController_QMKVialRGB.h | 5 +- .../RazerController/RGBController_Razer.cpp | 45 +- .../RazerController/RGBController_Razer.h | 6 +- .../RGBController_RazerAddressable.cpp | 26 +- .../RGBController_RazerAddressable.h | 6 +- .../RGBController_RazerHanbo.cpp | 38 +- .../RGBController_RazerHanbo.h | 6 +- .../RGBController_RazerKraken.cpp | 31 +- .../RGBController_RazerKraken.h | 6 +- .../RGBController_RazerKrakenV3.cpp | 29 +- .../RGBController_RazerKrakenV3.h | 6 +- .../RGBController_RazerKrakenV4.cpp | 10 +- .../RGBController_RazerKrakenV4.h | 6 +- .../RGBController_RedSquareKeyrox.cpp | 25 +- .../RGBController_RedSquareKeyrox.h | 5 +- ...GBController_RedSquareKeyroxTKLClassic.cpp | 39 +- .../RGBController_RedSquareKeyroxTKLClassic.h | 5 +- .../RGBController_RedragonMouse.cpp | 12 +- .../RGBController_RedragonMouse.h | 5 +- .../RGBController_RobobloqLightStrip.cpp | 12 +- .../RGBController_RobobloqLightStrip.h | 6 +- .../RGBController_RoccatBurst.cpp | 16 +- .../RGBController_RoccatBurst.h | 5 +- .../RGBController_RoccatBurstProAir.cpp | 16 +- .../RGBController_RoccatBurstProAir.h | 7 +- .../RGBController_RoccatElo.cpp | 12 +- .../RGBController_RoccatElo.h | 5 +- .../RGBController_RoccatHordeAimo.cpp | 16 +- .../RGBController_RoccatHordeAimo.h | 5 +- .../RGBController_RoccatKoneAimo.cpp | 16 +- .../RGBController_RoccatKoneAimo.h | 5 +- .../RGBController_RoccatKoneProAir.cpp | 12 +- .../RGBController_RoccatKoneProAir.h | 5 +- .../RGBController_RoccatKonePro.cpp | 12 +- .../RGBController_RoccatKonePro.h | 5 +- .../RGBController_RoccatKoneXP.cpp | 15 +- .../RGBController_RoccatKoneXP.h | 5 +- .../RGBController_RoccatKova.cpp | 12 +- .../RGBController_RoccatKova.h | 6 +- .../RGBController_RoccatSenseAimo.cpp | 12 +- .../RGBController_RoccatSenseAimo.h | 5 +- .../RGBController_RoccatVulcanKeyboard.cpp | 16 +- .../RGBController_RoccatVulcanKeyboard.h | 5 +- .../RGBController_SRGBmodsLEDControllerV1.cpp | 8 +- .../RGBController_SRGBmodsLEDControllerV1.h | 6 +- .../RGBController_SRGBmodsPico.cpp | 8 +- .../RGBController_SRGBmodsPico.h | 6 +- .../RGBController_SapphireNitroGlowV1.cpp | 12 +- .../RGBController_SapphireNitroGlowV1.h | 5 +- .../RGBController_SapphireNitroGlowV3.cpp | 12 +- .../RGBController_SapphireNitroGlowV3.h | 5 +- .../RGBController_Seagate.cpp | 14 +- .../SeagateController/RGBController_Seagate.h | 7 +- .../RGBController_GenesisXenon200.cpp | 9 +- .../RGBController_GenesisXenon200.h | 6 +- .../RGBController_Sinowealth1007.cpp | 12 +- .../RGBController_Sinowealth1007.h | 5 +- .../RGBController_Sinowealth.cpp | 12 +- .../RGBController_Sinowealth.h | 5 +- .../RGBController_SinowealthGMOW.cpp | 9 +- .../RGBController_SinowealthGMOW.h | 5 +- .../RGBController_SinowealthKeyboard10c.cpp | 31 +- .../RGBController_SinowealthKeyboard10c.h | 5 +- .../RGBController_SinowealthKeyboard16.cpp | 18 +- .../RGBController_SinowealthKeyboard16.h | 5 +- .../RGBController_SinowealthKeyboard90.cpp | 27 +- .../RGBController_SinowealthKeyboard90.h | 6 +- .../RGBController_SinowealthKeyboard.cpp | 16 +- .../RGBController_SinowealthKeyboard.h | 5 +- .../RGBController_SkyloongGK104Pro.cpp | 25 +- .../RGBController_SkyloongGK104Pro.h | 5 +- .../RGBController_SonyDS4.cpp | 12 +- .../SonyDS4Controller/RGBController_SonyDS4.h | 5 +- .../RGBController_SonyDualSense.cpp | 13 +- .../RGBController_SonyDualSense.h | 5 +- .../RGBController_SteelSeriesApex3.cpp | 12 +- .../RGBController_SteelSeriesApex3.h | 5 +- .../RGBController_SteelSeriesApex.cpp | 34 +- .../RGBController_SteelSeriesApex.h | 5 +- .../SteelSeriesApexRegions.h | 6 +- .../RGBController_SteelSeriesArctis5.cpp | 16 +- .../RGBController_SteelSeriesArctis5.h | 5 +- .../RGBController_SteelSeriesOldApex.cpp | 16 +- .../RGBController_SteelSeriesOldApex.h | 5 +- .../RGBController_SteelSeriesQCKMat.cpp | 12 +- .../RGBController_SteelSeriesQCKMat.h | 5 +- .../RGBController_SteelSeriesRival3.cpp | 16 +- .../RGBController_SteelSeriesRival3.h | 5 +- .../RGBController_SteelSeriesRival.cpp | 17 +- .../RGBController_SteelSeriesRival.h | 5 +- .../RGBController_SteelSeriesSensei.cpp | 19 +- .../RGBController_SteelSeriesSensei.h | 5 +- .../RGBController_SteelSeriesSiberia.cpp | 14 +- .../RGBController_SteelSeriesSiberia.h | 5 +- .../RGBController_ElgatoStreamDeck.cpp | 16 +- .../RGBController_ElgatoStreamDeck.h | 5 +- .../RGBController_TForceXtreem.cpp | 18 +- .../RGBController_TForceXtreem.h | 6 +- .../RGBController_Tecknet.cpp | 14 +- .../TecknetController/RGBController_Tecknet.h | 5 +- .../RGBController_ThermaltakePoseidonZRGB.cpp | 27 +- .../RGBController_ThermaltakePoseidonZRGB.h | 5 +- .../RGBController_ThermaltakeRiing.cpp | 8 +- .../RGBController_ThermaltakeRiing.h | 6 +- .../RGBController_ThermaltakeRiingQuad.cpp | 8 +- .../RGBController_ThermaltakeRiingQuad.h | 6 +- .../RGBController_ThermaltakeRiingTrio.cpp | 8 +- .../RGBController_ThermaltakeRiingTrio.h | 6 +- .../RGBController_BlinkController.cpp | 15 +- .../RGBController_BlinkController.h | 5 +- .../RGBController_TrustGXT114.cpp | 12 +- .../RGBController_TrustGXT114.h | 5 +- .../RGBController_TrustGXT180.cpp | 12 +- .../RGBController_TrustGXT180.h | 5 +- .../RGBController_ValkyrieKeyboard.cpp | 28 +- .../RGBController_ValkyrieKeyboard.h | 7 +- .../XG270QC/RGBController_XG270QC.cpp | 13 +- .../XG270QC/RGBController_XG270QC.h | 5 +- .../XG270QG/RGBController_XG270QG.cpp | 13 +- .../XG270QG/RGBController_XG270QG.h | 5 +- .../RGBController_WinbondGamingKeyboard.cpp | 31 +- .../RGBController_WinbondGamingKeyboard.h | 11 +- .../RGBController_WootingKeyboard.cpp | 29 +- .../RGBController_WootingKeyboard.h | 5 +- .../RGBController_WushiL50USB.cpp | 12 +- .../RGBController_WushiL50USB.h | 5 +- .../RGBController_XPGSummoner.cpp | 34 +- .../RGBController_XPGSummoner.h | 7 +- .../RGBController_Yeelight.cpp | 12 +- .../RGBController_Yeelight.h | 5 +- .../RGBController_ZETBladeOptical.cpp | 31 +- .../RGBController_ZETBladeOptical.h | 5 +- .../RGBController_ZalmanZSync.cpp | 144 +- .../RGBController_ZalmanZSync.h | 9 +- .../ZalmanZSyncController.h | 1 + .../RGBController_ZotacTuringGPU.cpp | 14 +- .../RGBController_ZotacTuringGPU.h | 6 +- .../RGBController_ZotacV2GPU.cpp | 14 +- .../RGBController_ZotacV2GPU.h | 6 +- Documentation/RGBControllerAPI.md | 14 +- .../KeyboardLayoutManager.cpp | 26 +- KeyboardLayoutManager/KeyboardLayoutManager.h | 8 +- ProfileManager.cpp | 36 +- RGBController/RGBController.cpp | 3955 +++++++++++++---- RGBController/RGBController.h | 652 ++- RGBController/RGBController_Dummy.cpp | 14 +- RGBController/RGBController_Dummy.h | 7 +- RGBController/RGBController_Network.cpp | 4 +- RGBController/RGBController_Network.h | 4 +- cli.cpp | 102 +- qt/DeviceView.cpp | 149 +- .../OpenRGBClientInfoPage.cpp | 8 +- .../OpenRGBDeviceInfoPage.cpp | 24 +- qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp | 3803 +++++++++------- qt/OpenRGBDevicePage/OpenRGBDevicePage.h | 140 +- qt/OpenRGBDevicePage/OpenRGBDevicePage.ui | 184 +- qt/OpenRGBDialog/OpenRGBDialog.cpp | 180 +- qt/OpenRGBDialog/OpenRGBDialog.h | 7 + .../OpenRGBZoneResizeDialog.cpp | 40 +- .../OpenRGBZoneResizeDialog.h | 1 - .../OpenRGBZonesBulkResizer.cpp | 75 +- 657 files changed, 9060 insertions(+), 8807 deletions(-) diff --git a/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp b/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp index 58ffacc18..e05df15f0 100644 --- a/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp +++ b/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp @@ -187,11 +187,7 @@ void RGBController_BloodyB820R::SetupZones() KB_zone.leds_min = BLOODY_B820R_KEYCOUNT; KB_zone.leds_max = BLOODY_B820R_KEYCOUNT; KB_zone.leds_count = BLOODY_B820R_KEYCOUNT; - - KB_zone.matrix_map = new matrix_map_type; - KB_zone.matrix_map->height = 6; - KB_zone.matrix_map->width = 21; - KB_zone.matrix_map->map = (unsigned int *)&matrix_map; + KB_zone.matrix_map.Set(6, 21, (unsigned int *)&matrix_map); zones.push_back(KB_zone); /*-------------------------------------------------*\ @@ -214,20 +210,12 @@ void RGBController_BloodyB820R::SetupZones() SetupColors(); } -void RGBController_BloodyB820R::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - - void RGBController_BloodyB820R::DeviceUpdateLEDs() { controller->SetLEDDirect(colors); } -void RGBController_BloodyB820R::UpdateZoneLEDs(int zone) +void RGBController_BloodyB820R::DeviceUpdateZoneLEDs(int zone) { std::vector colour; @@ -239,7 +227,7 @@ void RGBController_BloodyB820R::UpdateZoneLEDs(int zone) controller->SetLEDDirect(colour); } -void RGBController_BloodyB820R::UpdateSingleLED(int led) +void RGBController_BloodyB820R::DeviceUpdateSingleLED(int led) { std::vector colour; colour.push_back(colors[led]); diff --git a/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.h b/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.h index 293c128b3..890eca1a4 100644 --- a/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.h +++ b/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.h @@ -22,11 +22,10 @@ public: ~RGBController_BloodyB820R(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.cpp b/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.cpp index 14091a27e..49c139b89 100644 --- a/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.cpp +++ b/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.cpp @@ -134,7 +134,6 @@ void RGBController_BloodyMouse::SetupZones() new_zone.leds_max = new_zone.leds_min; new_zone.leds_count = new_zone.leds_min; new_zone.type = bool_single ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR; - new_zone.matrix_map = NULL; zones.push_back(new_zone); for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++) @@ -160,13 +159,6 @@ void RGBController_BloodyMouse::SetupZones() SetupColors(); } -void RGBController_BloodyMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_BloodyMouse::DeviceUpdateLEDs() { std::vector colour; @@ -179,12 +171,12 @@ void RGBController_BloodyMouse::DeviceUpdateLEDs() controller->SetLedsDirect(colour); } -void RGBController_BloodyMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_BloodyMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_BloodyMouse::UpdateSingleLED(int /*led*/) +void RGBController_BloodyMouse::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.h b/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.h index c715d9edd..829ee3f84 100644 --- a/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.h +++ b/Controllers/A4TechController/BloodyMouseController/RGBController_BloodyMouse.h @@ -30,11 +30,10 @@ public: ~RGBController_BloodyMouse(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AMBXController/RGBController_AMBX.cpp b/Controllers/AMBXController/RGBController_AMBX.cpp index 344f0ee8a..6daeabb07 100644 --- a/Controllers/AMBXController/RGBController_AMBX.cpp +++ b/Controllers/AMBXController/RGBController_AMBX.cpp @@ -56,7 +56,6 @@ void RGBController_AMBX::SetupZones() side_lights_zone.leds_min = 2; side_lights_zone.leds_max = 2; side_lights_zone.leds_count = 2; - side_lights_zone.matrix_map = NULL; zones.push_back(side_lights_zone); zone wallwasher_zone; @@ -65,7 +64,6 @@ void RGBController_AMBX::SetupZones() wallwasher_zone.leds_min = 3; wallwasher_zone.leds_max = 3; wallwasher_zone.leds_count = 3; - wallwasher_zone.matrix_map = NULL; zones.push_back(wallwasher_zone); // Set up LEDs @@ -97,11 +95,6 @@ void RGBController_AMBX::SetupZones() SetupColors(); } -void RGBController_AMBX::ResizeZone(int /*zone*/, int /*new_size*/) -{ - // This device does not support resizing zones -} - void RGBController_AMBX::DeviceUpdateLEDs() { if(!controller->IsInitialized()) @@ -121,7 +114,7 @@ void RGBController_AMBX::DeviceUpdateLEDs() controller->SetLEDColors(led_values, led_colors, static_cast(leds.size())); } -void RGBController_AMBX::UpdateZoneLEDs(int zone) +void RGBController_AMBX::DeviceUpdateZoneLEDs(int zone) { if(!controller->IsInitialized()) { @@ -156,7 +149,7 @@ void RGBController_AMBX::UpdateZoneLEDs(int zone) controller->SetLEDColors(led_values, led_colors, zone_size); } -void RGBController_AMBX::UpdateSingleLED(int led) +void RGBController_AMBX::DeviceUpdateSingleLED(int led) { if(!controller->IsInitialized()) { diff --git a/Controllers/AMBXController/RGBController_AMBX.h b/Controllers/AMBXController/RGBController_AMBX.h index feee40fdf..7d3996387 100644 --- a/Controllers/AMBXController/RGBController_AMBX.h +++ b/Controllers/AMBXController/RGBController_AMBX.h @@ -19,11 +19,10 @@ public: ~RGBController_AMBX(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp index fc1abf068..4b65cfb20 100644 --- a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp +++ b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp @@ -154,7 +154,6 @@ void RGBController_AMDWraithPrism::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); zone fan_zone; @@ -163,7 +162,6 @@ void RGBController_AMDWraithPrism::SetupZones() fan_zone.leds_min = 1; fan_zone.leds_max = 1; fan_zone.leds_count = 1; - fan_zone.matrix_map = NULL; zones.push_back(fan_zone); zone ring_zone; @@ -172,7 +170,6 @@ void RGBController_AMDWraithPrism::SetupZones() ring_zone.leds_min = 15; ring_zone.leds_max = 15; ring_zone.leds_count = 15; - ring_zone.matrix_map = NULL; zones.push_back(ring_zone); /*-----------------------------------------------------*\ @@ -205,13 +202,6 @@ void RGBController_AMDWraithPrism::SetupZones() SetupColors(); } -void RGBController_AMDWraithPrism::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*-----------------------------------------------------*\ - | This device does not support resizing zones | - \*-----------------------------------------------------*/ -} - void RGBController_AMDWraithPrism::DeviceUpdateLEDs() { if(modes[active_mode].color_mode == MODE_COLORS_PER_LED) @@ -271,12 +261,12 @@ void RGBController_AMDWraithPrism::DeviceUpdateLEDs() } } -void RGBController_AMDWraithPrism::UpdateZoneLEDs(int /*zone*/) +void RGBController_AMDWraithPrism::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AMDWraithPrism::UpdateSingleLED(int /*led*/) +void RGBController_AMDWraithPrism::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.h b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.h index 90937b3a6..ec54d89c2 100644 --- a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.h +++ b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.cpp b/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.cpp index 0c0c29212..f8a60d8b3 100644 --- a/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.cpp +++ b/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.cpp @@ -262,30 +262,18 @@ RGBController_AOCKeyboard::~RGBController_AOCKeyboard() void RGBController_AOCKeyboard::SetupZones() { + KeyboardLayoutManager new_kb(KEYBOARD_LAYOUT_ANSI_QWERTY, KEYBOARD_SIZE_FULL, aoc_keyboard_offset_values); + /*---------------------------------------------------------*\ | Create the keyboard zone usiung Keyboard Layout Manager | \*---------------------------------------------------------*/ zone new_zone; - new_zone.name = ZONE_EN_KEYBOARD; - new_zone.type = ZONE_TYPE_MATRIX; - - KeyboardLayoutManager new_kb(KEYBOARD_LAYOUT_ANSI_QWERTY, KEYBOARD_SIZE_FULL, aoc_keyboard_offset_values); - - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_zone.matrix_map->height = new_kb.GetRowCount(); - new_zone.matrix_map->width = new_kb.GetColumnCount(); - - new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width]; - new_zone.leds_count = new_kb.GetKeyCount(); - new_zone.leds_min = new_zone.leds_count; - new_zone.leds_max = new_zone.leds_count; - - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, new_map->height, new_map->width); + new_zone.name = ZONE_EN_KEYBOARD; + new_zone.type = ZONE_TYPE_MATRIX; + new_zone.leds_count = new_kb.GetKeyCount(); + new_zone.leds_min = new_zone.leds_count; + new_zone.leds_max = new_zone.leds_count; + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | @@ -305,13 +293,6 @@ void RGBController_AOCKeyboard::SetupZones() SetupColors(); } -void RGBController_AOCKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AOCKeyboard::DeviceUpdateLEDs() { if(modes[active_mode].value == AOC_KEYBOARD_MODE_CUSTOM) @@ -331,12 +312,12 @@ void RGBController_AOCKeyboard::DeviceUpdateLEDs() } } -void RGBController_AOCKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_AOCKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AOCKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_AOCKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.h b/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.h index 5fbefdee9..e4a877f38 100644 --- a/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.h +++ b/Controllers/AOCKeyboardController/RGBController_AOCKeyboard.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AOCMouseController/RGBController_AOCMouse.cpp b/Controllers/AOCMouseController/RGBController_AOCMouse.cpp index e90088abc..6102931f3 100644 --- a/Controllers/AOCMouseController/RGBController_AOCMouse.cpp +++ b/Controllers/AOCMouseController/RGBController_AOCMouse.cpp @@ -134,7 +134,6 @@ void RGBController_AOCMouse::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led logo_led; @@ -147,7 +146,6 @@ void RGBController_AOCMouse::SetupZones() scroll_wheel_zone.leds_min = 1; scroll_wheel_zone.leds_max = 1; scroll_wheel_zone.leds_count = 1; - scroll_wheel_zone.matrix_map = NULL; zones.push_back(scroll_wheel_zone); led scroll_wheel_led; @@ -157,24 +155,17 @@ void RGBController_AOCMouse::SetupZones() SetupColors(); } -void RGBController_AOCMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AOCMouse::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_AOCMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_AOCMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AOCMouse::UpdateSingleLED(int /*led*/) +void RGBController_AOCMouse::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AOCMouseController/RGBController_AOCMouse.h b/Controllers/AOCMouseController/RGBController_AOCMouse.h index 5972fb2ff..98026ef8a 100644 --- a/Controllers/AOCMouseController/RGBController_AOCMouse.h +++ b/Controllers/AOCMouseController/RGBController_AOCMouse.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AOCMousematController/RGBController_AOCMousemat.cpp b/Controllers/AOCMousematController/RGBController_AOCMousemat.cpp index 1af3a52b3..5ef058064 100644 --- a/Controllers/AOCMousematController/RGBController_AOCMousemat.cpp +++ b/Controllers/AOCMousematController/RGBController_AOCMousemat.cpp @@ -124,7 +124,6 @@ void RGBController_AOCMousemat::SetupZones() mousemat_zone.leds_min = 1; mousemat_zone.leds_max = 1; mousemat_zone.leds_count = 1; - mousemat_zone.matrix_map = NULL; zones.push_back(mousemat_zone); led mousemat_led; @@ -134,24 +133,17 @@ void RGBController_AOCMousemat::SetupZones() SetupColors(); } -void RGBController_AOCMousemat::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AOCMousemat::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_AOCMousemat::UpdateZoneLEDs(int /*zone*/) +void RGBController_AOCMousemat::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AOCMousemat::UpdateSingleLED(int /*led*/) +void RGBController_AOCMousemat::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AOCMousematController/RGBController_AOCMousemat.h b/Controllers/AOCMousematController/RGBController_AOCMousemat.h index b63999b2d..4ae59fdba 100644 --- a/Controllers/AOCMousematController/RGBController_AOCMousemat.h +++ b/Controllers/AOCMousematController/RGBController_AOCMousemat.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.cpp b/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.cpp index cfca350f6..8cb2d0f7d 100755 --- a/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.cpp +++ b/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.cpp @@ -191,7 +191,7 @@ void PolychromeUSBController::SetDeviceInfo() WriteRGSwap(rgswap_final[0], rgswap_final[1], rgswap_final[2], rgswap_final[3], rgswap_final[4], rgswap_final[5], rgswap_final[6], rgswap_final[7]); } -void PolychromeUSBController::ResizeZone(int zone, int new_size) +void PolychromeUSBController::DeviceResizeZone(int zone, int new_size) { unsigned char zonecfg[POLYCHROME_USB_ZONE_MAX_NUM]; diff --git a/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.h b/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.h index c04530990..e2e178c53 100755 --- a/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.h +++ b/Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.h @@ -135,7 +135,7 @@ public: unsigned int configsize ); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void SetRGSwap(bool reset); protected: diff --git a/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.cpp b/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.cpp index 3f62d0ddf..1e111234e 100755 --- a/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.cpp +++ b/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.cpp @@ -229,8 +229,6 @@ void RGBController_PolychromeUSB::SetupZones() leds.push_back(new_led); } - - zones[channel_idx].matrix_map = NULL; } SetupColors(); @@ -273,10 +271,10 @@ void RGBController_PolychromeUSB::SetupZones() } } -void RGBController_PolychromeUSB::ResizeZone(int zone, int new_size) +void RGBController_PolychromeUSB::DeviceResizeZone(int zone, int new_size) { zones[zone].leds_count = (unsigned char) new_size; - controller->ResizeZone(zones_info[zone].zone, new_size); + controller->DeviceResizeZone(zones_info[zone].zone, new_size); } void RGBController_PolychromeUSB::DeviceUpdateLEDs() @@ -299,7 +297,7 @@ void RGBController_PolychromeUSB::DeviceUpdateLEDs() } } -void RGBController_PolychromeUSB::UpdateZoneLEDs(int zone) +void RGBController_PolychromeUSB::DeviceUpdateZoneLEDs(int zone) { unsigned char set_mode=zones_info[zone].mode; @@ -311,7 +309,7 @@ void RGBController_PolychromeUSB::UpdateZoneLEDs(int zone) controller->WriteZone(zone, set_mode, zones_info[zone].speed, zones[zone].colors[0], false); } -void RGBController_PolychromeUSB::UpdateSingleLED(int led) +void RGBController_PolychromeUSB::DeviceUpdateSingleLED(int led) { unsigned int channel = leds[led].value; unsigned char set_mode = zones_info[channel].mode; diff --git a/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.h b/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.h index c4d3e6d59..de5c70c23 100755 --- a/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.h +++ b/Controllers/ASRockPolychromeUSBController/RGBController_ASRockPolychromeUSB.h @@ -22,11 +22,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.cpp b/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.cpp index 66bd3037f..b21ee7262 100644 --- a/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.cpp +++ b/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.cpp @@ -135,7 +135,6 @@ void RGBController_ASRockASRRGBSMBus::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; /*---------------------------------------------------------*\ | Push new zone to zones vector | @@ -160,7 +159,7 @@ void RGBController_ASRockASRRGBSMBus::SetupZones() SetupColors(); } -void RGBController_ASRockASRRGBSMBus::ResizeZone(int /*zone*/, int /*new_size*/) +void RGBController_ASRockASRRGBSMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/) { /*---------------------------------------------------------*\ | This device does not support resizing zones | @@ -171,16 +170,16 @@ void RGBController_ASRockASRRGBSMBus::DeviceUpdateLEDs() { for(unsigned int led = 0; led < colors.size(); led++) { - UpdateSingleLED(led); + DeviceUpdateSingleLED(led); } } -void RGBController_ASRockASRRGBSMBus::UpdateZoneLEDs(int /*zone*/) +void RGBController_ASRockASRRGBSMBus::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ASRockASRRGBSMBus::UpdateSingleLED(int led) +void RGBController_ASRockASRRGBSMBus::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.h b/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.h index 8a192e761..aef091f27 100644 --- a/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.h +++ b/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/RGBController_ASRockASRRGBSMBus.h @@ -22,11 +22,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.cpp b/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.cpp index 21d2ada0d..c524d8783 100644 --- a/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.cpp +++ b/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.cpp @@ -267,7 +267,6 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; if(zone_idx == POLYCHROME_V1_ZONE_ADDRESSABLE) { @@ -297,9 +296,9 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones() SetupColors(); } -void RGBController_ASRockPolychromeV1SMBus::ResizeZone(int zone, int new_size) +void RGBController_ASRockPolychromeV1SMBus::DeviceResizeZone(int zone, int new_size) { - LOG_TRACE("[%s] ResizeZone(%02X, %02X)", name.c_str(), zone, new_size); + LOG_TRACE("[%s] DeviceResizeZone(%02X, %02X)", name.c_str(), zone, new_size); controller-> SetARGBSize(new_size & 0xFF); zones[POLYCHROME_V1_ZONE_ADDRESSABLE].leds_count = 1; } @@ -309,19 +308,19 @@ void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateLEDs() LOG_TRACE("[%s] DeviceUpdateLEDs()", name.c_str()); for (uint8_t zone_idx = 0; zone_idx < zoneIndexMap.size(); zone_idx++) { - UpdateSingleLED(zone_idx); + DeviceUpdateSingleLED(zone_idx); } } -void RGBController_ASRockPolychromeV1SMBus::UpdateZoneLEDs(int /*zone*/) +void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateZoneLEDs(int /*zone*/) { - LOG_TRACE("[%s] UpdateZoneLEDs()", name.c_str()); + LOG_TRACE("[%s] DeviceUpdateZoneLEDs()", name.c_str()); DeviceUpdateLEDs(); } -void RGBController_ASRockPolychromeV1SMBus::UpdateSingleLED(int zone) +void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateSingleLED(int zone) { - LOG_TRACE("[%s] UpdateSingleLED(%02X)", name.c_str(), zone); + LOG_TRACE("[%s] DeviceUpdateSingleLED(%02X)", name.c_str(), zone); uint8_t red = RGBGetRValue(colors[zone]); uint8_t grn = RGBGetGValue(colors[zone]); @@ -338,7 +337,7 @@ void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateMode() for(uint8_t zone_idx = 0; zone_idx < zoneIndexMap.size(); zone_idx++) { controller->SetMode(zoneIndexMap[zone_idx], modes[active_mode].value, modes[active_mode].speed); - UpdateSingleLED(zone_idx); + DeviceUpdateSingleLED(zone_idx); } } else diff --git a/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.h b/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.h index 479922ada..0190df099 100644 --- a/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.h +++ b/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/RGBController_ASRockPolychromeV1SMBus.h @@ -23,11 +23,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.cpp b/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.cpp index 4f8f9d3ca..8dbbd964b 100644 --- a/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.cpp +++ b/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.cpp @@ -229,8 +229,6 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones() new_zone->type = ZONE_TYPE_SINGLE; } - new_zone->matrix_map = NULL; - /*---------------------------------------------------------*\ | Push new zone to zones vector | \*---------------------------------------------------------*/ @@ -281,7 +279,7 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones() SetupColors(); } -void RGBController_ASRockPolychromeV2SMBus::ResizeZone(int /*zone*/, int /*new_size*/) +void RGBController_ASRockPolychromeV2SMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/) { /*---------------------------------------------------------*\ | This device does not support resizing zones | @@ -292,16 +290,16 @@ void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateLEDs() { for(unsigned int led = 0; led < colors.size(); led++) { - UpdateSingleLED(led); + DeviceUpdateSingleLED(led); } } -void RGBController_ASRockPolychromeV2SMBus::UpdateZoneLEDs(int /*zone*/) +void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ASRockPolychromeV2SMBus::UpdateSingleLED(int led) +void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.h b/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.h index f932bca9a..53b2365a6 100644 --- a/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.h +++ b/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/RGBController_ASRockPolychromeV2SMBus.h @@ -23,11 +23,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AlienwareController/RGBController_Alienware.cpp b/Controllers/AlienwareController/RGBController_Alienware.cpp index 1a8087892..49d1e22a4 100644 --- a/Controllers/AlienwareController/RGBController_Alienware.cpp +++ b/Controllers/AlienwareController/RGBController_Alienware.cpp @@ -141,7 +141,6 @@ void RGBController_Alienware::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); } @@ -158,26 +157,19 @@ void RGBController_Alienware::SetupZones() SetupColors(); } -void RGBController_Alienware::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Alienware::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_Alienware::UpdateZoneLEDs(int /*zone*/) +void RGBController_Alienware::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Alienware::UpdateSingleLED(int led) +void RGBController_Alienware::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } static bool modes_eq(const mode& mode1, const mode& mode2) diff --git a/Controllers/AlienwareController/RGBController_Alienware.h b/Controllers/AlienwareController/RGBController_Alienware.h index 2e0f16e88..ffcd6da55 100644 --- a/Controllers/AlienwareController/RGBController_Alienware.h +++ b/Controllers/AlienwareController/RGBController_Alienware.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.cpp b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.cpp index b7834e1ae..458a126ab 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.cpp +++ b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.cpp @@ -319,7 +319,7 @@ void AlienwareAW410KController::SetMode SendCommit(); } -void AlienwareAW410KController::UpdateSingleLED +void AlienwareAW410KController::DeviceUpdateSingleLED ( unsigned char led, unsigned char red, diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.h b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.h index 027176388..c01f73d2e 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.h +++ b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/AlienwareAW410KController.h @@ -130,7 +130,7 @@ public: unsigned char blue2 ); - void UpdateSingleLED + void DeviceUpdateSingleLED ( unsigned char led, unsigned char red, diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.cpp b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.cpp index e42778fa0..76bbeaf52 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.cpp +++ b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.cpp @@ -278,17 +278,6 @@ RGBController_AlienwareAW410K::RGBController_AlienwareAW410K(AlienwareAW410KCont RGBController_AlienwareAW410K::~RGBController_AlienwareAW410K() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -310,14 +299,7 @@ void RGBController_AlienwareAW410K::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 24; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(6, 24, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -336,13 +318,6 @@ void RGBController_AlienwareAW410K::SetupZones() SetupColors(); } -void RGBController_AlienwareAW410K::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AlienwareAW410K::DeviceUpdateLEDs() { std::vector frame_buf_keys; @@ -374,21 +349,21 @@ void RGBController_AlienwareAW410K::DeviceUpdateLEDs() std::copy(new_colors.begin(), new_colors.end(),current_colors.begin()); } -void RGBController_AlienwareAW410K::UpdateZoneLEDs(int zone) +void RGBController_AlienwareAW410K::DeviceUpdateZoneLEDs(int zone) { controller->SetDirect((unsigned char) zone, RGBGetRValue(zones[zone].colors[0]), RGBGetGValue(zones[zone].colors[0]), RGBGetBValue(zones[zone].colors[0])); } -void RGBController_AlienwareAW410K::UpdateSingleLED(int led) +void RGBController_AlienwareAW410K::DeviceUpdateSingleLED(int led) { - controller->UpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led])); + controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led])); } void RGBController_AlienwareAW410K::DeviceUpdateMode() { if(active_mode == 0xFFFF) { - UpdateLEDs(); + UpdateLEDsInternal(); return; } diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.h b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.h index 8c2b920ea..51a9c4b82 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.h +++ b/Controllers/AlienwareKeyboardController/AlienwareAW410KController/RGBController_AlienwareAW410K.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.cpp b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.cpp index db16c0f63..4e6b4f673 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.cpp +++ b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.cpp @@ -318,7 +318,7 @@ void AlienwareAW510KController::SetMode SendCommit(); } -void AlienwareAW510KController::UpdateSingleLED +void AlienwareAW510KController::DeviceUpdateSingleLED ( unsigned char led, unsigned char red, diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.h b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.h index d17014e75..3c0ee056e 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.h +++ b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/AlienwareAW510KController.h @@ -132,7 +132,7 @@ public: unsigned char blue2 ); - void UpdateSingleLED + void DeviceUpdateSingleLED ( unsigned char led, unsigned char red, diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.cpp b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.cpp index 9c484a146..06488f1d6 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.cpp +++ b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.cpp @@ -277,17 +277,6 @@ RGBController_AlienwareAW510K::RGBController_AlienwareAW510K(AlienwareAW510KCont RGBController_AlienwareAW510K::~RGBController_AlienwareAW510K() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -309,14 +298,7 @@ void RGBController_AlienwareAW510K::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 24; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 24, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -335,13 +317,6 @@ void RGBController_AlienwareAW510K::SetupZones() SetupColors(); } -void RGBController_AlienwareAW510K::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AlienwareAW510K::DeviceUpdateLEDs() { std::vector frame_buf_keys; @@ -395,21 +370,21 @@ void RGBController_AlienwareAW510K::DeviceUpdateLEDs() std::copy(new_colors.begin(), new_colors.end(),current_colors.begin()); } -void RGBController_AlienwareAW510K::UpdateZoneLEDs(int zone) +void RGBController_AlienwareAW510K::DeviceUpdateZoneLEDs(int zone) { controller->SetDirect((unsigned char) zone, RGBGetRValue(zones[zone].colors[0]), RGBGetGValue(zones[zone].colors[0]), RGBGetBValue(zones[zone].colors[0])); } -void RGBController_AlienwareAW510K::UpdateSingleLED(int led) +void RGBController_AlienwareAW510K::DeviceUpdateSingleLED(int led) { - controller->UpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led])); + controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led])); } void RGBController_AlienwareAW510K::DeviceUpdateMode() { if(active_mode == 0xFFFF) { - UpdateLEDs(); + UpdateLEDsInternal(); return; } diff --git a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.h b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.h index 99d7fd3b2..4342505a3 100644 --- a/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.h +++ b/Controllers/AlienwareKeyboardController/AlienwareAW510KController/RGBController_AlienwareAW510K.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.cpp b/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.cpp index 8f4bfb86c..8270b6e88 100644 --- a/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.cpp +++ b/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.cpp @@ -57,7 +57,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones() Logo.leds_min = 1; Logo.leds_max = 1; Logo.leds_count = 1; - Logo.matrix_map = NULL; zones.push_back(Logo); led Logo_LED; @@ -71,7 +70,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones() Number.leds_min = 1; Number.leds_max = 1; Number.leds_count = 1; - Number.matrix_map = NULL; zones.push_back(Number); led Number_LED; @@ -85,7 +83,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones() PowerButton.leds_min = 1; PowerButton.leds_max = 1; PowerButton.leds_count = 1; - PowerButton.matrix_map = NULL; zones.push_back(PowerButton); led PowerButton_LED; @@ -96,10 +93,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones() SetupColors(); } -void RGBController_AlienwareAW3423DWF::ResizeZone(int /*zone*/, int /*new_size*/) -{ -} - void RGBController_AlienwareAW3423DWF::DeviceUpdateLEDs() { /*-----------------------------------------------------*\ @@ -118,17 +111,17 @@ void RGBController_AlienwareAW3423DWF::DeviceUpdateLEDs() { for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++) { - UpdateSingleLED(led_idx); + DeviceUpdateSingleLED(led_idx); } } } -void RGBController_AlienwareAW3423DWF::UpdateZoneLEDs(int /*zone*/) +void RGBController_AlienwareAW3423DWF::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AlienwareAW3423DWF::UpdateSingleLED(int led) +void RGBController_AlienwareAW3423DWF::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.h b/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.h index b2af94b52..95652b6f3 100644 --- a/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.h +++ b/Controllers/AlienwareMonitorController/RGBController_AlienwareAW3423DWF.h @@ -21,11 +21,10 @@ public: ~RGBController_AlienwareAW3423DWF(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.cpp b/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.cpp index 55abf1ab3..8a247a242 100644 --- a/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.cpp +++ b/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.cpp @@ -57,7 +57,6 @@ void RGBController_AlienwareMonitor::SetupZones() Logo.leds_min = 1; Logo.leds_max = 1; Logo.leds_count = 1; - Logo.matrix_map = NULL; zones.push_back(Logo); led Logo_LED; @@ -71,7 +70,6 @@ void RGBController_AlienwareMonitor::SetupZones() Number.leds_min = 1; Number.leds_max = 1; Number.leds_count = 1; - Number.matrix_map = NULL; zones.push_back(Number); led Number_LED; @@ -85,7 +83,6 @@ void RGBController_AlienwareMonitor::SetupZones() PowerButton.leds_min = 1; PowerButton.leds_max = 1; PowerButton.leds_count = 1; - PowerButton.matrix_map = NULL; zones.push_back(PowerButton); led PowerButton_LED; @@ -96,11 +93,6 @@ void RGBController_AlienwareMonitor::SetupZones() SetupColors(); } -void RGBController_AlienwareMonitor::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_AlienwareMonitor::DeviceUpdateLEDs() { /*-----------------------------------------------------*\ @@ -119,17 +111,17 @@ void RGBController_AlienwareMonitor::DeviceUpdateLEDs() { for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++) { - UpdateSingleLED(led_idx); + DeviceUpdateSingleLED(led_idx); } } } -void RGBController_AlienwareMonitor::UpdateZoneLEDs(int /*zone*/) +void RGBController_AlienwareMonitor::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AlienwareMonitor::UpdateSingleLED(int led) +void RGBController_AlienwareMonitor::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.h b/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.h index ef59dd390..b0729c7cf 100644 --- a/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.h +++ b/Controllers/AlienwareMonitorController/RGBController_AlienwareMonitor.h @@ -21,11 +21,10 @@ RGBController_AlienwareMonitor(AlienwareMonitorController* controller_ptr); ~RGBController_AlienwareMonitor(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AnnePro2Controller/RGBController_AnnePro2.cpp b/Controllers/AnnePro2Controller/RGBController_AnnePro2.cpp index 6c87a2c2d..5a537ff9a 100644 --- a/Controllers/AnnePro2Controller/RGBController_AnnePro2.cpp +++ b/Controllers/AnnePro2Controller/RGBController_AnnePro2.cpp @@ -164,14 +164,7 @@ void RGBController_AnnePro2::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 5; - new_zone.matrix_map->width = 14; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(5, 14, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -190,13 +183,6 @@ void RGBController_AnnePro2::SetupZones() SetupColors(); } -void RGBController_AnnePro2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AnnePro2::DeviceUpdateLEDs() { const unsigned char frame_buf_length = LED_REAL_COUNT * 3; @@ -228,12 +214,12 @@ void RGBController_AnnePro2::DeviceUpdateLEDs() controller->SendDirect(frame_buf_length, frame_buf); } -void RGBController_AnnePro2::UpdateZoneLEDs(int /*zone*/) +void RGBController_AnnePro2::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AnnePro2::UpdateSingleLED(int /*led*/) +void RGBController_AnnePro2::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AnnePro2Controller/RGBController_AnnePro2.h b/Controllers/AnnePro2Controller/RGBController_AnnePro2.h index 865d82e48..868817309 100644 --- a/Controllers/AnnePro2Controller/RGBController_AnnePro2.h +++ b/Controllers/AnnePro2Controller/RGBController_AnnePro2.h @@ -21,11 +21,10 @@ public: ~RGBController_AnnePro2(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ArcticController/RGBController_Arctic.cpp b/Controllers/ArcticController/RGBController_Arctic.cpp index d6d2605fa..1eea37236 100644 --- a/Controllers/ArcticController/RGBController_Arctic.cpp +++ b/Controllers/ArcticController/RGBController_Arctic.cpp @@ -70,7 +70,6 @@ void RGBController_Arctic::SetupZones() LedZone.leds_count = 1; LedZone.leds_min = 1; LedZone.leds_max = 1; - LedZone.matrix_map = nullptr; led Led; Led.name = LedZone.name + " LED"; @@ -83,13 +82,6 @@ void RGBController_Arctic::SetupZones() SetupColors(); } -void RGBController_Arctic::ResizeZone(int /* zone */, int /* new_size */) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Arctic::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -97,12 +89,12 @@ void RGBController_Arctic::DeviceUpdateLEDs() controller->SetChannels(colors); } -void RGBController_Arctic::UpdateZoneLEDs(int /* zone */) +void RGBController_Arctic::DeviceUpdateZoneLEDs(int /* zone */) { DeviceUpdateLEDs(); } -void RGBController_Arctic::UpdateSingleLED(int /* led */) +void RGBController_Arctic::DeviceUpdateSingleLED(int /* led */) { DeviceUpdateLEDs(); } @@ -123,7 +115,7 @@ void RGBController_Arctic::KeepaliveThreadFunction() sleep_time = ARCTIC_KEEPALIVE_PERIOD - (std::chrono::steady_clock::now() - last_update_time); if(sleep_time <= ARCTIC_SLEEP_THRESHOLD) { - UpdateLEDs(); // Already protected thru a device update thread + UpdateLEDsInternal(); // Already protected thru a device update thread std::this_thread::sleep_for(ARCTIC_KEEPALIVE_PERIOD); } else diff --git a/Controllers/ArcticController/RGBController_Arctic.h b/Controllers/ArcticController/RGBController_Arctic.h index 870c041f9..3dc87e19b 100644 --- a/Controllers/ArcticController/RGBController_Arctic.h +++ b/Controllers/ArcticController/RGBController_Arctic.h @@ -25,11 +25,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AresonController/RGBController_Areson.cpp b/Controllers/AresonController/RGBController_Areson.cpp index b4e46b863..388517da6 100644 --- a/Controllers/AresonController/RGBController_Areson.cpp +++ b/Controllers/AresonController/RGBController_Areson.cpp @@ -137,7 +137,6 @@ void RGBController_Areson::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -150,24 +149,17 @@ void RGBController_Areson::SetupZones() SetupColors(); } -void RGBController_Areson::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Areson::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_Areson::UpdateZoneLEDs(int /*zone*/) +void RGBController_Areson::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_Areson::UpdateSingleLED(int /*led*/) +void RGBController_Areson::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/AresonController/RGBController_Areson.h b/Controllers/AresonController/RGBController_Areson.h index faea5a53f..baea9f2b8 100644 --- a/Controllers/AresonController/RGBController_Areson.h +++ b/Controllers/AresonController/RGBController_Areson.h @@ -21,11 +21,10 @@ public: ~RGBController_Areson(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.cpp b/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.cpp index 6f51697ee..248b3f5c6 100644 --- a/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.cpp +++ b/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.cpp @@ -186,7 +186,6 @@ void RGBController_AuraCore::SetupZones() auraZone.leds_min = 4; auraZone.leds_max = 4; auraZone.leds_count = 4; - auraZone.matrix_map = NULL; } else if(controller->aura_device.aura_type == AURA_CORE_DEVICE_GA15DH) { @@ -195,7 +194,6 @@ void RGBController_AuraCore::SetupZones() auraZone.leds_min = 20; auraZone.leds_max = 20; auraZone.leds_count = 20; - auraZone.matrix_map = NULL; } else { @@ -215,19 +213,12 @@ void RGBController_AuraCore::SetupZones() SetupColors(); } -void RGBController_AuraCore::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AuraCore::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_AuraCore::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraCore::DeviceUpdateZoneLEDs(int /*zone*/) { if(modes[active_mode].value == AURA_CORE_MODE_DIRECT) { @@ -256,16 +247,16 @@ void RGBController_AuraCore::UpdateZoneLEDs(int /*zone*/) { for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++) { - UpdateSingleLED(led_idx); + DeviceUpdateSingleLED(led_idx); } } else { - UpdateSingleLED(0); + DeviceUpdateSingleLED(0); } } -void RGBController_AuraCore::UpdateSingleLED(int led) +void RGBController_AuraCore::DeviceUpdateSingleLED(int led) { unsigned char speed = 0xFF; unsigned char red = 0; diff --git a/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.h b/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.h index b9dbe9e26..c988d72a6 100644 --- a/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.h +++ b/Controllers/AsusAuraCoreController/AsusAuraCoreController/RGBController_AsusAuraCore.h @@ -24,11 +24,9 @@ public: void SetupGA15DH(); void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusAuraCoreController/AsusAuraCoreControllerDetect.cpp b/Controllers/AsusAuraCoreController/AsusAuraCoreControllerDetect.cpp index 7d38e55e0..a1791e66a 100644 --- a/Controllers/AsusAuraCoreController/AsusAuraCoreControllerDetect.cpp +++ b/Controllers/AsusAuraCoreController/AsusAuraCoreControllerDetect.cpp @@ -36,7 +36,7 @@ void DetectAsusAuraCoreControllers(hid_device_info* info, const std::string& /*n AuraCoreController* controller = new AuraCoreController(dev, info->path); RGBController_AuraCore* rgb_controller = new RGBController_AuraCore(controller); - if(rgb_controller->type != DEVICE_TYPE_UNKNOWN) + if(rgb_controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN) { ResourceManager::get()->RegisterRGBController(rgb_controller); } diff --git a/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.cpp b/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.cpp index 915ae8ddc..caacb2c6b 100644 --- a/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.cpp +++ b/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.cpp @@ -263,7 +263,7 @@ RGBController_AsusAuraCoreLaptop::RGBController_AsusAuraCoreLaptop(AsusAuraCoreL SetupZones(); - SetMode(active_mode); + SetActiveMode(active_mode); } RGBController_AsusAuraCoreLaptop::~RGBController_AsusAuraCoreLaptop() @@ -339,18 +339,7 @@ void RGBController_AsusAuraCoreLaptop::SetupZones() else { new_zone.type = ZONE_TYPE_MATRIX; - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - - /*---------------------------------------------------------*\ - | Trusting the layout handed to the KLM is correct use the | - | row & column counts to set the matrix height & width | - \*---------------------------------------------------------*/ - new_map->height = new_kb.GetRowCount(); - new_map->width = new_kb.GetColumnCount(); - new_map->map = new unsigned int[new_map->height * new_map->width]; - - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); } /*---------------------------------------------------------*\ @@ -398,13 +387,6 @@ void RGBController_AsusAuraCoreLaptop::SetupZones() } } -void RGBController_AsusAuraCoreLaptop::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AsusAuraCoreLaptop::DeviceUpdateLEDs() { for(size_t i = 85; i < leds.size(); i++) @@ -422,12 +404,12 @@ void RGBController_AsusAuraCoreLaptop::DeviceUpdateLEDs() controller->SetLedsDirect(buffer_map); } -void RGBController_AsusAuraCoreLaptop::UpdateZoneLEDs(int /*zone*/) +void RGBController_AsusAuraCoreLaptop::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLedsDirect(buffer_map); } -void RGBController_AsusAuraCoreLaptop::UpdateSingleLED(int /*led*/) +void RGBController_AsusAuraCoreLaptop::DeviceUpdateSingleLED(int /*led*/) { controller->SetLedsDirect(buffer_map); } diff --git a/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.h b/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.h index 180424c4b..ae974102c 100644 --- a/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.h +++ b/Controllers/AsusAuraCoreController/AsusAuraCoreLaptopController/RGBController_AsusAuraCoreLaptop.h @@ -23,11 +23,10 @@ public: ~RGBController_AsusAuraCoreLaptop(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.cpp b/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.cpp index 7358f7dc5..3ecf33683 100644 --- a/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.cpp +++ b/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.cpp @@ -138,7 +138,6 @@ void RGBController_AuraGPU::SetupZones() aura_gpu_zone.leds_min = 1; aura_gpu_zone.leds_max = 1; aura_gpu_zone.leds_count = 1; - aura_gpu_zone.matrix_map = NULL; zones.push_back(aura_gpu_zone); /*---------------------------------------------------------*\ @@ -160,13 +159,6 @@ void RGBController_AuraGPU::SetupZones() colors[0] = ToRGBColor(red, grn, blu); } -void RGBController_AuraGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AuraGPU::DeviceUpdateLEDs() { for(std::size_t led = 0; led < colors.size(); led++) @@ -177,18 +169,18 @@ void RGBController_AuraGPU::DeviceUpdateLEDs() controller->SetLEDColors(red, grn, blu); } - if (controller->SaveOnlyApplies() && GetMode() != 0) + if (controller->SaveOnlyApplies() && GetActiveMode() != 0) { controller->Save(); } } -void RGBController_AuraGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AuraGPU::UpdateSingleLED(int /*led*/) +void RGBController_AuraGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.h b/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.h index bb4c4b912..e0b5fe387 100644 --- a/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.h +++ b/Controllers/AsusAuraGPUController/RGBController_AsusAuraGPU.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.cpp b/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.cpp index 1801828d7..5792e0512 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.cpp @@ -124,7 +124,6 @@ void RGBController_AuraHeadsetStand::SetupZones() underglow_zone.leds_min = 17; underglow_zone.leds_max = 17; underglow_zone.leds_count = 17; - underglow_zone.matrix_map = NULL; zones.push_back(underglow_zone); @@ -144,7 +143,6 @@ void RGBController_AuraHeadsetStand::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); @@ -157,24 +155,17 @@ void RGBController_AuraHeadsetStand::SetupZones() SetupColors(); } -void RGBController_AuraHeadsetStand::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AuraHeadsetStand::DeviceUpdateLEDs() { controller->UpdateLeds(std::vector(colors)); } -void RGBController_AuraHeadsetStand::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraHeadsetStand::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AuraHeadsetStand::UpdateSingleLED(int /*led*/) +void RGBController_AuraHeadsetStand::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.h b/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.h index b1e32f054..61e383c29 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.h +++ b/Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController/RGBController_AsusAuraHeadsetStand.h @@ -32,11 +32,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.cpp b/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.cpp index f64535bfb..7a085c7d4 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.cpp @@ -380,14 +380,6 @@ RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* c RGBController_AuraKeyboard::~RGBController_AuraKeyboard() { - for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) - { - if(zones[zone_idx].type == ZONE_TYPE_MATRIX) - { - delete zones[zone_idx].matrix_map; - } - } - delete controller; } @@ -407,7 +399,7 @@ void RGBController_AuraKeyboard::SetupZones() \*-----------------------------------------------------*/ case SCOPE_LAYOUT: led_names = default_led_names; - led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 106, new matrix_map_type{6, 22, (unsigned int *)&scope_matrix_map}}); + led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 106, new matrix_map_type(6, 22, (unsigned int *)&scope_matrix_map)}); led_names.insert(led_names.begin() + 7, {KEY_EN_LEFT_WINDOWS, 0x15}); led_names.insert(led_names.begin() + 12, {KEY_EN_LEFT_ALT, 0x1D}); @@ -415,7 +407,7 @@ void RGBController_AuraKeyboard::SetupZones() case SCOPE_RX_LAYOUT: led_names = default_led_names; - led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 106, new matrix_map_type{6, 22, (unsigned int *)&scope_matrix_map}}); + led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 106, new matrix_map_type(6, 22, (unsigned int *)&scope_matrix_map)}); led_zones.push_back({"Logo", ZONE_TYPE_SINGLE, 1, NULL}); led_names.insert(led_names.begin() + 7, {KEY_EN_LEFT_WINDOWS, 0x15}); @@ -425,7 +417,7 @@ void RGBController_AuraKeyboard::SetupZones() case SCOPE_TKL_LAYOUT: led_names = default_tkl_led_names; - led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 86, new matrix_map_type{6, 18, (unsigned int *)&scope_tkl_matrix_map}}); + led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 86, new matrix_map_type(6, 18, (unsigned int *)&scope_tkl_matrix_map)}); led_zones.push_back({"Logo", ZONE_TYPE_LINEAR, 2, NULL}); led_zones.push_back({"Underglow", ZONE_TYPE_LINEAR, 26, NULL}); @@ -435,7 +427,7 @@ void RGBController_AuraKeyboard::SetupZones() case FLARE_LAYOUT: led_names = default_led_names; - led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 106, new matrix_map_type{6, 22, (unsigned int *)&flare_matrix_map}}); + led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 106, new matrix_map_type(6, 22, (unsigned int *)&flare_matrix_map)}); led_zones.push_back({"Logo", ZONE_TYPE_SINGLE, 1, NULL}); led_zones.push_back({"Underglow", ZONE_TYPE_SINGLE, 2, NULL}); @@ -449,7 +441,7 @@ void RGBController_AuraKeyboard::SetupZones() case FALCHION_LAYOUT: led_names = default_65pct_led_names; - led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 68, new matrix_map_type{5, 16, (unsigned int *)&falchion_matrix_map}}); + led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 68, new matrix_map_type(5, 16, (unsigned int *)&falchion_matrix_map)}); break; } @@ -463,13 +455,9 @@ void RGBController_AuraKeyboard::SetupZones() new_zone.leds_max = led_zones[zone_idx].size; new_zone.leds_count = led_zones[zone_idx].size; - if(led_zones[zone_idx].type == ZONE_TYPE_MATRIX) + if(led_zones[zone_idx].type == ZONE_TYPE_MATRIX && led_zones[zone_idx].matrix != NULL) { - new_zone.matrix_map = led_zones[zone_idx].matrix; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map = *led_zones[zone_idx].matrix; } zones.push_back(new_zone); @@ -489,13 +477,6 @@ void RGBController_AuraKeyboard::SetupZones() SetupColors(); } -void RGBController_AuraKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AuraKeyboard::DeviceUpdateLEDs() { std::vector frame_buf; @@ -519,12 +500,12 @@ void RGBController_AuraKeyboard::DeviceUpdateLEDs() controller->SendDirect((unsigned char)leds.size(), frame_buf.data()); } -void RGBController_AuraKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AuraKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_AuraKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.h b/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.h index 1e8c25aba..6c0d0c3a9 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.h +++ b/Controllers/AsusAuraUSBController/AsusAuraKeyboardController/RGBController_AsusAuraKeyboard.h @@ -45,11 +45,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.cpp b/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.cpp index 82fc11b6c..0d0241b8e 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.cpp @@ -57,7 +57,6 @@ void RGBController_AuraMonitor::SetupZones() underglow_zone.leds_min = 3; underglow_zone.leds_max = 3; underglow_zone.leds_count = 3; - underglow_zone.matrix_map = NULL; zones.push_back(underglow_zone); @@ -73,13 +72,6 @@ void RGBController_AuraMonitor::SetupZones() SetupColors(); } -void RGBController_AuraMonitor::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AuraMonitor::DeviceUpdateLEDs() { controller->BeginUpdate(); @@ -96,12 +88,12 @@ void RGBController_AuraMonitor::DeviceUpdateLEDs() controller->ApplyChanges(); } -void RGBController_AuraMonitor::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraMonitor::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AuraMonitor::UpdateSingleLED(int led) +void RGBController_AuraMonitor::DeviceUpdateSingleLED(int led) { controller->BeginUpdate(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.h b/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.h index f1b0e45a0..e93c73c08 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.h +++ b/Controllers/AsusAuraUSBController/AsusAuraMonitorController/RGBController_AsusAuraMonitor.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.cpp b/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.cpp index bf5832190..666d738a7 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.cpp @@ -199,7 +199,6 @@ void RGBController_AuraMouse::SetupZones() mouse_zone.leds_min = 1; mouse_zone.leds_max = 1; mouse_zone.leds_count = 1; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); @@ -214,11 +213,6 @@ void RGBController_AuraMouse::SetupZones() SetupColors(); } -void RGBController_AuraMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_AuraMouse::DeviceUpdateLEDs() { if(modes[active_mode].value == AURA_MOUSE_MODE_DIRECT) @@ -229,17 +223,17 @@ void RGBController_AuraMouse::DeviceUpdateLEDs() { for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) { - UpdateSingleLED(zone_index); + DeviceUpdateSingleLED(zone_index); } } } -void RGBController_AuraMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AuraMouse::UpdateSingleLED(int led) +void RGBController_AuraMouse::DeviceUpdateSingleLED(int led) { if(modes[active_mode].value == AURA_MOUSE_MODE_DIRECT) { diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.h b/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.h index d6b3e6c62..769a6ac91 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.h +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseController/RGBController_AsusAuraMouse.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.cpp b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.cpp index 51df54af7..c7491c5ae 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.cpp @@ -133,7 +133,6 @@ void RGBController_AsusROGSpatha::SetupZones() spatha_zone.leds_min = 1; spatha_zone.leds_max = 1; spatha_zone.leds_count = 1; - spatha_zone.matrix_map = NULL; zones.push_back(spatha_zone); @@ -148,11 +147,6 @@ void RGBController_AsusROGSpatha::SetupZones() SetupColors(); } -void RGBController_AsusROGSpatha::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_AsusROGSpatha::DeviceUpdateLEDs() { if(modes[active_mode].value == ASUS_ROG_SPATHA_MODE_DIRECT) @@ -161,13 +155,13 @@ void RGBController_AsusROGSpatha::DeviceUpdateLEDs() } else { - UpdateSingleLED(0); - UpdateSingleLED(1); - UpdateSingleLED(2); + DeviceUpdateSingleLED(0); + DeviceUpdateSingleLED(1); + DeviceUpdateSingleLED(2); } } -void RGBController_AsusROGSpatha::UpdateZoneLEDs(int zone) +void RGBController_AsusROGSpatha::DeviceUpdateZoneLEDs(int zone) { if(modes[active_mode].value == ASUS_ROG_SPATHA_MODE_DIRECT) { @@ -175,11 +169,11 @@ void RGBController_AsusROGSpatha::UpdateZoneLEDs(int zone) } else { - UpdateSingleLED(zone); + DeviceUpdateSingleLED(zone); } } -void RGBController_AsusROGSpatha::UpdateSingleLED(int led) +void RGBController_AsusROGSpatha::DeviceUpdateSingleLED(int led) { if(modes[active_mode].value == ASUS_ROG_SPATHA_MODE_DIRECT) { diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.h b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.h index e1e509380..b727c09ad 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.h +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGSpatha.h @@ -40,11 +40,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.cpp b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.cpp index 75b61285a..8b700c2a4 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.cpp @@ -91,7 +91,6 @@ void RGBController_AsusROGStrixEvolve::SetupZones() mouse_zone.leds_min = 1; mouse_zone.leds_max = 1; mouse_zone.leds_count = 1; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); @@ -105,22 +104,17 @@ void RGBController_AsusROGStrixEvolve::SetupZones() SetupColors(); } -void RGBController_AsusROGStrixEvolve::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_AsusROGStrixEvolve::DeviceUpdateLEDs() { - UpdateSingleLED(0); + DeviceUpdateSingleLED(0); } -void RGBController_AsusROGStrixEvolve::UpdateZoneLEDs(int zone) +void RGBController_AsusROGStrixEvolve::DeviceUpdateZoneLEDs(int zone) { - UpdateSingleLED(zone); + DeviceUpdateSingleLED(zone); } -void RGBController_AsusROGStrixEvolve::UpdateSingleLED(int /*led*/) +void RGBController_AsusROGStrixEvolve::DeviceUpdateSingleLED(int /*led*/) { controller->SendUpdate(0x1C, RGBGetRValue(colors[0])); controller->SendUpdate(0x1D, RGBGetGValue(colors[0])); diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.h b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.h index f68ae52c8..66dae1a18 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.h +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseGen1Controller/RGBController_AsusROGStrixEvolve.h @@ -37,11 +37,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.cpp b/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.cpp index fe2196d6d..31f39f635 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.cpp @@ -194,7 +194,6 @@ void RGBController_AuraMousemat::SetupZones() mousemat_zone.leds_min = 15; mousemat_zone.leds_max = 15; mousemat_zone.leds_count = 15; - mousemat_zone.matrix_map = NULL; zones.push_back(mousemat_zone); @@ -210,24 +209,17 @@ void RGBController_AuraMousemat::SetupZones() SetupColors(); } -void RGBController_AuraMousemat::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AuraMousemat::DeviceUpdateLEDs() { controller->UpdateLeds(std::vector(colors)); } -void RGBController_AuraMousemat::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraMousemat::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AuraMousemat::UpdateSingleLED(int /*led*/) +void RGBController_AuraMousemat::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.h b/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.h index 5c915857b..405bfd776 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.h +++ b/Controllers/AsusAuraUSBController/AsusAuraMousematController/RGBController_AsusAuraMousemat.h @@ -40,11 +40,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.cpp b/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.cpp index e99537e77..f4b7ccba9 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.cpp @@ -171,29 +171,22 @@ void RGBController_AsusAuraRyuoAIO::SetupZones() SetupColors(); } -void RGBController_AsusAuraRyuoAIO::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AsusAuraRyuoAIO::DeviceUpdateLEDs() { for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_AsusAuraRyuoAIO::UpdateZoneLEDs(int zone) +void RGBController_AsusAuraRyuoAIO::DeviceUpdateZoneLEDs(int zone) { controller->SetLedsDirect(zones[zone].colors, zones[zone].leds_count); } -void RGBController_AsusAuraRyuoAIO::UpdateSingleLED(int led) +void RGBController_AsusAuraRyuoAIO::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(GetLED_Zone(led)); + DeviceUpdateZoneLEDs(GetLED_Zone(led)); } void RGBController_AsusAuraRyuoAIO::DeviceUpdateMode() diff --git a/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.h b/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.h index 48d28da34..7745f8c2f 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.h +++ b/Controllers/AsusAuraUSBController/AsusAuraRyuoAIOController/RGBController_AsusAuraRyuoAIO.h @@ -24,11 +24,10 @@ public: ~RGBController_AsusAuraRyuoAIO(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.cpp b/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.cpp index 1d4c216cc..a2f38c0f0 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.cpp @@ -511,10 +511,7 @@ void RGBController_AuraTUFKeyboard::SetupZones() keyboard_zone.leds_min = keyboard[layout].size; keyboard_zone.leds_max = keyboard[layout].size; keyboard_zone.leds_count = keyboard[layout].size; - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->height = keyboard[layout].rows; - keyboard_zone.matrix_map->width = keyboard[layout].cols; - keyboard_zone.matrix_map->map = keyboard[layout].matrix_map; + keyboard_zone.matrix_map.Set(keyboard[layout].rows, keyboard[layout].cols, keyboard[layout].matrix_map); zones.push_back(keyboard_zone); for(int led_id = 0; led_id < keyboard[layout].size; led_id++) @@ -533,11 +530,6 @@ void RGBController_AuraTUFKeyboard::SetupZones() DeviceUpdateMode(); } -void RGBController_AuraTUFKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs() { std::vector led_color_list = {}; @@ -550,12 +542,12 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs() controller->UpdateLeds(led_color_list); } -void RGBController_AuraTUFKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_AuraTUFKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AuraTUFKeyboard::UpdateSingleLED(int led) +void RGBController_AuraTUFKeyboard::DeviceUpdateSingleLED(int led) { if(!controller->is_per_led_keyboard) { diff --git a/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.h b/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.h index d2eb3ac57..0d10f51a2 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.h +++ b/Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController/RGBController_AsusAuraTUFKeyboard.h @@ -43,11 +43,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp b/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp index d43d01788..1a4f6ebe6 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp @@ -195,14 +195,12 @@ void RGBController_AuraUSB::SetupZones() leds.push_back(new_led); } - - zones[channel_idx].matrix_map = NULL; } SetupColors(); } -void RGBController_AuraUSB::ResizeZone(int zone, int new_size) +void RGBController_AuraUSB::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -229,7 +227,7 @@ void RGBController_AuraUSB::DeviceUpdateLEDs() } } -void RGBController_AuraUSB::UpdateZoneLEDs(int zone) +void RGBController_AuraUSB::DeviceUpdateZoneLEDs(int zone) { if(!initializedMode) { @@ -239,7 +237,7 @@ void RGBController_AuraUSB::UpdateZoneLEDs(int zone) controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); } -void RGBController_AuraUSB::UpdateSingleLED(int led) +void RGBController_AuraUSB::DeviceUpdateSingleLED(int led) { if(!initializedMode) { diff --git a/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.h b/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.h index f09df21b5..e249c333d 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.h +++ b/Controllers/AsusAuraUSBController/AsusAuraUSBController/RGBController_AsusAuraUSB.h @@ -24,11 +24,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.cpp b/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.cpp index bfebc46fa..2fa4a6331 100644 --- a/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.cpp +++ b/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.cpp @@ -129,7 +129,6 @@ void RGBController_AsusROGAlly::SetupZones() left_stick_zone.leds_min = 2; left_stick_zone.leds_max = 2; left_stick_zone.leds_count = 2; - left_stick_zone.matrix_map = NULL; zones.push_back(left_stick_zone); @@ -149,7 +148,6 @@ void RGBController_AsusROGAlly::SetupZones() right_stick_zone.leds_min = 2; right_stick_zone.leds_max = 2; right_stick_zone.leds_count = 2; - right_stick_zone.matrix_map = NULL; zones.push_back(right_stick_zone); @@ -165,13 +163,6 @@ void RGBController_AsusROGAlly::SetupZones() SetupColors(); } -void RGBController_AsusROGAlly::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AsusROGAlly::DeviceUpdateLEDs() { if(modes[active_mode].value == ROG_ALLY_MODE_DIRECT) @@ -180,12 +171,12 @@ void RGBController_AsusROGAlly::DeviceUpdateLEDs() } } -void RGBController_AsusROGAlly::UpdateZoneLEDs(int /*zone*/) +void RGBController_AsusROGAlly::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AsusROGAlly::UpdateSingleLED(int /*led*/) +void RGBController_AsusROGAlly::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.h b/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.h index 4aa2abd5b..80aa3c388 100644 --- a/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.h +++ b/Controllers/AsusAuraUSBController/AsusROGAllyController/RGBController_AsusROGAlly.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.cpp b/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.cpp index b8646cfbe..0a8be8872 100644 --- a/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.cpp +++ b/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.cpp @@ -172,29 +172,22 @@ void RGBController_AsusROGStrixLC::SetupZones() SetupColors(); } -void RGBController_AsusROGStrixLC::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AsusROGStrixLC::DeviceUpdateLEDs() { for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_AsusROGStrixLC::UpdateZoneLEDs(int zone) +void RGBController_AsusROGStrixLC::DeviceUpdateZoneLEDs(int zone) { controller->SetLedsDirect( zones[zone].colors, zones[zone].leds_count ); } -void RGBController_AsusROGStrixLC::UpdateSingleLED(int led) +void RGBController_AsusROGStrixLC::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(GetLED_Zone(led)); + DeviceUpdateZoneLEDs(GetLED_Zone(led)); } void RGBController_AsusROGStrixLC::DeviceUpdateMode() diff --git a/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.h b/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.h index 80318e848..e2e46695c 100644 --- a/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.h +++ b/Controllers/AsusAuraUSBController/AsusROGStrixLCController/RGBController_AsusROGStrixLC.h @@ -23,11 +23,10 @@ public: ~RGBController_AsusROGStrixLC(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); private: diff --git a/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.cpp b/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.cpp index 68f1b0c86..551ac8c2e 100644 --- a/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.cpp +++ b/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.cpp @@ -296,10 +296,7 @@ void RGBController_AsusCerberusKeyboard::SetupZones() keyboard.leds_min = zone_size; keyboard.leds_max = zone_size; keyboard.leds_count = zone_size; - keyboard.matrix_map = new matrix_map_type; - keyboard.matrix_map->height = 6; - keyboard.matrix_map->width = 24; - keyboard.matrix_map->map = *matrix_map; + keyboard.matrix_map.Set(6, 24, *matrix_map); zones.push_back(keyboard); for(int led_id = 0; led_id < zone_size; led_id++) @@ -314,11 +311,6 @@ void RGBController_AsusCerberusKeyboard::SetupZones() SetupColors(); } -void RGBController_AsusCerberusKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_AsusCerberusKeyboard::DeviceUpdateLEDs() { for(unsigned int i = 0; i < colors.size(); i++) @@ -332,12 +324,12 @@ void RGBController_AsusCerberusKeyboard::DeviceUpdateLEDs() controller->SendPerLEDColorEnd(); } -void RGBController_AsusCerberusKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_AsusCerberusKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AsusCerberusKeyboard::UpdateSingleLED(int led) +void RGBController_AsusCerberusKeyboard::DeviceUpdateSingleLED(int led) { uint8_t red = RGBGetRValue(colors[led]); uint8_t green = RGBGetGValue(colors[led]); diff --git a/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.h b/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.h index aa8ffeffa..30933c6bd 100644 --- a/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.h +++ b/Controllers/AsusLegacyUSBController/AsusCerberusKeyboardController/RGBController_AsusCerberusKeyboard.h @@ -29,11 +29,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.cpp b/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.cpp index a68f8faf1..1cd14a988 100644 --- a/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.cpp +++ b/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.cpp @@ -176,27 +176,21 @@ void RGBController_AsusSagarisKeyboard::SetupZones() keyboard.leds_min = 1; keyboard.leds_max = 1; keyboard.leds_count = 1; - keyboard.matrix_map = nullptr; SetupColors(); } -void RGBController_AsusSagarisKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_AsusSagarisKeyboard::DeviceUpdateLEDs() { } -void RGBController_AsusSagarisKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_AsusSagarisKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_AsusSagarisKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_AsusSagarisKeyboard::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.h b/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.h index 0d8d732ff..b66aaa932 100644 --- a/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.h +++ b/Controllers/AsusLegacyUSBController/AsusSagarisKeyboardController/RGBController_AsusSagarisKeyboard.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.cpp b/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.cpp index fc0826de3..0085a430a 100644 --- a/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.cpp +++ b/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.cpp @@ -65,7 +65,6 @@ void RGBController_StrixClaw::SetupZones() scroll_wheel_zone.leds_min = 1; scroll_wheel_zone.leds_max = 1; scroll_wheel_zone.leds_count = 1; - scroll_wheel_zone.matrix_map = NULL; zones.push_back(scroll_wheel_zone); @@ -83,7 +82,6 @@ void RGBController_StrixClaw::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); @@ -97,22 +95,17 @@ void RGBController_StrixClaw::SetupZones() SetupColors(); } -void RGBController_StrixClaw::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_StrixClaw::DeviceUpdateLEDs() { } -void RGBController_StrixClaw::UpdateZoneLEDs(int /*zone*/) +void RGBController_StrixClaw::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_StrixClaw::UpdateSingleLED(int /*led*/) +void RGBController_StrixClaw::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.h b/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.h index 45c38b98e..e2cb88371 100644 --- a/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.h +++ b/Controllers/AsusLegacyUSBController/AsusStrixClawController/RGBController_AsusStrixClaw.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusMonitorController/RGBController_AsusMonitor.cpp b/Controllers/AsusMonitorController/RGBController_AsusMonitor.cpp index 3cee74eed..bd8a0ad4e 100644 --- a/Controllers/AsusMonitorController/RGBController_AsusMonitor.cpp +++ b/Controllers/AsusMonitorController/RGBController_AsusMonitor.cpp @@ -60,8 +60,6 @@ void RGBController_AsusMonitor::SetupZones() new_zone.leds_max = number_of_leds; new_zone.leds_count = number_of_leds; - new_zone.matrix_map = nullptr; - zones.emplace_back(new_zone); leds.resize(new_zone.leds_count); @@ -74,24 +72,17 @@ void RGBController_AsusMonitor::SetupZones() SetupColors(); } -void RGBController_AsusMonitor::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AsusMonitor::DeviceUpdateLEDs() { controller->SetDirect(colors); } -void RGBController_AsusMonitor::UpdateZoneLEDs(int /*zone*/) +void RGBController_AsusMonitor::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AsusMonitor::UpdateSingleLED(int /*led*/) +void RGBController_AsusMonitor::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AsusMonitorController/RGBController_AsusMonitor.h b/Controllers/AsusMonitorController/RGBController_AsusMonitor.h index 3791f4a39..c8d126100 100644 --- a/Controllers/AsusMonitorController/RGBController_AsusMonitor.h +++ b/Controllers/AsusMonitorController/RGBController_AsusMonitor.h @@ -21,11 +21,10 @@ public: ~RGBController_AsusMonitor(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.cpp b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.cpp index 3fcccaf11..4761f82a2 100644 --- a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.cpp +++ b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.cpp @@ -103,7 +103,6 @@ void RGBController_AsusTUFLaptopLinux::SetupZones() zones[0].leds_min = 1; zones[0].leds_max = 1; zones[0].leds_count = 1; - zones[0].matrix_map = NULL; /*---------------------------------------------------------*\ | Set up LED | @@ -114,13 +113,6 @@ void RGBController_AsusTUFLaptopLinux::SetupZones() SetupColors(); } -void RGBController_AsusTUFLaptopLinux::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AsusTUFLaptopLinux::DeviceUpdateLEDs() { uint8_t red = RGBGetRValue(colors[0]); @@ -143,12 +135,12 @@ void RGBController_AsusTUFLaptopLinux::DeviceUpdateLEDs() controller->SendBrightness(modes[active_mode].brightness); } -void RGBController_AsusTUFLaptopLinux::UpdateZoneLEDs(int /*zone*/) +void RGBController_AsusTUFLaptopLinux::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_AsusTUFLaptopLinux::UpdateSingleLED(int /*led*/) +void RGBController_AsusTUFLaptopLinux::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.h b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.h index 72fffd2b9..f7b0071be 100644 --- a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.h +++ b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Linux.h @@ -17,15 +17,13 @@ class RGBController_AsusTUFLaptopLinux : public RGBController public: RGBController_AsusTUFLaptopLinux(AsusTUFLaptopLinuxController* controller_ptr); - void SetupZones() override; + void SetupZones(); - void ResizeZone(int zone, int new_size) override; + void DeviceUpdateLEDs(); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); - void DeviceUpdateLEDs() override; - void UpdateZoneLEDs(int zone) override; - void UpdateSingleLED(int led) override; - - void DeviceUpdateMode() override; + void DeviceUpdateMode(); private: AsusTUFLaptopLinuxController* controller; diff --git a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.cpp b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.cpp index 79ec24bd8..6cd4a13c8 100644 --- a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.cpp +++ b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.cpp @@ -101,7 +101,6 @@ void RGBController_AsusTUFLaptopWMI::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "Keyboard Backlight LED"; @@ -111,13 +110,6 @@ void RGBController_AsusTUFLaptopWMI::SetupZones() SetupColors(); } -void RGBController_AsusTUFLaptopWMI::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - /*---------------------------------------------------------*\ | Break this function off since we have to call save in the | same operation as doing everything else. | @@ -148,12 +140,12 @@ void RGBController_AsusTUFLaptopWMI::DeviceUpdateLEDs() ControllerSetMode(false); } -void RGBController_AsusTUFLaptopWMI::UpdateZoneLEDs(int /*zone*/) +void RGBController_AsusTUFLaptopWMI::DeviceUpdateZoneLEDs(int /*zone*/) { ControllerSetMode(false); } -void RGBController_AsusTUFLaptopWMI::UpdateSingleLED(int /*led*/) +void RGBController_AsusTUFLaptopWMI::DeviceUpdateSingleLED(int /*led*/) { ControllerSetMode(false); } diff --git a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.h b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.h index 2995fca84..9dee8cea1 100644 --- a/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.h +++ b/Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptop_Windows.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/BlinkyTapeController/RGBController_BlinkyTape.cpp b/Controllers/BlinkyTapeController/RGBController_BlinkyTape.cpp index 0f85cbb67..99695baea 100644 --- a/Controllers/BlinkyTapeController/RGBController_BlinkyTape.cpp +++ b/Controllers/BlinkyTapeController/RGBController_BlinkyTape.cpp @@ -58,13 +58,12 @@ void RGBController_BlinkyTape::SetupZones() led_zone.leds_min = 0; led_zone.leds_max = 512; led_zone.leds_count = 0; - led_zone.matrix_map = NULL; zones.push_back(led_zone); - ResizeZone(0, led_zone.leds_count); + DeviceResizeZone(0, led_zone.leds_count); } -void RGBController_BlinkyTape::ResizeZone(int zone, int new_size) +void RGBController_BlinkyTape::DeviceResizeZone(int zone, int new_size) { /*-------------------------------------------------*\ | Explicitly cast these to avoid compiler warnings | @@ -130,12 +129,12 @@ void RGBController_BlinkyTape::DeviceUpdateLEDs() controller->SetLEDs(colors); } -void RGBController_BlinkyTape::UpdateZoneLEDs(int /*zone*/) +void RGBController_BlinkyTape::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_BlinkyTape::UpdateSingleLED(int /*led*/) +void RGBController_BlinkyTape::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/BlinkyTapeController/RGBController_BlinkyTape.h b/Controllers/BlinkyTapeController/RGBController_BlinkyTape.h index beb252355..3efa151ab 100644 --- a/Controllers/BlinkyTapeController/RGBController_BlinkyTape.h +++ b/Controllers/BlinkyTapeController/RGBController_BlinkyTape.h @@ -23,11 +23,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.cpp b/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.cpp index c7a83f662..280f15f38 100644 --- a/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.cpp +++ b/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.cpp @@ -312,17 +312,6 @@ RGBController_CherryKeyboard::RGBController_CherryKeyboard(CherryKeyboardControl RGBController_CherryKeyboard::~RGBController_CherryKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -335,10 +324,7 @@ void RGBController_CherryKeyboard::SetupZones() new_zone.leds_min = CHERRY_MATRIX_CELL_COUNT; new_zone.leds_max = CHERRY_MATRIX_CELL_COUNT; new_zone.leds_count = CHERRY_MATRIX_CELL_COUNT; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = CHERRY_MATRIX_MAP_HEIGHT; - new_zone.matrix_map->width = CHERRY_MATRIX_MAP_WIDTH; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; + new_zone.matrix_map.Set(CHERRY_MATRIX_MAP_HEIGHT, CHERRY_MATRIX_MAP_WIDTH, (unsigned int *)&matrix_map); zones.push_back(new_zone); @@ -355,13 +341,6 @@ void RGBController_CherryKeyboard::SetupZones() SetupColors(); } -void RGBController_CherryKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CherryKeyboard::DeviceUpdateLEDs() { unsigned char color_data[CUSTOM_COLOR_ARRAY_BYTE_COUNT]; @@ -380,12 +359,12 @@ void RGBController_CherryKeyboard::DeviceUpdateLEDs() ); } -void RGBController_CherryKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_CherryKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CherryKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_CherryKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.h b/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.h index cf37c4c0e..22606307d 100644 --- a/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.h +++ b/Controllers/CherryKeyboardController/RGBController_CherryKeyboard.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ClevoKeyboardController/ClevoKeyboardControllerDetect.cpp b/Controllers/ClevoKeyboardController/ClevoKeyboardControllerDetect.cpp index ba8ed99f2..213a564fb 100644 --- a/Controllers/ClevoKeyboardController/ClevoKeyboardControllerDetect.cpp +++ b/Controllers/ClevoKeyboardController/ClevoKeyboardControllerDetect.cpp @@ -34,10 +34,9 @@ void DetectClevoKeyboardControllers(hid_device_info* info, const std::string& na { ClevoKeyboardController* controller = new ClevoKeyboardController(dev, *info); RGBController_ClevoKeyboard* rgb_controller = new RGBController_ClevoKeyboard(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } } -REGISTER_HID_DETECTOR_PU("Clevo Keyboard", DetectClevoKeyboardControllers, 0x048D, 0x600B, 0xFF03, 0x01); +REGISTER_HID_DETECTOR_PU("CLEVO Keyboard", DetectClevoKeyboardControllers, 0x048D, 0x600B, 0xFF03, 0x01); diff --git a/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.cpp b/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.cpp index e4462d7af..5aad4287d 100644 --- a/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.cpp +++ b/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.cpp @@ -366,15 +366,6 @@ RGBController_ClevoKeyboard::RGBController_ClevoKeyboard(ClevoKeyboardController RGBController_ClevoKeyboard::~RGBController_ClevoKeyboard() { - for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) - { - if(zones[zone_idx].matrix_map != nullptr) - { - delete[] zones[zone_idx].matrix_map->map; - delete zones[zone_idx].matrix_map; - } - } - delete controller; } @@ -391,18 +382,7 @@ void RGBController_ClevoKeyboard::SetupZones() keyboard_zone.leds_max = CLEVO_KEYBOARD_NUM_LEDS; keyboard_zone.leds_count = CLEVO_KEYBOARD_NUM_LEDS; - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->height = 7; - keyboard_zone.matrix_map->width = 21; - keyboard_zone.matrix_map->map = new unsigned int[7 * 21]; - - for(int row = 0; row < 7; row++) - { - for(int col = 0; col < 21; col++) - { - keyboard_zone.matrix_map->map[row * 21 + col] = matrix_map[row][col]; - } - } + keyboard_zone.matrix_map.Set(7, 21, (unsigned int *)&matrix_map); zones.push_back(keyboard_zone); @@ -419,13 +399,6 @@ void RGBController_ClevoKeyboard::SetupZones() SetupColors(); } -void RGBController_ClevoKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ClevoKeyboard::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -443,12 +416,12 @@ void RGBController_ClevoKeyboard::DeviceUpdateLEDs() controller->SendColors(color_data, modes[active_mode].brightness); } -void RGBController_ClevoKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_ClevoKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ClevoKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_ClevoKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.h b/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.h index f27dc5c41..b1ca65478 100644 --- a/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.h +++ b/Controllers/ClevoKeyboardController/RGBController_ClevoKeyboard.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ClevoLightbarController/ClevoLightbarControllerDetect.cpp b/Controllers/ClevoLightbarController/ClevoLightbarControllerDetect.cpp index ce6c6e035..da81367bd 100644 --- a/Controllers/ClevoLightbarController/ClevoLightbarControllerDetect.cpp +++ b/Controllers/ClevoLightbarController/ClevoLightbarControllerDetect.cpp @@ -33,7 +33,6 @@ void DetectClevoLightbarControllers(hid_device_info* info, const std::string& na { ClevoLightbarController* controller = new ClevoLightbarController(dev, *info); RGBController_ClevoLightbar* rgb_controller = new RGBController_ClevoLightbar(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } diff --git a/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.cpp b/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.cpp index a87a0a2d8..22ff00059 100644 --- a/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.cpp +++ b/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.cpp @@ -66,7 +66,6 @@ void RGBController_ClevoLightbar::SetupZones() lightbar_zone.leds_min = 1; lightbar_zone.leds_max = 1; lightbar_zone.leds_count = 1; - lightbar_zone.matrix_map = NULL; zones.push_back(lightbar_zone); led lightbar_led; @@ -76,13 +75,6 @@ void RGBController_ClevoLightbar::SetupZones() SetupColors(); } -void RGBController_ClevoLightbar::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ClevoLightbar::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -93,12 +85,12 @@ void RGBController_ClevoLightbar::DeviceUpdateLEDs() controller->SetBrightness(modes[active_mode].brightness); } -void RGBController_ClevoLightbar::UpdateZoneLEDs(int /*zone*/) +void RGBController_ClevoLightbar::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ClevoLightbar::UpdateSingleLED(int /*led*/) +void RGBController_ClevoLightbar::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.h b/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.h index a429cfdb1..b6d95bd2d 100644 --- a/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.h +++ b/Controllers/ClevoLightbarController/RGBController_ClevoLightbar.h @@ -21,11 +21,10 @@ public: ~RGBController_ClevoLightbar(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.cpp b/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.cpp index 171a85ed9..20e070e61 100644 --- a/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.cpp +++ b/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.cpp @@ -56,7 +56,6 @@ void RGBController_ColorfulGPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -66,22 +65,17 @@ void RGBController_ColorfulGPU::SetupZones() SetupColors(); } -void RGBController_ColorfulGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_ColorfulGPU::DeviceUpdateLEDs() { controller->SetDirect(colors[0]); } -void RGBController_ColorfulGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_ColorfulGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ColorfulGPU::UpdateSingleLED(int /*led*/) +void RGBController_ColorfulGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.h b/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.h index 04e5e8b04..46ecf216f 100644 --- a/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.h +++ b/Controllers/ColorfulGPUController/RGBController_ColorfulGPU.h @@ -19,11 +19,10 @@ public: ~RGBController_ColorfulGPU(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.cpp b/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.cpp index 6c3cd847e..59acc4592 100644 --- a/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.cpp +++ b/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.cpp @@ -100,7 +100,6 @@ void RGBController_ColorfulTuringGPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -110,11 +109,6 @@ void RGBController_ColorfulTuringGPU::SetupZones() SetupColors(); } -void RGBController_ColorfulTuringGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_ColorfulTuringGPU::DeviceUpdateLEDs() { switch(modes[active_mode].value) @@ -139,12 +133,12 @@ void RGBController_ColorfulTuringGPU::DeviceUpdateLEDs() } } -void RGBController_ColorfulTuringGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_ColorfulTuringGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ColorfulTuringGPU::UpdateSingleLED(int /*led*/) +void RGBController_ColorfulTuringGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.h b/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.h index 810eb8f05..3d7f328d9 100644 --- a/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.h +++ b/Controllers/ColorfulTuringGPUController/RGBController_ColorfulTuringGPU.h @@ -19,10 +19,11 @@ public: ~RGBController_ColorfulTuringGPU(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); + void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.cpp b/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.cpp index 27cae2bca..a1ce62c79 100644 --- a/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.cpp +++ b/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.cpp @@ -313,7 +313,6 @@ void RGBController_CMARGBController::Init_Controller() ARGB_zone.leds_min = 4; ARGB_zone.leds_max = 48; ARGB_zone.leds_count = zone_led_count; - ARGB_zone.matrix_map = NULL; zones.push_back(ARGB_zone); } @@ -361,7 +360,7 @@ void RGBController_CMARGBController::SetupZones() SetupColors(); } -void RGBController_CMARGBController::ResizeZone(int zone, int new_size) +void RGBController_CMARGBController::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -386,18 +385,18 @@ void RGBController_CMARGBController::DeviceUpdateLEDs() for(int zone_idx = first_zone(cmargb->GetZoneIndex()); zone_idx < end_zone; zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_CMARGBController::UpdateZoneLEDs(int zone) +void RGBController_CMARGBController::DeviceUpdateZoneLEDs(int zone) { controller->SetLedsDirect( zones[zone].colors, zones[zone].leds_count ); } -void RGBController_CMARGBController::UpdateSingleLED(int led) +void RGBController_CMARGBController::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(GetLED_Zone(led)); + DeviceUpdateZoneLEDs(GetLED_Zone(led)); } void RGBController_CMARGBController::DeviceUpdateMode() diff --git a/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.h b/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.h index 68ed600d2..cecde8e30 100644 --- a/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.h +++ b/Controllers/CoolerMasterController/CMARGBController/RGBController_CMARGBController.h @@ -25,11 +25,11 @@ public: ~RGBController_CMARGBController(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.cpp b/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.cpp index 826169b63..7bbeeb18e 100644 --- a/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.cpp +++ b/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.cpp @@ -202,7 +202,6 @@ void RGBController_CMARGBGen2A1Controller::SetupZones() new_zone.leds_min = 0; new_zone.leds_max = CM_ARGB_GEN2_A1_CHANNEL_MAX_SIZE; new_zone.leds_count = 0; - new_zone.matrix_map = nullptr; zones.push_back(new_zone); @@ -219,7 +218,7 @@ void RGBController_CMARGBGen2A1Controller::SetupZones() SetupColors(); } -void RGBController_CMARGBGen2A1Controller::ResizeZone(int zone, int new_size) +void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_size) { zones[zone].leds_count = new_size; @@ -261,7 +260,7 @@ void RGBController_CMARGBGen2A1Controller::DeviceUpdateLEDs() } } -void RGBController_CMARGBGen2A1Controller::UpdateZoneLEDs(int zone) +void RGBController_CMARGBGen2A1Controller::DeviceUpdateZoneLEDs(int zone) { if(zones[zone].leds_count > 0) { @@ -304,7 +303,7 @@ void RGBController_CMARGBGen2A1Controller::UpdateSegmentLEDs(int zone, int subch controller->SendChannelColors(zone, CM_ARGB_GEN2_A1_SUBCHANNEL_ALL, color_vector); } -void RGBController_CMARGBGen2A1Controller::UpdateSingleLED(int /*led*/) +void RGBController_CMARGBGen2A1Controller::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.h b/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.h index a3d4a860f..1aba83a54 100644 --- a/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.h +++ b/Controllers/CoolerMasterController/CMARGBGen2A1Controller/RGBController_CMARGBGen2A1Controller.h @@ -23,11 +23,12 @@ public: ~RGBController_CMARGBGen2A1Controller(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); + void DeviceUpdateZoneLEDs(int zone); void UpdateSegmentLEDs(int zone, int subchannel); - void UpdateSingleLED(int led); + void DeviceUpdateSingleLED(int led); + void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.cpp b/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.cpp index 87aac9133..243b5952e 100644 --- a/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.cpp +++ b/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.cpp @@ -151,7 +151,6 @@ void RGBController_CMGD160Controller::SetupZones() front.leds_min = CM_GD160_LEDS_PER_SIDE; front.leds_max = CM_GD160_LEDS_PER_SIDE; front.leds_count = CM_GD160_LEDS_PER_SIDE; - front.matrix_map = NULL; zones.push_back(front); for(unsigned int i = 0; i < CM_GD160_LEDS_PER_SIDE; i++) @@ -168,7 +167,6 @@ void RGBController_CMGD160Controller::SetupZones() back.leds_min = CM_GD160_LEDS_PER_SIDE; back.leds_max = CM_GD160_LEDS_PER_SIDE; back.leds_count = CM_GD160_LEDS_PER_SIDE; - back.matrix_map = NULL; zones.push_back(back); for(unsigned int i = 0; i < CM_GD160_LEDS_PER_SIDE; i++) @@ -182,13 +180,6 @@ void RGBController_CMGD160Controller::SetupZones() SetupColors(); } -void RGBController_CMGD160Controller::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CMGD160Controller::DeviceUpdateLEDs() { switch(modes[active_mode].value) @@ -206,12 +197,12 @@ void RGBController_CMGD160Controller::DeviceUpdateLEDs() } } -void RGBController_CMGD160Controller::UpdateZoneLEDs(int /*zone*/) +void RGBController_CMGD160Controller::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CMGD160Controller::UpdateSingleLED(int /*led*/) +void RGBController_CMGD160Controller::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.h b/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.h index 1373267bd..32f150d1c 100644 --- a/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.h +++ b/Controllers/CoolerMasterController/CMGD160Controller/RGBController_CMGD160Controller.h @@ -23,14 +23,12 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); private: CMGD160Controller* controller; -}; \ No newline at end of file +}; diff --git a/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.cpp b/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.cpp index 841b6ad6a..90c99634e 100644 --- a/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.cpp +++ b/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.cpp @@ -49,22 +49,6 @@ RGBController_CMKeyboardController::RGBController_CMKeyboardController(CMKeyboar RGBController_CMKeyboardController::~RGBController_CMKeyboardController() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - if(zones[zone_index].matrix_map->map != NULL) - { - delete zones[zone_index].matrix_map->map; - } - - delete zones[zone_index].matrix_map; - } - } - if(m_pController) { delete m_pController; @@ -98,9 +82,6 @@ void RGBController_CMKeyboardController::SetupZones() { KeyboardLayoutManager new_kb(m_keyboardLayout, coolermaster->layout_new->base_size, coolermaster->layout_new->key_values); - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - if(coolermaster->layout_new->base_size != KEYBOARD_SIZE_EMPTY) { /*---------------------------------------------------------*\ @@ -109,15 +90,7 @@ void RGBController_CMKeyboardController::SetupZones() keyboard_keymap_overlay_values* temp = coolermaster->layout_new; new_kb.ChangeKeys(*temp); - new_map->height = new_kb.GetRowCount(); - new_map->width = new_kb.GetColumnCount(); - new_map->map = new unsigned int[new_map->height * new_map->width]; - - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, new_map->height, new_map->width); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | @@ -161,27 +134,17 @@ void RGBController_CMKeyboardController::SetupZones() SetupColors(); } -void RGBController_CMKeyboardController::ResizeZone(int /*zone*/, int /*new_size*/) -{ -} - void RGBController_CMKeyboardController::DeviceUpdateLEDs() { m_pController->SetLeds(leds, colors); } -void RGBController_CMKeyboardController::UpdateSingleLED(int led, RGBColor color) -{ - uint8_t key_value = m_pLayoutManager->GetKeyValueAt(led); - m_pController->SetSingleLED(key_value, color); -} - -void RGBController_CMKeyboardController::UpdateSingleLED(int led) +void RGBController_CMKeyboardController::DeviceUpdateSingleLED(int led) { m_pController->SetSingleLED(led, colors[led]); } -void RGBController_CMKeyboardController::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_CMKeyboardController::DeviceUpdateZoneLEDs(int /*zone_idx*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.h b/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.h index 94d0597f6..602100ca7 100644 --- a/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.h +++ b/Controllers/CoolerMasterController/CMKeyboardController/RGBController_CMKeyboardController.h @@ -24,12 +24,10 @@ public: ~RGBController_CMKeyboardController(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateSingleLED(int led, RGBColor color); - void UpdateSingleLED(int led); - void UpdateZoneLEDs(int zone_idx); + void DeviceUpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone_idx); void SetCustomMode(); void DeviceUpdateMode(); diff --git a/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.cpp b/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.cpp index d4a30e30b..9b149099b 100644 --- a/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.cpp +++ b/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.cpp @@ -140,7 +140,6 @@ void RGBController_CMMM711Controller::Init_Controller() mouse_zone.leds_min = 2; mouse_zone.leds_max = 2; mouse_zone.leds_count = 2; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); led wheel_led; @@ -159,13 +158,6 @@ void RGBController_CMMM711Controller::SetupZones() SetupColors(); } -void RGBController_CMMM711Controller::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CMMM711Controller::DeviceUpdateLEDs() { RGBColor wheel = applyBrightness(colors[0], modes[active_mode].brightness); @@ -174,12 +166,12 @@ void RGBController_CMMM711Controller::DeviceUpdateLEDs() controller->SetLedsDirect( wheel, logo); } -void RGBController_CMMM711Controller::UpdateZoneLEDs(int /*zone*/) +void RGBController_CMMM711Controller::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CMMM711Controller::UpdateSingleLED(int /*led*/) +void RGBController_CMMM711Controller::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.h b/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.h index 7c587fbd6..ea1bcbc0f 100644 --- a/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.h +++ b/Controllers/CoolerMasterController/CMMM711Controller/RGBController_CMMM711Controller.h @@ -26,11 +26,10 @@ public: ~RGBController_CMMM711Controller(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.cpp b/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.cpp index c71dcff56..4712d6b18 100644 --- a/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.cpp +++ b/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.cpp @@ -133,7 +133,6 @@ void RGBController_CMMM712Controller::Init_Controller() mouse_zone.leds_min = 1; mouse_zone.leds_max = 1; mouse_zone.leds_count = 1; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); led logo_led; @@ -147,13 +146,6 @@ void RGBController_CMMM712Controller::SetupZones() SetupColors(); } -void RGBController_CMMM712Controller::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CMMM712Controller::DeviceUpdateLEDs() { modes[active_mode].brightness=255; @@ -162,12 +154,12 @@ void RGBController_CMMM712Controller::DeviceUpdateLEDs() controller->SetLedsDirect(logo); } -void RGBController_CMMM712Controller::UpdateZoneLEDs(int /*zone*/) +void RGBController_CMMM712Controller::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CMMM712Controller::UpdateSingleLED(int /*led*/) +void RGBController_CMMM712Controller::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.h b/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.h index d6995e267..16e00bdc7 100644 --- a/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.h +++ b/Controllers/CoolerMasterController/CMMM712Controller/RGBController_CMMM712Controller.h @@ -27,11 +27,10 @@ public: ~RGBController_CMMM712Controller(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.cpp b/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.cpp index 343b9576e..ed7dc088e 100644 --- a/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.cpp +++ b/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.cpp @@ -179,7 +179,6 @@ void RGBController_CMMMController::Init_Controller() mouse_zone.leds_min = leds_count; mouse_zone.leds_max = leds_count; mouse_zone.leds_count = leds_count; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); int value = 0; @@ -212,13 +211,6 @@ void RGBController_CMMMController::SetupZones() SetupColors(); } -void RGBController_CMMMController::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CMMMController::DeviceUpdateLEDs() { int value = 0; @@ -239,12 +231,12 @@ void RGBController_CMMMController::DeviceUpdateLEDs() controller->SetLedsDirect(wheel, buttons, logo); } -void RGBController_CMMMController::UpdateZoneLEDs(int /*zone*/) +void RGBController_CMMMController::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CMMMController::UpdateSingleLED(int /*led*/) +void RGBController_CMMMController::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.h b/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.h index eebe2648c..f23b39ac6 100644 --- a/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.h +++ b/Controllers/CoolerMasterController/CMMMController/RGBController_CMMMController.h @@ -27,11 +27,10 @@ public: ~RGBController_CMMMController(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.cpp b/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.cpp index 1572134c3..56913d955 100644 --- a/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.cpp +++ b/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.cpp @@ -122,7 +122,6 @@ void RGBController_CMMP750Controller::SetupZones() MP_zone.leds_min = 1; MP_zone.leds_max = 1; MP_zone.leds_count = 1; - MP_zone.matrix_map = NULL; zones.push_back(MP_zone); led MP_led; @@ -144,13 +143,6 @@ void RGBController_CMMP750Controller::SetupZones() } } -void RGBController_CMMP750Controller::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CMMP750Controller::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -160,7 +152,7 @@ void RGBController_CMMP750Controller::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_CMMP750Controller::UpdateZoneLEDs(int zone) +void RGBController_CMMP750Controller::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -170,9 +162,9 @@ void RGBController_CMMP750Controller::UpdateZoneLEDs(int zone) controller->SetColor(red, grn, blu); } -void RGBController_CMMP750Controller::UpdateSingleLED(int led) +void RGBController_CMMP750Controller::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_CMMP750Controller::DeviceUpdateMode() diff --git a/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.h b/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.h index 71880b073..42be471bb 100644 --- a/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.h +++ b/Controllers/CoolerMasterController/CMMP750Controller/RGBController_CMMP750Controller.h @@ -21,11 +21,10 @@ public: ~RGBController_CMMP750Controller(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.cpp b/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.cpp index 6e73193a5..bd802058a 100644 --- a/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.cpp +++ b/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.cpp @@ -153,7 +153,6 @@ void RGBController_CMMonitorController::SetupZones() z.leds_min = 47; z.leds_max = 47; z.leds_count = 47; - z.matrix_map = NULL; zones.push_back(z); @@ -168,13 +167,6 @@ void RGBController_CMMonitorController::SetupZones() SetupColors(); } -void RGBController_CMMonitorController::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CMMonitorController::DeviceUpdateLEDs() { if(modes[active_mode].value == CM_MONITOR_DIRECT_MODE) @@ -187,12 +179,12 @@ void RGBController_CMMonitorController::DeviceUpdateLEDs() } } -void RGBController_CMMonitorController::UpdateZoneLEDs(int /*zone*/) +void RGBController_CMMonitorController::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CMMonitorController::UpdateSingleLED(int /*led*/) +void RGBController_CMMonitorController::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.h b/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.h index 3569a0947..4f8eac57d 100644 --- a/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.h +++ b/Controllers/CoolerMasterController/CMMonitorController/RGBController_CMMonitorController.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.cpp b/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.cpp index f2c393513..a42a9717e 100644 --- a/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.cpp +++ b/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.cpp @@ -163,7 +163,6 @@ void RGBController_CMR6000Controller::SetupZones() GP_zone.leds_min = 1; GP_zone.leds_max = 1; GP_zone.leds_count = 1; - GP_zone.matrix_map = NULL; zones.push_back(GP_zone); led GP_led; @@ -175,13 +174,6 @@ void RGBController_CMR6000Controller::SetupZones() } -void RGBController_CMR6000Controller::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CMR6000Controller::DeviceUpdateLEDs() { mode new_mode = modes[active_mode]; @@ -212,12 +204,12 @@ void RGBController_CMR6000Controller::DeviceUpdateLEDs() controller->SetMode(new_mode.value, new_mode.speed, color1, color2, rnd, bri); } -void RGBController_CMR6000Controller::UpdateZoneLEDs(int /*zone*/) +void RGBController_CMR6000Controller::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CMR6000Controller::UpdateSingleLED(int /*led*/) +void RGBController_CMR6000Controller::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.h b/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.h index 6d3a5d32b..dc27eda47 100644 --- a/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.h +++ b/Controllers/CoolerMasterController/CMR6000Controller/RGBController_CMR6000Controller.h @@ -22,13 +22,13 @@ public: ~RGBController_CMR6000Controller(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); + private: CMR6000Controller* controller; diff --git a/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.cpp b/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.cpp index db7924d83..a4d940e1c 100644 --- a/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.cpp +++ b/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.cpp @@ -199,7 +199,7 @@ void RGBController_CMRGBController::LoadConfigFromDeviceController(int mode_idx) { for(int led_idx = 0; led_idx < (int)leds.size(); led_idx++) { - SetLED(led_idx, controller->GetPortColor(led_idx)); + colors[led_idx] = controller->GetPortColor(led_idx); } } @@ -231,7 +231,6 @@ void RGBController_CMRGBController::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 4; new_zone->leds_count = 4; - new_zone->matrix_map = NULL; for(int i = 1; i <= CM_RGBC_NUM_LEDS; i++) { @@ -244,24 +243,20 @@ void RGBController_CMRGBController::SetupZones() SetupColors(); } -void RGBController_CMRGBController::ResizeZone(int /*zone*/, int /*new_size*/) -{ -} - void RGBController_CMRGBController::DeviceUpdateLEDs() { for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_CMRGBController::UpdateZoneLEDs(int zone) +void RGBController_CMRGBController::DeviceUpdateZoneLEDs(int zone) { controller->SetLedsDirect(zones[zone].colors[0], zones[zone].colors[1], zones[zone].colors[2], zones[zone].colors[3]); } -void RGBController_CMRGBController::UpdateSingleLED(int /*led*/) +void RGBController_CMRGBController::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.h b/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.h index bb13c4180..a37faafba 100644 --- a/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.h +++ b/Controllers/CoolerMasterController/CMRGBController/RGBController_CMRGBController.h @@ -22,11 +22,10 @@ public: ~RGBController_CMRGBController(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.cpp b/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.cpp index b7e8ca9cc..869dcb7e1 100644 --- a/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.cpp +++ b/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.cpp @@ -196,7 +196,6 @@ void RGBController_CMSmallARGBController::Init_Controller() ARGB_zone.leds_min = CM_SMALL_ARGB_MIN_LEDS; ARGB_zone.leds_max = CM_SMALL_ARGB_MAX_LEDS; ARGB_zone.leds_count = zone_led_count; - ARGB_zone.matrix_map = NULL; zones.push_back(ARGB_zone); } @@ -244,7 +243,7 @@ void RGBController_CMSmallARGBController::SetupZones() SetupColors(); } -void RGBController_CMSmallARGBController::ResizeZone(int zone, int new_size) +void RGBController_CMSmallARGBController::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -263,11 +262,11 @@ void RGBController_CMSmallARGBController::DeviceUpdateLEDs() { for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_CMSmallARGBController::UpdateZoneLEDs(int zone) +void RGBController_CMSmallARGBController::DeviceUpdateZoneLEDs(int zone) { if(serial >= CM_SMALL_ARGB_FW0012) { @@ -275,9 +274,9 @@ void RGBController_CMSmallARGBController::UpdateZoneLEDs(int zone) } } -void RGBController_CMSmallARGBController::UpdateSingleLED(int led) +void RGBController_CMSmallARGBController::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_CMSmallARGBController::SetCustomMode() diff --git a/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.h b/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.h index d56aced40..e60c8d44c 100644 --- a/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.h +++ b/Controllers/CoolerMasterController/CMSmallARGBController/RGBController_CMSmallARGBController.h @@ -27,11 +27,11 @@ public: ~RGBController_CMSmallARGBController(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void SetCustomMode(); void DeviceUpdateMode(); diff --git a/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.cpp b/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.cpp index 777abe0be..b4ea5f9ef 100644 --- a/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.cpp +++ b/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.cpp @@ -101,18 +101,14 @@ void RGBController_CorsairCommanderCore::SetupZones() zones[0].leds_min = led_count.at(0); zones[0].leds_max = led_count.at(0); zones[0].leds_count = led_count.at(0); - zones[0].matrix_map = new matrix_map_type; + if(led_count.at(0) == 24) { - zones[0].matrix_map->height = 11; - zones[0].matrix_map->width = 11; - zones[0].matrix_map->map = (unsigned int *)&matrix_map24; + zones[0].matrix_map.Set(11, 11, (unsigned int *)&matrix_map24); } else { - zones[0].matrix_map->height = 7; - zones[0].matrix_map->width = 7; - zones[0].matrix_map->map = (unsigned int *)&matrix_map29; + zones[0].matrix_map.Set(7, 7, (unsigned int *)matrix_map29); } } @@ -146,7 +142,7 @@ void RGBController_CorsairCommanderCore::SetupZones() SetupColors(); } -void RGBController_CorsairCommanderCore::ResizeZone(int zone, int new_size) +void RGBController_CorsairCommanderCore::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -177,12 +173,12 @@ void RGBController_CorsairCommanderCore::DeviceUpdateLEDs() DeviceUpdateMode(); } -void RGBController_CorsairCommanderCore::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairCommanderCore::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairCommanderCore::UpdateSingleLED(int /*led*/) +void RGBController_CorsairCommanderCore::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.h b/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.h index d2b5b6805..cf8f95f1c 100644 --- a/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.h +++ b/Controllers/CorsairCommanderCoreController/RGBController_CorsairCommanderCore.h @@ -22,10 +22,10 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.cpp b/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.cpp index afd7e7822..850e13609 100644 --- a/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.cpp +++ b/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.cpp @@ -73,7 +73,6 @@ void RGBController_CorsairDominatorPlatinum::SetupZones() new_zone.leds_min = controller->GetLEDCount(); new_zone.leds_max = controller->GetLEDCount(); new_zone.leds_count = controller->GetLEDCount(); - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -90,13 +89,6 @@ void RGBController_CorsairDominatorPlatinum::SetupZones() SetupColors(); } -void RGBController_CorsairDominatorPlatinum::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairDominatorPlatinum::DeviceUpdateLEDs() { for(unsigned int led = 0; led < (unsigned int)colors.size(); led++) @@ -112,12 +104,12 @@ void RGBController_CorsairDominatorPlatinum::DeviceUpdateLEDs() controller->ApplyColors(); } -void RGBController_CorsairDominatorPlatinum::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairDominatorPlatinum::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairDominatorPlatinum::UpdateSingleLED(int led) +void RGBController_CorsairDominatorPlatinum::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.h b/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.h index 56c96f284..3c918d82a 100644 --- a/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.h +++ b/Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.cpp b/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.cpp index 4b7fc1537..e732a9c3e 100644 --- a/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.cpp +++ b/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.cpp @@ -56,7 +56,7 @@ void RGBController_CorsairHydro2::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; + zones.push_back(new_zone); led new_led; @@ -67,24 +67,17 @@ void RGBController_CorsairHydro2::SetupZones() SetupColors(); } -void RGBController_CorsairHydro2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairHydro2::DeviceUpdateLEDs() { controller->SetLED(colors); } -void RGBController_CorsairHydro2::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairHydro2::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLED(colors); } -void RGBController_CorsairHydro2::UpdateSingleLED(int /*led*/) +void RGBController_CorsairHydro2::DeviceUpdateSingleLED(int /*led*/) { controller->SetLED(colors); } diff --git a/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.h b/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.h index 9b2e5e65d..7535f8737 100644 --- a/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.h +++ b/Controllers/CorsairHydro2Controller/RGBController_CorsairHydro2.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairHydroController/RGBController_CorsairHydro.cpp b/Controllers/CorsairHydroController/RGBController_CorsairHydro.cpp index 2ba7698bf..5008aa970 100644 --- a/Controllers/CorsairHydroController/RGBController_CorsairHydro.cpp +++ b/Controllers/CorsairHydroController/RGBController_CorsairHydro.cpp @@ -96,7 +96,7 @@ void RGBController_CorsairHydro::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; + zones.push_back(new_zone); led new_led; @@ -107,24 +107,17 @@ void RGBController_CorsairHydro::SetupZones() SetupColors(); } -void RGBController_CorsairHydro::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairHydro::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_CorsairHydro::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairHydro::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairHydro::UpdateSingleLED(int /*led*/) +void RGBController_CorsairHydro::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CorsairHydroController/RGBController_CorsairHydro.h b/Controllers/CorsairHydroController/RGBController_CorsairHydro.h index 964fa3100..15a656715 100644 --- a/Controllers/CorsairHydroController/RGBController_CorsairHydro.h +++ b/Controllers/CorsairHydroController/RGBController_CorsairHydro.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.cpp b/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.cpp index 6f83972d5..e3f4f58c8 100644 --- a/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.cpp +++ b/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.cpp @@ -68,10 +68,7 @@ void RGBController_CorsairHydroPlatinum::Init_Controller() cpu_block_zone.leds_min = 16; cpu_block_zone.leds_max = 16; cpu_block_zone.leds_count = 16; - cpu_block_zone.matrix_map = new matrix_map_type; - cpu_block_zone.matrix_map->height = 5; - cpu_block_zone.matrix_map->width = 5; - cpu_block_zone.matrix_map->map = (unsigned int *)&matrix_map; + cpu_block_zone.matrix_map.Set(5, 5, (unsigned int *)&matrix_map); zones.push_back(cpu_block_zone); /*-----------------------------------------------------*\ @@ -85,7 +82,6 @@ void RGBController_CorsairHydroPlatinum::Init_Controller() fans_zone.leds_min = 0; fans_zone.leds_max = 32; fans_zone.leds_count = 0; - fans_zone.matrix_map = NULL; zones.push_back(fans_zone); } } @@ -111,7 +107,7 @@ void RGBController_CorsairHydroPlatinum::SetupZones() SetupColors(); } -void RGBController_CorsairHydroPlatinum::ResizeZone(int zone, int new_size) +void RGBController_CorsairHydroPlatinum::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -131,12 +127,12 @@ void RGBController_CorsairHydroPlatinum::DeviceUpdateLEDs() controller->SetupColors(colors); } -void RGBController_CorsairHydroPlatinum::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairHydroPlatinum::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairHydroPlatinum::UpdateSingleLED(int /*led*/) +void RGBController_CorsairHydroPlatinum::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.h b/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.h index c2728bf4f..adf7f2060 100644 --- a/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.h +++ b/Controllers/CorsairHydroPlatinumController/RGBController_CorsairHydroPlatinum.h @@ -23,11 +23,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.cpp b/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.cpp index faf1c5a3e..fc9801741 100644 --- a/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.cpp +++ b/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.cpp @@ -113,24 +113,17 @@ void RGBController_CorsairICueLink::SetupZones() SetupColors(); } -void RGBController_CorsairICueLink::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*-----------------------------------------------------*\ - | Device does not support resizing zones | - \*-----------------------------------------------------*/ -} - void RGBController_CorsairICueLink::DeviceUpdateLEDs() { controller->UpdateLights(&colors[0], colors.size()); } -void RGBController_CorsairICueLink::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairICueLink::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairICueLink::UpdateSingleLED(int /*led*/) +void RGBController_CorsairICueLink::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -150,4 +143,4 @@ void RGBController_CorsairICueLink::KeepaliveThread() } std::this_thread::sleep_for(1s); } -} \ No newline at end of file +} diff --git a/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.h b/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.h index d205e701a..f7a431467 100644 --- a/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.h +++ b/Controllers/CorsairICueLinkController/RGBController_CorsairICueLink.h @@ -26,10 +26,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h b/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h index f9deb50ec..5c4ad22ab 100644 --- a/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h +++ b/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h @@ -83,6 +83,7 @@ enum CORSAIR_LIGHTING_NODE_MODE_BLINK = 0x08, /* Blink mode */ CORSAIR_LIGHTING_NODE_MODE_SEQUENTIAL = 0x09, /* Sequential mode */ CORSAIR_LIGHTING_NODE_MODE_RAINBOW = 0x0A, /* Rainbow mode */ + CORSAIR_LIGHTING_NODE_MODE_DIRECT = 0xFFFF /* Dummy mode ID for direct mode */ }; class CorsairLightingNodeController diff --git a/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp b/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp index ec7a44073..1ef706e9c 100644 --- a/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp +++ b/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp @@ -34,182 +34,8 @@ RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLigh location = controller->GetLocationString(); serial = controller->GetSerialString(); - mode Direct; - Direct.name = "Direct"; - Direct.value = 0xFFFF; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; - modes.push_back(Direct); - - mode RainbowWave; - RainbowWave.name = "Rainbow Wave"; - RainbowWave.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW_WAVE; - RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - RainbowWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - RainbowWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - RainbowWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - RainbowWave.direction = MODE_DIRECTION_RIGHT; - RainbowWave.color_mode = MODE_COLORS_NONE; - RainbowWave.brightness_min = 0; - RainbowWave.brightness_max = 100; - RainbowWave.brightness = 100; - modes.push_back(RainbowWave); - - mode ColorShift; - ColorShift.name = "Color Shift"; - ColorShift.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_SHIFT; - ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - ColorShift.colors_min = 2; - ColorShift.colors_max = 2; - ColorShift.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - ColorShift.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - ColorShift.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC; - ColorShift.colors.resize(2); - ColorShift.brightness_min = 0; - ColorShift.brightness_max = 100; - ColorShift.brightness = 100; - modes.push_back(ColorShift); - - mode ColorPulse; - ColorPulse.name = "Color Pulse"; - ColorPulse.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_PULSE; - ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - ColorPulse.colors_min = 2; - ColorPulse.colors_max = 2; - ColorPulse.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - ColorPulse.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - ColorPulse.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - ColorPulse.color_mode = MODE_COLORS_MODE_SPECIFIC; - ColorPulse.colors.resize(2); - ColorPulse.brightness_min = 0; - ColorPulse.brightness_max = 100; - ColorPulse.brightness = 100; - modes.push_back(ColorPulse); - - mode ColorWave; - ColorWave.name = "Color Wave"; - ColorWave.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_WAVE; - ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - ColorWave.colors_min = 2; - ColorWave.colors_max = 2; - ColorWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - ColorWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - ColorWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - ColorWave.direction = MODE_DIRECTION_RIGHT; - ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC; - ColorWave.colors.resize(2); - ColorWave.brightness_min = 0; - ColorWave.brightness_max = 100; - ColorWave.brightness = 100; - modes.push_back(ColorWave); - - mode Static; - Static.name = "Static"; - Static.value = CORSAIR_LIGHTING_NODE_MODE_STATIC; - Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - Static.colors_min = 1; - Static.colors_max = 1; - Static.color_mode = MODE_COLORS_MODE_SPECIFIC; - Static.colors.resize(1); - Static.brightness_min = 0; - Static.brightness_max = 100; - Static.brightness = 100; - modes.push_back(Static); - - mode Temperature; - Temperature.name = "Temperature"; - Temperature.value = CORSAIR_LIGHTING_NODE_MODE_TEMPERATURE; - Temperature.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - Temperature.colors_min = 3; - Temperature.colors_max = 3; - Temperature.color_mode = MODE_COLORS_MODE_SPECIFIC; - Temperature.colors.resize(3); - Temperature.brightness_min = 0; - Temperature.brightness_max = 100; - Temperature.brightness = 100; - modes.push_back(Temperature); - - mode Visor; - Visor.name = "Visor"; - Visor.value = CORSAIR_LIGHTING_NODE_MODE_VISOR; - Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - Visor.colors_min = 2; - Visor.colors_max = 2; - Visor.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - Visor.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - Visor.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - Visor.color_mode = MODE_COLORS_MODE_SPECIFIC; - Visor.colors.resize(2); - Visor.brightness_min = 0; - Visor.brightness_max = 100; - Visor.brightness = 100; - modes.push_back(Visor); - - mode Marquee; - Marquee.name = "Marquee"; - Marquee.value = CORSAIR_LIGHTING_NODE_MODE_MARQUEE; - Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - Marquee.colors_min = 1; - Marquee.colors_max = 1; - Marquee.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - Marquee.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - Marquee.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - Marquee.direction = MODE_DIRECTION_RIGHT; - Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC; - Marquee.colors.resize(1); - Marquee.brightness_min = 0; - Marquee.brightness_max = 100; - Marquee.brightness = 100; - modes.push_back(Marquee); - - mode Blink; - Blink.name = "Blink"; - Blink.value = CORSAIR_LIGHTING_NODE_MODE_BLINK; - Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - Blink.colors_min = 2; - Blink.colors_max = 2; - Blink.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - Blink.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - Blink.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - Blink.color_mode = MODE_COLORS_MODE_SPECIFIC; - Blink.colors.resize(2); - Blink.brightness_min = 0; - Blink.brightness_max = 100; - Blink.brightness = 100; - modes.push_back(Blink); - - mode Sequential; - Sequential.name = "Sequential"; - Sequential.value = CORSAIR_LIGHTING_NODE_MODE_SEQUENTIAL; - Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - Sequential.colors_min = 1; - Sequential.colors_max = 1; - Sequential.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - Sequential.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - Sequential.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - Sequential.direction = MODE_DIRECTION_RIGHT; - Sequential.color_mode = MODE_COLORS_MODE_SPECIFIC; - Sequential.colors.resize(1); - Sequential.brightness_min = 0; - Sequential.brightness_max = 100; - Sequential.brightness = 100; - modes.push_back(Sequential); - - mode Rainbow; - Rainbow.name = "Rainbow"; - Rainbow.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW; - Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; - Rainbow.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; - Rainbow.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; - Rainbow.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; - Rainbow.color_mode = MODE_COLORS_NONE; - Rainbow.brightness_min = 0; - Rainbow.brightness_max = 100; - Rainbow.brightness = 100; - modes.push_back(Rainbow); - SetupZones(); + SetupModes(); } RGBController_CorsairLightingNode::~RGBController_CorsairLightingNode() @@ -217,6 +43,256 @@ RGBController_CorsairLightingNode::~RGBController_CorsairLightingNode() delete controller; } +void RGBController_CorsairLightingNode::SetupModes() +{ + /*-----------------------------------------------------*\ + | Modes can be set per zone, but brightness is set | + | globally. Remove the HAS_BRIGHTNESS flag for each | + | mode when setting up the per-zone modes. | + \*-----------------------------------------------------*/ + + mode Direct; + Direct.name = "Direct"; + Direct.value = CORSAIR_LIGHTING_NODE_MODE_DIRECT; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE; + Direct.color_mode = MODE_COLORS_PER_LED; + modes.push_back(Direct); + + mode RainbowWave; + RainbowWave.name = "Rainbow Wave"; + RainbowWave.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW_WAVE; + RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + RainbowWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + RainbowWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + RainbowWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + RainbowWave.direction = MODE_DIRECTION_RIGHT; + RainbowWave.color_mode = MODE_COLORS_NONE; + RainbowWave.brightness_min = 0; + RainbowWave.brightness_max = 100; + RainbowWave.brightness = 100; + modes.push_back(RainbowWave); + + RainbowWave.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(RainbowWave); + } + + mode ColorShift; + ColorShift.name = "Color Shift"; + ColorShift.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_SHIFT; + ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + ColorShift.colors_min = 2; + ColorShift.colors_max = 2; + ColorShift.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + ColorShift.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + ColorShift.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC; + ColorShift.colors.resize(2); + ColorShift.brightness_min = 0; + ColorShift.brightness_max = 100; + ColorShift.brightness = 100; + modes.push_back(ColorShift); + + ColorShift.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(ColorShift); + } + + mode ColorPulse; + ColorPulse.name = "Color Pulse"; + ColorPulse.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_PULSE; + ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + ColorPulse.colors_min = 2; + ColorPulse.colors_max = 2; + ColorPulse.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + ColorPulse.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + ColorPulse.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + ColorPulse.color_mode = MODE_COLORS_MODE_SPECIFIC; + ColorPulse.colors.resize(2); + ColorPulse.brightness_min = 0; + ColorPulse.brightness_max = 100; + ColorPulse.brightness = 100; + modes.push_back(ColorPulse); + + ColorPulse.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(ColorPulse); + } + + mode ColorWave; + ColorWave.name = "Color Wave"; + ColorWave.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_WAVE; + ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + ColorWave.colors_min = 2; + ColorWave.colors_max = 2; + ColorWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + ColorWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + ColorWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + ColorWave.direction = MODE_DIRECTION_RIGHT; + ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC; + ColorWave.colors.resize(2); + ColorWave.brightness_min = 0; + ColorWave.brightness_max = 100; + ColorWave.brightness = 100; + modes.push_back(ColorWave); + + ColorWave.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(ColorWave); + } + + mode Static; + Static.name = "Static"; + Static.value = CORSAIR_LIGHTING_NODE_MODE_STATIC; + Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + Static.colors_min = 1; + Static.colors_max = 1; + Static.color_mode = MODE_COLORS_MODE_SPECIFIC; + Static.colors.resize(1); + Static.brightness_min = 0; + Static.brightness_max = 100; + Static.brightness = 100; + modes.push_back(Static); + + Static.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Static); + } + + mode Temperature; + Temperature.name = "Temperature"; + Temperature.value = CORSAIR_LIGHTING_NODE_MODE_TEMPERATURE; + Temperature.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + Temperature.colors_min = 3; + Temperature.colors_max = 3; + Temperature.color_mode = MODE_COLORS_MODE_SPECIFIC; + Temperature.colors.resize(3); + Temperature.brightness_min = 0; + Temperature.brightness_max = 100; + Temperature.brightness = 100; + modes.push_back(Temperature); + + Temperature.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Temperature); + } + + mode Visor; + Visor.name = "Visor"; + Visor.value = CORSAIR_LIGHTING_NODE_MODE_VISOR; + Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + Visor.colors_min = 2; + Visor.colors_max = 2; + Visor.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + Visor.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + Visor.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + Visor.color_mode = MODE_COLORS_MODE_SPECIFIC; + Visor.colors.resize(2); + Visor.brightness_min = 0; + Visor.brightness_max = 100; + Visor.brightness = 100; + modes.push_back(Visor); + + Visor.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Visor); + } + + mode Marquee; + Marquee.name = "Marquee"; + Marquee.value = CORSAIR_LIGHTING_NODE_MODE_MARQUEE; + Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + Marquee.colors_min = 1; + Marquee.colors_max = 1; + Marquee.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + Marquee.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + Marquee.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + Marquee.direction = MODE_DIRECTION_RIGHT; + Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC; + Marquee.colors.resize(1); + Marquee.brightness_min = 0; + Marquee.brightness_max = 100; + Marquee.brightness = 100; + modes.push_back(Marquee); + + Marquee.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Marquee); + } + + mode Blink; + Blink.name = "Blink"; + Blink.value = CORSAIR_LIGHTING_NODE_MODE_BLINK; + Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + Blink.colors_min = 2; + Blink.colors_max = 2; + Blink.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + Blink.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + Blink.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + Blink.color_mode = MODE_COLORS_MODE_SPECIFIC; + Blink.colors.resize(2); + Blink.brightness_min = 0; + Blink.brightness_max = 100; + Blink.brightness = 100; + modes.push_back(Blink); + + Blink.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Blink); + } + + mode Sequential; + Sequential.name = "Sequential"; + Sequential.value = CORSAIR_LIGHTING_NODE_MODE_SEQUENTIAL; + Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + Sequential.colors_min = 1; + Sequential.colors_max = 1; + Sequential.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + Sequential.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + Sequential.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + Sequential.direction = MODE_DIRECTION_RIGHT; + Sequential.color_mode = MODE_COLORS_MODE_SPECIFIC; + Sequential.colors.resize(1); + Sequential.brightness_min = 0; + Sequential.brightness_max = 100; + Sequential.brightness = 100; + modes.push_back(Sequential); + + Sequential.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Sequential); + } + + mode Rainbow; + Rainbow.name = "Rainbow"; + Rainbow.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW; + Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE; + Rainbow.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW; + Rainbow.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST; + Rainbow.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM; + Rainbow.color_mode = MODE_COLORS_NONE; + Rainbow.brightness_min = 0; + Rainbow.brightness_max = 100; + Rainbow.brightness = 100; + modes.push_back(Rainbow); + + Rainbow.flags &= ~MODE_FLAG_HAS_BRIGHTNESS; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Rainbow); + } +} + void RGBController_CorsairLightingNode::SetupZones() { /*-------------------------------------------------*\ @@ -261,8 +337,6 @@ void RGBController_CorsairLightingNode::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[4]; @@ -282,7 +356,7 @@ void RGBController_CorsairLightingNode::SetupZones() SetupColors(); } -void RGBController_CorsairLightingNode::ResizeZone(int zone, int new_size) +void RGBController_CorsairLightingNode::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -301,56 +375,96 @@ void RGBController_CorsairLightingNode::DeviceUpdateLEDs() { for(unsigned char zone_idx = 0; zone_idx < (unsigned char)zones.size(); zone_idx++) { - controller->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_CorsairLightingNode::UpdateZoneLEDs(int zone) +void RGBController_CorsairLightingNode::DeviceUpdateZoneLEDs(int zone) { - controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + if(modes[active_mode].value == CORSAIR_LIGHTING_NODE_MODE_DIRECT) + { + controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + } } -void RGBController_CorsairLightingNode::UpdateSingleLED(int led) +void RGBController_CorsairLightingNode::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; - controller->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count); + DeviceUpdateZoneLEDs(channel); } void RGBController_CorsairLightingNode::DeviceUpdateMode() { - if(modes[active_mode].value == 0xFFFF) + if(modes[active_mode].value == CORSAIR_LIGHTING_NODE_MODE_DIRECT) { DeviceUpdateLEDs(); } else { - for(int channel = 0; channel < CORSAIR_LIGHTING_NODE_NUM_CHANNELS; channel++) + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - unsigned int direction = 0; - bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM); + DeviceUpdateZoneMode(zone_idx); + } + } - if(modes[active_mode].direction == MODE_DIRECTION_RIGHT) + if(modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS) + { + controller->SetBrightness(modes[active_mode].brightness); + } + else + { + controller->SetBrightness(100); + } +} + +void RGBController_CorsairLightingNode::DeviceUpdateZoneMode(int zone) +{ + if(modes[active_mode].value == CORSAIR_LIGHTING_NODE_MODE_DIRECT) + { + return; + } + else + { + unsigned int direction = 0; + mode* mode_ptr = NULL; + bool random = false; + + if((zones[zone].active_mode >= 0) && (zones[zone].active_mode < (int)zones[zone].modes.size())) + { + mode_ptr = &zones[zone].modes[zones[zone].active_mode]; + } + else if(active_mode < (int)modes.size()) + { + mode_ptr = &modes[active_mode]; + } + + if(mode_ptr != NULL) + { + random = (mode_ptr->color_mode == MODE_COLORS_RANDOM); + + if(mode_ptr->direction == MODE_DIRECTION_RIGHT) { direction = 1; } unsigned char mode_colors[9]; + memset(mode_colors, 0, sizeof(mode_colors)); - if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC) + if(mode_ptr->color_mode == MODE_COLORS_MODE_SPECIFIC) { - for(std::size_t i = 0; i < modes[active_mode].colors.size(); i++) + for(std::size_t i = 0; i < mode_ptr->colors.size(); i++) { - mode_colors[(3 * i) + 0] = RGBGetRValue(modes[active_mode].colors[i]); - mode_colors[(3 * i) + 1] = RGBGetGValue(modes[active_mode].colors[i]); - mode_colors[(3 * i) + 2] = RGBGetBValue(modes[active_mode].colors[i]); + mode_colors[(3 * i) + 0] = RGBGetRValue(mode_ptr->colors[i]); + mode_colors[(3 * i) + 1] = RGBGetGValue(mode_ptr->colors[i]); + mode_colors[(3 * i) + 2] = RGBGetBValue(mode_ptr->colors[i]); } } - controller->SetChannelEffect(channel, - zones[channel].leds_count, - modes[active_mode].value, - modes[active_mode].speed, + controller->SetChannelEffect(zone, + zones[zone].leds_count, + mode_ptr->value, + mode_ptr->speed, direction, random, mode_colors[0], @@ -364,13 +478,4 @@ void RGBController_CorsairLightingNode::DeviceUpdateMode() mode_colors[8]); } } - - if(modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS) - { - controller->SetBrightness(modes[active_mode].brightness); - } - else - { - controller->SetBrightness(100); - } } diff --git a/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.h b/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.h index 5f27517d9..42cb1cc25 100644 --- a/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.h +++ b/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.h @@ -20,15 +20,17 @@ public: RGBController_CorsairLightingNode(CorsairLightingNodeController* controller_ptr); ~RGBController_CorsairLightingNode(); + void SetupModes(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); + void DeviceUpdateZoneMode(int zone); private: CorsairLightingNodeController* controller; diff --git a/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.cpp b/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.cpp index d29558b13..2a644df1d 100644 --- a/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.cpp +++ b/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.cpp @@ -359,7 +359,6 @@ RGBController_CorsairK55RGBPROXT::~RGBController_CorsairK55RGBPROXT() keepalive_thread_run = false; keepalive_thread->join(); delete keepalive_thread; - delete[] zones[0].matrix_map; delete controller; } @@ -370,10 +369,7 @@ void RGBController_CorsairK55RGBPROXT::SetupZones() keyboard_zone.name = "Keyboard"; keyboard_zone.type = ZONE_TYPE_MATRIX; - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->map = (unsigned int *)&matrix_map; - keyboard_zone.matrix_map->height = HEIGHT; - keyboard_zone.matrix_map->width = WIDTH; + keyboard_zone.matrix_map.Set(HEIGHT, WIDTH, (unsigned int *)&matrix_map); for(size_t led_index = 0; led_index < key_names.size(); ++led_index) { @@ -391,13 +387,6 @@ void RGBController_CorsairK55RGBPROXT::SetupZones() SetupColors(); } -void RGBController_CorsairK55RGBPROXT::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairK55RGBPROXT::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -405,12 +394,12 @@ void RGBController_CorsairK55RGBPROXT::DeviceUpdateLEDs() controller->SetLEDs(colors); } -void RGBController_CorsairK55RGBPROXT::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairK55RGBPROXT::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_CorsairK55RGBPROXT::UpdateSingleLED(int /*led*/) +void RGBController_CorsairK55RGBPROXT::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.h b/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.h index 549bdd248..362a300ad 100644 --- a/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.h +++ b/Controllers/CorsairPeripheralController/RGBController_CorsairK55RGBPROXT.h @@ -19,11 +19,10 @@ public: ~RGBController_CorsairK55RGBPROXT(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void KeepaliveThread(); diff --git a/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.cpp b/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.cpp index d85480f20..aaff46877 100644 --- a/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.cpp +++ b/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.cpp @@ -178,24 +178,19 @@ RGBController_CorsairK65Mini::~RGBController_CorsairK65Mini() void RGBController_CorsairK65Mini::SetupZones() { - unsigned int zone_size = 0; + unsigned int zone_size = 0; zone keyboard_zone; - keyboard_zone.name = ZONE_EN_KEYBOARD; - keyboard_zone.type = ZONE_TYPE_MATRIX; + keyboard_zone.name = ZONE_EN_KEYBOARD; + keyboard_zone.type = ZONE_TYPE_MATRIX; - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->height = HEIGHT; - keyboard_zone.matrix_map->width = WIDTH; - - keyboard_zone.matrix_map->map = new unsigned int[HEIGHT * WIDTH]; + keyboard_zone.matrix_map.Set(HEIGHT, WIDTH, (unsigned int *)matrix_map); for(unsigned int w = 0; w < WIDTH; w++) { for(unsigned int h = 0; h < HEIGHT; h++) { unsigned int key = matrix_map[h][w]; - keyboard_zone.matrix_map->map[h * WIDTH + w] = key; if(key != NA) { @@ -217,25 +212,18 @@ void RGBController_CorsairK65Mini::SetupZones() SetupColors(); } -void RGBController_CorsairK65Mini::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairK65Mini::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); controller->SetLEDs(colors, led_positions); } -void RGBController_CorsairK65Mini::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairK65Mini::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairK65Mini::UpdateSingleLED(int /*led*/) +void RGBController_CorsairK65Mini::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.h b/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.h index 9ca48972b..15f7173ae 100644 --- a/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.h +++ b/Controllers/CorsairPeripheralController/RGBController_CorsairK65Mini.h @@ -19,11 +19,10 @@ public: ~RGBController_CorsairK65Mini(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp b/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp index 1baa9f46b..899f18cd4 100644 --- a/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp +++ b/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp @@ -929,17 +929,6 @@ RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripher RGBController_CorsairPeripheral::~RGBController_CorsairPeripheral() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -987,7 +976,7 @@ void RGBController_CorsairPeripheral::SetupZones() switch(type) { case DEVICE_TYPE_KEYBOARD: - if (logical_layout == CORSAIR_TYPE_K95_PLAT) + if(logical_layout == CORSAIR_TYPE_K95_PLAT) { new_zone.name = zone_names_k95_platinum[zone_idx]; new_zone.type = zone_types_k95_platinum[zone_idx]; @@ -997,17 +986,10 @@ void RGBController_CorsairPeripheral::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 24; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95_platinum; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 24, (unsigned int *)&matrix_map_k95_platinum); } } - else if (logical_layout == CORSAIR_TYPE_K95) + else if(logical_layout == CORSAIR_TYPE_K95) { new_zone.name = zone_names_k95[zone_idx]; new_zone.type = zone_types_k95[zone_idx]; @@ -1017,14 +999,7 @@ void RGBController_CorsairPeripheral::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 26; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 26, (unsigned int *)&matrix_map_k95); } } else if (logical_layout == CORSAIR_TYPE_K55) @@ -1034,7 +1009,6 @@ void RGBController_CorsairPeripheral::SetupZones() new_zone.leds_min = zone_sizes_k55[zone_idx]; new_zone.leds_max = zone_sizes_k55[zone_idx]; new_zone.leds_count = zone_sizes_k55[zone_idx]; - new_zone.matrix_map = NULL; } else if (logical_layout == CORSAIR_TYPE_K70_MK2) { @@ -1046,14 +1020,7 @@ void RGBController_CorsairPeripheral::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_k70_mk2; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 23, (unsigned int *)&matrix_map_k70_mk2); } } else //default layout @@ -1066,14 +1033,7 @@ void RGBController_CorsairPeripheral::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(6, 23, (unsigned int *)&matrix_map); } } break; @@ -1085,7 +1045,6 @@ void RGBController_CorsairPeripheral::SetupZones() new_zone.leds_min = 15; new_zone.leds_max = 15; new_zone.leds_count = 15; - new_zone.matrix_map = NULL; break; case DEVICE_TYPE_MOUSEMAT: @@ -1094,7 +1053,6 @@ void RGBController_CorsairPeripheral::SetupZones() new_zone.leds_min = 15; new_zone.leds_max = 15; new_zone.leds_count = 15; - new_zone.matrix_map = NULL; break; case DEVICE_TYPE_HEADSET_STAND: @@ -1105,7 +1063,6 @@ void RGBController_CorsairPeripheral::SetupZones() new_zone.leds_min = 8; new_zone.leds_max = 8; new_zone.leds_count = 8; - new_zone.matrix_map = NULL; } else { @@ -1114,7 +1071,6 @@ void RGBController_CorsairPeripheral::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; } break; } @@ -1189,24 +1145,17 @@ void RGBController_CorsairPeripheral::SetupZones() SetupColors(); } -void RGBController_CorsairPeripheral::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairPeripheral::DeviceUpdateLEDs() { controller->SetLEDs(colors); } -void RGBController_CorsairPeripheral::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairPeripheral::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_CorsairPeripheral::UpdateSingleLED(int /*led*/) +void RGBController_CorsairPeripheral::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.h b/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.h index cc0cbe06d..9c9b8abcc 100644 --- a/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.h +++ b/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.h @@ -25,11 +25,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.cpp b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.cpp index 29a58d883..789c62169 100644 --- a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.cpp +++ b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.cpp @@ -79,17 +79,6 @@ RGBController_CorsairV2HW::~RGBController_CorsairV2HW() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].type == ZONE_TYPE_MATRIX) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -138,13 +127,6 @@ void RGBController_CorsairV2HW::SetupZones() { KeyboardLayoutManager new_kb(new_layout, corsair->layout_new->base_size, corsair->layout_new->key_values); - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - - new_map->height = corsair->zones[i]->rows; - new_map->width = corsair->zones[i]->cols; - new_map->map = new unsigned int[new_map->height * new_map->width]; - if(corsair->layout_new->base_size != KEYBOARD_SIZE_EMPTY) { /*---------------------------------------------------------*\ @@ -153,11 +135,7 @@ void RGBController_CorsairV2HW::SetupZones() keyboard_keymap_overlay_values* temp = corsair->layout_new; new_kb.ChangeKeys(*temp); - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, new_map->height, new_map->width); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT, corsair->zones[i]->rows, corsair->zones[i]->cols); /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | @@ -186,7 +164,6 @@ void RGBController_CorsairV2HW::SetupZones() else { new_zone.leds_count = corsair->zones[i]->rows * corsair->zones[i]->cols; - new_zone.matrix_map = NULL; /*---------------------------------------------------------*\ | Create LEDs for the Linear / Single zone | @@ -234,13 +211,6 @@ void RGBController_CorsairV2HW::SetupZones() } } -void RGBController_CorsairV2HW::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairV2HW::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -248,12 +218,12 @@ void RGBController_CorsairV2HW::DeviceUpdateLEDs() controller->SetLedsDirect(buffer_map); } -void RGBController_CorsairV2HW::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairV2HW::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLedsDirect(buffer_map); } -void RGBController_CorsairV2HW::UpdateSingleLED(int /*led*/) +void RGBController_CorsairV2HW::DeviceUpdateSingleLED(int /*led*/) { controller->SetLedsDirect(buffer_map); } diff --git a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.h b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.h index f36e0b8dd..dc8e8170e 100644 --- a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.h +++ b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Hardware.h @@ -23,11 +23,10 @@ public: ~RGBController_CorsairV2HW(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void KeepaliveThread(); diff --git a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.cpp b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.cpp index 42add1fab..41b5c10bd 100644 --- a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.cpp +++ b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.cpp @@ -66,17 +66,6 @@ RGBController_CorsairV2SW::~RGBController_CorsairV2SW() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].type == ZONE_TYPE_MATRIX) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -125,13 +114,6 @@ void RGBController_CorsairV2SW::SetupZones() { KeyboardLayoutManager new_kb(new_layout, corsair->layout_new->base_size, corsair->layout_new->key_values); - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - - new_map->height = corsair->zones[i]->rows; - new_map->width = corsair->zones[i]->cols; - new_map->map = new unsigned int[new_map->height * new_map->width]; - if(corsair->layout_new->base_size != KEYBOARD_SIZE_EMPTY) { /*---------------------------------------------------------*\ @@ -140,11 +122,7 @@ void RGBController_CorsairV2SW::SetupZones() keyboard_keymap_overlay_values* temp = corsair->layout_new; new_kb.ChangeKeys(*temp); - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, new_map->height, new_map->width); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT, corsair->zones[i]->rows, corsair->zones[i]->cols); /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | @@ -173,7 +151,6 @@ void RGBController_CorsairV2SW::SetupZones() else { new_zone.leds_count = corsair->zones[i]->rows * corsair->zones[i]->cols; - new_zone.matrix_map = NULL; /*---------------------------------------------------------*\ | Create LEDs for the Linear / Single zone | @@ -221,13 +198,6 @@ void RGBController_CorsairV2SW::SetupZones() } } -void RGBController_CorsairV2SW::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairV2SW::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -235,12 +205,12 @@ void RGBController_CorsairV2SW::DeviceUpdateLEDs() controller->SetLedsDirect(buffer_map); } -void RGBController_CorsairV2SW::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairV2SW::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLedsDirect(buffer_map); } -void RGBController_CorsairV2SW::UpdateSingleLED(int /*led*/) +void RGBController_CorsairV2SW::DeviceUpdateSingleLED(int /*led*/) { controller->SetLedsDirect(buffer_map); } diff --git a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.h b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.h index eb83baa1d..0f09f99ca 100644 --- a/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.h +++ b/Controllers/CorsairPeripheralV2Controller/RGBController_CorsairV2Software.h @@ -24,13 +24,13 @@ public: ~RGBController_CorsairV2SW(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); + void KeepaliveThread(); private: diff --git a/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.cpp b/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.cpp index 19dc7fae7..0e895a53a 100644 --- a/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.cpp +++ b/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.cpp @@ -73,7 +73,6 @@ void RGBController_CorsairVengeance::SetupZones() new_zone.leds_min = controller->GetLEDCount(); new_zone.leds_max = controller->GetLEDCount(); new_zone.leds_count = controller->GetLEDCount(); - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -89,13 +88,6 @@ void RGBController_CorsairVengeance::SetupZones() SetupColors(); } -void RGBController_CorsairVengeance::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairVengeance::DeviceUpdateLEDs() { RGBColor color = colors[0]; @@ -106,12 +98,12 @@ void RGBController_CorsairVengeance::DeviceUpdateLEDs() controller->SetLEDColor(red, grn, blu); } -void RGBController_CorsairVengeance::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairVengeance::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairVengeance::UpdateSingleLED(int /*led*/) +void RGBController_CorsairVengeance::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.h b/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.h index 67cc97000..4ecc809a6 100644 --- a/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.h +++ b/Controllers/CorsairVengeanceController/RGBController_CorsairVengeance.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.cpp b/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.cpp index 625289d74..6eb33094e 100644 --- a/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.cpp +++ b/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.cpp @@ -189,7 +189,6 @@ void RGBController_CorsairVengeancePro::SetupZones() new_zone.leds_min = controller->GetLEDCount(); new_zone.leds_max = controller->GetLEDCount(); new_zone.leds_count = controller->GetLEDCount(); - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -206,13 +205,6 @@ void RGBController_CorsairVengeancePro::SetupZones() SetupColors(); } -void RGBController_CorsairVengeancePro::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairVengeancePro::DeviceUpdateLEDs() { for(unsigned int led = 0; led < (unsigned int)colors.size(); led++) @@ -227,12 +219,12 @@ void RGBController_CorsairVengeancePro::DeviceUpdateLEDs() controller->ApplyColors(); } -void RGBController_CorsairVengeancePro::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairVengeancePro::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairVengeancePro::UpdateSingleLED(int led) +void RGBController_CorsairVengeancePro::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.h b/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.h index e1901388d..a930f7fa6 100644 --- a/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.h +++ b/Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CorsairWirelessController/RGBController_CorsairWireless.cpp b/Controllers/CorsairWirelessController/RGBController_CorsairWireless.cpp index 4097fdae3..588984872 100644 --- a/Controllers/CorsairWirelessController/RGBController_CorsairWireless.cpp +++ b/Controllers/CorsairWirelessController/RGBController_CorsairWireless.cpp @@ -233,17 +233,6 @@ RGBController_CorsairWireless::~RGBController_CorsairWireless() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -271,14 +260,7 @@ void RGBController_CorsairWireless::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 24; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 24, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -297,13 +279,6 @@ void RGBController_CorsairWireless::SetupZones() SetupColors(); } -void RGBController_CorsairWireless::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CorsairWireless::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -311,12 +286,12 @@ void RGBController_CorsairWireless::DeviceUpdateLEDs() controller->SetLEDs(colors); } -void RGBController_CorsairWireless::UpdateZoneLEDs(int /*zone*/) +void RGBController_CorsairWireless::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_CorsairWireless::UpdateSingleLED(int /*led*/) +void RGBController_CorsairWireless::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/CorsairWirelessController/RGBController_CorsairWireless.h b/Controllers/CorsairWirelessController/RGBController_CorsairWireless.h index bcadb44b6..f07c3faff 100644 --- a/Controllers/CorsairWirelessController/RGBController_CorsairWireless.h +++ b/Controllers/CorsairWirelessController/RGBController_CorsairWireless.h @@ -25,11 +25,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp b/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp index 466cbce60..c4b262a61 100644 --- a/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp +++ b/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp @@ -389,11 +389,7 @@ void RGBController_CougarKeyboard::SetupZones() KB_zone.leds_count = 113; KB_zone.leds_min = KB_zone.leds_count; KB_zone.leds_max = KB_zone.leds_count; - - KB_zone.matrix_map = new matrix_map_type; - KB_zone.matrix_map->height = 6; - KB_zone.matrix_map->width = COUGARKEYBOARDCONTROLLER_MATRIX_WIDTH; - KB_zone.matrix_map->map = (unsigned int *)&matrix_map; + KB_zone.matrix_map.Set(6, COUGARKEYBOARDCONTROLLER_MATRIX_WIDTH, (unsigned int *)&matrix_map); zones.push_back(KB_zone); /*-------------------------------------------------*\ @@ -419,19 +415,12 @@ void RGBController_CougarKeyboard::SetupZones() SetupColors(); } -void RGBController_CougarKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CougarKeyboard::DeviceUpdateLEDs() { controller->SetLedsDirect(colors); } -void RGBController_CougarKeyboard::UpdateZoneLEDs(int zone) +void RGBController_CougarKeyboard::DeviceUpdateZoneLEDs(int zone) { std::vector colour; for(size_t i = 0; i < zones[zone].leds_count; i++) @@ -442,7 +431,7 @@ void RGBController_CougarKeyboard::UpdateZoneLEDs(int zone) controller->SetLedsDirect(colour); } -void RGBController_CougarKeyboard::UpdateSingleLED(int led) +void RGBController_CougarKeyboard::DeviceUpdateSingleLED(int led) { std::vector colour; colour.push_back(colors[led]); diff --git a/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.h b/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.h index 2f8e4c40b..3e9a8c965 100644 --- a/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.h +++ b/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.h @@ -23,11 +23,10 @@ public: ~RGBController_CougarKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp b/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp index 7f42ad2ab..b7f4181a5 100644 --- a/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp +++ b/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp @@ -119,7 +119,6 @@ void RGBController_CougarRevengerST::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.push_back(new_zone); new_zone.name = "Mouse wheel"; @@ -138,29 +137,22 @@ void RGBController_CougarRevengerST::SetupZones() SetupColors(); } -void RGBController_CougarRevengerST::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CougarRevengerST::DeviceUpdateLEDs() { for(unsigned int i = 0; i < colors.size(); i++) { - UpdateZoneLEDs(i); + DeviceUpdateZoneLEDs(i); } } -void RGBController_CougarRevengerST::UpdateZoneLEDs(int zone) +void RGBController_CougarRevengerST::DeviceUpdateZoneLEDs(int zone) { controller->SetDirect(zone, colors[zone], modes[active_mode].brightness); } -void RGBController_CougarRevengerST::UpdateSingleLED(int led) +void RGBController_CougarRevengerST::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_CougarRevengerST::DeviceUpdateMode() diff --git a/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.h b/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.h index 5125dec2f..6008446af 100644 --- a/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.h +++ b/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.h @@ -21,11 +21,10 @@ public: ~RGBController_CougarRevengerST(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.cpp b/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.cpp index dd2441eeb..607ced0f4 100644 --- a/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.cpp +++ b/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.cpp @@ -54,7 +54,6 @@ void RGBController_CreativeSoundBlasterAE5::SetupZones() internal_zone.leds_min = 5; internal_zone.leds_max = 5; internal_zone.leds_count = 5; - internal_zone.matrix_map = NULL; zones.push_back(internal_zone); for(unsigned int led_idx = 0; led_idx < 5; led_idx++) @@ -70,7 +69,6 @@ void RGBController_CreativeSoundBlasterAE5::SetupZones() external_zone.leds_min = 0; external_zone.leds_max = 100; external_zone.leds_count = controller->GetExternalLEDCount(); - external_zone.matrix_map = NULL; zones.push_back(external_zone); for(unsigned int led_idx = 0; led_idx < controller->GetExternalLEDCount(); led_idx++) @@ -83,7 +81,7 @@ void RGBController_CreativeSoundBlasterAE5::SetupZones() SetupColors(); } -void RGBController_CreativeSoundBlasterAE5::ResizeZone(int zone, int new_size) +void RGBController_CreativeSoundBlasterAE5::DeviceResizeZone(int zone, int new_size) { if(zone == 1) // External zone { @@ -134,7 +132,7 @@ void RGBController_CreativeSoundBlasterAE5::DeviceUpdateLEDs() UpdateLEDRange(0, controller->GetLEDCount()); } -void RGBController_CreativeSoundBlasterAE5::UpdateZoneLEDs(int zone) +void RGBController_CreativeSoundBlasterAE5::DeviceUpdateZoneLEDs(int zone) { if(zone >= 0 && zone < (int)zones.size()) { @@ -149,7 +147,7 @@ void RGBController_CreativeSoundBlasterAE5::UpdateZoneLEDs(int zone) } } -void RGBController_CreativeSoundBlasterAE5::UpdateSingleLED(int led) +void RGBController_CreativeSoundBlasterAE5::DeviceUpdateSingleLED(int led) { /*-------------------------------------------------------------*\ | Find which zone this LED belongs to and update only that zone | diff --git a/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.h b/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.h index f714620d6..6ecaf7078 100644 --- a/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.h +++ b/Controllers/CreativeController/RGBController_CreativeSoundBlasterAE5_Windows.h @@ -20,15 +20,15 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); private: CreativeSoundBlasterAE5ControllerBase* controller; void UpdateLEDRange(unsigned int start_led, unsigned int led_count); -}; \ No newline at end of file +}; diff --git a/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.cpp b/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.cpp index 50f2abfa4..bf5a5539d 100644 --- a/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.cpp +++ b/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.cpp @@ -57,7 +57,6 @@ void RGBController_CreativeSoundBlasterXG6::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led logo_led; @@ -67,13 +66,6 @@ void RGBController_CreativeSoundBlasterXG6::SetupZones() SetupColors(); } -void RGBController_CreativeSoundBlasterXG6::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_CreativeSoundBlasterXG6::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -83,12 +75,12 @@ void RGBController_CreativeSoundBlasterXG6::DeviceUpdateLEDs() controller->SetLedColor(red, grn, blu, modes[active_mode].brightness); } -void RGBController_CreativeSoundBlasterXG6::UpdateZoneLEDs(int /*zone*/) +void RGBController_CreativeSoundBlasterXG6::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CreativeSoundBlasterXG6::UpdateSingleLED(int /*led*/) +void RGBController_CreativeSoundBlasterXG6::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.h b/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.h index ed699854c..7c49cac6d 100644 --- a/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.h +++ b/Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CrucialController/RGBController_Crucial.cpp b/Controllers/CrucialController/RGBController_Crucial.cpp index a2884dd9c..9d46be61b 100644 --- a/Controllers/CrucialController/RGBController_Crucial.cpp +++ b/Controllers/CrucialController/RGBController_Crucial.cpp @@ -143,7 +143,6 @@ void RGBController_Crucial::SetupZones() new_zone.leds_min = 8; new_zone.leds_max = 8; new_zone.leds_count = 8; - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -160,13 +159,6 @@ void RGBController_Crucial::SetupZones() SetupColors(); } -void RGBController_Crucial::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Crucial::DeviceUpdateLEDs() { if(modes[active_mode].value == 0xFFFF) @@ -184,12 +176,12 @@ void RGBController_Crucial::DeviceUpdateLEDs() } } -void RGBController_Crucial::UpdateZoneLEDs(int /*zone*/) +void RGBController_Crucial::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Crucial::UpdateSingleLED(int /*led*/) +void RGBController_Crucial::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/CrucialController/RGBController_Crucial.h b/Controllers/CrucialController/RGBController_Crucial.h index 63d53f6e1..66c437be7 100644 --- a/Controllers/CrucialController/RGBController_Crucial.h +++ b/Controllers/CrucialController/RGBController_Crucial.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.cpp b/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.cpp index a8189a27c..7b7a50948 100644 --- a/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.cpp +++ b/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.cpp @@ -34,10 +34,21 @@ RGBController_CryorigH7QuadLumi::RGBController_CryorigH7QuadLumi(CryorigH7QuadLu location = controller->GetLocation(); serial = controller->GetSerialString(); + SetupZones(); + SetupModes(); +} + +RGBController_CryorigH7QuadLumi::~RGBController_CryorigH7QuadLumi() +{ + delete controller; +} + +void RGBController_CryorigH7QuadLumi::SetupModes() +{ mode Direct; Direct.name = "Direct"; Direct.value = CRYORIG_H7_QUAD_LUMI_MODE_FIXED; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE; Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); @@ -53,17 +64,25 @@ RGBController_CryorigH7QuadLumi::RGBController_CryorigH7QuadLumi(CryorigH7QuadLu Fading.color_mode = MODE_COLORS_MODE_SPECIFIC; Fading.colors.resize(2); modes.push_back(Fading); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Fading); + } - mode SpectrumCycle; - SpectrumCycle.name = "Rainbow Wave"; - SpectrumCycle.value = CRYORIG_H7_QUAD_LUMI_MODE_SPECTRUM; - SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR; - SpectrumCycle.speed_min = CRYORIG_H7_QUAD_LUMI_SPEED_SLOWEST; - SpectrumCycle.speed_max = CRYORIG_H7_QUAD_LUMI_SPEED_FASTEST; - SpectrumCycle.speed = CRYORIG_H7_QUAD_LUMI_SPEED_NORMAL; - SpectrumCycle.direction = MODE_DIRECTION_RIGHT; - SpectrumCycle.color_mode = MODE_COLORS_NONE; - modes.push_back(SpectrumCycle); + mode RainbowWave; + RainbowWave.name = "Rainbow Wave"; + RainbowWave.value = CRYORIG_H7_QUAD_LUMI_MODE_SPECTRUM; + RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR; + RainbowWave.speed_min = CRYORIG_H7_QUAD_LUMI_SPEED_SLOWEST; + RainbowWave.speed_max = CRYORIG_H7_QUAD_LUMI_SPEED_FASTEST; + RainbowWave.speed = CRYORIG_H7_QUAD_LUMI_SPEED_NORMAL; + RainbowWave.direction = MODE_DIRECTION_RIGHT; + RainbowWave.color_mode = MODE_COLORS_NONE; + modes.push_back(RainbowWave); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(RainbowWave); + } mode Marquee; Marquee.name = "Marquee"; @@ -78,6 +97,10 @@ RGBController_CryorigH7QuadLumi::RGBController_CryorigH7QuadLumi(CryorigH7QuadLu Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC; Marquee.colors.resize(1); modes.push_back(Marquee); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Marquee); + } mode CoverMarquee; CoverMarquee.name = "Cover Marquee"; @@ -92,6 +115,10 @@ RGBController_CryorigH7QuadLumi::RGBController_CryorigH7QuadLumi(CryorigH7QuadLu CoverMarquee.color_mode = MODE_COLORS_MODE_SPECIFIC; CoverMarquee.colors.resize(2); modes.push_back(CoverMarquee); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(CoverMarquee); + } mode Alternating; Alternating.name = "Alternating"; @@ -106,6 +133,10 @@ RGBController_CryorigH7QuadLumi::RGBController_CryorigH7QuadLumi(CryorigH7QuadLu Alternating.color_mode = MODE_COLORS_MODE_SPECIFIC; Alternating.colors.resize(2); modes.push_back(Alternating); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Alternating); + } mode Pulsing; Pulsing.name = "Pulsing"; @@ -119,6 +150,10 @@ RGBController_CryorigH7QuadLumi::RGBController_CryorigH7QuadLumi(CryorigH7QuadLu Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC; Pulsing.colors.resize(2) ; modes.push_back(Pulsing); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Pulsing); + } mode Breathing; Breathing.name = "Breathing"; @@ -132,13 +167,10 @@ RGBController_CryorigH7QuadLumi::RGBController_CryorigH7QuadLumi(CryorigH7QuadLu Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC; Breathing.colors.resize(2); modes.push_back(Breathing); - - SetupZones(); -} - -RGBController_CryorigH7QuadLumi::~RGBController_CryorigH7QuadLumi() -{ - delete controller; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Breathing); + } } void RGBController_CryorigH7QuadLumi::SetupZones() @@ -157,7 +189,6 @@ void RGBController_CryorigH7QuadLumi::SetupZones() new_zone->leds_min = 5; new_zone->leds_max = 5; new_zone->leds_count = 5; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); } @@ -182,29 +213,27 @@ void RGBController_CryorigH7QuadLumi::SetupZones() SetupColors(); } -void RGBController_CryorigH7QuadLumi::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_CryorigH7QuadLumi::DeviceUpdateLEDs() { for(unsigned char zone_idx = 0; zone_idx < (unsigned char)zones.size(); zone_idx++) { - controller->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_CryorigH7QuadLumi::UpdateZoneLEDs(int zone) +void RGBController_CryorigH7QuadLumi::DeviceUpdateZoneLEDs(int zone) { - controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + if(modes[active_mode].value == CRYORIG_H7_QUAD_LUMI_MODE_FIXED) + { + controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + } } -void RGBController_CryorigH7QuadLumi::UpdateSingleLED(int led) +void RGBController_CryorigH7QuadLumi::DeviceUpdateSingleLED(int led) { unsigned int zone_idx = leds[led].value; - controller->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); + DeviceUpdateZoneLEDs(zone_idx); } void RGBController_CryorigH7QuadLumi::DeviceUpdateMode() @@ -217,27 +246,52 @@ void RGBController_CryorigH7QuadLumi::DeviceUpdateMode() { for(unsigned char zone_idx = 0; zone_idx < (unsigned char)zones.size(); zone_idx++) { - RGBColor* colors = NULL; - bool direction = false; + DeviceUpdateZoneMode(zone_idx); + } + } +} - if(modes[active_mode].direction == MODE_DIRECTION_LEFT) +void RGBController_CryorigH7QuadLumi::DeviceUpdateZoneMode(int zone) +{ + if(modes[active_mode].value == CRYORIG_H7_QUAD_LUMI_MODE_FIXED) + { + return; + } + else + { + RGBColor* colors = NULL; + bool direction = false; + mode* mode_ptr = NULL; + + if((zones[zone].active_mode >= 0) && (zones[zone].active_mode < (int)zones[zone].modes.size())) + { + mode_ptr = &zones[zone].modes[zones[zone].active_mode]; + } + else if(active_mode < (int)modes.size()) + { + mode_ptr = &modes[active_mode]; + } + + if(mode_ptr != NULL) + { + if(mode_ptr->direction == MODE_DIRECTION_LEFT) { direction = true; } - if(modes[active_mode].colors.size() > 0) + if(mode_ptr->colors.size() > 0) { - colors = &modes[active_mode].colors[0]; + colors = &mode_ptr->colors[0]; } controller->SetChannelEffect ( - zone_idx, - modes[active_mode].value, - modes[active_mode].speed, + zone, + mode_ptr->value, + mode_ptr->speed, direction, colors, - (unsigned int)modes[active_mode].colors.size() + (unsigned int)mode_ptr->colors.size() ); } } diff --git a/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.h b/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.h index b17e61f12..4753de80d 100644 --- a/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.h +++ b/Controllers/CryorigH7QuadLumiController/RGBController_CryorigH7QuadLumi.h @@ -20,15 +20,15 @@ public: RGBController_CryorigH7QuadLumi(CryorigH7QuadLumiController* controller_ptr); ~RGBController_CryorigH7QuadLumi(); + void SetupModes(); void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); + void DeviceUpdateZoneMode(int zone); private: CryorigH7QuadLumiController* controller; diff --git a/Controllers/DDPController/RGBController_DDP.cpp b/Controllers/DDPController/RGBController_DDP.cpp index 349fe827b..fefc256cc 100644 --- a/Controllers/DDPController/RGBController_DDP.cpp +++ b/Controllers/DDPController/RGBController_DDP.cpp @@ -65,7 +65,6 @@ void RGBController_DDP::SetupZones() led_zone.leds_min = devices[zone_idx].num_leds; led_zone.leds_max = devices[zone_idx].num_leds; led_zone.leds_count = devices[zone_idx].num_leds; - led_zone.matrix_map = NULL; zones.push_back(led_zone); } @@ -82,10 +81,6 @@ void RGBController_DDP::SetupZones() SetupColors(); } -void RGBController_DDP::ResizeZone(int /*zone*/, int /*new_size*/) -{ -} - void RGBController_DDP::DeviceUpdateLEDs() { std::vector brightness_adjusted_colors; @@ -108,12 +103,12 @@ void RGBController_DDP::DeviceUpdateLEDs() controller->UpdateLEDs(brightness_adjusted_colors); } -void RGBController_DDP::UpdateZoneLEDs(int /*zone*/) +void RGBController_DDP::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_DDP::UpdateSingleLED(int /*led*/) +void RGBController_DDP::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/DDPController/RGBController_DDP.h b/Controllers/DDPController/RGBController_DDP.h index 329438d46..cfad4baf7 100644 --- a/Controllers/DDPController/RGBController_DDP.h +++ b/Controllers/DDPController/RGBController_DDP.h @@ -20,11 +20,10 @@ public: ~RGBController_DDP(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/DMXController/RGBController_DMX.cpp b/Controllers/DMXController/RGBController_DMX.cpp index 01b8d96e8..9db7b520d 100644 --- a/Controllers/DMXController/RGBController_DMX.cpp +++ b/Controllers/DMXController/RGBController_DMX.cpp @@ -107,22 +107,6 @@ RGBController_DMX::~RGBController_DMX() keepalive_thread->join(); delete keepalive_thread; } - - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - if(zones[zone_index].matrix_map->map != NULL) - { - delete zones[zone_index].matrix_map->map; - } - - delete zones[zone_index].matrix_map; - } - } } void RGBController_DMX::SetupZones() @@ -138,8 +122,6 @@ void RGBController_DMX::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; - zones.push_back(led_zone); } @@ -162,13 +144,6 @@ void RGBController_DMX::SetupZones() SetupColors(); } -void RGBController_DMX::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_DMX::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -204,12 +179,12 @@ void RGBController_DMX::DeviceUpdateLEDs() port->serial_write((char*)&dmx_data, sizeof(dmx_data)); } -void RGBController_DMX::UpdateZoneLEDs(int /*zone*/) +void RGBController_DMX::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_DMX::UpdateSingleLED(int /*led*/) +void RGBController_DMX::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -225,7 +200,7 @@ void RGBController_DMX::KeepaliveThreadFunction() { if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) ) { - UpdateLEDs(); + UpdateLEDsInternal(); } std::this_thread::sleep_for(keepalive_delay / 2); } diff --git a/Controllers/DMXController/RGBController_DMX.h b/Controllers/DMXController/RGBController_DMX.h index e80cad9cd..4f39ad60e 100644 --- a/Controllers/DMXController/RGBController_DMX.h +++ b/Controllers/DMXController/RGBController_DMX.h @@ -34,11 +34,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/DRGBController/RGBController_DRGB.cpp b/Controllers/DRGBController/RGBController_DRGB.cpp index e8f15077a..8e48bb196 100644 --- a/Controllers/DRGBController/RGBController_DRGB.cpp +++ b/Controllers/DRGBController/RGBController_DRGB.cpp @@ -328,8 +328,6 @@ void RGBController_DRGB::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[4]; @@ -346,7 +344,7 @@ void RGBController_DRGB::SetupZones() } -void RGBController_DRGB::ResizeZone(int zone, int new_size) +void RGBController_DRGB::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -495,12 +493,12 @@ void RGBController_DRGB::DeviceUpdateLEDs() } } -void RGBController_DRGB::UpdateZoneLEDs(int zone) +void RGBController_DRGB::DeviceUpdateZoneLEDs(int zone) { controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); } -void RGBController_DRGB::UpdateSingleLED(int led) +void RGBController_DRGB::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; controller->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count); diff --git a/Controllers/DRGBController/RGBController_DRGB.h b/Controllers/DRGBController/RGBController_DRGB.h index 3db431a66..ebfc0db37 100644 --- a/Controllers/DRGBController/RGBController_DRGB.h +++ b/Controllers/DRGBController/RGBController_DRGB.h @@ -61,10 +61,10 @@ public: ~RGBController_DRGB(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); private: diff --git a/Controllers/DarkProject/RGBController_DarkProjectKeyboard.cpp b/Controllers/DarkProject/RGBController_DarkProjectKeyboard.cpp index dd2e5586b..a9e9675ce 100644 --- a/Controllers/DarkProject/RGBController_DarkProjectKeyboard.cpp +++ b/Controllers/DarkProject/RGBController_DarkProjectKeyboard.cpp @@ -167,11 +167,7 @@ void RGBController_DarkProjectKeyboard::SetupZones() KB_zone.leds_min = DARKPROKECTKEYBOARD_TKL_KEYCOUNT; KB_zone.leds_max = DARKPROKECTKEYBOARD_TKL_KEYCOUNT; KB_zone.leds_count = DARKPROKECTKEYBOARD_TKL_KEYCOUNT; - - KB_zone.matrix_map = new matrix_map_type; - KB_zone.matrix_map->height = 6; - KB_zone.matrix_map->width = 18; - KB_zone.matrix_map->map = (unsigned int *)&matrix_map; + KB_zone.matrix_map.Set(6, 18, (unsigned int *)&matrix_map); zones.push_back(KB_zone); /*-------------------------------------------------*\ @@ -197,20 +193,12 @@ void RGBController_DarkProjectKeyboard::SetupZones() SetupColors(); } -void RGBController_DarkProjectKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - - void RGBController_DarkProjectKeyboard::DeviceUpdateLEDs() { controller->SetLedsDirect(colors); } -void RGBController_DarkProjectKeyboard::UpdateZoneLEDs(int zone) +void RGBController_DarkProjectKeyboard::DeviceUpdateZoneLEDs(int zone) { std::vector colour; for(size_t i = 0; i < zones[zone].leds_count; i++) @@ -221,7 +209,7 @@ void RGBController_DarkProjectKeyboard::UpdateZoneLEDs(int zone) controller->SetLedsDirect(colour); } -void RGBController_DarkProjectKeyboard::UpdateSingleLED(int led) +void RGBController_DarkProjectKeyboard::DeviceUpdateSingleLED(int led) { std::vector colour; colour.push_back(colors[led]); diff --git a/Controllers/DarkProject/RGBController_DarkProjectKeyboard.h b/Controllers/DarkProject/RGBController_DarkProjectKeyboard.h index 2d3870429..55a7b74ef 100644 --- a/Controllers/DarkProject/RGBController_DarkProjectKeyboard.h +++ b/Controllers/DarkProject/RGBController_DarkProjectKeyboard.h @@ -23,11 +23,10 @@ public: ~RGBController_DarkProjectKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/DasKeyboardController/RGBController_DasKeyboard.cpp b/Controllers/DasKeyboardController/RGBController_DasKeyboard.cpp index 6a5626372..8cadb39df 100644 --- a/Controllers/DasKeyboardController/RGBController_DasKeyboard.cpp +++ b/Controllers/DasKeyboardController/RGBController_DasKeyboard.cpp @@ -248,16 +248,6 @@ RGBController_DasKeyboard::RGBController_DasKeyboard(DasKeyboardController* cont RGBController_DasKeyboard::~RGBController_DasKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - unsigned int zone_size = (unsigned int)zones.size(); - - for(unsigned int zone_index = 0; zone_index < zone_size; zone_index++) - { - delete zones[zone_index].matrix_map; - } - delete controller; } @@ -276,17 +266,14 @@ void RGBController_DasKeyboard::SetupZones() new_zone.leds_min = zone_sizes[zone_idx]; new_zone.leds_max = zone_sizes[zone_idx]; new_zone.leds_count = zone_sizes[zone_idx]; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 21; if(controller->GetLayoutString() == "US") { - new_zone.matrix_map->map = (unsigned int *) &matrix_map_us; + new_zone.matrix_map.Set(7, 21, (unsigned int *)&matrix_map_us); } else { - new_zone.matrix_map->map = (unsigned int *) &matrix_map_eu; + new_zone.matrix_map.Set(7, 21, (unsigned int *)&matrix_map_eu); } zones.push_back(new_zone); @@ -304,25 +291,18 @@ void RGBController_DasKeyboard::SetupZones() SetupColors(); } -void RGBController_DasKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_DasKeyboard::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_DasKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_DasKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { updateDevice = false; for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++) { - UpdateSingleLED(static_cast(led_idx)); + DeviceUpdateSingleLED(static_cast(led_idx)); } updateDevice = true; @@ -330,7 +310,7 @@ void RGBController_DasKeyboard::UpdateZoneLEDs(int /*zone*/) controller->SendApply(); } -void RGBController_DasKeyboard::UpdateSingleLED(int led) +void RGBController_DasKeyboard::DeviceUpdateSingleLED(int led) { mode selected_mode = modes[active_mode]; diff --git a/Controllers/DasKeyboardController/RGBController_DasKeyboard.h b/Controllers/DasKeyboardController/RGBController_DasKeyboard.h index c5d93b573..2426760cd 100644 --- a/Controllers/DasKeyboardController/RGBController_DasKeyboard.h +++ b/Controllers/DasKeyboardController/RGBController_DasKeyboard.h @@ -29,11 +29,10 @@ public: ~RGBController_DasKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/DebugController/RGBController_Debug.cpp b/Controllers/DebugController/RGBController_Debug.cpp index 0eb4f03f3..c3584c072 100644 --- a/Controllers/DebugController/RGBController_Debug.cpp +++ b/Controllers/DebugController/RGBController_Debug.cpp @@ -148,19 +148,14 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett continue; } - custom_zone.matrix_map = new matrix_map_type; + unsigned int H = ZoneJson["matrix_width"]; + unsigned int W = ZoneJson["matrix_height"]; - custom_zone.matrix_map->width = ZoneJson["matrix_width"]; - custom_zone.matrix_map->height = ZoneJson["matrix_height"]; - - int H = custom_zone.matrix_map->height; - int W = custom_zone.matrix_map->width; - - BadVal = (ZoneJson["matrix_map"].size() != custom_zone.matrix_map->height); + BadVal = ((unsigned int)ZoneJson["matrix_map"].size() != H); unsigned int* MatrixARR = new unsigned int[H * W]; - for(int MatrixMapRow = 0; MatrixMapRow < H; MatrixMapRow++) + for(unsigned int MatrixMapRow = 0; MatrixMapRow < H; MatrixMapRow++) { /*-------------------------------------*\ | If something went wrong then make no | @@ -169,15 +164,15 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett | bad row can corrupt the map so skip | | the zone entirely | \*-------------------------------------*/ - if((custom_zone.matrix_map->width != ZoneJson["matrix_map"][MatrixMapRow].size()) || BadVal) + if((W != (unsigned int)ZoneJson["matrix_map"][MatrixMapRow].size()) || BadVal) { BadVal = true; break; } - for(int MatrixMapCol = 0; MatrixMapCol < W; MatrixMapCol++) + for(unsigned int MatrixMapCol = 0; MatrixMapCol < W; MatrixMapCol++) { - int Val = ZoneJson["matrix_map"][MatrixMapRow][MatrixMapCol]; + unsigned int Val = ZoneJson["matrix_map"][MatrixMapRow][MatrixMapCol]; if((signed)Val == -1) { @@ -185,12 +180,12 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett } else { - MatrixARR[MatrixMapRow * W + MatrixMapCol] = (unsigned)Val; + MatrixARR[MatrixMapRow * W + MatrixMapCol] = Val; } } } - custom_zone.matrix_map->map = MatrixARR; + custom_zone.matrix_map.Set(H, W, MatrixARR); } /*---------------------------------------------*\ @@ -359,7 +354,6 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett single_zone.leds_min = 1; single_zone.leds_max = 1; single_zone.leds_count = 1; - single_zone.matrix_map = NULL; zones.push_back(single_zone); @@ -384,7 +378,6 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett linear_zone.leds_min = 10; linear_zone.leds_max = 10; linear_zone.leds_count = 10; - linear_zone.matrix_map = NULL; zones.push_back(linear_zone); @@ -491,12 +484,7 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett keyboard_zone.leds_min = new_kb.GetKeyCount(); keyboard_zone.leds_max = new_kb.GetKeyCount(); keyboard_zone.leds_count = new_kb.GetKeyCount(); - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->height = new_kb.GetRowCount(); - keyboard_zone.matrix_map->width = new_kb.GetColumnCount(); - keyboard_zone.matrix_map->map = new unsigned int[keyboard_zone.matrix_map->height * keyboard_zone.matrix_map->width]; - - new_kb.GetKeyMap(keyboard_zone.matrix_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT); + keyboard_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); zones.push_back(keyboard_zone); @@ -523,10 +511,7 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett underglow_zone.leds_min = 30; underglow_zone.leds_max = 30; underglow_zone.leds_count = 30; - underglow_zone.matrix_map = new matrix_map_type; - underglow_zone.matrix_map->height = 3; - underglow_zone.matrix_map->width = 10; - underglow_zone.matrix_map->map = (unsigned int*)&debug_keyboard_underglow_map; + underglow_zone.matrix_map.Set(3, 10, (unsigned int*)&debug_keyboard_underglow_map); zones.push_back(underglow_zone); @@ -553,7 +538,6 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett resizable_zone.leds_min = 0; resizable_zone.leds_max = 100; resizable_zone.leds_count = 0; - resizable_zone.matrix_map = NULL; zones.push_back(resizable_zone); } @@ -567,12 +551,7 @@ RGBController_Debug::~RGBController_Debug() } -void RGBController_Debug::SetupZones() -{ - -} - -void RGBController_Debug::ResizeZone(int index, int new_size) +void RGBController_Debug::DeviceResizeZone(int index, int new_size) { //Make sure that it isn't out of bounds (negative numbers) if(new_size < int(zones[index].leds_min)) @@ -617,12 +596,12 @@ void RGBController_Debug::DeviceUpdateLEDs() } -void RGBController_Debug::UpdateZoneLEDs(int /*zone*/) +void RGBController_Debug::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_Debug::UpdateSingleLED(int /*led*/) +void RGBController_Debug::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/DebugController/RGBController_Debug.h b/Controllers/DebugController/RGBController_Debug.h index 2babefa7c..48ffa262f 100644 --- a/Controllers/DebugController/RGBController_Debug.h +++ b/Controllers/DebugController/RGBController_Debug.h @@ -23,13 +23,11 @@ public: RGBController_Debug(bool custom_controller, json debug_settings); ~RGBController_Debug(); - void SetupZones(); - - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); }; diff --git a/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp b/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp index 385e5a1d5..63dd861e5 100644 --- a/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp +++ b/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp @@ -45,7 +45,6 @@ void RGBController_DreamCheeky::SetupZones() mail_zone.leds_min = 1; mail_zone.leds_max = 1; mail_zone.leds_count = 1; - mail_zone.matrix_map = NULL; zones.push_back(mail_zone); led mail_led; @@ -55,13 +54,6 @@ void RGBController_DreamCheeky::SetupZones() SetupColors(); } -void RGBController_DreamCheeky::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*-----------------------------------------------------*\ - | This device does not support resizing zones | - \*-----------------------------------------------------*/ -} - void RGBController_DreamCheeky::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -71,12 +63,12 @@ void RGBController_DreamCheeky::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_DreamCheeky::UpdateZoneLEDs(int /*zone*/) +void RGBController_DreamCheeky::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_DreamCheeky::UpdateSingleLED(int /*led*/) +void RGBController_DreamCheeky::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/DreamCheekyController/RGBController_DreamCheeky.h b/Controllers/DreamCheekyController/RGBController_DreamCheeky.h index a0531ac88..68238c014 100644 --- a/Controllers/DreamCheekyController/RGBController_DreamCheeky.h +++ b/Controllers/DreamCheekyController/RGBController_DreamCheeky.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp b/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp index 9d66a4856..345530191 100644 --- a/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp +++ b/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp @@ -222,17 +222,6 @@ RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController RGBController_DuckyKeyboard::~RGBController_DuckyKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -269,10 +258,7 @@ void RGBController_DuckyKeyboard::SetupZones() new_zone.leds_min = zone_size; new_zone.leds_max = zone_size; new_zone.leds_count = zone_size; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = matrix_width; - new_zone.matrix_map->map = matrix_map_ptr; + new_zone.matrix_map.Set(6, matrix_width, matrix_map_ptr); zones.push_back(new_zone); total_led_count += zone_size; @@ -288,13 +274,6 @@ void RGBController_DuckyKeyboard::SetupZones() SetupColors(); } -void RGBController_DuckyKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_DuckyKeyboard::DeviceUpdateLEDs() { unsigned char colordata[155*3]; @@ -309,12 +288,12 @@ void RGBController_DuckyKeyboard::DeviceUpdateLEDs() controller->SendColors(colordata, sizeof(colordata)); } -void RGBController_DuckyKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_DuckyKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_DuckyKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_DuckyKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.h b/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.h index feec6240d..6575cf4e5 100644 --- a/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.h +++ b/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/DygmaRaiseController/RGBController_DygmaRaise.cpp b/Controllers/DygmaRaiseController/RGBController_DygmaRaise.cpp index dd1cb203e..6d951ac87 100644 --- a/Controllers/DygmaRaiseController/RGBController_DygmaRaise.cpp +++ b/Controllers/DygmaRaiseController/RGBController_DygmaRaise.cpp @@ -183,17 +183,11 @@ void RGBController_DygmaRaise::SetupZones() if(i==0) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 14; - new_zone.matrix_map->map = (unsigned int *)&kb_matrix_map_ISO; + new_zone.matrix_map.Set(6, 14, (unsigned int *)&kb_matrix_map_ISO); } else if(i==1) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 11; - new_zone.matrix_map->width = 14; - new_zone.matrix_map->map = (unsigned int *)&underglow_matrix; + new_zone.matrix_map.Set(11, 14, (unsigned int *)&underglow_matrix); } zones.push_back(new_zone); @@ -229,24 +223,17 @@ void RGBController_DygmaRaise::SetupZones() SetupColors(); } -void RGBController_DygmaRaise::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_DygmaRaise::DeviceUpdateLEDs() { controller->SendDirect(colors,leds.size()); } -void RGBController_DygmaRaise::UpdateZoneLEDs(int /*zone*/) +void RGBController_DygmaRaise::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_DygmaRaise::UpdateSingleLED(int /*led*/) +void RGBController_DygmaRaise::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/DygmaRaiseController/RGBController_DygmaRaise.h b/Controllers/DygmaRaiseController/RGBController_DygmaRaise.h index bb0d6d2e5..7fcba6165 100644 --- a/Controllers/DygmaRaiseController/RGBController_DygmaRaise.h +++ b/Controllers/DygmaRaiseController/RGBController_DygmaRaise.h @@ -21,11 +21,10 @@ public: ~RGBController_DygmaRaise(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/E131Controller/RGBController_E131.cpp b/Controllers/E131Controller/RGBController_E131.cpp index 665074fb7..0f8471f5d 100644 --- a/Controllers/E131Controller/RGBController_E131.cpp +++ b/Controllers/E131Controller/RGBController_E131.cpp @@ -203,90 +203,90 @@ RGBController_E131::RGBController_E131(std::vector device_list) if(devices[device_idx].type == ZONE_TYPE_MATRIX) { unsigned int led_idx = 0; - matrix_map_type * new_map = new matrix_map_type; + matrix_map_type new_map; - new_map->width = devices[device_idx].matrix_width; - new_map->height = devices[device_idx].matrix_height; - new_map->map = new unsigned int[devices[device_idx].matrix_width * devices[device_idx].matrix_height]; + new_map.width = devices[device_idx].matrix_width; + new_map.height = devices[device_idx].matrix_height; + new_map.map.resize(devices[device_idx].matrix_width * devices[device_idx].matrix_height); switch(devices[device_idx].matrix_order) { case E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT: - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_map.height; y++) { - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_map.width; x++) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } break; case E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT: - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_map.height; y++) { - for(int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map.width - 1; x >= 0; x--) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } break; case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT: - for(int y = new_map->height; y >= 0; y--) + for(int y = new_map.height; y >= 0; y--) { - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_map.width; x++) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } break; case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT: - for(int y = new_map->height; y >= 0; y--) + for(int y = new_map.height; y >= 0; y--) { - for(int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map.width - 1; x >= 0; x--) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } break; case E131_MATRIX_ORDER_VERTICAL_TOP_LEFT: - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_map.width; x++) { - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_map.height; y++) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } break; case E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT: - for(int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map.width - 1; x >= 0; x--) { - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_map.height; y++) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } break; case E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT: - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_map.width; x++) { - for(int y = new_map->height - 1; y >= 0; y--) + for(int y = new_map.height - 1; y >= 0; y--) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } break; case E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT: - for(int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map.width - 1; x >= 0; x--) { - for(int y = new_map->height - 1; y >= 0; y--) + for(int y = new_map.height - 1; y >= 0; y--) { - new_map->map[(y * new_map->width) + x] = led_idx; + new_map.map[(y * new_map.width) + x] = led_idx; led_idx++; } } @@ -316,22 +316,6 @@ RGBController_E131::~RGBController_E131() keepalive_thread->join(); delete keepalive_thread; } - - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - if(zones[zone_index].matrix_map->map != NULL) - { - delete zones[zone_index].matrix_map->map; - } - - delete zones[zone_index].matrix_map; - } - } } void RGBController_E131::SetupZones() @@ -347,8 +331,6 @@ void RGBController_E131::SetupZones() led_zone.leds_min = devices[zone_idx].num_leds; led_zone.leds_max = devices[zone_idx].num_leds; led_zone.leds_count = devices[zone_idx].num_leds; - led_zone.matrix_map = NULL; - zones.push_back(led_zone); } @@ -371,13 +353,6 @@ void RGBController_E131::SetupZones() SetupColors(); } -void RGBController_E131::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_E131::DeviceUpdateLEDs() { int color_idx = 0; @@ -442,12 +417,12 @@ void RGBController_E131::DeviceUpdateLEDs() } } -void RGBController_E131::UpdateZoneLEDs(int /*zone*/) +void RGBController_E131::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_E131::UpdateSingleLED(int /*led*/) +void RGBController_E131::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -463,7 +438,7 @@ void RGBController_E131::KeepaliveThreadFunction() { if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) ) { - UpdateLEDs(); + UpdateLEDsInternal(); } std::this_thread::sleep_for(keepalive_delay / 2); } diff --git a/Controllers/E131Controller/RGBController_E131.h b/Controllers/E131Controller/RGBController_E131.h index 83a400fbb..f84683bac 100644 --- a/Controllers/E131Controller/RGBController_E131.h +++ b/Controllers/E131Controller/RGBController_E131.h @@ -66,11 +66,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/EKController/RGBController_EKController.cpp b/Controllers/EKController/RGBController_EKController.cpp index ba1b82d2c..a5c7e0fa8 100644 --- a/Controllers/EKController/RGBController_EKController.cpp +++ b/Controllers/EKController/RGBController_EKController.cpp @@ -136,7 +136,6 @@ void RGBController_EKController::SetupZones() EK_zone.leds_min = 1; EK_zone.leds_max = 1; EK_zone.leds_count = 1; - EK_zone.matrix_map = NULL; zones.push_back(EK_zone); led EK_led; @@ -146,7 +145,7 @@ void RGBController_EKController::SetupZones() SetupColors(); } -void RGBController_EKController::ResizeZone(int /*zone*/, int /*new_size*/) +void RGBController_EKController::DeviceResizeZone(int /*zone*/, int /*new_size*/) { /*---------------------------------------------------------*\ | ToDo | @@ -162,7 +161,7 @@ void RGBController_EKController::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_EKController::UpdateZoneLEDs(int zone) +void RGBController_EKController::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -172,9 +171,9 @@ void RGBController_EKController::UpdateZoneLEDs(int zone) controller->SetColor(red, grn, blu); } -void RGBController_EKController::UpdateSingleLED(int led) +void RGBController_EKController::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_EKController::DeviceUpdateMode() diff --git a/Controllers/EKController/RGBController_EKController.h b/Controllers/EKController/RGBController_EKController.h index 459ffbcec..3297d6731 100644 --- a/Controllers/EKController/RGBController_EKController.h +++ b/Controllers/EKController/RGBController_EKController.h @@ -21,11 +21,11 @@ public: ~RGBController_EKController(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ENESMBusController/RGBController_ENESMBus.cpp b/Controllers/ENESMBusController/RGBController_ENESMBus.cpp index 0656e264f..e34663899 100644 --- a/Controllers/ENESMBusController/RGBController_ENESMBus.cpp +++ b/Controllers/ENESMBusController/RGBController_ENESMBus.cpp @@ -289,7 +289,7 @@ int RGBController_ENESMBus::GetDeviceMode() void RGBController_ENESMBus::DeviceUpdateLEDs() { - if(GetMode() == 0) + if(GetActiveMode() == 0) { controller->SetAllColorsDirect(&colors[0]); } @@ -300,7 +300,7 @@ void RGBController_ENESMBus::DeviceUpdateLEDs() } -void RGBController_ENESMBus::UpdateZoneLEDs(int zone) +void RGBController_ENESMBus::DeviceUpdateZoneLEDs(int zone) { for(std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++) { @@ -310,7 +310,7 @@ void RGBController_ENESMBus::UpdateZoneLEDs(int zone) unsigned char grn = RGBGetGValue(color); unsigned char blu = RGBGetBValue(color); - if(GetMode() == 0) + if(GetActiveMode() == 0) { controller->SetLEDColorDirect(led, red, grn, blu); } @@ -321,14 +321,14 @@ void RGBController_ENESMBus::UpdateZoneLEDs(int zone) } } -void RGBController_ENESMBus::UpdateSingleLED(int led) +void RGBController_ENESMBus::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); unsigned char grn = RGBGetGValue(color); unsigned char blu = RGBGetBValue(color); - if(GetMode() == 0) + if(GetActiveMode() == 0) { controller->SetLEDColorDirect(led, red, grn, blu); } @@ -418,8 +418,6 @@ void RGBController_ENESMBus::SetupZones() { zones[zone_idx].type = ZONE_TYPE_SINGLE; } - - zones[zone_idx].matrix_map = NULL; } /*---------------------------------------------------------*\ @@ -445,13 +443,6 @@ void RGBController_ENESMBus::SetupZones() SetupColors(); } -void RGBController_ENESMBus::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ENESMBus::DeviceUpdateMode() { if (modes[active_mode].value == 0xFFFF) diff --git a/Controllers/ENESMBusController/RGBController_ENESMBus.h b/Controllers/ENESMBusController/RGBController_ENESMBus.h index 7bba9468a..7894f2bfe 100644 --- a/Controllers/ENESMBusController/RGBController_ENESMBus.h +++ b/Controllers/ENESMBusController/RGBController_ENESMBus.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.cpp b/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.cpp index 394d9e6ac..22c88a58a 100644 --- a/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.cpp +++ b/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.cpp @@ -242,7 +242,6 @@ void RGBController_EVGAGPUv3::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = evga_v3_zone_names[zone_idx]; /*---------------------------------------------------------*\ @@ -256,7 +255,7 @@ void RGBController_EVGAGPUv3::SetupZones() SetupColors(); } -void RGBController_EVGAGPUv3::ResizeZone(int /*zone*/, int newSize) +void RGBController_EVGAGPUv3::DeviceResizeZone(int /*zone*/, int newSize) { controller->ResizeARGB(newSize); } @@ -290,13 +289,13 @@ void RGBController_EVGAGPUv3::DeviceUpdateLEDs() } } -void RGBController_EVGAGPUv3::UpdateZoneLEDs(int /*zone*/) +void RGBController_EVGAGPUv3::DeviceUpdateZoneLEDs(int /*zone*/) { //LOG_TRACE("[%s] Updating zone %1d", controller->evgaGPUName, zone); DeviceUpdateLEDs(); } -void RGBController_EVGAGPUv3::UpdateSingleLED(int /*led*/) +void RGBController_EVGAGPUv3::DeviceUpdateSingleLED(int /*led*/) { //LOG_TRACE("[%s] Updating single LED %1d", controller->evgaGPUName, led); DeviceUpdateLEDs(); diff --git a/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.h b/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.h index 28772475d..df446b701 100644 --- a/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.h +++ b/Controllers/EVGAAmpereGPUController/RGBController_EVGAGPUv3.h @@ -22,11 +22,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.cpp b/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.cpp index ec82d77c9..c3496eafb 100644 --- a/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.cpp +++ b/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.cpp @@ -101,7 +101,6 @@ void RGBController_EVGAGP102::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; new_led.name = controllers[i]->GetZoneName(); @@ -112,22 +111,15 @@ void RGBController_EVGAGP102::SetupZones() SetupColors(); } -void RGBController_EVGAGP102::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_EVGAGP102::DeviceUpdateLEDs() { for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_EVGAGP102::UpdateZoneLEDs(int zone) +void RGBController_EVGAGP102::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -136,7 +128,7 @@ void RGBController_EVGAGP102::UpdateZoneLEDs(int zone) controllers[zone]->SetColor(red, grn, blu); } -void RGBController_EVGAGP102::UpdateSingleLED(int /*led*/) +void RGBController_EVGAGP102::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.h b/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.h index 0244a5b9a..64f00318e 100644 --- a/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.h +++ b/Controllers/EVGAGP102GPUController/RGBController_EVGAGP102.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.cpp b/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.cpp index 6dda2d465..c4d0c3e28 100644 --- a/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.cpp +++ b/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.cpp @@ -103,7 +103,6 @@ void RGBController_EVGAGPUv1::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -116,13 +115,6 @@ void RGBController_EVGAGPUv1::SetupZones() SetupColors(); } -void RGBController_EVGAGPUv1::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_EVGAGPUv1::DeviceUpdateLEDs() { RGBColor color = colors[0]; @@ -133,12 +125,12 @@ void RGBController_EVGAGPUv1::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_EVGAGPUv1::UpdateZoneLEDs(int /*zone*/) +void RGBController_EVGAGPUv1::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_EVGAGPUv1::UpdateSingleLED(int /*led*/) +void RGBController_EVGAGPUv1::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.h b/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.h index 1c4010d27..d194d3d81 100644 --- a/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.h +++ b/Controllers/EVGAPascalGPUController/RGBController_EVGAGPUv1.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.cpp b/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.cpp index 37fcc1c10..a84f95969 100644 --- a/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.cpp +++ b/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.cpp @@ -96,7 +96,6 @@ void RGBController_EVGAACX30SMBus::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; /*---------------------------------------------------------*\ | Push new zone to zones vector | @@ -121,27 +120,20 @@ void RGBController_EVGAACX30SMBus::SetupZones() SetupColors(); } -void RGBController_EVGAACX30SMBus::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_EVGAACX30SMBus::DeviceUpdateLEDs() { for(unsigned int led = 0; led < colors.size(); led++) { - UpdateSingleLED(led); + DeviceUpdateSingleLED(led); } } -void RGBController_EVGAACX30SMBus::UpdateZoneLEDs(int /*zone*/) +void RGBController_EVGAACX30SMBus::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_EVGAACX30SMBus::UpdateSingleLED(int led) +void RGBController_EVGAACX30SMBus::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.h b/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.h index 394e1070e..0900b53a9 100644 --- a/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.h +++ b/Controllers/EVGASMBusController/RGBController_EVGAACX30SMBus.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.cpp b/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.cpp index 92abe48f7..7ff01aa85 100644 --- a/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.cpp +++ b/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.cpp @@ -159,7 +159,6 @@ void RGBController_EVGAGPUv2::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -172,13 +171,6 @@ void RGBController_EVGAGPUv2::SetupZones() SetupColors(); } -void RGBController_EVGAGPUv2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_EVGAGPUv2::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -189,12 +181,12 @@ void RGBController_EVGAGPUv2::DeviceUpdateLEDs() controller->SetColor(colors[0], /* colorB*/ 0, modes[active_mode].brightness); } -void RGBController_EVGAGPUv2::UpdateZoneLEDs(int /*zone*/) +void RGBController_EVGAGPUv2::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_EVGAGPUv2::UpdateSingleLED(int /*led*/) +void RGBController_EVGAGPUv2::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.h b/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.h index 9b1150239..928f4b7dc 100644 --- a/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.h +++ b/Controllers/EVGATuringGPUController/RGBController_EVGAGPUv2.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.cpp b/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.cpp index 9e94a7a4a..9e04290ed 100644 --- a/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.cpp +++ b/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.cpp @@ -406,10 +406,7 @@ void RGBController_EVGAKeyboard::SetupZones() KB_zone.leds_max = EVGA_KEYBOARD_FULL_SIZE_KEYCOUNT; KB_zone.leds_count = EVGA_KEYBOARD_FULL_SIZE_KEYCOUNT; - KB_zone.matrix_map = new matrix_map_type; - KB_zone.matrix_map->height = 6; - KB_zone.matrix_map->width = 21; - KB_zone.matrix_map->map = (unsigned int *)&full_matrix_map; + KB_zone.matrix_map.Set(6, 21, (unsigned int *)&full_matrix_map); zones.push_back(KB_zone); /*-------------------------------------------------*\ @@ -417,7 +414,6 @@ void RGBController_EVGAKeyboard::SetupZones() \*-------------------------------------------------*/ if(controller->GetPid() == 0x260A || controller->GetPid() == 0x2610) { - for(uint8_t i = 0; i < EVGA_KEYBOARD_Z20_EXTRA_ZONES; i++) { uint8_t zone_size = sizeof(Z20_extra_zones[i]) / sizeof(Z20_extra_zones[i][0]); @@ -438,10 +434,7 @@ void RGBController_EVGAKeyboard::SetupZones() new_zone.leds_max = zone_size; new_zone.leds_count = zone_size; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 1; - new_zone.matrix_map->width = zone_size; - new_zone.matrix_map->map = (unsigned int *)&Z20_extra_zones[i]; + new_zone.matrix_map.Set(1, zone_size, (unsigned int *)&Z20_extra_zones[i]); zones.push_back(new_zone); } } @@ -471,19 +464,12 @@ void RGBController_EVGAKeyboard::SetupZones() SetupColors(); } -void RGBController_EVGAKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_EVGAKeyboard::DeviceUpdateLEDs() { controller->SetLedsDirect(colors); } -void RGBController_EVGAKeyboard::UpdateZoneLEDs(int zone) +void RGBController_EVGAKeyboard::DeviceUpdateZoneLEDs(int zone) { std::vector colour; for(size_t i = 0; i < zones[zone].leds_count; i++) @@ -494,7 +480,7 @@ void RGBController_EVGAKeyboard::UpdateZoneLEDs(int zone) controller->SetLedsDirect(colour); } -void RGBController_EVGAKeyboard::UpdateSingleLED(int led) +void RGBController_EVGAKeyboard::DeviceUpdateSingleLED(int led) { std::vector colour; colour.push_back(colors[led]); diff --git a/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.h b/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.h index 06732fd51..1fad98ad1 100644 --- a/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.h +++ b/Controllers/EVGAUSBController/EVGAKeyboardController/RGBController_EVGAKeyboard.h @@ -21,11 +21,10 @@ public: ~RGBController_EVGAKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.cpp b/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.cpp index 1e6bb2512..948ac5f88 100644 --- a/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.cpp +++ b/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.cpp @@ -152,7 +152,6 @@ void RGBController_EVGAMouse::Init_Controller() front_zone.leds_min = 1; front_zone.leds_max = 1; front_zone.leds_count = 1; - front_zone.matrix_map = NULL; zones.push_back(front_zone); zone wheel_zone; @@ -161,7 +160,6 @@ void RGBController_EVGAMouse::Init_Controller() wheel_zone.leds_min = 1; wheel_zone.leds_max = 1; wheel_zone.leds_count = 1; - wheel_zone.matrix_map = NULL; zones.push_back(wheel_zone); zone logo_zone; @@ -170,7 +168,6 @@ void RGBController_EVGAMouse::Init_Controller() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led front_led; @@ -194,13 +191,6 @@ void RGBController_EVGAMouse::SetupZones() SetupColors(); } -void RGBController_EVGAMouse::ResizeZone(int /* zone */, int /* new_size */) -{ - /*--------------------------------------*\ - | This device does not support resizing. | - \*--------------------------------------*/ -} - void RGBController_EVGAMouse::DeviceUpdateLEDs() { for(unsigned int i = 0; i < colors.size(); i++) @@ -209,12 +199,12 @@ void RGBController_EVGAMouse::DeviceUpdateLEDs() } } -void RGBController_EVGAMouse::UpdateZoneLEDs(int zone) +void RGBController_EVGAMouse::DeviceUpdateZoneLEDs(int zone) { controller->SetLed(zone, modes[active_mode].brightness, modes[active_mode].speed, colors[zone]); } -void RGBController_EVGAMouse::UpdateSingleLED(int led) +void RGBController_EVGAMouse::DeviceUpdateSingleLED(int led) { controller->SetLed(led, modes[active_mode].brightness, modes[active_mode].speed, colors[led]); } diff --git a/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.h b/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.h index b29c2598d..712ba1e16 100644 --- a/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.h +++ b/Controllers/EVGAUSBController/EVGAMouseController/RGBController_EVGAMouse.h @@ -27,11 +27,10 @@ public: ~RGBController_EVGAMouse(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.cpp b/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.cpp index bba253290..c6684a42d 100644 --- a/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.cpp +++ b/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.cpp @@ -302,17 +302,6 @@ RGBController_EVisionKeyboard::RGBController_EVisionKeyboard(EVisionKeyboardCont RGBController_EVisionKeyboard::~RGBController_EVisionKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -325,10 +314,7 @@ void RGBController_EVisionKeyboard::SetupZones() new_zone.leds_min = 126; new_zone.leds_max = 126; new_zone.leds_count = 126; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; + new_zone.matrix_map.Set(6, 23, (unsigned int *)&matrix_map); zones.push_back(new_zone); @@ -345,13 +331,6 @@ void RGBController_EVisionKeyboard::SetupZones() SetupColors(); } -void RGBController_EVisionKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_EVisionKeyboard::DeviceUpdateLEDs() { unsigned char color_data[7*0x36]; @@ -370,12 +349,12 @@ void RGBController_EVisionKeyboard::DeviceUpdateLEDs() ); } -void RGBController_EVisionKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_EVisionKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_EVisionKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_EVisionKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.h b/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.h index dfa900eeb..80c7c66bc 100644 --- a/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.h +++ b/Controllers/EVisionKeyboardController/RGBController_EVisionKeyboard.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.cpp b/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.cpp index 86e5a6c84..e3dd0f866 100644 --- a/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.cpp +++ b/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.cpp @@ -786,11 +786,7 @@ void RGBController_EVisionV2Keyboard::SetupZones() KB_zone.leds_count = leds_count; KB_zone.leds_min = KB_zone.leds_count; KB_zone.leds_max = KB_zone.leds_count; - - KB_zone.matrix_map = new matrix_map_type; - KB_zone.matrix_map->height = EVISION_V2_MATRIX_HEIGHT; - KB_zone.matrix_map->width = EVISION_V2_MATRIX_WIDTH; - KB_zone.matrix_map->map = matrix_map; + KB_zone.matrix_map.Set(EVISION_V2_MATRIX_HEIGHT, EVISION_V2_MATRIX_WIDTH, matrix_map); zones.push_back(KB_zone); /*-------------------------------------------------*\ @@ -904,13 +900,6 @@ void RGBController_EVisionV2Keyboard::LoadConfig() } } -void RGBController_EVisionV2Keyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_EVisionV2Keyboard::DeviceUpdateLEDs() { if(part != EVISION_V2_KEYBOARD_PART_KEYBOARD) @@ -923,12 +912,12 @@ void RGBController_EVisionV2Keyboard::DeviceUpdateLEDs() last_update_time = std::chrono::steady_clock::now(); } -void RGBController_EVisionV2Keyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_EVisionV2Keyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_EVisionV2Keyboard::UpdateSingleLED(int led) +void RGBController_EVisionV2Keyboard::DeviceUpdateSingleLED(int led) { if(part != EVISION_V2_KEYBOARD_PART_KEYBOARD) { @@ -999,7 +988,6 @@ void RGBController_EVisionV2Keyboard::DeviceUpdateMode() if((part == EVISION_V2_KEYBOARD_PART_KEYBOARD) && (config.mode == EVISION_V2_MODE_CUSTOM)) { controller->GetLedsCustom(config.ledmode, colors); - SignalUpdate(); } } diff --git a/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.h b/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.h index 0018108e6..788503027 100644 --- a/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.h +++ b/Controllers/EVisionKeyboardController/RGBController_EVisionV2Keyboard.h @@ -22,15 +22,14 @@ public: RGBController_EVisionV2Keyboard(EVisionV2KeyboardController* controller_ptr, EVisionV2KeyboardPart kb_part); ~RGBController_EVisionV2Keyboard(); - void SetupZones() override; - void ResizeZone(int zone, int new_size) override; + void SetupZones(); - void DeviceUpdateLEDs() override; - void UpdateZoneLEDs(int zone) override; - void UpdateSingleLED(int led) override; + void DeviceUpdateLEDs(); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); - void DeviceUpdateMode() override; - void DeviceSaveMode() override; + void DeviceUpdateMode(); + void DeviceSaveMode(); private: void SetupKeyboardModes(); diff --git a/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.cpp b/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.cpp index 39bb89f89..ecc0bc7ce 100644 --- a/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.cpp +++ b/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.cpp @@ -47,7 +47,6 @@ void RGBController_ElgatoKeyLight::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -58,13 +57,6 @@ void RGBController_ElgatoKeyLight::SetupZones() SetupColors(); } -void RGBController_ElgatoKeyLight::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ElgatoKeyLight::DeviceUpdateLEDs() { RGBColor rgb_color = colors[0]; @@ -73,12 +65,12 @@ void RGBController_ElgatoKeyLight::DeviceUpdateLEDs() controller->SetColor(hsv_color); } -void RGBController_ElgatoKeyLight::UpdateZoneLEDs(int /*zone*/) +void RGBController_ElgatoKeyLight::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ElgatoKeyLight::UpdateSingleLED(int /*led*/) +void RGBController_ElgatoKeyLight::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.h b/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.h index 54d154335..0dbae4b4c 100644 --- a/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.h +++ b/Controllers/ElgatoKeyLightController/RGBController_ElgatoKeyLight.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.cpp b/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.cpp index 63a6d9a80..04e4e70e7 100644 --- a/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.cpp +++ b/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.cpp @@ -51,7 +51,6 @@ void RGBController_ElgatoLightStrip::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -61,13 +60,6 @@ void RGBController_ElgatoLightStrip::SetupZones() SetupColors(); } -void RGBController_ElgatoLightStrip::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ElgatoLightStrip::DeviceUpdateLEDs() { RGBColor rgb_color = colors[0]; @@ -77,12 +69,12 @@ void RGBController_ElgatoLightStrip::DeviceUpdateLEDs() controller->SetBrightness((unsigned char)modes[(unsigned int)active_mode].brightness); } -void RGBController_ElgatoLightStrip::UpdateZoneLEDs(int /*zone*/) +void RGBController_ElgatoLightStrip::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ElgatoLightStrip::UpdateSingleLED(int /*led*/) +void RGBController_ElgatoLightStrip::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.h b/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.h index 50542de53..ad7ff11f4 100644 --- a/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.h +++ b/Controllers/ElgatoLightStripController/RGBController_ElgatoLightStrip.h @@ -23,11 +23,9 @@ class RGBController_ElgatoLightStrip : public RGBController void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/EpomakerController/RGBController_EpomakerController.cpp b/Controllers/EpomakerController/RGBController_EpomakerController.cpp index 3568f664f..d8bbf3c47 100644 --- a/Controllers/EpomakerController/RGBController_EpomakerController.cpp +++ b/Controllers/EpomakerController/RGBController_EpomakerController.cpp @@ -382,7 +382,6 @@ void RGBController_EpomakerController::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; zones.push_back(new_zone); @@ -394,20 +393,12 @@ void RGBController_EpomakerController::SetupZones() SetupColors(); } - -void RGBController_EpomakerController::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | Not implemented | - \*---------------------------------------------------------*/ -} - -void RGBController_EpomakerController::UpdateZoneLEDs(int /*zone*/) +void RGBController_EpomakerController::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_EpomakerController::UpdateSingleLED(int /*led*/) +void RGBController_EpomakerController::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/EpomakerController/RGBController_EpomakerController.h b/Controllers/EpomakerController/RGBController_EpomakerController.h index cf3efd00b..56361a00e 100644 --- a/Controllers/EpomakerController/RGBController_EpomakerController.h +++ b/Controllers/EpomakerController/RGBController_EpomakerController.h @@ -20,13 +20,11 @@ public: RGBController_EpomakerController(EpomakerController* controller_ptr); ~RGBController_EpomakerController(); - void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/EspurnaController/RGBController_Espurna.cpp b/Controllers/EspurnaController/RGBController_Espurna.cpp index cd9bb60de..b1f835435 100644 --- a/Controllers/EspurnaController/RGBController_Espurna.cpp +++ b/Controllers/EspurnaController/RGBController_Espurna.cpp @@ -54,7 +54,6 @@ void RGBController_Espurna::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -65,24 +64,17 @@ void RGBController_Espurna::SetupZones() SetupColors(); } -void RGBController_Espurna::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Espurna::DeviceUpdateLEDs() { controller->SetLEDs(colors); } -void RGBController_Espurna::UpdateZoneLEDs(int /*zone*/) +void RGBController_Espurna::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_Espurna::UpdateSingleLED(int /*led*/) +void RGBController_Espurna::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/EspurnaController/RGBController_Espurna.h b/Controllers/EspurnaController/RGBController_Espurna.h index e3e00d324..6b70df40b 100644 --- a/Controllers/EspurnaController/RGBController_Espurna.h +++ b/Controllers/EspurnaController/RGBController_Espurna.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/FanBusController/RGBController_FanBus.cpp b/Controllers/FanBusController/RGBController_FanBus.cpp index 299ac6996..78a6d3bc8 100644 --- a/Controllers/FanBusController/RGBController_FanBus.cpp +++ b/Controllers/FanBusController/RGBController_FanBus.cpp @@ -54,7 +54,6 @@ void RGBController_FanBus::SetupZones() led_zone.leds_min = 4; led_zone.leds_max = 4; led_zone.leds_count = 4; - led_zone.matrix_map = NULL; zones.push_back(led_zone); for(unsigned int led_idx = 0; led_idx < led_zone.leds_count; led_idx++) @@ -69,24 +68,17 @@ void RGBController_FanBus::SetupZones() SetupColors(); } -void RGBController_FanBus::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_FanBus::DeviceUpdateLEDs() { controller->SetLEDs(colors); } -void RGBController_FanBus::UpdateZoneLEDs(int /*zone*/) +void RGBController_FanBus::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_FanBus::UpdateSingleLED(int /*led*/) +void RGBController_FanBus::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/FanBusController/RGBController_FanBus.h b/Controllers/FanBusController/RGBController_FanBus.h index 052ec3ef6..ad9f298fa 100644 --- a/Controllers/FanBusController/RGBController_FanBus.h +++ b/Controllers/FanBusController/RGBController_FanBus.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/FaustusController/RGBController_Faustus_Linux.cpp b/Controllers/FaustusController/RGBController_Faustus_Linux.cpp index 97ca197a9..3b2f74b05 100644 --- a/Controllers/FaustusController/RGBController_Faustus_Linux.cpp +++ b/Controllers/FaustusController/RGBController_Faustus_Linux.cpp @@ -86,7 +86,6 @@ void RGBController_Faustus::SetupZones() zones[0].leds_min = 1; zones[0].leds_max = 1; zones[0].leds_count = 1; - zones[0].matrix_map = NULL; /*---------------------------------------------------------*\ | Set up LED | @@ -97,13 +96,6 @@ void RGBController_Faustus::SetupZones() SetupColors(); } -void RGBController_Faustus::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Faustus::DeviceUpdateLEDs() { int rv = uint8_t(RGBGetRValue(colors[0])); @@ -147,12 +139,12 @@ void RGBController_Faustus::DeviceUpdateLEDs() str_set.close(); } -void RGBController_Faustus::UpdateZoneLEDs(int /*zone*/) +void RGBController_Faustus::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Faustus::UpdateSingleLED(int /*led*/) +void RGBController_Faustus::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/FaustusController/RGBController_Faustus_Linux.h b/Controllers/FaustusController/RGBController_Faustus_Linux.h index 582e562bd..4985ada0c 100644 --- a/Controllers/FaustusController/RGBController_Faustus_Linux.h +++ b/Controllers/FaustusController/RGBController_Faustus_Linux.h @@ -41,11 +41,9 @@ class RGBController_Faustus : public RGBController void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); }; diff --git a/Controllers/FnaticStreakController/RGBController_FnaticStreak.cpp b/Controllers/FnaticStreakController/RGBController_FnaticStreak.cpp index 0c4415743..ecb09aef9 100644 --- a/Controllers/FnaticStreakController/RGBController_FnaticStreak.cpp +++ b/Controllers/FnaticStreakController/RGBController_FnaticStreak.cpp @@ -493,17 +493,6 @@ RGBController_FnaticStreak::~RGBController_FnaticStreak() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -524,10 +513,7 @@ void RGBController_FnaticStreak::SetupZones() new_zone.leds_min = total_led_count; new_zone.leds_max = total_led_count; new_zone.leds_count = total_led_count; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = matrix_cols; - new_zone.matrix_map->map = matrix_map_ptr; + new_zone.matrix_map.Set(6, matrix_cols, matrix_map_ptr); zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -544,13 +530,6 @@ void RGBController_FnaticStreak::SetupZones() SetupColors(); } -void RGBController_FnaticStreak::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_FnaticStreak::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -564,12 +543,12 @@ void RGBController_FnaticStreak::DeviceUpdateLEDs() controller->SendRGBToDevice(); } -void RGBController_FnaticStreak::UpdateZoneLEDs(int /*zone*/) +void RGBController_FnaticStreak::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_FnaticStreak::UpdateSingleLED(int /*led*/) +void RGBController_FnaticStreak::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/FnaticStreakController/RGBController_FnaticStreak.h b/Controllers/FnaticStreakController/RGBController_FnaticStreak.h index 58edd1eff..b652f4afa 100644 --- a/Controllers/FnaticStreakController/RGBController_FnaticStreak.h +++ b/Controllers/FnaticStreakController/RGBController_FnaticStreak.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.cpp b/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.cpp index 6db4abb35..1314d734f 100644 --- a/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.cpp +++ b/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.cpp @@ -451,17 +451,6 @@ RGBController_GaiZhongGaiKeyboard::RGBController_GaiZhongGaiKeyboard(GaiZhongGai RGBController_GaiZhongGaiKeyboard::~RGBController_GaiZhongGaiKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -491,10 +480,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() new_zone.leds_min = 68; new_zone.leds_max = 68; new_zone.leds_count = 68; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->width = 17; - new_zone.matrix_map->height = 5; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_68; + new_zone.matrix_map.Set(17, 5, (unsigned int *)&matrix_map_68); new_zone.name = zone_names[zone_idx]; } break; @@ -505,10 +491,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() new_zone.leds_min = 42; new_zone.leds_max = 42; new_zone.leds_count = 42; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->width = 12; - new_zone.matrix_map->height = 4; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_42; + new_zone.matrix_map.Set(12, 4, (unsigned int *)&matrix_map_42); new_zone.name = zone_names[zone_idx]; } break; @@ -519,10 +502,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() new_zone.leds_min = 88; new_zone.leds_max = 88; new_zone.leds_count = 88; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->width = 5; - new_zone.matrix_map->height = 5; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_PAD_Touch; + new_zone.matrix_map.Set(5, 5, (unsigned int *)&matrix_map_PAD_Touch); new_zone.name = zone_names[zone_idx]; } break; @@ -533,10 +513,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() new_zone.leds_min = 85; new_zone.leds_max = 85; new_zone.leds_count = 85; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->width = 4; - new_zone.matrix_map->height = 5; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_17PAD; + new_zone.matrix_map.Set(4, 5, (unsigned int *)&matrix_map_17PAD); new_zone.name = zone_names[zone_idx]; } break; @@ -547,10 +524,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() new_zone.leds_min = 88; new_zone.leds_max = 88; new_zone.leds_count = 88; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->width = 4; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_20PAD; + new_zone.matrix_map.Set(4, 6, (unsigned int *)&matrix_map_20PAD); new_zone.name = zone_names[zone_idx]; } break; @@ -561,10 +535,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() new_zone.leds_min = 89; new_zone.leds_max = 89; new_zone.leds_count = 89; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->width = 2; - new_zone.matrix_map->height = 2; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_dial; + new_zone.matrix_map.Set(2, 2, (unsigned int *)&matrix_map_dial); new_zone.name = zone_names[zone_idx]; } break; @@ -576,10 +547,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() new_zone.leds_min = temp; new_zone.leds_max = temp; new_zone.leds_count = temp; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->width = controller->GetDataFlash()[124]; - new_zone.matrix_map->height = controller->GetDataFlash()[125]; - new_zone.matrix_map->map = (unsigned int *)&matrix_map_light_board; + new_zone.matrix_map.Set(controller->GetDataFlash()[124], controller->GetDataFlash()[125], (unsigned int *)&matrix_map_light_board); new_zone.name = zone_names[zone_idx + 1]; } break; @@ -649,7 +617,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones() SetupColors(); } -void RGBController_GaiZhongGaiKeyboard::ResizeZone(int zone, int new_size) +void RGBController_GaiZhongGaiKeyboard::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -689,12 +657,12 @@ void RGBController_GaiZhongGaiKeyboard::DeviceUpdateLEDs() controller->SendColors(colordata, data_size * 3); } -void RGBController_GaiZhongGaiKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_GaiZhongGaiKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GaiZhongGaiKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_GaiZhongGaiKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.h b/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.h index f4eac2032..3726211e2 100644 --- a/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.h +++ b/Controllers/GaiZongGaiKeyboardController/RGBController_GaiZhongGai.h @@ -20,11 +20,11 @@ public: ~RGBController_GaiZhongGaiKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.cpp b/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.cpp index 7515de336..738acd42e 100644 --- a/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.cpp +++ b/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.cpp @@ -64,7 +64,6 @@ void RGBController_GainwardGPUv1::SetupZones() gainward_gpu_zone.leds_min = 1; gainward_gpu_zone.leds_max = 1; gainward_gpu_zone.leds_count = 1; - gainward_gpu_zone.matrix_map = NULL; zones.push_back(gainward_gpu_zone); /*---------------------------------------------------------*\ @@ -86,13 +85,6 @@ void RGBController_GainwardGPUv1::SetupZones() colors[0] = ToRGBColor(red, grn, blu); } -void RGBController_GainwardGPUv1::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_GainwardGPUv1::DeviceUpdateLEDs() { for(std::size_t led = 0; led < colors.size(); led++) @@ -105,12 +97,12 @@ void RGBController_GainwardGPUv1::DeviceUpdateLEDs() } } -void RGBController_GainwardGPUv1::UpdateZoneLEDs(int /*zone*/) +void RGBController_GainwardGPUv1::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GainwardGPUv1::UpdateSingleLED(int /*led*/) +void RGBController_GainwardGPUv1::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.h b/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.h index f66e54e16..64dce0120 100644 --- a/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.h +++ b/Controllers/GainwardGPUController/GainwardGPUv1Controller/RGBController_GainwardGPUv1.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.cpp b/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.cpp index 95b11fe93..de6c94e24 100644 --- a/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.cpp +++ b/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.cpp @@ -96,7 +96,6 @@ void RGBController_GainwardGPUv2::SetupZones() gainward_gpu_zone.leds_min = 1; gainward_gpu_zone.leds_max = 1; gainward_gpu_zone.leds_count = 1; - gainward_gpu_zone.matrix_map = NULL; zones.push_back(gainward_gpu_zone); /*---------------------------------------------------------*\ @@ -118,13 +117,6 @@ void RGBController_GainwardGPUv2::SetupZones() colors[0] = ToRGBColor(red, grn, blu); } -void RGBController_GainwardGPUv2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_GainwardGPUv2::DeviceUpdateLEDs() { for(unsigned int color : colors) @@ -138,12 +130,12 @@ void RGBController_GainwardGPUv2::DeviceUpdateLEDs() } } -void RGBController_GainwardGPUv2::UpdateZoneLEDs(int /*zone*/) +void RGBController_GainwardGPUv2::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GainwardGPUv2::UpdateSingleLED(int /*led*/) +void RGBController_GainwardGPUv2::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.h b/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.h index 4376c3d32..40d14e72c 100644 --- a/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.h +++ b/Controllers/GainwardGPUController/GainwardGPUv2Controller/RGBController_GainwardGPUv2.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp b/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp index 8f210dc21..2019b92cc 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp @@ -113,7 +113,6 @@ void RGBController_GalaxGPUv1::SetupZones() galax_gpu_zone.leds_min = 1; galax_gpu_zone.leds_max = 1; galax_gpu_zone.leds_count = 1; - galax_gpu_zone.matrix_map = NULL; zones.push_back(galax_gpu_zone); /*---------------------------------------------------------*\ @@ -135,13 +134,6 @@ void RGBController_GalaxGPUv1::SetupZones() colors[0] = ToRGBColor(red, grn, blu); } -void RGBController_GalaxGPUv1::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_GalaxGPUv1::DeviceUpdateLEDs() { for(std::size_t led = 0; led < colors.size(); led++) @@ -150,7 +142,7 @@ void RGBController_GalaxGPUv1::DeviceUpdateLEDs() unsigned char grn = RGBGetGValue(colors[led]); unsigned char blu = RGBGetBValue(colors[led]); - if(GetMode() == 1) + if(GetActiveMode() == 1) { controller->SetLEDColorsDirect(red, grn, blu); } @@ -161,12 +153,12 @@ void RGBController_GalaxGPUv1::DeviceUpdateLEDs() } } -void RGBController_GalaxGPUv1::UpdateZoneLEDs(int /*zone*/) +void RGBController_GalaxGPUv1::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GalaxGPUv1::UpdateSingleLED(int /*led*/) +void RGBController_GalaxGPUv1::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.h b/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.h index f2661fb43..4f2fb45b6 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.h +++ b/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp b/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp index 6779090c9..f347502f9 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp @@ -133,7 +133,6 @@ void RGBController_GalaxGPUv2::SetupZones() galax_gpu_zone.leds_min = 1; galax_gpu_zone.leds_max = 1; galax_gpu_zone.leds_count = 1; - galax_gpu_zone.matrix_map = NULL; zones.push_back(galax_gpu_zone); /*---------------------------------------------------------*\ @@ -155,13 +154,6 @@ void RGBController_GalaxGPUv2::SetupZones() colors[0] = ToRGBColor(red, grn, blu); } -void RGBController_GalaxGPUv2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_GalaxGPUv2::DeviceUpdateLEDs() { for(std::size_t led = 0; led < colors.size(); led++) @@ -174,12 +166,12 @@ void RGBController_GalaxGPUv2::DeviceUpdateLEDs() } } -void RGBController_GalaxGPUv2::UpdateZoneLEDs(int /*zone*/) +void RGBController_GalaxGPUv2::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GalaxGPUv2::UpdateSingleLED(int /*led*/) +void RGBController_GalaxGPUv2::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.h b/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.h index 6734d1dbb..a5a5d1522 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.h +++ b/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp index 8b41b098a..1d3f75294 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp +++ b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp @@ -205,7 +205,6 @@ void RGBController_AorusATC800::SetupZones() atc800_cpu_fans_zone.leds_min = 1; atc800_cpu_fans_zone.leds_max = 1; atc800_cpu_fans_zone.leds_count = 1; - atc800_cpu_fans_zone.matrix_map = NULL; zones.push_back(atc800_cpu_fans_zone); led atc800_fan_led; @@ -218,7 +217,6 @@ void RGBController_AorusATC800::SetupZones() atc800_top_zone.leds_min = 1; atc800_top_zone.leds_max = 1; atc800_top_zone.leds_count = 1; - atc800_top_zone.matrix_map = NULL; zones.push_back(atc800_top_zone); led atc800_top_led; @@ -228,20 +226,13 @@ void RGBController_AorusATC800::SetupZones() SetupColors(); } -void RGBController_AorusATC800::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_AorusATC800::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); - UpdateZoneLEDs(1); + DeviceUpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(1); } -void RGBController_AorusATC800::UpdateZoneLEDs(int zone) +void RGBController_AorusATC800::DeviceUpdateZoneLEDs(int zone) { aorus_atc800_mode_config zone_config; @@ -261,9 +252,9 @@ void RGBController_AorusATC800::UpdateZoneLEDs(int zone) controller->SendCoolerMode(zone, modes[active_mode].value, zone_config); } -void RGBController_AorusATC800::UpdateSingleLED(int led) +void RGBController_AorusATC800::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_AorusATC800::DeviceUpdateMode() diff --git a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.h b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.h index 4546dc9fd..b5cde3510 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.h +++ b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp b/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp index 3af2c682e..7110ef33a 100644 --- a/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp +++ b/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp @@ -381,7 +381,6 @@ void RGBController_GigabyteAorusLaptop::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.push_back(new_zone); @@ -400,21 +399,16 @@ void RGBController_GigabyteAorusLaptop::SetupZones() unsigned int zone_size = 0; zone keyboard_zone; - keyboard_zone.name = "Keyboard layout"; - keyboard_zone.type = ZONE_TYPE_MATRIX; + keyboard_zone.name = "Keyboard layout"; + keyboard_zone.type = ZONE_TYPE_MATRIX; - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->height = aorus_laptop_default_keyboard_layout.height; - keyboard_zone.matrix_map->width = aorus_laptop_default_keyboard_layout.width; - - keyboard_zone.matrix_map->map = new unsigned int[aorus_laptop_default_keyboard_layout.height * aorus_laptop_default_keyboard_layout.width]; + keyboard_zone.matrix_map.Set(aorus_laptop_default_keyboard_layout.height, aorus_laptop_default_keyboard_layout.width, (unsigned int *)&aorus_laptop_default_keyboard_layout.matrix_map); for(unsigned int h = 0; h < aorus_laptop_default_keyboard_layout.height; h++) { for(unsigned int w = 0; w < aorus_laptop_default_keyboard_layout.width; w++) { unsigned int key = aorus_laptop_default_keyboard_layout.matrix_map[h][w]; - keyboard_zone.matrix_map->map[h * aorus_laptop_default_keyboard_layout.width + w] = key; if(key != NA) { @@ -436,13 +430,6 @@ void RGBController_GigabyteAorusLaptop::SetupZones() SetupColors(); } -void RGBController_GigabyteAorusLaptop::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_GigabyteAorusLaptop::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -472,12 +459,12 @@ void RGBController_GigabyteAorusLaptop::DeviceUpdateLEDs() } } -void RGBController_GigabyteAorusLaptop::UpdateZoneLEDs(int /*zone*/) +void RGBController_GigabyteAorusLaptop::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GigabyteAorusLaptop::UpdateSingleLED(int /*led*/) +void RGBController_GigabyteAorusLaptop::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.h b/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.h index fb4342b35..143d9f023 100644 --- a/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.h +++ b/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.h @@ -27,11 +27,10 @@ public: ~RGBController_GigabyteAorusLaptop(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.cpp b/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.cpp index d70715a1c..cf2f10151 100644 --- a/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.cpp +++ b/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.cpp @@ -133,7 +133,6 @@ void RGBController_GigabyteAorusMouse::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -143,24 +142,17 @@ void RGBController_GigabyteAorusMouse::SetupZones() SetupColors(); } -void RGBController_GigabyteAorusMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_GigabyteAorusMouse::DeviceUpdateLEDs() { controller->SendDirect(colors[0]); } -void RGBController_GigabyteAorusMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_GigabyteAorusMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GigabyteAorusMouse::UpdateSingleLED(int /*led*/) +void RGBController_GigabyteAorusMouse::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.h b/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.h index e6bb10040..8586700ee 100644 --- a/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.h +++ b/Controllers/GigabyteAorusMouseController/RGBController_GigabyteAorusMouse.h @@ -21,11 +21,10 @@ public: ~RGBController_GigabyteAorusMouse(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp index f52bf73fa..5225116bc 100644 --- a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp +++ b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp @@ -124,7 +124,6 @@ void RGBController_GigabyteAorusPCCase::SetupZones() case_zone.leds_min = 1; case_zone.leds_max = 1; case_zone.leds_count = 1; - case_zone.matrix_map = NULL; zones.push_back(case_zone); led case_led; @@ -134,13 +133,6 @@ void RGBController_GigabyteAorusPCCase::SetupZones() SetupColors(); } -void RGBController_GigabyteAorusPCCase::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_GigabyteAorusPCCase::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -148,14 +140,14 @@ void RGBController_GigabyteAorusPCCase::DeviceUpdateLEDs() \*---------------------------------------------------------*/ } -void RGBController_GigabyteAorusPCCase::UpdateZoneLEDs(int /*zone*/) +void RGBController_GigabyteAorusPCCase::DeviceUpdateZoneLEDs(int /*zone*/) { /*---------------------------------------------------------*\ | This device does not need update zone leds | \*---------------------------------------------------------*/ } -void RGBController_GigabyteAorusPCCase::UpdateSingleLED(int /*led*/) +void RGBController_GigabyteAorusPCCase::DeviceUpdateSingleLED(int /*led*/) { /*---------------------------------------------------------*\ | This device does not need update single led | diff --git a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.h b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.h index fb560872c..61397bc04 100644 --- a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.h +++ b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.cpp b/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.cpp index 6feb1b8db..d4e0f94ba 100644 --- a/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.cpp +++ b/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.cpp @@ -72,7 +72,6 @@ void RGBController_RGBFusion2AorusMasterGPU::SetupZones() fan_zone.leds_min = 8; fan_zone.leds_max = 8; fan_zone.leds_count = 8; - fan_zone.matrix_map = NULL; zones.push_back(fan_zone); @@ -98,7 +97,6 @@ void RGBController_RGBFusion2AorusMasterGPU::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); @@ -109,13 +107,6 @@ void RGBController_RGBFusion2AorusMasterGPU::SetupZones() SetupColors(); } -void RGBController_RGBFusion2AorusMasterGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RGBFusion2AorusMasterGPU::DeviceUpdateLEDs() { uint8_t brightness = modes[active_mode].brightness; @@ -148,7 +139,7 @@ void RGBController_RGBFusion2AorusMasterGPU::DeviceUpdateLEDs() controller->ApplyChanges(); } -void RGBController_RGBFusion2AorusMasterGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_RGBFusion2AorusMasterGPU::DeviceUpdateZoneLEDs(int /*zone*/) { /*---------------------------------------------------------*\ | For simplicity, update all LEDs when any zone changes | @@ -157,7 +148,7 @@ void RGBController_RGBFusion2AorusMasterGPU::UpdateZoneLEDs(int /*zone*/) DeviceUpdateLEDs(); } -void RGBController_RGBFusion2AorusMasterGPU::UpdateSingleLED(int /*led*/) +void RGBController_RGBFusion2AorusMasterGPU::DeviceUpdateSingleLED(int /*led*/) { /*---------------------------------------------------------*\ | For simplicity, update all LEDs when any LED changes | diff --git a/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.h b/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.h index c2bb3b51c..5911493a6 100644 --- a/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.h +++ b/Controllers/GigabyteRGBFusion2AorusMasterGPUController/RGBController_GigabyteRGBFusion2AorusMasterGPU.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.cpp b/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.cpp index bb3952356..cb7070974 100644 --- a/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.cpp +++ b/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.cpp @@ -193,7 +193,6 @@ void RGBController_RGBFusion2BlackwellGPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; new_led.name = new_zone.name; @@ -233,7 +232,6 @@ void RGBController_RGBFusion2BlackwellGPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; new_led.name = new_zone.name; @@ -266,7 +264,6 @@ void RGBController_RGBFusion2BlackwellGPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; new_led.name = new_zone.name; @@ -311,7 +308,6 @@ void RGBController_RGBFusion2BlackwellGPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; new_led.name = new_zone.name; @@ -326,13 +322,6 @@ void RGBController_RGBFusion2BlackwellGPU::SetupZones() SetupColors(); } -void RGBController_RGBFusion2BlackwellGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RGBFusion2BlackwellGPU::DeviceUpdateLEDs() { fusion2_config zone_config; @@ -411,12 +400,12 @@ void RGBController_RGBFusion2BlackwellGPU::DeviceUpdateLEDs() } } -void RGBController_RGBFusion2BlackwellGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_RGBFusion2BlackwellGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RGBFusion2BlackwellGPU::UpdateSingleLED(int /*led*/) +void RGBController_RGBFusion2BlackwellGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.h b/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.h index af424020b..84f159120 100644 --- a/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.h +++ b/Controllers/GigabyteRGBFusion2BlackwellGPUController/RGBController_GigabyteRGBFusion2BlackwellGPU.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.cpp b/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.cpp index 28b71102a..b14725f30 100644 --- a/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.cpp +++ b/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.cpp @@ -109,13 +109,6 @@ void RGBController_RGBFusion2DRAM::SetupZones() SetupColors(); } -void RGBController_RGBFusion2DRAM::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RGBFusion2DRAM::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -155,12 +148,12 @@ void RGBController_RGBFusion2DRAM::DeviceUpdateLEDs() } } -void RGBController_RGBFusion2DRAM::UpdateZoneLEDs(int /*zone*/) +void RGBController_RGBFusion2DRAM::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RGBFusion2DRAM::UpdateSingleLED(int /*led*/) +void RGBController_RGBFusion2DRAM::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.h b/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.h index 97fa2cfdb..25584d631 100644 --- a/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.h +++ b/Controllers/GigabyteRGBFusion2DRAMController/RGBController_GigabyteRGBFusion2DRAM.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.cpp b/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.cpp index f521a2514..7b7e2e408 100644 --- a/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.cpp +++ b/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.cpp @@ -176,7 +176,6 @@ void RGBController_RGBFusion2GPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; new_led.name = new_zone.name; @@ -190,13 +189,6 @@ void RGBController_RGBFusion2GPU::SetupZones() SetupColors(); } -void RGBController_RGBFusion2GPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RGBFusion2GPU::DeviceUpdateLEDs() { fusion2_config zone_config; @@ -222,13 +214,13 @@ void RGBController_RGBFusion2GPU::DeviceUpdateLEDs() } } -void RGBController_RGBFusion2GPU::UpdateZoneLEDs(int zone) +void RGBController_RGBFusion2GPU::DeviceUpdateZoneLEDs(int zone) { LOG_TRACE("[%s] Update zone #%d", name.c_str(), zone); DeviceUpdateLEDs(); } -void RGBController_RGBFusion2GPU::UpdateSingleLED(int led) +void RGBController_RGBFusion2GPU::DeviceUpdateSingleLED(int led) { LOG_TRACE("[%s] Update single led : %d", name.c_str(), led); DeviceUpdateLEDs(); diff --git a/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.h b/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.h index a63f821cf..cd0e4f7e6 100644 --- a/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.h +++ b/Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.cpp b/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.cpp index 7142dc374..5e2d5eb08 100644 --- a/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.cpp +++ b/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.cpp @@ -240,13 +240,6 @@ void RGBController_RGBFusion2SMBus::SetupZones() SetupColors(); } -void RGBController_RGBFusion2SMBus::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RGBFusion2SMBus::DeviceUpdateLEDs() { for(unsigned int led = 0; led < (unsigned int)colors.size(); led++) @@ -266,7 +259,7 @@ void RGBController_RGBFusion2SMBus::DeviceUpdateLEDs() controller->Apply(); } -void RGBController_RGBFusion2SMBus::UpdateZoneLEDs(int zone) +void RGBController_RGBFusion2SMBus::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -281,9 +274,9 @@ void RGBController_RGBFusion2SMBus::UpdateZoneLEDs(int zone) controller->Apply(); } -void RGBController_RGBFusion2SMBus::UpdateSingleLED(int led) +void RGBController_RGBFusion2SMBus::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_RGBFusion2SMBus::DeviceUpdateMode() diff --git a/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.h b/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.h index 1f3d1f1e6..d1c196040 100644 --- a/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.h +++ b/Controllers/GigabyteRGBFusion2SMBusController/RGBController_GigabyteRGBFusion2SMBus.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.cpp b/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.cpp index 3d3785923..3ea50b27f 100644 --- a/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.cpp +++ b/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.cpp @@ -344,7 +344,6 @@ void RGBController_RGBFusion2USB::Init_Controller() new_zone.leds_max = zone_at_idx->leds_max; new_zone.leds_count = new_zone.leds_min; new_zone.type = (new_zone.leds_min == new_zone.leds_max) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR; - new_zone.matrix_map = NULL; zones.emplace_back(new_zone); } } @@ -413,7 +412,7 @@ void RGBController_RGBFusion2USB::SetupZones() SetupColors(); } -void RGBController_RGBFusion2USB::ResizeZone(int zone, int new_size) +void RGBController_RGBFusion2USB::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -519,7 +518,7 @@ void RGBController_RGBFusion2USB::DeviceUpdateLEDs() controller->ApplyEffect(); } -void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone) +void RGBController_RGBFusion2USB::DeviceUpdateZoneLEDs(int zone) { /*---------------------------------------------------------*\ | Get mode parameters | @@ -616,7 +615,7 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone) } } -void RGBController_RGBFusion2USB::UpdateSingleLED(int led) +void RGBController_RGBFusion2USB::DeviceUpdateSingleLED(int led) { /*---------------------------------------------------------*\ | Get mode parameters | @@ -671,7 +670,7 @@ void RGBController_RGBFusion2USB::UpdateSingleLED(int led) \*---------------------------------------------------------*/ else { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } diff --git a/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.h b/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.h index 3efb7a553..d129a8753 100644 --- a/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.h +++ b/Controllers/GigabyteRGBFusion2USBController/RGBController_GigabyteRGBFusion2USB.h @@ -50,11 +50,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.cpp b/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.cpp index 730f11a52..0432fd158 100644 --- a/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.cpp +++ b/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.cpp @@ -94,7 +94,6 @@ void RGBController_RGBFusion::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; /*---------------------------------------------------------*\ | Push new zone to zones vector | @@ -120,13 +119,6 @@ void RGBController_RGBFusion::SetupZones() SetupColors(); } -void RGBController_RGBFusion::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RGBFusion::DeviceUpdateLEDs() { for(unsigned int led = 0; led < (unsigned int)colors.size(); led++) @@ -140,7 +132,7 @@ void RGBController_RGBFusion::DeviceUpdateLEDs() } } -void RGBController_RGBFusion::UpdateZoneLEDs(int zone) +void RGBController_RGBFusion::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -150,9 +142,9 @@ void RGBController_RGBFusion::UpdateZoneLEDs(int zone) controller->SetLEDColor(zone, red, grn, blu); } -void RGBController_RGBFusion::UpdateSingleLED(int led) +void RGBController_RGBFusion::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } int RGBController_RGBFusion::GetDeviceMode() diff --git a/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.h b/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.h index 75d23b8f9..0da8a4c1e 100644 --- a/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.h +++ b/Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.cpp b/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.cpp index de705841d..5dae16def 100644 --- a/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.cpp +++ b/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.cpp @@ -129,7 +129,6 @@ void RGBController_RGBFusionGPU::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -142,13 +141,6 @@ void RGBController_RGBFusionGPU::SetupZones() SetupColors(); } -void RGBController_RGBFusionGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RGBFusionGPU::DeviceUpdateLEDs() { RGBColor color = colors[0]; @@ -159,12 +151,12 @@ void RGBController_RGBFusionGPU::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_RGBFusionGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_RGBFusionGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RGBFusionGPU::UpdateSingleLED(int /*led*/) +void RGBController_RGBFusionGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.h b/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.h index d6df3a498..c512dddcb 100644 --- a/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.h +++ b/Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.cpp b/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.cpp index 869a057a5..736b5fbd1 100644 --- a/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.cpp +++ b/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.cpp @@ -146,7 +146,6 @@ void RGBController_GigabyteSuperIORGB::SetupZones() gig_zone.leds_min = 1; gig_zone.leds_max = 1; gig_zone.leds_count = 1; - gig_zone.matrix_map = NULL; zones.push_back(gig_zone); led gig_led; @@ -156,11 +155,6 @@ void RGBController_GigabyteSuperIORGB::SetupZones() SetupColors(); } -void RGBController_GigabyteSuperIORGB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_GigabyteSuperIORGB::DeviceUpdateLEDs() { RGBColor color = colors[0]; @@ -171,12 +165,12 @@ void RGBController_GigabyteSuperIORGB::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_GigabyteSuperIORGB::UpdateZoneLEDs(int /*zone*/) +void RGBController_GigabyteSuperIORGB::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_GigabyteSuperIORGB::UpdateSingleLED(int /*led*/) +void RGBController_GigabyteSuperIORGB::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.h b/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.h index 27d705c99..f1b91f2e6 100644 --- a/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.h +++ b/Controllers/GigabyteSuperIORGBController/RGBController_GigabyteSuperIORGB.h @@ -21,11 +21,10 @@ public: ~RGBController_GigabyteSuperIORGB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/GoveeController/RGBController_Govee.cpp b/Controllers/GoveeController/RGBController_Govee.cpp index 25c4ee4ed..4c8e285b7 100644 --- a/Controllers/GoveeController/RGBController_Govee.cpp +++ b/Controllers/GoveeController/RGBController_Govee.cpp @@ -99,7 +99,6 @@ void RGBController_Govee::SetupZones() strip.leds_min = led_count; strip.leds_max = led_count; } - strip.matrix_map = NULL; zones.push_back(strip); for(std::size_t led_idx = 0; led_idx < strip.leds_count; led_idx++) @@ -112,7 +111,7 @@ void RGBController_Govee::SetupZones() SetupColors(); } -void RGBController_Govee::ResizeZone(int zone, int new_size) +void RGBController_Govee::DeviceResizeZone(int zone, int new_size) { if(zone < 0 || zone >= (int)zones.size() || new_size <= 0) { @@ -148,12 +147,12 @@ void RGBController_Govee::DeviceUpdateLEDs() } } -void RGBController_Govee::UpdateZoneLEDs(int /*zone*/) +void RGBController_Govee::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Govee::UpdateSingleLED(int /*led*/) +void RGBController_Govee::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/GoveeController/RGBController_Govee.h b/Controllers/GoveeController/RGBController_Govee.h index b17de5349..53517e938 100644 --- a/Controllers/GoveeController/RGBController_Govee.h +++ b/Controllers/GoveeController/RGBController_Govee.h @@ -21,11 +21,11 @@ public: ~RGBController_Govee(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HPOmen30LController/RGBController_HPOmen30L.cpp b/Controllers/HPOmen30LController/RGBController_HPOmen30L.cpp index daaa28d20..2a3fc2081 100644 --- a/Controllers/HPOmen30LController/RGBController_HPOmen30L.cpp +++ b/Controllers/HPOmen30LController/RGBController_HPOmen30L.cpp @@ -156,7 +156,6 @@ void RGBController_HPOmen30L::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); zone light_bar; @@ -165,7 +164,6 @@ void RGBController_HPOmen30L::SetupZones() light_bar.leds_min = 1; light_bar.leds_max = 1; light_bar.leds_count = 1; - light_bar.matrix_map = NULL; zones.push_back(light_bar); zone ring_zone; @@ -174,7 +172,6 @@ void RGBController_HPOmen30L::SetupZones() ring_zone.leds_min = 1; ring_zone.leds_max = 1; ring_zone.leds_count = 1; - ring_zone.matrix_map = NULL; zones.push_back(ring_zone); zone cpu_zone; @@ -183,7 +180,6 @@ void RGBController_HPOmen30L::SetupZones() cpu_zone.leds_min = 1; cpu_zone.leds_max = 1; cpu_zone.leds_count = 1; - cpu_zone.matrix_map = NULL; zones.push_back(cpu_zone); zone bot_fan; @@ -192,7 +188,6 @@ void RGBController_HPOmen30L::SetupZones() bot_fan.leds_min = 1; bot_fan.leds_max = 1; bot_fan.leds_count = 1; - bot_fan.matrix_map = NULL; zones.push_back(bot_fan); zone mid_fan; @@ -201,7 +196,6 @@ void RGBController_HPOmen30L::SetupZones() mid_fan.leds_min = 1; mid_fan.leds_max = 1; mid_fan.leds_count = 1; - mid_fan.matrix_map = NULL; zones.push_back(mid_fan); zone top_fan; @@ -210,7 +204,6 @@ void RGBController_HPOmen30L::SetupZones() top_fan.leds_min = 1; top_fan.leds_max = 1; top_fan.leds_count = 1; - top_fan.matrix_map = NULL; zones.push_back(top_fan); /*---------------------------------------------------------*\ @@ -247,13 +240,6 @@ void RGBController_HPOmen30L::SetupZones() SetupColors(); } -void RGBController_HPOmen30L::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HPOmen30L::DeviceUpdateLEDs() { for(unsigned int i = 0; i < zones.size(); i++) @@ -271,14 +257,14 @@ void RGBController_HPOmen30L::DeviceUpdateLEDs() } } -void RGBController_HPOmen30L::UpdateZoneLEDs(int zone) +void RGBController_HPOmen30L::DeviceUpdateZoneLEDs(int zone) { controller->SetZoneColor(zone,colors); } -void RGBController_HPOmen30L::UpdateSingleLED(int led) +void RGBController_HPOmen30L::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_HPOmen30L::DeviceUpdateMode() diff --git a/Controllers/HPOmen30LController/RGBController_HPOmen30L.h b/Controllers/HPOmen30LController/RGBController_HPOmen30L.h index 9134cedfa..45640b0ff 100644 --- a/Controllers/HPOmen30LController/RGBController_HPOmen30L.h +++ b/Controllers/HPOmen30LController/RGBController_HPOmen30L.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.cpp b/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.cpp index 939849e52..a9bc27c73 100644 --- a/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.cpp +++ b/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.cpp @@ -65,7 +65,6 @@ void RGBController_HPOmenLaptopWMI_Windows::SetupZones() keyboard_zone.leds_min = 0; keyboard_zone.leds_max = 4; keyboard_zone.name = "Keyboard"; - keyboard_zone.matrix_map = NULL; keyboard_zone.type = ZONE_TYPE_LINEAR; this->zones.push_back(keyboard_zone); @@ -91,13 +90,6 @@ void RGBController_HPOmenLaptopWMI_Windows::SetupZones() SetupColors(); } -void RGBController_HPOmenLaptopWMI_Windows::ResizeZone(int zone, int new_size) -{ - /*-----------------------------------------------------*\ - | Not Supported | - \*-----------------------------------------------------*/ -} - void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateLEDs() { /*-----------------------------------------------------*\ @@ -106,7 +98,7 @@ void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateLEDs() controller->setColors(this->colors); } -void RGBController_HPOmenLaptopWMI_Windows::UpdateZoneLEDs(int zone) +void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateZoneLEDs(int zone) { /*-----------------------------------------------------*\ | Set new colors | @@ -114,7 +106,7 @@ void RGBController_HPOmenLaptopWMI_Windows::UpdateZoneLEDs(int zone) controller->setColors(this->colors); } -void RGBController_HPOmenLaptopWMI_Windows::UpdateSingleLED(int led) +void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateSingleLED(int led) { /*-----------------------------------------------------*\ | Set new colors | diff --git a/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.h b/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.h index 5c56849d6..4d3b97e39 100644 --- a/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.h +++ b/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.cpp b/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.cpp index 084df6037..dda48cb5e 100644 --- a/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.cpp +++ b/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.cpp @@ -89,27 +89,15 @@ void RGBController_HYTEKeyboard::SetupZones() zone keyboard_zone; - keyboard_zone.name = "Keyboard"; - keyboard_zone.type = ZONE_TYPE_MATRIX; - - matrix_map_type * keyboard_map = new matrix_map_type; - keyboard_zone.matrix_map = keyboard_map; - keyboard_zone.matrix_map->height = new_kb.GetRowCount(); - keyboard_zone.matrix_map->width = new_kb.GetColumnCount(); - - keyboard_zone.matrix_map->map = new unsigned int[keyboard_map->height * keyboard_map->width]; - keyboard_zone.leds_count = new_kb.GetKeyCount(); - keyboard_zone.leds_min = keyboard_zone.leds_count; - keyboard_zone.leds_max = keyboard_zone.leds_count; + keyboard_zone.name = "Keyboard"; + keyboard_zone.type = ZONE_TYPE_MATRIX; + keyboard_zone.leds_count = new_kb.GetKeyCount(); + keyboard_zone.leds_min = keyboard_zone.leds_count; + keyboard_zone.leds_max = keyboard_zone.leds_count; + keyboard_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); zones.push_back(keyboard_zone); - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(keyboard_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, keyboard_map->height, keyboard_map->width); - /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | | Place keys in the layout to populate the matrix | @@ -131,7 +119,6 @@ void RGBController_HYTEKeyboard::SetupZones() surround_zone.leds_min = 63; surround_zone.leds_max = 63; surround_zone.leds_count = 63; - surround_zone.matrix_map = NULL; zones.push_back(surround_zone); @@ -148,22 +135,15 @@ void RGBController_HYTEKeyboard::SetupZones() SetupColors(); } -void RGBController_HYTEKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HYTEKeyboard::DeviceUpdateLEDs() { for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_HYTEKeyboard::UpdateZoneLEDs(int zone) +void RGBController_HYTEKeyboard::DeviceUpdateZoneLEDs(int zone) { if(zone == HYTE_KEYBOARD_ZONE_KEYBOARD) { @@ -182,15 +162,15 @@ void RGBController_HYTEKeyboard::UpdateZoneLEDs(int zone) } } -void RGBController_HYTEKeyboard::UpdateSingleLED(int led) +void RGBController_HYTEKeyboard::DeviceUpdateSingleLED(int led) { if(led < (int)zones[0].leds_count) { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } else { - UpdateZoneLEDs(1); + DeviceUpdateZoneLEDs(1); } } diff --git a/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.h b/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.h index f505536e6..9725b56dd 100644 --- a/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.h +++ b/Controllers/HYTEKeyboardController/RGBController_HYTEKeyboard.h @@ -21,11 +21,10 @@ public: ~RGBController_HYTEKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HYTEMousematController/RGBController_HYTEMousemat.cpp b/Controllers/HYTEMousematController/RGBController_HYTEMousemat.cpp index b6a8baadf..63ff92885 100644 --- a/Controllers/HYTEMousematController/RGBController_HYTEMousemat.cpp +++ b/Controllers/HYTEMousematController/RGBController_HYTEMousemat.cpp @@ -65,7 +65,6 @@ void RGBController_HYTEMousemat::SetupZones() mousemat_zone.leds_min = 50; mousemat_zone.leds_max = 50; mousemat_zone.leds_count = 50; - mousemat_zone.matrix_map = NULL; zones.push_back(mousemat_zone); @@ -82,22 +81,17 @@ void RGBController_HYTEMousemat::SetupZones() SetupColors(); } -void RGBController_HYTEMousemat::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_HYTEMousemat::DeviceUpdateLEDs() { controller->StreamingCommand(&colors[0]); } -void RGBController_HYTEMousemat::UpdateZoneLEDs(int /*zone*/) +void RGBController_HYTEMousemat::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_HYTEMousemat::UpdateSingleLED(int /*led*/) +void RGBController_HYTEMousemat::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/HYTEMousematController/RGBController_HYTEMousemat.h b/Controllers/HYTEMousematController/RGBController_HYTEMousemat.h index ee6df1dd5..c0215cd19 100644 --- a/Controllers/HYTEMousematController/RGBController_HYTEMousemat.h +++ b/Controllers/HYTEMousematController/RGBController_HYTEMousemat.h @@ -35,11 +35,10 @@ public: ~RGBController_HYTEMousemat(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HYTENexusController/RGBController_HYTENexus.cpp b/Controllers/HYTENexusController/RGBController_HYTENexus.cpp index 34ee1725d..ca0943ba6 100644 --- a/Controllers/HYTENexusController/RGBController_HYTENexus.cpp +++ b/Controllers/HYTENexusController/RGBController_HYTENexus.cpp @@ -93,7 +93,6 @@ void RGBController_HYTENexus::SetupZones() channel_zone.leds_min = channel_leds; channel_zone.leds_max = channel_leds; channel_zone.leds_count = channel_leds; - channel_zone.matrix_map = NULL; for(unsigned int led_idx = 0; led_idx < channel_leds; led_idx++) { @@ -123,22 +122,20 @@ void RGBController_HYTENexus::SetupZones() if(controller->channels[channel].has_lcd_leds == true) { - segment lcd_leds_segment; +// segment lcd_leds_segment; - lcd_leds_segment.name = "LCD LED Matrix"; - lcd_leds_segment.leds_count = 42; - lcd_leds_segment.start_idx = start_idx; - lcd_leds_segment.type = ZONE_TYPE_MATRIX; +// lcd_leds_segment.name = "LCD LED Matrix"; +// lcd_leds_segment.leds_count = 42; +// lcd_leds_segment.start_idx = start_idx; +// lcd_leds_segment.type = ZONE_TYPE_MATRIX; channel_zone.type = ZONE_TYPE_MATRIX; - channel_zone.matrix_map = new matrix_map_type; - channel_zone.matrix_map->height = 9; - channel_zone.matrix_map->width = 5; - channel_zone.matrix_map->map = (unsigned int *)&thicc_q60_matrix_map; + channel_zone.matrix_map.Set(9, 5, (unsigned int *)&thicc_q60_matrix_map); - channel_zone.segments.push_back(lcd_leds_segment); +// channel_zone.segments.push_back(lcd_leds_segment); - start_idx += lcd_leds_segment.leds_count; +// start_idx += lcd_leds_segment.leds_count; + start_idx += 42; } for(unsigned int device = 0; device < controller->channels[channel].num_devices; device++) @@ -164,29 +161,22 @@ void RGBController_HYTENexus::SetupZones() SetupColors(); } -void RGBController_HYTENexus::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HYTENexus::DeviceUpdateLEDs() { for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - UpdateZoneLEDs(zone_idx); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_HYTENexus::UpdateZoneLEDs(int zone) +void RGBController_HYTENexus::DeviceUpdateZoneLEDs(int zone) { controller->LEDStreaming(zone, zones[zone].leds_count, zones[zone].colors); } -void RGBController_HYTENexus::UpdateSingleLED(int led) +void RGBController_HYTENexus::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(leds[led].value); + DeviceUpdateZoneLEDs(leds[led].value); } void RGBController_HYTENexus::DeviceUpdateMode() diff --git a/Controllers/HYTENexusController/RGBController_HYTENexus.h b/Controllers/HYTENexusController/RGBController_HYTENexus.h index 246c80269..980c44f69 100644 --- a/Controllers/HYTENexusController/RGBController_HYTENexus.h +++ b/Controllers/HYTENexusController/RGBController_HYTENexus.h @@ -21,11 +21,10 @@ public: ~RGBController_HYTENexus(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.cpp b/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.cpp index 57dd70316..ed222ebf5 100644 --- a/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.cpp +++ b/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.cpp @@ -65,7 +65,6 @@ void RGBController_HoltekA070::SetupZones() mouse_zone.leds_min = 1; mouse_zone.leds_max = 1; mouse_zone.leds_count = 1; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); led mouse_led; @@ -75,13 +74,6 @@ void RGBController_HoltekA070::SetupZones() SetupColors(); } -void RGBController_HoltekA070::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HoltekA070::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -91,12 +83,12 @@ void RGBController_HoltekA070::DeviceUpdateLEDs() controller->SendCustomColor(red, green, blue); } -void RGBController_HoltekA070::UpdateZoneLEDs(int /*zone*/) +void RGBController_HoltekA070::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HoltekA070::UpdateSingleLED(int /*led*/) +void RGBController_HoltekA070::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.h b/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.h index 03b932713..2b107812d 100644 --- a/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.h +++ b/Controllers/HoltekController/HoltekA070Controller/RGBController_HoltekA070.h @@ -21,11 +21,10 @@ public: ~RGBController_HoltekA070(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.cpp b/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.cpp index a313e24bc..7d309a856 100644 --- a/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.cpp +++ b/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.cpp @@ -93,7 +93,6 @@ void RGBController_HoltekA1FA::SetupZones() mouse_zone.leds_min = 1; mouse_zone.leds_max = 1; mouse_zone.leds_count = 1; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); led mouse_led; @@ -103,13 +102,6 @@ void RGBController_HoltekA1FA::SetupZones() SetupColors(); } -void RGBController_HoltekA1FA::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HoltekA1FA::DeviceUpdateLEDs() { unsigned char mode = modes[active_mode].value; @@ -123,12 +115,12 @@ void RGBController_HoltekA1FA::DeviceUpdateLEDs() controller->SendData(mode, brightness, speed, preset, red, green, blue); } -void RGBController_HoltekA1FA::UpdateZoneLEDs(int /*zone*/) +void RGBController_HoltekA1FA::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HoltekA1FA::UpdateSingleLED(int /*led*/) +void RGBController_HoltekA1FA::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.h b/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.h index 868ba9b60..d3338b11b 100644 --- a/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.h +++ b/Controllers/HoltekController/HoltekA1FAController/RGBController_HoltekA1FA.h @@ -23,11 +23,10 @@ public: int previous_mode = 0; /* previous mode */ void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.cpp b/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.cpp index 29d415942..33c6040d8 100644 --- a/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.cpp +++ b/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.cpp @@ -154,7 +154,6 @@ void RGBController_HyperXDRAM::SetupZones() new_zone->leds_min = 5; new_zone->leds_max = 5; new_zone->leds_count = 5; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); } @@ -179,13 +178,6 @@ void RGBController_HyperXDRAM::SetupZones() SetupColors(); } -void RGBController_HyperXDRAM::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXDRAM::DeviceUpdateLEDs() { if(controller->GetMode() == HYPERX_MODE_DIRECT) @@ -211,7 +203,7 @@ void RGBController_HyperXDRAM::DeviceUpdateLEDs() } } -void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone) +void RGBController_HyperXDRAM::DeviceUpdateZoneLEDs(int zone) { if(controller->GetMode() == HYPERX_MODE_DIRECT) { @@ -237,7 +229,7 @@ void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone) } } -void RGBController_HyperXDRAM::UpdateSingleLED(int led) +void RGBController_HyperXDRAM::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.h b/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.h index 41dc58a44..deb2a4944 100644 --- a/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.h +++ b/Controllers/HyperXDRAMController/RGBController_HyperXDRAM.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.cpp index 6d431eb2e..6aec74670 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.cpp @@ -242,17 +242,6 @@ RGBController_HyperXAlloyElite2::~RGBController_HyperXAlloyElite2() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != nullptr) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -273,14 +262,7 @@ void RGBController_HyperXAlloyElite2::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 8; - new_zone.matrix_map->width = 22; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = nullptr; + new_zone.matrix_map.Set(8, 22, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -298,13 +280,6 @@ void RGBController_HyperXAlloyElite2::SetupZones() SetupColors(); } -void RGBController_HyperXAlloyElite2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXAlloyElite2::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -315,12 +290,12 @@ void RGBController_HyperXAlloyElite2::DeviceUpdateLEDs() } } -void RGBController_HyperXAlloyElite2::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXAlloyElite2::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXAlloyElite2::UpdateSingleLED(int /*led*/) +void RGBController_HyperXAlloyElite2::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -338,7 +313,7 @@ void RGBController_HyperXAlloyElite2::KeepaliveThreadFunction() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(1000)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(50ms); diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.h b/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.h index eab03284a..ee641ace5 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.h +++ b/Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller/RGBController_HyperXAlloyElite2.h @@ -25,11 +25,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.cpp index 08775f737..1709b00ae 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.cpp @@ -255,17 +255,6 @@ RGBController_HyperXAlloyElite::~RGBController_HyperXAlloyElite() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -286,14 +275,7 @@ void RGBController_HyperXAlloyElite::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(6, 23, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -311,13 +293,6 @@ void RGBController_HyperXAlloyElite::SetupZones() SetupColors(); } -void RGBController_HyperXAlloyElite::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXAlloyElite::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -332,12 +307,12 @@ void RGBController_HyperXAlloyElite::DeviceUpdateLEDs() } } -void RGBController_HyperXAlloyElite::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXAlloyElite::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXAlloyElite::UpdateSingleLED(int /*led*/) +void RGBController_HyperXAlloyElite::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -363,7 +338,7 @@ void RGBController_HyperXAlloyElite::KeepaliveThreadFunction() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms);; diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.h b/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.h index a8870b3fc..cb26b268e 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.h +++ b/Controllers/HyperXKeyboardController/HyperXAlloyEliteController/RGBController_HyperXAlloyElite.h @@ -25,11 +25,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.cpp index 9ebc140a6..06f7efe04 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.cpp @@ -196,17 +196,6 @@ RGBController_HyperXAlloyFPS::~RGBController_HyperXAlloyFPS() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -227,14 +216,7 @@ void RGBController_HyperXAlloyFPS::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(6, 23, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -252,13 +234,6 @@ void RGBController_HyperXAlloyFPS::SetupZones() SetupColors(); } -void RGBController_HyperXAlloyFPS::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXAlloyFPS::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -269,12 +244,12 @@ void RGBController_HyperXAlloyFPS::DeviceUpdateLEDs() } } -void RGBController_HyperXAlloyFPS::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXAlloyFPS::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXAlloyFPS::UpdateSingleLED(int /*led*/) +void RGBController_HyperXAlloyFPS::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -292,7 +267,7 @@ void RGBController_HyperXAlloyFPS::KeepaliveThreadFunction() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms);; diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.h b/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.h index f969666af..b45d0caf6 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.h +++ b/Controllers/HyperXKeyboardController/HyperXAlloyFPSController/RGBController_HyperXAlloyFPS.h @@ -25,11 +25,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.cpp index 0e310259e..01298f2fa 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.cpp @@ -249,17 +249,6 @@ RGBController_HyperXAlloyOrigins60and65::~RGBController_HyperXAlloyOrigins60and6 keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -277,11 +266,11 @@ void RGBController_HyperXAlloyOrigins60and65::SetupZones() case ALLOY_ORIGINS_60_LAYOUT: default: led_names = led_names_60; - led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 71, new matrix_map_type{5, 14, (unsigned int *)&matrix_map_60}}); + led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 71, new matrix_map_type(5, 14, (unsigned int *)&matrix_map_60)}); break; case ALLOY_ORIGINS_65_LAYOUT: led_names = led_names_65; - led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 77, new matrix_map_type{5, 15, (unsigned int *)&matrix_map_65}}); + led_zones.push_back({ZONE_EN_KEYBOARD, ZONE_TYPE_MATRIX, 77, new matrix_map_type(5, 15, (unsigned int *)&matrix_map_65)}); break; } @@ -295,13 +284,9 @@ void RGBController_HyperXAlloyOrigins60and65::SetupZones() new_zone.leds_max = led_zones[zone_idx].size; new_zone.leds_count = led_zones[zone_idx].size; - if(led_zones[zone_idx].type == ZONE_TYPE_MATRIX) + if(led_zones[zone_idx].type == ZONE_TYPE_MATRIX && led_zones[zone_idx].matrix != NULL) { - new_zone.matrix_map = led_zones[zone_idx].matrix; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map = *led_zones[zone_idx].matrix; } zones.push_back(new_zone); @@ -319,24 +304,17 @@ void RGBController_HyperXAlloyOrigins60and65::SetupZones() SetupColors(); } -void RGBController_HyperXAlloyOrigins60and65::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXAlloyOrigins60and65::DeviceUpdateLEDs() { controller->SetLEDsDirect(colors); } -void RGBController_HyperXAlloyOrigins60and65::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXAlloyOrigins60and65::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXAlloyOrigins60and65::UpdateSingleLED(int /*led*/) +void RGBController_HyperXAlloyOrigins60and65::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -354,7 +332,7 @@ void RGBController_HyperXAlloyOrigins60and65::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms);; diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.h b/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.h index b222bb99d..5fc7b15d0 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.h +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOrigins60and65Controller/RGBController_HyperXAlloyOrigins60and65.h @@ -38,11 +38,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.cpp index 3a40fc604..7220e0009 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.cpp @@ -217,17 +217,6 @@ RGBController_HyperXAlloyOrigins::~RGBController_HyperXAlloyOrigins() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -248,14 +237,7 @@ void RGBController_HyperXAlloyOrigins::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(6, 23, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -273,24 +255,17 @@ void RGBController_HyperXAlloyOrigins::SetupZones() SetupColors(); } -void RGBController_HyperXAlloyOrigins::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXAlloyOrigins::DeviceUpdateLEDs() { controller->SetLEDsDirect(colors); } -void RGBController_HyperXAlloyOrigins::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXAlloyOrigins::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXAlloyOrigins::UpdateSingleLED(int /*led*/) +void RGBController_HyperXAlloyOrigins::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -308,7 +283,7 @@ void RGBController_HyperXAlloyOrigins::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms);; diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.h b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.h index 29b7d4521..cf0f5c8e9 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.h +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController/RGBController_HyperXAlloyOrigins.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.cpp index 826433d4f..95b639e0a 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.cpp @@ -132,17 +132,6 @@ RGBController_HyperXAlloyOriginsCore::~RGBController_HyperXAlloyOriginsCore() keepalive_thread->join(); delete keepalive_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -177,24 +166,15 @@ void RGBController_HyperXAlloyOriginsCore::SetupZones() total_leds = new_kb.GetKeyCount(); - matrix_map_type * keyboard_map = new matrix_map_type; new_zone.leds_count = total_leds; new_zone.leds_min = new_zone.leds_count; new_zone.leds_max = new_zone.leds_count; if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = keyboard_map; - keyboard_map->height = new_kb.GetRowCount(); - keyboard_map->width = new_kb.GetColumnCount(); - keyboard_map->map = new unsigned int[keyboard_map->height * keyboard_map->width]; - - new_kb.GetKeyMap(keyboard_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT); - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); } + zones.push_back(new_zone); for(unsigned int led_idx = 0; led_idx < total_leds; led_idx++) @@ -210,24 +190,17 @@ void RGBController_HyperXAlloyOriginsCore::SetupZones() SetupColors(); } -void RGBController_HyperXAlloyOriginsCore::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXAlloyOriginsCore::DeviceUpdateLEDs() { controller->SetLEDsDirect(leds, colors); } -void RGBController_HyperXAlloyOriginsCore::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXAlloyOriginsCore::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXAlloyOriginsCore::UpdateSingleLED(int /*led*/) +void RGBController_HyperXAlloyOriginsCore::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.h b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.h index 0537eee19..715ef6ccc 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.h +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController/RGBController_HyperXAlloyOriginsCore.h @@ -26,11 +26,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.cpp b/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.cpp index 1b7ae5a25..f2354e1f6 100644 --- a/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.cpp +++ b/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.cpp @@ -104,33 +104,27 @@ void RGBController_HyperXMicrophone::SetupZones() Mic.leds_min = 2; Mic.leds_max = 2; Mic.leds_count = 2; - Mic.matrix_map = nullptr; - zones.push_back(Mic); SetupColors(); } -void RGBController_HyperXMicrophone::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXMicrophone::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); controller->SendDirect(colors); } -void RGBController_HyperXMicrophone::UpdateZoneLEDs(int /*zone*/) + +void RGBController_HyperXMicrophone::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXMicrophone::UpdateSingleLED(int /*led*/) + +void RGBController_HyperXMicrophone::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } + void RGBController_HyperXMicrophone::DeviceUpdateMode() { DeviceUpdateLEDs(); @@ -148,7 +142,7 @@ void RGBController_HyperXMicrophone::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } std::this_thread::sleep_for(15ms); } diff --git a/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.h b/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.h index 7cfa62488..3239111ed 100644 --- a/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.h +++ b/Controllers/HyperXMicrophoneController/RGBController_HyperXMicrophone.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.cpp b/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.cpp index 3bfddb529..c29b0f618 100644 --- a/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.cpp +++ b/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.cpp @@ -62,31 +62,28 @@ RGBController_HyperXMicrophoneV2::~RGBController_HyperXMicrophoneV2() void RGBController_HyperXMicrophoneV2::SetupZones() { + unsigned int led_mapping[HYPERX_QUADCAST_2S_TOTAL_LEDS] = + { + /* front */ /* rear */ + 26, 27, 44, 45, 62, 63, 80, 81, 98, 99, 8, 9, + 25, 28, 43, 46, 61, 64, 79, 82, 97, 100, 7, 10, + 24, 29, 42, 47, 60, 65, 78, 83, 96, 101, 6, 11, + 23, 30, 41, 48, 59, 66, 77, 84, 95, 102, 5, 12, + 22, 31, 40, 49, 58, 67, 76, 85, 94, 103, 4, 13, + 21, 32, 39, 50, 57, 68, 75, 86, 93, 104, 3, 14, + 20, 33, 38, 51, 56, 69, 74, 87, 92, 105, 2, 15, + 19, 34, 37, 52, 55, 70, 73, 88, 91, 106, 1, 16, + 18, 35, 36, 53, 54, 71, 72, 89, 90, 107, 0, 17 + }; + zone Mic; - Mic.name = "Microphone"; - Mic.type = ZONE_TYPE_MATRIX; - Mic.leds_min = HYPERX_QUADCAST_2S_TOTAL_LEDS; - Mic.leds_max = HYPERX_QUADCAST_2S_TOTAL_LEDS; - Mic.leds_count = HYPERX_QUADCAST_2S_TOTAL_LEDS; - Mic.matrix_map = new matrix_map_type; - Mic.matrix_map->width = HYPERX_QUADCAST_2S_MATRIX_WIDTH; - Mic.matrix_map->height = HYPERX_QUADCAST_2S_MATRIX_HEIGHT; - Mic.matrix_map->map = new unsigned int[HYPERX_QUADCAST_2S_TOTAL_LEDS]; - - unsigned int led_mapping[HYPERX_QUADCAST_2S_TOTAL_LEDS] = - { - /* front */ /* rear */ - 26, 27, 44, 45, 62, 63, 80, 81, 98, 99, 8, 9, - 25, 28, 43, 46, 61, 64, 79, 82, 97, 100, 7, 10, - 24, 29, 42, 47, 60, 65, 78, 83, 96, 101, 6, 11, - 23, 30, 41, 48, 59, 66, 77, 84, 95, 102, 5, 12, - 22, 31, 40, 49, 58, 67, 76, 85, 94, 103, 4, 13, - 21, 32, 39, 50, 57, 68, 75, 86, 93, 104, 3, 14, - 20, 33, 38, 51, 56, 69, 74, 87, 92, 105, 2, 15, - 19, 34, 37, 52, 55, 70, 73, 88, 91, 106, 1, 16, - 18, 35, 36, 53, 54, 71, 72, 89, 90, 107, 0, 17 - }; + Mic.name = "Microphone"; + Mic.type = ZONE_TYPE_MATRIX; + Mic.leds_min = HYPERX_QUADCAST_2S_TOTAL_LEDS; + Mic.leds_max = HYPERX_QUADCAST_2S_TOTAL_LEDS; + Mic.leds_count = HYPERX_QUADCAST_2S_TOTAL_LEDS; + Mic.matrix_map.Set(HYPERX_QUADCAST_2S_MATRIX_WIDTH, HYPERX_QUADCAST_2S_MATRIX_HEIGHT, led_mapping); for(unsigned int i = 0; i < HYPERX_QUADCAST_2S_TOTAL_LEDS; i ++) { @@ -94,8 +91,6 @@ void RGBController_HyperXMicrophoneV2::SetupZones() l.name = "LED " + std::to_string(i); l.value = led_mapping[i]; leds.push_back(l); - - Mic.matrix_map->map[i] = led_mapping[i]; } zones.push_back(Mic); @@ -103,23 +98,16 @@ void RGBController_HyperXMicrophoneV2::SetupZones() SetupColors(); } -void RGBController_HyperXMicrophoneV2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXMicrophoneV2::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); controller->SendDirect(colors); } -void RGBController_HyperXMicrophoneV2::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXMicrophoneV2::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXMicrophoneV2::UpdateSingleLED(int /*led*/) +void RGBController_HyperXMicrophoneV2::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -140,7 +128,7 @@ void RGBController_HyperXMicrophoneV2::KeepaliveThread() { if(!controller->ShouldPauseUpdates() && (std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(1000)) { - UpdateLEDs(); + UpdateLEDsInternal(); } std::this_thread::sleep_for(250ms); } diff --git a/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.h b/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.h index e08153a3e..7f243d3be 100644 --- a/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.h +++ b/Controllers/HyperXMicrophoneV2Controller/RGBController_HyperXMicrophoneV2.h @@ -24,11 +24,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.cpp b/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.cpp index ce470a565..ca6ca966a 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.cpp +++ b/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.cpp @@ -99,7 +99,6 @@ void RGBController_HyperXPulsefireDart::SetupZones() scroll_zone.leds_min = 1; scroll_zone.leds_max = 1; scroll_zone.leds_count = 1; - scroll_zone.matrix_map = NULL; zones.push_back(scroll_zone); led scroll_led; @@ -113,7 +112,6 @@ void RGBController_HyperXPulsefireDart::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led logo_led; @@ -124,22 +122,17 @@ void RGBController_HyperXPulsefireDart::SetupZones() SetupColors(); } -void RGBController_HyperXPulsefireDart::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_HyperXPulsefireDart::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_HyperXPulsefireDart::UpdateZoneLEDs(int zone) +void RGBController_HyperXPulsefireDart::DeviceUpdateZoneLEDs(int zone) { - UpdateSingleLED(zone); + DeviceUpdateSingleLED(zone); } -void RGBController_HyperXPulsefireDart::UpdateSingleLED(int led) +void RGBController_HyperXPulsefireDart::DeviceUpdateSingleLED(int led) { if(modes[active_mode].color_mode == MODE_COLORS_PER_LED) { diff --git a/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.h b/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.h index 3a41f4611..d68c2366a 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.h +++ b/Controllers/HyperXMouseController/HyperXPulsefireDartController/RGBController_HyperXPulsefireDart.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.cpp b/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.cpp index e94d7eaa5..75c521429 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.cpp +++ b/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.cpp @@ -71,7 +71,6 @@ void RGBController_HyperXPulsefireFPSPro::SetupZones() logo.leds_min = 1; logo.leds_max = 1; logo.leds_count = 1; - logo.matrix_map = NULL; zones.push_back(logo); for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) @@ -95,13 +94,6 @@ void RGBController_HyperXPulsefireFPSPro::SetupZones() SetupColors(); } -void RGBController_HyperXPulsefireFPSPro::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXPulsefireFPSPro::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -116,12 +108,12 @@ void RGBController_HyperXPulsefireFPSPro::DeviceUpdateLEDs() } -void RGBController_HyperXPulsefireFPSPro::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXPulsefireFPSPro::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXPulsefireFPSPro::UpdateSingleLED(int /*led*/) +void RGBController_HyperXPulsefireFPSPro::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -139,7 +131,7 @@ void RGBController_HyperXPulsefireFPSPro::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.h b/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.h index b12dfaec5..6fd19dcd9 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.h +++ b/Controllers/HyperXMouseController/HyperXPulsefireFPSProController/RGBController_HyperXPulsefireFPSPro.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.cpp b/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.cpp index 24b6bb361..440f6403d 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.cpp +++ b/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.cpp @@ -71,7 +71,6 @@ void RGBController_HyperXPulsefireHaste::SetupZones() logo.leds_min = 1; logo.leds_max = 1; logo.leds_count = 1; - logo.matrix_map = NULL; zones.push_back(logo); for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) @@ -95,13 +94,6 @@ void RGBController_HyperXPulsefireHaste::SetupZones() SetupColors(); } -void RGBController_HyperXPulsefireHaste::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXPulsefireHaste::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -116,12 +108,12 @@ void RGBController_HyperXPulsefireHaste::DeviceUpdateLEDs() } -void RGBController_HyperXPulsefireHaste::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXPulsefireHaste::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXPulsefireHaste::UpdateSingleLED(int /*led*/) +void RGBController_HyperXPulsefireHaste::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -139,7 +131,7 @@ void RGBController_HyperXPulsefireHaste::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.h b/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.h index 6bb10cd9a..ceaf7ca8a 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.h +++ b/Controllers/HyperXMouseController/HyperXPulsefireHasteController/RGBController_HyperXPulsefireHaste.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.cpp b/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.cpp index e51843b7e..e633ee834 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.cpp +++ b/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.cpp @@ -76,7 +76,6 @@ void RGBController_HyperXPulsefireRaid::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; zones.push_back(new_zone); led new_led; @@ -87,22 +86,17 @@ void RGBController_HyperXPulsefireRaid::SetupZones() SetupColors(); } -void RGBController_HyperXPulsefireRaid::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_HyperXPulsefireRaid::DeviceUpdateLEDs() { - UpdateSingleLED(0); + DeviceUpdateSingleLED(0); } -void RGBController_HyperXPulsefireRaid::UpdateZoneLEDs(int zone) +void RGBController_HyperXPulsefireRaid::DeviceUpdateZoneLEDs(int zone) { - UpdateSingleLED(zone); + DeviceUpdateSingleLED(zone); } -void RGBController_HyperXPulsefireRaid::UpdateSingleLED(int /*led*/) +void RGBController_HyperXPulsefireRaid::DeviceUpdateSingleLED(int /*led*/) { last_update_time = std::chrono::steady_clock::now(); controller->SendColors(colors); @@ -126,7 +120,7 @@ void RGBController_HyperXPulsefireRaid::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > 1s) { - UpdateLEDs(); + UpdateLEDsInternal(); } } diff --git a/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.h b/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.h index 5a633be40..106cf8db1 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.h +++ b/Controllers/HyperXMouseController/HyperXPulsefireRaidController/RGBController_HyperXPulsefireRaid.h @@ -22,11 +22,10 @@ public: ~RGBController_HyperXPulsefireRaid(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.cpp b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.cpp index f77a76988..60e2e06e5 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.cpp +++ b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.cpp @@ -71,7 +71,6 @@ void RGBController_HyperXPulsefireSurge::SetupZones() led_strip.leds_min = 32; led_strip.leds_max = 32; led_strip.leds_count = 32; - led_strip.matrix_map = NULL; zones.push_back(led_strip); zone logo; @@ -80,7 +79,6 @@ void RGBController_HyperXPulsefireSurge::SetupZones() logo.leds_min = 1; logo.leds_max = 1; logo.leds_count = 1; - logo.matrix_map = NULL; zones.push_back(logo); for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) @@ -104,13 +102,6 @@ void RGBController_HyperXPulsefireSurge::SetupZones() SetupColors(); } -void RGBController_HyperXPulsefireSurge::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXPulsefireSurge::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -125,12 +116,12 @@ void RGBController_HyperXPulsefireSurge::DeviceUpdateLEDs() } -void RGBController_HyperXPulsefireSurge::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXPulsefireSurge::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXPulsefireSurge::UpdateSingleLED(int /*led*/) +void RGBController_HyperXPulsefireSurge::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -148,7 +139,7 @@ void RGBController_HyperXPulsefireSurge::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms); diff --git a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.h b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.h index fc011183b..f15083b7f 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.h +++ b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController/RGBController_HyperXPulsefireSurge.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp b/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp index 659aeed01..e32a21930 100644 --- a/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp +++ b/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp @@ -75,7 +75,6 @@ void RGBController_HyperXMousemat::SetupZones() underglow.leds_min = first_zone_leds_count; underglow.leds_max = first_zone_leds_count; underglow.leds_count = first_zone_leds_count; - underglow.matrix_map = NULL; zones.push_back(underglow); } @@ -87,7 +86,6 @@ void RGBController_HyperXMousemat::SetupZones() led_strip.leds_min = second_zone_leds_count; led_strip.leds_max = second_zone_leds_count; led_strip.leds_count = second_zone_leds_count; - led_strip.matrix_map = NULL; zones.push_back(led_strip); } @@ -113,13 +111,6 @@ void RGBController_HyperXMousemat::SetupZones() SetupColors(); } -void RGBController_HyperXMousemat::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_HyperXMousemat::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -127,12 +118,12 @@ void RGBController_HyperXMousemat::DeviceUpdateLEDs() controller->SendDirect(&colors[0]); } -void RGBController_HyperXMousemat::UpdateZoneLEDs(int /*zone*/) +void RGBController_HyperXMousemat::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXMousemat::UpdateSingleLED(int /*led*/) +void RGBController_HyperXMousemat::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -150,7 +141,7 @@ void RGBController_HyperXMousemat::KeepaliveThread() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(10ms); diff --git a/Controllers/HyperXMousematController/RGBController_HyperXMousemat.h b/Controllers/HyperXMousematController/RGBController_HyperXMousemat.h index c61d020b6..6f9e8ec4c 100644 --- a/Controllers/HyperXMousematController/RGBController_HyperXMousemat.h +++ b/Controllers/HyperXMousematController/RGBController_HyperXMousemat.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/InstantMouseController/RGBController_InstantMouse.cpp b/Controllers/InstantMouseController/RGBController_InstantMouse.cpp index e8a74ed5a..3b3e715f4 100644 --- a/Controllers/InstantMouseController/RGBController_InstantMouse.cpp +++ b/Controllers/InstantMouseController/RGBController_InstantMouse.cpp @@ -172,7 +172,6 @@ void RGBController_InstantMouse::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -182,24 +181,17 @@ void RGBController_InstantMouse::SetupZones() SetupColors(); } -void RGBController_InstantMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_InstantMouse::DeviceUpdateLEDs() { controller->SendColor(colors[0]); } -void RGBController_InstantMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_InstantMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_InstantMouse::UpdateSingleLED(int /*led*/) +void RGBController_InstantMouse::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/InstantMouseController/RGBController_InstantMouse.h b/Controllers/InstantMouseController/RGBController_InstantMouse.h index 37e55f122..66c1fca54 100644 --- a/Controllers/InstantMouseController/RGBController_InstantMouse.h +++ b/Controllers/InstantMouseController/RGBController_InstantMouse.h @@ -21,11 +21,10 @@ public: ~RGBController_InstantMouse(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.cpp b/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.cpp index fa0c1bba9..5e0a4bab0 100644 --- a/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.cpp +++ b/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.cpp @@ -76,7 +76,6 @@ void RGBController_IntelArcA770LE::SetupZones() fan_1_zone.leds_min = 16; fan_1_zone.leds_max = 16; fan_1_zone.leds_count = 16; - fan_1_zone.matrix_map = NULL; zones.push_back(fan_1_zone); zone fan_2_zone; @@ -85,7 +84,6 @@ void RGBController_IntelArcA770LE::SetupZones() fan_2_zone.leds_min = 16; fan_2_zone.leds_max = 16; fan_2_zone.leds_count = 16; - fan_2_zone.matrix_map = NULL; zones.push_back(fan_2_zone); zone back; @@ -94,7 +92,6 @@ void RGBController_IntelArcA770LE::SetupZones() back.leds_min = 8; back.leds_max = 8; back.leds_count = 8; - back.matrix_map = NULL; zones.push_back(back); zone ring; @@ -103,7 +100,6 @@ void RGBController_IntelArcA770LE::SetupZones() ring.leds_min = 50; ring.leds_max = 50; ring.leds_count = 50; - ring.matrix_map = NULL; zones.push_back(ring); zone logo; @@ -112,7 +108,6 @@ void RGBController_IntelArcA770LE::SetupZones() logo.leds_min = 1; logo.leds_max = 1; logo.leds_count = 1; - logo.matrix_map = NULL; zones.push_back(logo); for(unsigned int led_idx = 0; led_idx < 16; led_idx++) @@ -158,13 +153,6 @@ void RGBController_IntelArcA770LE::SetupZones() SetupColors(); } -void RGBController_IntelArcA770LE::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_IntelArcA770LE::DeviceUpdateLEDs() { unsigned char led_ids[15]; @@ -191,12 +179,12 @@ void RGBController_IntelArcA770LE::DeviceUpdateLEDs() } } -void RGBController_IntelArcA770LE::UpdateZoneLEDs(int /*zone*/) +void RGBController_IntelArcA770LE::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_IntelArcA770LE::UpdateSingleLED(int /*led*/) +void RGBController_IntelArcA770LE::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.h b/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.h index 05f8be2d1..b4f3e350e 100644 --- a/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.h +++ b/Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/IonicoController/IonicoControllerDetect.cpp b/Controllers/IonicoController/IonicoControllerDetect.cpp index cc73ee65e..2a82889c1 100644 --- a/Controllers/IonicoController/IonicoControllerDetect.cpp +++ b/Controllers/IonicoController/IonicoControllerDetect.cpp @@ -37,14 +37,6 @@ void DetectIonicoControllers(hid_device_info* info, const std::string& name) IonicoController* controller = new IonicoController(dev, *info, info->product_id, name); RGBController_Ionico* rgb_controller = new RGBController_Ionico(controller); - if(info->product_id == IONICO_KB_PID) - { - rgb_controller->type = DEVICE_TYPE_KEYBOARD; - } - else if(info->product_id == IONICO_FB_PID) - { - rgb_controller->type = DEVICE_TYPE_LEDSTRIP; - } ResourceManager::get()->RegisterRGBController(rgb_controller); } } diff --git a/Controllers/IonicoController/RGBController_Ionico.cpp b/Controllers/IonicoController/RGBController_Ionico.cpp index 0e81095a2..f51faaf7f 100644 --- a/Controllers/IonicoController/RGBController_Ionico.cpp +++ b/Controllers/IonicoController/RGBController_Ionico.cpp @@ -32,6 +32,15 @@ RGBController_Ionico::RGBController_Ionico(IonicoController* controller_ptr) description = name; location = controller->GetDeviceLocation(); + if(controller->GetUSBPID() == IONICO_KB_PID) + { + type = DEVICE_TYPE_KEYBOARD; + } + else if(controller->GetUSBPID() == IONICO_FB_PID) + { + type = DEVICE_TYPE_LEDSTRIP; + } + mode Direct; Direct.name = "Direct"; Direct.value = IONICO_MODE_DIRECT; @@ -144,7 +153,6 @@ void RGBController_Ionico::SetupZones() zone_keyboard.leds_min = (unsigned int)leds.size(); zone_keyboard.leds_max = (unsigned int)leds.size(); zone_keyboard.leds_count = (unsigned int)leds.size(); - zone_keyboard.matrix_map = nullptr; zones.emplace_back(zone_keyboard); for(size_t i = 0; i < leds.size(); ++i) { @@ -160,7 +168,6 @@ void RGBController_Ionico::SetupZones() zone_bar.leds_min = (unsigned int)leds.size(); zone_bar.leds_max = (unsigned int)leds.size(); zone_bar.leds_count = (unsigned int)leds.size(); - zone_bar.matrix_map = nullptr; zones.emplace_back(zone_bar); for(size_t i = 0; i < leds.size(); ++i) { @@ -170,13 +177,6 @@ void RGBController_Ionico::SetupZones() SetupColors(); } -void RGBController_Ionico::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Ionico::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -190,12 +190,12 @@ void RGBController_Ionico::DeviceSaveMode() controller->SaveBios(); } -void RGBController_Ionico::UpdateZoneLEDs(int /*zone*/) +void RGBController_Ionico::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Ionico::UpdateSingleLED(int /*led*/) +void RGBController_Ionico::DeviceUpdateSingleLED(int /*led*/) { // } diff --git a/Controllers/IonicoController/RGBController_Ionico.h b/Controllers/IonicoController/RGBController_Ionico.h index c39222158..605e6c472 100644 --- a/Controllers/IonicoController/RGBController_Ionico.h +++ b/Controllers/IonicoController/RGBController_Ionico.h @@ -24,17 +24,14 @@ public: ~RGBController_Ionico(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void SetSingleLED(); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); + void DeviceSaveMode(); - void DeviceUpdateMode(); - private: IonicoController* controller; }; diff --git a/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.cpp b/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.cpp index 8a8f1bb0e..0b54620b5 100644 --- a/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.cpp +++ b/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.cpp @@ -207,13 +207,11 @@ void RGBController_JGINYUEInternalUSB::SetupZones() zones[0].type = ZONE_TYPE_LINEAR; zones[0].leds_min = 0; zones[0].leds_max = 100; - zones[0].matrix_map = NULL; zones[1].name = "ARGB Header 2"; zones[1].type = ZONE_TYPE_LINEAR; zones[1].leds_min = 0; zones[1].leds_max = 100; - zones[1].matrix_map = NULL; if(first_run) { @@ -235,7 +233,7 @@ void RGBController_JGINYUEInternalUSB::SetupZones() SetupColors(); } -void RGBController_JGINYUEInternalUSB::ResizeZone(int zone, int new_size) +void RGBController_JGINYUEInternalUSB::DeviceResizeZone(int zone, int new_size) { unsigned char area; @@ -263,11 +261,11 @@ void RGBController_JGINYUEInternalUSB::DeviceUpdateLEDs() { for(int i = 0; i < JGINYUE_MAX_ZONES; i++) { - UpdateZoneLEDs(i); + DeviceUpdateZoneLEDs(i); } } -void RGBController_JGINYUEInternalUSB::UpdateZoneLEDs(int zone) +void RGBController_JGINYUEInternalUSB::DeviceUpdateZoneLEDs(int zone) { unsigned char area; @@ -287,11 +285,11 @@ void RGBController_JGINYUEInternalUSB::UpdateZoneLEDs(int zone) controller->DirectLEDControl(zones[zone].colors,area); } -void RGBController_JGINYUEInternalUSB::UpdateSingleLED(int led) +void RGBController_JGINYUEInternalUSB::DeviceUpdateSingleLED(int led) { int zone; zone = leds[led].value; - UpdateZoneLEDs(zone); + DeviceUpdateZoneLEDs(zone); } void RGBController_JGINYUEInternalUSB::DeviceUpdateMode() diff --git a/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.h b/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.h index 6a5918fc7..c06148a5d 100644 --- a/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.h +++ b/Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.h @@ -24,11 +24,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.cpp b/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.cpp index 80799093c..27614a08f 100644 --- a/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.cpp +++ b/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.cpp @@ -368,7 +368,7 @@ void RGBController_JGINYUEInternalUSBV2::SetupZones() SetupColors(); } -void RGBController_JGINYUEInternalUSBV2::ResizeZone(int zone, int new_size) +void RGBController_JGINYUEInternalUSBV2::DeviceResizeZone(int zone, int new_size) { unsigned char area; @@ -400,11 +400,11 @@ void RGBController_JGINYUEInternalUSBV2::DeviceUpdateLEDs() for(int i = 0; i < normal_zone_count; i++) { - UpdateZoneLEDs(i); + DeviceUpdateZoneLEDs(i); } } -void RGBController_JGINYUEInternalUSBV2::UpdateZoneLEDs(int zone) +void RGBController_JGINYUEInternalUSBV2::DeviceUpdateZoneLEDs(int zone) { unsigned char area; area = controller->device_config[zone].Area_ID; @@ -412,12 +412,12 @@ void RGBController_JGINYUEInternalUSBV2::UpdateZoneLEDs(int zone) controller->DirectLEDControl(zones[zone].colors, zones[zone].leds_count, area); } -void RGBController_JGINYUEInternalUSBV2::UpdateSingleLED(int led) +void RGBController_JGINYUEInternalUSBV2::DeviceUpdateSingleLED(int led) { int zone; zone = leds[led].value; - UpdateZoneLEDs(zone); + DeviceUpdateZoneLEDs(zone); } void RGBController_JGINYUEInternalUSBV2::DeviceUpdateMode() @@ -477,7 +477,6 @@ void RGBController_JGINYUEInternalUSBV2::InitZones() zone_to_init->leds_max = cfg->Max_LED_numbers; zone_to_init->leds_count = 0; zone_to_init->type = ZONE_TYPE_LINEAR; - zone_to_init->matrix_map = NULL; switch(cfg->Area_ID) { diff --git a/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.h b/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.h index 93d904186..87ceef6aa 100644 --- a/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.h +++ b/Controllers/JGINYUEInternalUSBV2Controller/RGBController_JGINYUEInternalUSBV2.h @@ -24,11 +24,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceUpdateZoneMode(int zone); diff --git a/Controllers/KasaSmartController/RGBController_KasaSmart.cpp b/Controllers/KasaSmartController/RGBController_KasaSmart.cpp index 0c8616ab2..9187e1278 100644 --- a/Controllers/KasaSmartController/RGBController_KasaSmart.cpp +++ b/Controllers/KasaSmartController/RGBController_KasaSmart.cpp @@ -83,7 +83,6 @@ void RGBController_KasaSmart::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -94,13 +93,6 @@ void RGBController_KasaSmart::SetupZones() SetupColors(); } -void RGBController_KasaSmart::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*-------------------------------------------*\ - | This device does not support resizing zones | - \*-------------------------------------------*/ -} - void RGBController_KasaSmart::DeviceUpdateLEDs() { if(modes[active_mode].value != KASA_SMART_MODE_DIRECT) @@ -115,12 +107,12 @@ void RGBController_KasaSmart::DeviceUpdateLEDs() controller->SetColor(red, grn, blu, type); } -void RGBController_KasaSmart::UpdateZoneLEDs(int /*zone*/) +void RGBController_KasaSmart::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_KasaSmart::UpdateSingleLED(int /*led*/) +void RGBController_KasaSmart::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/KasaSmartController/RGBController_KasaSmart.h b/Controllers/KasaSmartController/RGBController_KasaSmart.h index e70fa10b1..582c2faa3 100644 --- a/Controllers/KasaSmartController/RGBController_KasaSmart.h +++ b/Controllers/KasaSmartController/RGBController_KasaSmart.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.cpp b/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.cpp index 739642d20..400f3d7b3 100644 --- a/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.cpp +++ b/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.cpp @@ -615,21 +615,19 @@ void RGBController_KeychronKeyboard::SetupZones() unsigned int zone_size = 0; zone keyboard_zone; - keyboard_zone.name = ZONE_EN_KEYBOARD; - keyboard_zone.type = ZONE_TYPE_MATRIX; + keyboard_zone.name = ZONE_EN_KEYBOARD; + keyboard_zone.type = ZONE_TYPE_MATRIX; - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->height = keyboard.height; - keyboard_zone.matrix_map->width = keyboard.width; - - keyboard_zone.matrix_map->map = new unsigned int[keyboard.height * keyboard.width]; + keyboard_zone.matrix_map.height = keyboard.height; + keyboard_zone.matrix_map.width = keyboard.width; + keyboard_zone.matrix_map.map.resize(keyboard.height * keyboard.width); for(unsigned int w = 0; w < keyboard.width; w++) { for(unsigned int h = 0; h < keyboard.height; h++) { unsigned int key = keyboard.matrix_map[h][w]; - keyboard_zone.matrix_map->map[h * keyboard.width + w] = key; + keyboard_zone.matrix_map.map[h * keyboard.width + w] = key; if(key != NA) { @@ -650,29 +648,22 @@ void RGBController_KeychronKeyboard::SetupZones() SetupColors(); } -void RGBController_KeychronKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_KeychronKeyboard::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_KeychronKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_KeychronKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetMode(modes, active_mode, colors); } -void RGBController_KeychronKeyboard::UpdateSingleLED(int led) +void RGBController_KeychronKeyboard::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_KeychronKeyboard::DeviceUpdateMode() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } diff --git a/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.h b/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.h index 2c506bb5d..1ddf9fc07 100644 --- a/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.h +++ b/Controllers/KeychronKeyboardController/RGBController_KeychronKeyboard.h @@ -21,11 +21,10 @@ public: ~RGBController_KeychronKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.cpp b/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.cpp index 73c4e34f7..623589e30 100644 --- a/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.cpp +++ b/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.cpp @@ -392,7 +392,6 @@ void RGBController_KingstonFuryDRAM::SetupZones() new_zone->leds_min = controller->GetLEDPerDIMM(); new_zone->leds_max = new_zone->leds_min; new_zone->leds_count = new_zone->leds_min; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); } @@ -417,15 +416,6 @@ void RGBController_KingstonFuryDRAM::SetupZones() SetupColors(); } -void RGBController_KingstonFuryDRAM::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ - LOG_DEBUG("[%s] resize zone", - FURY_CONTROLLER_NAME); -} - // some modes have different actual values to be written, depending on the color mode unsigned char RGBController_KingstonFuryDRAM::GetRealModeValue() { @@ -698,12 +688,12 @@ void RGBController_KingstonFuryDRAM::DeviceUpdateLEDs() controller->SendApply(); } -void RGBController_KingstonFuryDRAM::UpdateZoneLEDs(int /*zone*/) +void RGBController_KingstonFuryDRAM::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_KingstonFuryDRAM::UpdateSingleLED(int /*led*/) +void RGBController_KingstonFuryDRAM::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.h b/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.h index 9b8966841..264d86966 100644 --- a/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.h +++ b/Controllers/KingstonFuryDRAMController/RGBController_KingstonFuryDRAM.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LEDStripController/RGBController_LEDStrip.cpp b/Controllers/LEDStripController/RGBController_LEDStrip.cpp index 5d6c8d968..0afc4adff 100644 --- a/Controllers/LEDStripController/RGBController_LEDStrip.cpp +++ b/Controllers/LEDStripController/RGBController_LEDStrip.cpp @@ -54,7 +54,6 @@ void RGBController_LEDStrip::SetupZones() led_zone.leds_min = controller->num_leds; led_zone.leds_max = controller->num_leds; led_zone.leds_count = controller->num_leds; - led_zone.matrix_map = NULL; zones.push_back(led_zone); for(int led_idx = 0; led_idx < controller->num_leds; led_idx++) @@ -69,24 +68,17 @@ void RGBController_LEDStrip::SetupZones() SetupColors(); } -void RGBController_LEDStrip::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LEDStrip::DeviceUpdateLEDs() { controller->SetLEDs(colors); } -void RGBController_LEDStrip::UpdateZoneLEDs(int /*zone*/) +void RGBController_LEDStrip::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_LEDStrip::UpdateSingleLED(int /*led*/) +void RGBController_LEDStrip::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/LEDStripController/RGBController_LEDStrip.h b/Controllers/LEDStripController/RGBController_LEDStrip.h index c5acf1807..bc183fcbd 100644 --- a/Controllers/LEDStripController/RGBController_LEDStrip.h +++ b/Controllers/LEDStripController/RGBController_LEDStrip.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LGMonitorController/RGBController_LGMonitor.cpp b/Controllers/LGMonitorController/RGBController_LGMonitor.cpp index 475d5ab48..1bf57c425 100644 --- a/Controllers/LGMonitorController/RGBController_LGMonitor.cpp +++ b/Controllers/LGMonitorController/RGBController_LGMonitor.cpp @@ -107,7 +107,6 @@ void RGBController_LGMonitor::SetupZones() new_zone.leds_min = 48; new_zone.leds_max = 48; new_zone.leds_count = 48; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -121,25 +120,18 @@ void RGBController_LGMonitor::SetupZones() SetupColors(); } -void RGBController_LGMonitor::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LGMonitor::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); controller->SetDirect(colors); } -void RGBController_LGMonitor::UpdateZoneLEDs(int /*zone*/) +void RGBController_LGMonitor::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LGMonitor::UpdateSingleLED(int /*led*/) +void RGBController_LGMonitor::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -155,7 +147,7 @@ void RGBController_LGMonitor::KeepaliveThread() { if((modes[active_mode].value == LG_MONITOR_DIRECT_MODE_VALUE) && (std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(500)) { - UpdateLEDs(); + UpdateLEDsInternal(); } std::this_thread::sleep_for(15ms); diff --git a/Controllers/LGMonitorController/RGBController_LGMonitor.h b/Controllers/LGMonitorController/RGBController_LGMonitor.h index f35b556f3..308d3e6ee 100644 --- a/Controllers/LGMonitorController/RGBController_LGMonitor.h +++ b/Controllers/LGMonitorController/RGBController_LGMonitor.h @@ -22,10 +22,11 @@ public: ~RGBController_LGMonitor(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); + void DeviceUpdateMode(); private: diff --git a/Controllers/LIFXController/RGBController_LIFX.cpp b/Controllers/LIFXController/RGBController_LIFX.cpp index 274b00104..52df0d8a6 100644 --- a/Controllers/LIFXController/RGBController_LIFX.cpp +++ b/Controllers/LIFXController/RGBController_LIFX.cpp @@ -65,7 +65,6 @@ void RGBController_LIFX::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -83,7 +82,6 @@ void RGBController_LIFX::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = zone_count; led_zone.leds_count = zone_count; - led_zone.matrix_map = NULL; zones.push_back(led_zone); @@ -104,24 +102,17 @@ void RGBController_LIFX::SetupZones() SetupColors(); } -void RGBController_LIFX::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LIFX::DeviceUpdateLEDs() { controller->SetColors(colors); } -void RGBController_LIFX::UpdateZoneLEDs(int /*zone*/) +void RGBController_LIFX::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LIFX::UpdateSingleLED(int /*led*/) +void RGBController_LIFX::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LIFXController/RGBController_LIFX.h b/Controllers/LIFXController/RGBController_LIFX.h index 88e9972f8..d54d13f40 100644 --- a/Controllers/LIFXController/RGBController_LIFX.h +++ b/Controllers/LIFXController/RGBController_LIFX.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.cpp b/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.cpp index bb19bc36b..0cb58f538 100644 --- a/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.cpp +++ b/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.cpp @@ -159,7 +159,6 @@ void RGBController_LaviewTechnology::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -177,21 +176,17 @@ RGBController_LaviewTechnology::~RGBController_LaviewTechnology() delete controller; } -void RGBController_LaviewTechnology::ResizeZone(int /*zone*/, int /*new_size*/) -{ -} - void RGBController_LaviewTechnology::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_LaviewTechnology::UpdateZoneLEDs(int /*zone*/) +void RGBController_LaviewTechnology::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_LaviewTechnology::UpdateSingleLED(int /*led*/) +void RGBController_LaviewTechnology::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.h b/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.h index 8a7421c5f..9f38f3474 100644 --- a/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.h +++ b/Controllers/LaviewTechnologyController/LaviewTechnologyController/RGBController_LaviewTechnology.h @@ -21,11 +21,10 @@ public: ~RGBController_LaviewTechnology(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.cpp b/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.cpp index 8516d8a6d..7b3c76b1d 100644 --- a/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.cpp +++ b/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.cpp @@ -93,7 +93,6 @@ void RGBController_LegoDimensionsToypadBase::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -105,29 +104,22 @@ void RGBController_LegoDimensionsToypadBase::SetupZones() SetupColors(); } -void RGBController_LegoDimensionsToypadBase::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LegoDimensionsToypadBase::DeviceUpdateLEDs() { for(unsigned int zone = 0; zone < zones.size(); zone++) { - UpdateZoneLEDs(zone); + DeviceUpdateZoneLEDs(zone); } } -void RGBController_LegoDimensionsToypadBase::UpdateZoneLEDs(int zone) +void RGBController_LegoDimensionsToypadBase::DeviceUpdateZoneLEDs(int zone) { controller->SetDirect(zone + 1, zones[zone].colors[0]); } -void RGBController_LegoDimensionsToypadBase::UpdateSingleLED(int /*led*/) +void RGBController_LegoDimensionsToypadBase::DeviceUpdateSingleLED(int /*led*/) { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } void RGBController_LegoDimensionsToypadBase::DeviceUpdateMode() diff --git a/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.h b/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.h index b72c34643..b3e39abc4 100644 --- a/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.h +++ b/Controllers/LegoDimensionsToypadBaseController/RGBController_LegoDimensionsToypadBase.h @@ -21,11 +21,10 @@ public: ~RGBController_LegoDimensionsToypadBase(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.cpp b/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.cpp index dd499a713..d303e9acd 100644 --- a/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.cpp +++ b/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.cpp @@ -99,9 +99,6 @@ void RGBController_Lenovo4ZoneUSB::SetupZones() new_zone.leds_max = new_zone.leds_count; new_zone.leds_min = new_zone.leds_count; - new_zone.matrix_map = NULL; - - zones.push_back(new_zone); for(unsigned int led_idx = 0; led_idx < LENOVO_4_ZONE_NUM_LEDS; led_idx++ ) @@ -115,18 +112,11 @@ void RGBController_Lenovo4ZoneUSB::SetupZones() SetupColors(); } -void RGBController_Lenovo4ZoneUSB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - -void RGBController_Lenovo4ZoneUSB::UpdateSingleLED(int /*led*/) +void RGBController_Lenovo4ZoneUSB::DeviceUpdateSingleLED(int /*led*/) { } -void RGBController_Lenovo4ZoneUSB::UpdateZoneLEDs(int /*zone*/) +void RGBController_Lenovo4ZoneUSB::DeviceUpdateZoneLEDs(int /*zone*/) { } diff --git a/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.h b/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.h index 02e61f30d..e96f38cfa 100644 --- a/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.h +++ b/Controllers/LenovoControllers/Lenovo4ZoneUSBController/RGBController_Lenovo4ZoneUSB.h @@ -23,11 +23,10 @@ public: ~RGBController_Lenovo4ZoneUSB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.cpp b/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.cpp index 5cf6c53eb..4cb60d03e 100644 --- a/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.cpp +++ b/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.cpp @@ -286,7 +286,6 @@ void RGBController_LenovoK510::SetupZones() default_zone.leds_min = 1; default_zone.leds_max = 1; default_zone.leds_count = 1; - default_zone.matrix_map = nullptr; zones.emplace_back(default_zone); leds.resize(1); @@ -324,22 +323,17 @@ void RGBController_LenovoK510::ReadAndUpdateCurrentDeviceState() } } -void RGBController_LenovoK510::ResizeZone(int /*zone*/, int /*new_size*/) -{ - // Not Supported -} - void RGBController_LenovoK510::DeviceUpdateLEDs() { // Not Supported } -void RGBController_LenovoK510::UpdateZoneLEDs(int /*zone*/) +void RGBController_LenovoK510::DeviceUpdateZoneLEDs(int /*zone*/) { // Not Supported } -void RGBController_LenovoK510::UpdateSingleLED(int /*led*/) +void RGBController_LenovoK510::DeviceUpdateSingleLED(int /*led*/) { // Not Supported } diff --git a/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.h b/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.h index 0ec40b5ce..c586c090f 100644 --- a/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.h +++ b/Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.h @@ -21,11 +21,10 @@ public: ~RGBController_LenovoK510(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.cpp b/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.cpp index c793417b3..36e393360 100644 --- a/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.cpp +++ b/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.cpp @@ -84,7 +84,6 @@ void RGBController_LenovoM300::SetupZones() default_zone.leds_min = 1; default_zone.leds_max = 1; default_zone.leds_count = 1; - default_zone.matrix_map = nullptr; zones.emplace_back(default_zone); leds.resize(1); @@ -93,23 +92,18 @@ void RGBController_LenovoM300::SetupZones() SetupColors(); } -void RGBController_LenovoM300::ResizeZone(int /*zone*/, int /*new_size*/) -{ - // Not Supported -} - void RGBController_LenovoM300::DeviceUpdateLEDs() { const mode& active = modes[active_mode]; controller->SetMode(active.colors, active.value, active.brightness); } -void RGBController_LenovoM300::UpdateZoneLEDs(int /*zone*/) +void RGBController_LenovoM300::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LenovoM300::UpdateSingleLED(int /*led*/) +void RGBController_LenovoM300::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.h b/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.h index c43b0b778..fc606bf13 100644 --- a/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.h +++ b/Controllers/LenovoControllers/LenovoM300Controller/RGBController_LenovoM300.h @@ -21,11 +21,10 @@ public: ~RGBController_LenovoM300(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.cpp b/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.cpp index d6f3c4690..8dbefb216 100644 --- a/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.cpp +++ b/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.cpp @@ -332,14 +332,7 @@ void RGBController_LenovoUSB::SetupZones() if(lenovo_zones[i].type == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = lenovo_zones[i].height; - new_zone.matrix_map->width = lenovo_zones[i].width; - new_zone.matrix_map->map = (unsigned int *) lenovo_zones[i].matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(lenovo_zones[i].height, lenovo_zones[i].width, (unsigned int *)lenovo_zones[i].matrix_map); } zones.push_back(new_zone); @@ -356,14 +349,7 @@ void RGBController_LenovoUSB::SetupZones() SetupColors(); } -void RGBController_LenovoUSB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - -void RGBController_LenovoUSB::UpdateSingleLED(int led) +void RGBController_LenovoUSB::DeviceUpdateSingleLED(int led) { if(led != (int)NA) { @@ -371,7 +357,7 @@ void RGBController_LenovoUSB::UpdateSingleLED(int led) } } -void RGBController_LenovoUSB::UpdateZoneLEDs(int zone) +void RGBController_LenovoUSB::DeviceUpdateZoneLEDs(int zone) { uint8_t zone_id = zones[zone].leds_count > 0 ? leds[zones[zone].start_idx].value >> 8 : 0; vector> color_map; diff --git a/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.h b/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.h index 2e54e5b77..486688519 100644 --- a/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.h +++ b/Controllers/LenovoControllers/LenovoUSBController/RGBController_LenovoUSB.h @@ -25,11 +25,10 @@ public: ~RGBController_LenovoUSB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.cpp b/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.cpp index ac7d2b65e..93bf7cf09 100644 --- a/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.cpp +++ b/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.cpp @@ -339,20 +339,11 @@ void LenovoRGBController_Gen7_8::SetupZones() if(lenovo_zones[i].type == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = lenovo_zones[i].height; - new_zone.matrix_map->width = lenovo_zones[i].width; - new_zone.matrix_map->map = new unsigned int[new_zone.matrix_map->height * new_zone.matrix_map->width]; - if(lenovo_zones[i].matrix_map != NULL) { - new_zone.matrix_map->map = (unsigned int *) lenovo_zones[i].matrix_map; + new_zone.matrix_map.Set(lenovo_zones[i].height, lenovo_zones[i].width, (unsigned int *)lenovo_zones[i].matrix_map); } } - else - { - new_zone.matrix_map = NULL; - } zones.push_back(new_zone); @@ -373,19 +364,12 @@ void LenovoRGBController_Gen7_8::SetupZones() SetupColors(); } -void LenovoRGBController_Gen7_8::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - -void LenovoRGBController_Gen7_8::UpdateSingleLED(int /*led*/) +void LenovoRGBController_Gen7_8::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } -void LenovoRGBController_Gen7_8::UpdateZoneLEDs(int /*zone*/) +void LenovoRGBController_Gen7_8::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.h b/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.h index fc192b336..507db1d52 100644 --- a/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.h +++ b/Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.h @@ -37,11 +37,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.cpp b/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.cpp index fc5a4293c..78f5ba9f7 100644 --- a/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.cpp +++ b/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.cpp @@ -141,7 +141,6 @@ void RGBController_LenovoMotherboard::SetupZones() cpu_fan_zone.leds_min = 1; cpu_fan_zone.leds_max = 1; cpu_fan_zone.leds_count = 1; - cpu_fan_zone.matrix_map = nullptr; zones.emplace_back(cpu_fan_zone); @@ -152,7 +151,6 @@ void RGBController_LenovoMotherboard::SetupZones() rear_fan_zone.leds_min = 1; rear_fan_zone.leds_max = 1; rear_fan_zone.leds_count = 1; - rear_fan_zone.matrix_map = nullptr; zones.emplace_back(rear_fan_zone); @@ -167,13 +165,6 @@ void RGBController_LenovoMotherboard::SetupZones() SetupColors(); } -void RGBController_LenovoMotherboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LenovoMotherboard::DeviceUpdateLEDs() { for(uint8_t i = 0; i < leds.size(); i++) @@ -188,12 +179,12 @@ void RGBController_LenovoMotherboard::DeviceUpdateLEDs() } } -void RGBController_LenovoMotherboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_LenovoMotherboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LenovoMotherboard::UpdateSingleLED(int /*led*/) +void RGBController_LenovoMotherboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.h b/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.h index 406f2a30f..41f3a624d 100644 --- a/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.h +++ b/Controllers/LenovoMotherboardController/RGBController_LenovoMotherboard.h @@ -21,11 +21,10 @@ public: ~RGBController_LenovoMotherboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LexipMouseController/RGBController_LexipMouse.cpp b/Controllers/LexipMouseController/RGBController_LexipMouse.cpp index 1f2c83816..e4a4c0689 100644 --- a/Controllers/LexipMouseController/RGBController_LexipMouse.cpp +++ b/Controllers/LexipMouseController/RGBController_LexipMouse.cpp @@ -59,7 +59,6 @@ void RGBController_LexipMouse::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -69,29 +68,22 @@ void RGBController_LexipMouse::SetupZones() SetupColors(); } -void RGBController_LexipMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LexipMouse::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_LexipMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_LexipMouse::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetDirect(colors[0]); } -void RGBController_LexipMouse::UpdateSingleLED(int led) +void RGBController_LexipMouse::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_LexipMouse::DeviceUpdateMode() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } diff --git a/Controllers/LexipMouseController/RGBController_LexipMouse.h b/Controllers/LexipMouseController/RGBController_LexipMouse.h index 2aa8ea308..f35d97d25 100644 --- a/Controllers/LexipMouseController/RGBController_LexipMouse.h +++ b/Controllers/LexipMouseController/RGBController_LexipMouse.h @@ -21,11 +21,10 @@ public: ~RGBController_LexipMouse(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.cpp b/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.cpp index 179ae8ff0..8727765fb 100644 --- a/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.cpp +++ b/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.cpp @@ -293,7 +293,6 @@ void RGBController_LianLiGAIITrinity::SetupZones() gaii_trinity.leds_min = 2; gaii_trinity.leds_max = 2; gaii_trinity.leds_count = 2; - gaii_trinity.matrix_map = NULL; zones.push_back(gaii_trinity); led inner_led; @@ -311,13 +310,6 @@ void RGBController_LianLiGAIITrinity::SetupZones() zones[0].colors[1] = ToRGBColor(0, 0, 255); } -void RGBController_LianLiGAIITrinity::ResizeZone(int /* zone */, int /* new_size */) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LianLiGAIITrinity::DeviceUpdateLEDs() { switch(modes[active_mode].value) @@ -402,12 +394,12 @@ void RGBController_LianLiGAIITrinity::DeviceUpdateLEDs() } } -void RGBController_LianLiGAIITrinity::UpdateZoneLEDs(int /* zone */) +void RGBController_LianLiGAIITrinity::DeviceUpdateZoneLEDs(int /* zone */) { DeviceUpdateLEDs(); } -void RGBController_LianLiGAIITrinity::UpdateSingleLED(int /* led */) +void RGBController_LianLiGAIITrinity::DeviceUpdateSingleLED(int /* led */) { DeviceUpdateLEDs(); } diff --git a/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.h b/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.h index cecd38a88..be5079649 100644 --- a/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.h +++ b/Controllers/LianLiController/LianLiGAIITrinityController/RGBController_LianLiGAIITrinity.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.cpp b/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.cpp index 5a56f09e6..c15e8e3d0 100644 --- a/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.cpp +++ b/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.cpp @@ -166,7 +166,6 @@ void RGBController_LianLiStrimerLConnect::Init_Controller() new_zone.leds_min = 20; new_zone.leds_max = 20; new_zone.leds_count = new_zone.leds_max; - new_zone.matrix_map = NULL; zones.push_back(new_zone); } @@ -179,7 +178,6 @@ void RGBController_LianLiStrimerLConnect::Init_Controller() new_zone.leds_min = 27; new_zone.leds_max = 27; new_zone.leds_count = new_zone.leds_max; - new_zone.matrix_map = NULL; zones.push_back(new_zone); } } @@ -211,13 +209,6 @@ void RGBController_LianLiStrimerLConnect::SetupZones() SetupColors(); } -void RGBController_LianLiStrimerLConnect::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - bool RGBController_LianLiStrimerLConnect::TimeToSend() { /*-----------------------------------------------------*\ @@ -235,7 +226,7 @@ void RGBController_LianLiStrimerLConnect::DeviceUpdateLEDs() for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - UpdateZoneLEDs((int)zone_idx); + DeviceUpdateZoneLEDs((int)zone_idx); } controller->SendApply(); @@ -247,7 +238,7 @@ void RGBController_LianLiStrimerLConnect::DeviceUpdateLEDs() } } -void RGBController_LianLiStrimerLConnect::UpdateZoneLEDs(int zone) +void RGBController_LianLiStrimerLConnect::DeviceUpdateZoneLEDs(int zone) { mode current_mode = modes[active_mode]; @@ -255,9 +246,9 @@ void RGBController_LianLiStrimerLConnect::UpdateZoneLEDs(int zone) controller->SetMode(current_mode.value, zone, current_mode.speed, current_mode.brightness, current_mode.direction, false); } -void RGBController_LianLiStrimerLConnect::UpdateSingleLED(int led) +void RGBController_LianLiStrimerLConnect::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(GetLED_Zone(led)); + DeviceUpdateZoneLEDs(GetLED_Zone(led)); controller->SendApply(); } diff --git a/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.h b/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.h index 11600951b..44a9bf559 100644 --- a/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.h +++ b/Controllers/LianLiController/LianLiStrimerLConnectController/RGBController_LianLiStrimerLConnect.h @@ -23,11 +23,10 @@ public: ~RGBController_LianLiStrimerLConnect(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.cpp b/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.cpp index 1e19a3305..58b5e7b74 100644 --- a/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.cpp +++ b/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.cpp @@ -355,17 +355,6 @@ RGBController_LianLiUniHubAL::RGBController_LianLiUniHubAL(LianLiUniHubALControl RGBController_LianLiUniHubAL::~RGBController_LianLiUniHubAL() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -403,10 +392,7 @@ void RGBController_LianLiUniHubAL::SetupZones() zones[channel_idx].type = ZONE_TYPE_MATRIX; zones[channel_idx].leds_min = 0; zones[channel_idx].leds_max = UNIHUB_AL_CHAN_LED_COUNT; - zones[channel_idx].matrix_map = new matrix_map_type; - zones[channel_idx].matrix_map->height = 8; - zones[channel_idx].matrix_map->width = 35; - zones[channel_idx].matrix_map->map = (unsigned int *)&matrix_map; + zones[channel_idx].matrix_map.Set(8, 35, (unsigned int *)&matrix_map); } else // Treat as regular LED strip { @@ -436,7 +422,7 @@ void RGBController_LianLiUniHubAL::SetupZones() SetupColors(); } -void RGBController_LianLiUniHubAL::ResizeZone(int zone, int new_size) +void RGBController_LianLiUniHubAL::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -467,7 +453,7 @@ void RGBController_LianLiUniHubAL::DeviceUpdateLEDs() } } -void RGBController_LianLiUniHubAL::UpdateZoneLEDs(int zone) +void RGBController_LianLiUniHubAL::DeviceUpdateZoneLEDs(int zone) { if(!initializedMode) { @@ -479,7 +465,7 @@ void RGBController_LianLiUniHubAL::UpdateZoneLEDs(int zone) controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count, brightness_scale); } -void RGBController_LianLiUniHubAL::UpdateSingleLED(int /* led */) +void RGBController_LianLiUniHubAL::DeviceUpdateSingleLED(int /* led */) { DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.h b/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.h index 6ca124540..f5b56f7a0 100644 --- a/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.h +++ b/Controllers/LianLiController/LianLiUniHubALController/RGBController_LianLiUniHubAL.h @@ -25,11 +25,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.cpp b/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.cpp index f7a777973..0582e2e03 100644 --- a/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.cpp +++ b/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.cpp @@ -265,14 +265,12 @@ void RGBController_LianLiUniHub::SetupZones() leds.push_back(new_led); } - - zones[channel_idx].matrix_map = NULL; } SetupColors(); } -void RGBController_LianLiUniHub::ResizeZone(int zone, int new_size) +void RGBController_LianLiUniHub::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -303,7 +301,7 @@ void RGBController_LianLiUniHub::DeviceUpdateLEDs() controller->Synchronize(); } -void RGBController_LianLiUniHub::UpdateZoneLEDs(int zone) +void RGBController_LianLiUniHub::DeviceUpdateZoneLEDs(int zone) { if(!initializedMode) { @@ -318,7 +316,7 @@ void RGBController_LianLiUniHub::UpdateZoneLEDs(int zone) controller->Synchronize(); } -void RGBController_LianLiUniHub::UpdateSingleLED(int led) +void RGBController_LianLiUniHub::DeviceUpdateSingleLED(int led) { if(!initializedMode) { diff --git a/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.h b/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.h index fae6d969e..e4ef77982 100644 --- a/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.h +++ b/Controllers/LianLiController/LianLiUniHubController/RGBController_LianLiUniHub.h @@ -22,11 +22,11 @@ public: RGBController_LianLiUniHub(LianLiUniHubController* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.cpp b/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.cpp index 5971b7005..fe17b9c81 100644 --- a/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.cpp +++ b/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.cpp @@ -87,11 +87,11 @@ void LianLiUniHubSLController::UpdateMode(const std::vector &zones, const for (size_t channel = 0; channel < zones.size(); channel++) { - UpdateZoneLEDs(channel, zones[channel], active); + DeviceUpdateZoneLEDs(channel, zones[channel], active); } } -void LianLiUniHubSLController::UpdateZoneLEDs(size_t channel, const zone &z, const mode &active) +void LianLiUniHubSLController::DeviceUpdateZoneLEDs(size_t channel, const zone &z, const mode &active) { /*---------------------------------*\ | Handle per-LED color mode | diff --git a/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.h b/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.h index 0af69618c..81899557d 100644 --- a/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.h +++ b/Controllers/LianLiController/LianLiUniHubSLController/LianLiUniHubSLController.h @@ -93,7 +93,7 @@ public: std::string GetLocation() { return this->location; }; void UpdateMode(const std::vector &zones, const mode &active); - void UpdateZoneLEDs(size_t channel, const zone &z, const mode &active); + void DeviceUpdateZoneLEDs(size_t channel, const zone &z, const mode &active); private: hid_device *device; @@ -109,11 +109,11 @@ private: unsigned char ConvertBrightness(unsigned int brightness); unsigned char ConvertSpeed(unsigned int speed); unsigned char ConvertDirection(unsigned int direction); - + void SendActivate(size_t channel, unsigned char num_fans); void SendMerge(); void SendColor(size_t channel, const unsigned char *color_buf, size_t color_buf_len); void SendMode(size_t channel, const mode &active); - + void LogBuffer(const char *operation, const unsigned char *buf, size_t len); }; diff --git a/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.cpp b/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.cpp index f22bc0c4f..8572ff6a1 100644 --- a/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.cpp +++ b/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.cpp @@ -305,7 +305,6 @@ void RGBController_LianLiUniHubSL::SetupZones() zones[zone_idx].name = "Channel "; zones[zone_idx].name.append(std::to_string(zone_idx + 1)); zones[zone_idx].type = ZONE_TYPE_LINEAR; - zones[zone_idx].matrix_map = NULL; zones[zone_idx].leds_min = 0; zones[zone_idx].leds_max = UNIHUB_SL_MAX_FAN_PER_CHANNEL; @@ -330,7 +329,7 @@ void RGBController_LianLiUniHubSL::SetupZones() SetupColors(); } -void RGBController_LianLiUniHubSL::ResizeZone(int zone, int new_size) +void RGBController_LianLiUniHubSL::DeviceResizeZone(int zone, int new_size) { if((size_t)zone >= zones.size()) { @@ -350,16 +349,16 @@ void RGBController_LianLiUniHubSL::DeviceUpdateLEDs() DeviceUpdateMode(); } -void RGBController_LianLiUniHubSL::UpdateZoneLEDs(int zone) +void RGBController_LianLiUniHubSL::DeviceUpdateZoneLEDs(int zone) { if(!initialized) { return DeviceUpdateMode(); } - controller->UpdateZoneLEDs(zone, zones[zone], modes[active_mode]); + controller->DeviceUpdateZoneLEDs(zone, zones[zone], modes[active_mode]); } -void RGBController_LianLiUniHubSL::UpdateSingleLED(int /* led */) +void RGBController_LianLiUniHubSL::DeviceUpdateSingleLED(int /* led */) { DeviceUpdateMode(); } diff --git a/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.h b/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.h index b63eb8ed7..8afddd8a0 100644 --- a/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.h +++ b/Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.h @@ -23,11 +23,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.cpp b/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.cpp index 3802ced8d..e0ecb2fe4 100644 --- a/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.cpp +++ b/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.cpp @@ -369,7 +369,7 @@ void RGBController_LianLiUniHubSLInfinity::SetupZones() SetupColors(); } -void RGBController_LianLiUniHubSLInfinity::ResizeZone(int zone, int new_size) +void RGBController_LianLiUniHubSLInfinity::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -400,7 +400,7 @@ void RGBController_LianLiUniHubSLInfinity::DeviceUpdateLEDs() } } -void RGBController_LianLiUniHubSLInfinity::UpdateZoneLEDs(int zone) +void RGBController_LianLiUniHubSLInfinity::DeviceUpdateZoneLEDs(int zone) { if(!initializedMode) { @@ -412,7 +412,7 @@ void RGBController_LianLiUniHubSLInfinity::UpdateZoneLEDs(int zone) controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count, brightness_scale); } -void RGBController_LianLiUniHubSLInfinity::UpdateSingleLED(int /* led */) +void RGBController_LianLiUniHubSLInfinity::DeviceUpdateSingleLED(int /* led */) { DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.h b/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.h index a8c0b2915..4f418f16c 100644 --- a/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.h +++ b/Controllers/LianLiController/LianLiUniHubSLInfinityController/RGBController_LianLiUniHubSLInfinity.h @@ -27,11 +27,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.cpp b/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.cpp index 447f07e19..92e95678d 100644 --- a/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.cpp +++ b/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.cpp @@ -368,7 +368,7 @@ void RGBController_LianLiUniHubSLV2::SetupZones() SetupColors(); } -void RGBController_LianLiUniHubSLV2::ResizeZone(int zone, int new_size) +void RGBController_LianLiUniHubSLV2::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -399,7 +399,7 @@ void RGBController_LianLiUniHubSLV2::DeviceUpdateLEDs() } } -void RGBController_LianLiUniHubSLV2::UpdateZoneLEDs(int zone) +void RGBController_LianLiUniHubSLV2::DeviceUpdateZoneLEDs(int zone) { if(!initializedMode) { @@ -411,7 +411,7 @@ void RGBController_LianLiUniHubSLV2::UpdateZoneLEDs(int zone) controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count, brightness_scale); } -void RGBController_LianLiUniHubSLV2::UpdateSingleLED(int /* led */) +void RGBController_LianLiUniHubSLV2::DeviceUpdateSingleLED(int /* led */) { DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.h b/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.h index 919b2363e..4e8667b46 100644 --- a/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.h +++ b/Controllers/LianLiController/LianLiUniHubSLV2Controller/RGBController_LianLiUniHubSLV2.h @@ -26,11 +26,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.cpp b/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.cpp index 1c91880fb..fa56e36fb 100644 --- a/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.cpp +++ b/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.cpp @@ -403,14 +403,12 @@ void RGBController_LianLiUniHub_AL10::SetupZones() leds.push_back(new_led); } - - zones[channel_idx].matrix_map = NULL; } SetupColors(); } -void RGBController_LianLiUniHub_AL10::ResizeZone(int zone, int new_size) +void RGBController_LianLiUniHub_AL10::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -441,7 +439,7 @@ void RGBController_LianLiUniHub_AL10::DeviceUpdateLEDs() controller->Synchronize(); } -void RGBController_LianLiUniHub_AL10::UpdateZoneLEDs(int zone) +void RGBController_LianLiUniHub_AL10::DeviceUpdateZoneLEDs(int zone) { if(!initializedMode) { @@ -456,7 +454,7 @@ void RGBController_LianLiUniHub_AL10::UpdateZoneLEDs(int zone) controller->Synchronize(); } -void RGBController_LianLiUniHub_AL10::UpdateSingleLED(int led) +void RGBController_LianLiUniHub_AL10::DeviceUpdateSingleLED(int led) { if(!initializedMode) { diff --git a/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.h b/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.h index 849bb2c52..9931fa752 100644 --- a/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.h +++ b/Controllers/LianLiController/LianLiUniHub_AL10Controller/RGBController_LianLiUniHub_AL10.h @@ -24,11 +24,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.cpp b/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.cpp index 7c3e34c96..38829065c 100644 --- a/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.cpp +++ b/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.cpp @@ -53,7 +53,6 @@ void RGBController_LianLiUniversalScreen::SetupZones() Screen.leds_min = 60; Screen.leds_max = 60; Screen.leds_count = 60; - Screen.matrix_map = NULL; zones.push_back(Screen); for(std::size_t led_idx = 0; led_idx < Screen.leds_count; led_idx++) @@ -69,22 +68,17 @@ void RGBController_LianLiUniversalScreen::SetupZones() SetupColors(); } -void RGBController_LianLiUniversalScreen::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_LianLiUniversalScreen::DeviceUpdateLEDs() { controller->SetLedColors(colors.data(), colors.size()); } -void RGBController_LianLiUniversalScreen::UpdateZoneLEDs(int /*zone*/) +void RGBController_LianLiUniversalScreen::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LianLiUniversalScreen::UpdateSingleLED(int /*led*/) +void RGBController_LianLiUniversalScreen::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.h b/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.h index 1e4edb18b..94eeb31f3 100644 --- a/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.h +++ b/Controllers/LianLiController/LianLiUniversalScreenController/RGBController_LianLiUniversalScreen.h @@ -20,11 +20,10 @@ public: RGBController_LianLiUniversalScreen(LianLiUniversalScreenController* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LightSaltController/RGBController_LightSalt.cpp b/Controllers/LightSaltController/RGBController_LightSalt.cpp index 00f7036b2..1f121943d 100644 --- a/Controllers/LightSaltController/RGBController_LightSalt.cpp +++ b/Controllers/LightSaltController/RGBController_LightSalt.cpp @@ -33,17 +33,6 @@ static RGBColor DeflectColor(bool deflection, RGBColor color) RGBController_LightSalt::~RGBController_LightSalt() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != nullptr) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -347,10 +336,7 @@ void RGBController_LightSalt::SetupZones() zone.leds_min = table.led.count; zone.leds_max = table.led.count; zone.leds_count = table.led.count; - zone.matrix_map = new matrix_map_type; - zone.matrix_map->height = table.map.height; - zone.matrix_map->width = table.map.width; - zone.matrix_map->map = table.map.matrix; + zone.matrix_map.Set(table.map.height, table.map.width, table.map.matrix); zones.push_back(zone); } @@ -368,7 +354,6 @@ void RGBController_LightSalt::SetupZones() zone.leds_min = 1; zone.leds_max = 1; zone.leds_count = 1; - zone.matrix_map = NULL; zones.push_back(zone); } @@ -383,13 +368,6 @@ void RGBController_LightSalt::SetupZones() colors[colors.size() - 1] = ToRGBColor(0xFF, 0xFF, 0xFF); } -void RGBController_LightSalt::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LightSalt::DeviceUpdateColors(bool save) { int sets = table.led.sets; @@ -427,12 +405,12 @@ void RGBController_LightSalt::DeviceUpdateLEDs() DeviceUpdateColors(false); } -void RGBController_LightSalt::UpdateZoneLEDs(int /*zone*/) +void RGBController_LightSalt::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LightSalt::UpdateSingleLED(int /*led*/) +void RGBController_LightSalt::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LightSaltController/RGBController_LightSalt.h b/Controllers/LightSaltController/RGBController_LightSalt.h index fb7b305a7..4bc3bacae 100644 --- a/Controllers/LightSaltController/RGBController_LightSalt.h +++ b/Controllers/LightSaltController/RGBController_LightSalt.h @@ -23,12 +23,11 @@ public: void SetupModes(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateColors(bool save); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.cpp b/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.cpp index c9d478af2..5726c9186 100644 --- a/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.cpp +++ b/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.cpp @@ -64,7 +64,6 @@ void RGBController_LinuxLED::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -75,13 +74,6 @@ void RGBController_LinuxLED::SetupZones() SetupColors(); } -void RGBController_LinuxLED::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LinuxLED::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -91,12 +83,12 @@ void RGBController_LinuxLED::DeviceUpdateLEDs() controller->SetRGB(red, grn, blu); } -void RGBController_LinuxLED::UpdateZoneLEDs(int /*zone*/) +void RGBController_LinuxLED::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LinuxLED::UpdateSingleLED(int /*led*/) +void RGBController_LinuxLED::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.h b/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.h index 18aef898d..0e93ac848 100644 --- a/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.h +++ b/Controllers/LinuxLEDController/RGBController_LinuxLED_Linux.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.cpp b/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.cpp index e5d838d76..08e2fda91 100644 --- a/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.cpp +++ b/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.cpp @@ -118,7 +118,6 @@ void RGBController_LogitechG203L::SetupZones() g203L_zone.leds_min = 3; g203L_zone.leds_max = 3; g203L_zone.leds_count = 3; - g203L_zone.matrix_map = NULL; zones.push_back(g203L_zone); led g203L_led_l; @@ -139,25 +138,18 @@ void RGBController_LogitechG203L::SetupZones() SetupColors(); } -void RGBController_LogitechG203L::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG203L::DeviceUpdateLEDs() { controller->SetDevice(colors); controller->SetDevice(colors); //dirty workaround for color lag } -void RGBController_LogitechG203L::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG203L::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG203L::UpdateSingleLED(int led) +void RGBController_LogitechG203L::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.h b/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.h index 29539d6fd..adadd5feb 100644 --- a/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.h +++ b/Controllers/LogitechController/LogitechG203LController/RGBController_LogitechG203L.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.cpp b/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.cpp index 13951b577..f3ab54683 100644 --- a/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.cpp +++ b/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.cpp @@ -120,9 +120,6 @@ void RGBController_LogitechG213::SetupZones() new_zone.leds_min = 5; new_zone.leds_max = 5; new_zone.leds_count = 5; - - new_zone.matrix_map = NULL; - zones.push_back(new_zone); for(unsigned int led_idx = 0; led_idx < LOGITECH_G213_ZONES; led_idx++) @@ -136,13 +133,6 @@ void RGBController_LogitechG213::SetupZones() SetupColors(); } -void RGBController_LogitechG213::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG213::DeviceUpdateLEDs() { for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++) @@ -151,12 +141,12 @@ void RGBController_LogitechG213::DeviceUpdateLEDs() } } -void RGBController_LogitechG213::UpdateZoneLEDs(int zone) +void RGBController_LogitechG213::DeviceUpdateZoneLEDs(int zone) { controller->SetDirect((unsigned char) zone, RGBGetRValue(zones[zone].colors[0]), RGBGetGValue(zones[zone].colors[0]), RGBGetBValue(zones[zone].colors[0])); } -void RGBController_LogitechG213::UpdateSingleLED(int led) +void RGBController_LogitechG213::DeviceUpdateSingleLED(int led) { controller->SetDirect(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led])); } @@ -169,7 +159,7 @@ void RGBController_LogitechG213::DeviceUpdateMode() \*---------------------------------------------------------*/ if(active_mode == 0xFFFF) { - UpdateLEDs(); + UpdateLEDsInternal(); return; } diff --git a/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.h b/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.h index c84b044b9..b9e053efb 100644 --- a/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.h +++ b/Controllers/LogitechController/LogitechG213Controller/RGBController_LogitechG213.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.cpp b/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.cpp index 2906336ff..af1874d5f 100644 --- a/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.cpp +++ b/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.cpp @@ -57,7 +57,6 @@ void RGBController_LogitechG560::SetupZones() G560_left_front.leds_min = 1; G560_left_front.leds_max = 1; G560_left_front.leds_count = 1; - G560_left_front.matrix_map = NULL; zones.push_back(G560_left_front); led G560_left_front_led; @@ -72,7 +71,6 @@ void RGBController_LogitechG560::SetupZones() G560_right_front.leds_min = 1; G560_right_front.leds_max = 1; G560_right_front.leds_count = 1; - G560_right_front.matrix_map = NULL; zones.push_back(G560_right_front); led G560_right_front_led; @@ -87,7 +85,6 @@ void RGBController_LogitechG560::SetupZones() G560_left_rear.leds_min = 1; G560_left_rear.leds_max = 1; G560_left_rear.leds_count = 1; - G560_left_rear.matrix_map = NULL; zones.push_back(G560_left_rear); led G560_left_read_led; @@ -102,7 +99,6 @@ void RGBController_LogitechG560::SetupZones() G560_right_rear.leds_min = 1; G560_right_rear.leds_max = 1; G560_right_rear.leds_count = 1; - G560_right_rear.matrix_map = NULL; zones.push_back(G560_right_rear); led G560_right_rear_led; @@ -113,13 +109,6 @@ void RGBController_LogitechG560::SetupZones() SetupColors(); } -void RGBController_LogitechG560::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG560::DeviceUpdateLEDs() { for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++) @@ -132,12 +121,12 @@ void RGBController_LogitechG560::DeviceUpdateLEDs() } } -void RGBController_LogitechG560::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG560::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG560::UpdateSingleLED(int /*led*/) +void RGBController_LogitechG560::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.h b/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.h index 3f99b2c7b..89a5f490f 100644 --- a/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.h +++ b/Controllers/LogitechController/LogitechG560Controller/RGBController_LogitechG560.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.cpp b/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.cpp index a9cefe88b..1b41597e8 100644 --- a/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.cpp +++ b/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.cpp @@ -38,7 +38,7 @@ RGBController_LogitechG600::RGBController_LogitechG600(LogitechG600Controller* c Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); - + mode Breathing; Breathing.name = "Breathing"; Breathing.value = LOGITECH_G600_MODE_BREATHING; @@ -75,7 +75,6 @@ void RGBController_LogitechG600::SetupZones() side_lights_zone.leds_min = 1; side_lights_zone.leds_max = 1; side_lights_zone.leds_count = 1; - side_lights_zone.matrix_map = NULL; zones.push_back(side_lights_zone); // Set up LED @@ -86,29 +85,22 @@ void RGBController_LogitechG600::SetupZones() SetupColors(); } -void RGBController_LogitechG600::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | Currently does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG600::DeviceUpdateLEDs() { - controller->SetMode(modes[active_mode].value, modes[active_mode].speed, GetLED(0)); + controller->SetMode(modes[active_mode].value, modes[active_mode].speed, colors[0]); } -void RGBController_LogitechG600::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG600::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG600::UpdateSingleLED(int /*led*/) +void RGBController_LogitechG600::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } void RGBController_LogitechG600::DeviceUpdateMode() { - controller->SetMode(modes[active_mode].value, modes[active_mode].speed, GetLED(0)); + controller->SetMode(modes[active_mode].value, modes[active_mode].speed, colors[0]); } diff --git a/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.h b/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.h index 0f4780920..a7f1c2680 100644 --- a/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.h +++ b/Controllers/LogitechController/LogitechG600Controller/RGBController_LogitechG600.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.cpp b/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.cpp index 81cf7445a..4cf7ea304 100644 --- a/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.cpp +++ b/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.cpp @@ -241,17 +241,6 @@ RGBController_LogitechG810::RGBController_LogitechG810(LogitechG810Controller* c RGBController_LogitechG810::~RGBController_LogitechG810() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -272,14 +261,7 @@ void RGBController_LogitechG810::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 23, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -298,13 +280,6 @@ void RGBController_LogitechG810::SetupZones() SetupColors(); } -void RGBController_LogitechG810::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG810::DeviceUpdateLEDs() { #define MAX_FRAMES_PER_PACKET 0x0E @@ -352,12 +327,12 @@ void RGBController_LogitechG810::DeviceUpdateLEDs() controller->Commit(); } -void RGBController_LogitechG810::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG810::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG810::UpdateSingleLED(int led) +void RGBController_LogitechG810::DeviceUpdateSingleLED(int led) { unsigned char frame[4]; unsigned char zone; @@ -383,7 +358,7 @@ void RGBController_LogitechG810::DeviceUpdateMode() \*---------------------------------------------------------*/ if(active_mode == 0xFFFF) { - UpdateLEDs(); + UpdateLEDsInternal(); return; } diff --git a/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.h b/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.h index bc3f32f1f..6764fead3 100644 --- a/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.h +++ b/Controllers/LogitechController/LogitechG810Controller/RGBController_LogitechG810.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.cpp b/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.cpp index 3cb7ae0d3..313156569 100644 --- a/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.cpp +++ b/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.cpp @@ -246,17 +246,6 @@ RGBController_LogitechG815::RGBController_LogitechG815(LogitechG815Controller* c RGBController_LogitechG815::~RGBController_LogitechG815() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -277,14 +266,7 @@ void RGBController_LogitechG815::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 27; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 27, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -302,13 +284,6 @@ void RGBController_LogitechG815::SetupZones() SetupColors(); } -void RGBController_LogitechG815::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG815::DeviceUpdateLEDs() { std::map> ledsByColors; @@ -490,12 +465,12 @@ void RGBController_LogitechG815::DeviceUpdateLEDs() } } -void RGBController_LogitechG815::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG815::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG815::UpdateSingleLED(int /*led*/) +void RGBController_LogitechG815::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.h b/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.h index b8db46446..4820868e4 100644 --- a/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.h +++ b/Controllers/LogitechController/LogitechG815Controller/RGBController_LogitechG815.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.cpp b/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.cpp index c8a46f6f3..c73877837 100644 --- a/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.cpp +++ b/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.cpp @@ -242,17 +242,6 @@ RGBController_LogitechG910::RGBController_LogitechG910(LogitechG910Controller* c RGBController_LogitechG910::~RGBController_LogitechG910() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -273,14 +262,7 @@ void RGBController_LogitechG910::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 8; - new_zone.matrix_map->width = 24; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(8, 24, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -299,13 +281,6 @@ void RGBController_LogitechG910::SetupZones() SetupColors(); } -void RGBController_LogitechG910::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG910::DeviceUpdateLEDs() { #define MAX_FRAMES_PER_PACKET 0x0E @@ -353,12 +328,12 @@ void RGBController_LogitechG910::DeviceUpdateLEDs() controller->Commit(); } -void RGBController_LogitechG910::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG910::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG910::UpdateSingleLED(int led) +void RGBController_LogitechG910::DeviceUpdateSingleLED(int led) { unsigned char frame[4]; unsigned char zone; @@ -384,7 +359,7 @@ void RGBController_LogitechG910::DeviceUpdateMode() \*---------------------------------------------------------*/ if(active_mode == 0xFFFF) { - UpdateLEDs(); + UpdateLEDsInternal(); return; } diff --git a/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.h b/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.h index 5f80364c7..35b33e09f 100644 --- a/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.h +++ b/Controllers/LogitechController/LogitechG910Controller/RGBController_LogitechG910.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.cpp b/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.cpp index ad097f737..d78e5ef41 100644 --- a/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.cpp +++ b/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.cpp @@ -381,17 +381,6 @@ RGBController_LogitechG915::RGBController_LogitechG915(LogitechG915Controller* c RGBController_LogitechG915::~RGBController_LogitechG915() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -413,24 +402,15 @@ void RGBController_LogitechG915::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; if(is_tkl) { - new_zone.matrix_map->map = (unsigned int *)&matrix_map_tkl; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 20; + new_zone.matrix_map.Set(7, 20, (unsigned int *)&matrix_map_tkl); } else { - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 27; + new_zone.matrix_map.Set(7, 27, (unsigned int *)&matrix_map); } } - else - { - new_zone.matrix_map = NULL; - } zones.push_back(new_zone); @@ -447,13 +427,6 @@ void RGBController_LogitechG915::SetupZones() SetupColors(); } -void RGBController_LogitechG915::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG915::DeviceUpdateLEDs() { std::map> ledsByColors; @@ -608,12 +581,12 @@ void RGBController_LogitechG915::DeviceUpdateLEDs() controller->Commit(); } -void RGBController_LogitechG915::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG915::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG915::UpdateSingleLED(int /*led*/) +void RGBController_LogitechG915::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.h b/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.h index 04f23ee4a..27a13d92d 100644 --- a/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.h +++ b/Controllers/LogitechController/LogitechG915Controller/RGBController_LogitechG915.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.cpp b/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.cpp index ea294c0a7..6aefdb8e5 100644 --- a/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.cpp +++ b/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.cpp @@ -58,7 +58,6 @@ void RGBController_LogitechG933::SetupZones() G933_logo.leds_min = 1; G933_logo.leds_max = 1; G933_logo.leds_count = 1; - G933_logo.matrix_map = NULL; zones.push_back(G933_logo); led G933_logo_led; @@ -72,7 +71,6 @@ void RGBController_LogitechG933::SetupZones() G933_strip.leds_min = 1; G933_strip.leds_max = 1; G933_strip.leds_count = 1; - G933_strip.matrix_map = NULL; zones.push_back(G933_strip); led G933_strip_led; @@ -83,13 +81,6 @@ void RGBController_LogitechG933::SetupZones() SetupColors(); } -void RGBController_LogitechG933::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechG933::DeviceUpdateLEDs() { for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++) @@ -102,12 +93,12 @@ void RGBController_LogitechG933::DeviceUpdateLEDs() } } -void RGBController_LogitechG933::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechG933::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechG933::UpdateSingleLED(int /*led*/) +void RGBController_LogitechG933::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.h b/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.h index 25b265010..5a36b2c5b 100644 --- a/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.h +++ b/Controllers/LogitechController/LogitechG933Controller/RGBController_LogitechG933.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.cpp b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.cpp index f40de9afa..b81173342 100644 --- a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.cpp +++ b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.cpp @@ -96,7 +96,6 @@ void RGBController_LogitechGLightsync::SetupZones() GLightsync_primary_zone.leds_min = 1; GLightsync_primary_zone.leds_max = 1; GLightsync_primary_zone.leds_count = 1; - GLightsync_primary_zone.matrix_map = NULL; zones.push_back(GLightsync_primary_zone); led GLightsync_primary_led; @@ -109,7 +108,6 @@ void RGBController_LogitechGLightsync::SetupZones() GLightsync_logo_zone.leds_min = 1; GLightsync_logo_zone.leds_max = 1; GLightsync_logo_zone.leds_count = 1; - GLightsync_logo_zone.matrix_map = NULL; zones.push_back(GLightsync_logo_zone); led GLightsync_logo_led; @@ -119,20 +117,13 @@ void RGBController_LogitechGLightsync::SetupZones() SetupColors(); } -void RGBController_LogitechGLightsync::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechGLightsync::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); - UpdateZoneLEDs(1); + DeviceUpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(1); } -void RGBController_LogitechGLightsync::UpdateZoneLEDs(int zone) +void RGBController_LogitechGLightsync::DeviceUpdateZoneLEDs(int zone) { unsigned char red = RGBGetRValue(colors[zone]); unsigned char grn = RGBGetGValue(colors[zone]); @@ -146,9 +137,9 @@ void RGBController_LogitechGLightsync::UpdateZoneLEDs(int zone) controller->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, modes[active_mode].brightness); } -void RGBController_LogitechGLightsync::UpdateSingleLED(int led) +void RGBController_LogitechGLightsync::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_LogitechGLightsync::DeviceUpdateMode() diff --git a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.h b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.h index 98105b51d..f0c03c980 100644 --- a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.h +++ b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.cpp b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.cpp index 208906c2a..273a39cdc 100644 --- a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.cpp +++ b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.cpp @@ -96,7 +96,6 @@ void RGBController_LogitechGLightsync1zone::SetupZones() GLightsync_logo_zone.leds_min = 1; GLightsync_logo_zone.leds_max = 1; GLightsync_logo_zone.leds_count = 1; - GLightsync_logo_zone.matrix_map = NULL; zones.push_back(GLightsync_logo_zone); led GLightsync_logo_led; @@ -106,19 +105,12 @@ void RGBController_LogitechGLightsync1zone::SetupZones() SetupColors(); } -void RGBController_LogitechGLightsync1zone::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechGLightsync1zone::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_LogitechGLightsync1zone::UpdateZoneLEDs(int zone) +void RGBController_LogitechGLightsync1zone::DeviceUpdateZoneLEDs(int zone) { unsigned char red = RGBGetRValue(colors[zone]); unsigned char grn = RGBGetGValue(colors[zone]); @@ -132,9 +124,9 @@ void RGBController_LogitechGLightsync1zone::UpdateZoneLEDs(int zone) controller->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, modes[active_mode].brightness); } -void RGBController_LogitechGLightsync1zone::UpdateSingleLED(int led) +void RGBController_LogitechGLightsync1zone::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_LogitechGLightsync1zone::DeviceUpdateMode() diff --git a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.h b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.h index c625abcd6..fd1654c2e 100644 --- a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.h +++ b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGLightsync1zone.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.cpp b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.cpp index 7d89320ab..163bfa4d5 100644 --- a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.cpp +++ b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.cpp @@ -90,7 +90,6 @@ void RGBController_LogitechGPowerPlay::SetupZones() GPowerPlay_logo_zone.leds_min = 1; GPowerPlay_logo_zone.leds_max = 1; GPowerPlay_logo_zone.leds_count = 1; - GPowerPlay_logo_zone.matrix_map = NULL; zones.push_back(GPowerPlay_logo_zone); led GPowerPlay_logo_led; @@ -100,19 +99,12 @@ void RGBController_LogitechGPowerPlay::SetupZones() SetupColors(); } -void RGBController_LogitechGPowerPlay::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechGPowerPlay::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_LogitechGPowerPlay::UpdateZoneLEDs(int zone) +void RGBController_LogitechGPowerPlay::DeviceUpdateZoneLEDs(int zone) { unsigned char red = RGBGetRValue(colors[zone]); unsigned char grn = RGBGetGValue(colors[zone]); @@ -126,9 +118,9 @@ void RGBController_LogitechGPowerPlay::UpdateZoneLEDs(int zone) controller->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, /* Brightness */ 0x64); } -void RGBController_LogitechGPowerPlay::UpdateSingleLED(int led) +void RGBController_LogitechGPowerPlay::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_LogitechGPowerPlay::DeviceUpdateMode() diff --git a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.h b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.h index e9acd05b8..4b8e73817 100644 --- a/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.h +++ b/Controllers/LogitechController/LogitechGLightsyncController/RGBController_LogitechGPowerPlay.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.cpp b/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.cpp index 061fa4d76..5afe9c6c4 100644 --- a/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.cpp +++ b/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.cpp @@ -218,17 +218,6 @@ RGBController_LogitechGProKeyboard::RGBController_LogitechGProKeyboard(LogitechG RGBController_LogitechGProKeyboard::~RGBController_LogitechGProKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -249,14 +238,7 @@ void RGBController_LogitechGProKeyboard::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 7; - new_zone.matrix_map->width = 19; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(7, 19, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -275,13 +257,6 @@ void RGBController_LogitechGProKeyboard::SetupZones() SetupColors(); } -void RGBController_LogitechGProKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechGProKeyboard::DeviceUpdateLEDs() { #define MAX_FRAMES_PER_PACKET 0x0E @@ -329,12 +304,12 @@ void RGBController_LogitechGProKeyboard::DeviceUpdateLEDs() controller->Commit(); } -void RGBController_LogitechGProKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechGProKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_LogitechGProKeyboard::UpdateSingleLED(int led) +void RGBController_LogitechGProKeyboard::DeviceUpdateSingleLED(int led) { unsigned char frame[4]; unsigned char zone; @@ -360,7 +335,7 @@ void RGBController_LogitechGProKeyboard::DeviceUpdateMode() \*---------------------------------------------------------*/ if(active_mode == 0xFFFF) { - UpdateLEDs(); + UpdateLEDsInternal(); return; } diff --git a/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.h b/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.h index f72b1daff..d9c0b5e99 100644 --- a/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.h +++ b/Controllers/LogitechController/LogitechGProKeyboardController/RGBController_LogitechGProKeyboard.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.cpp b/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.cpp index 5a50cb00c..112441f41 100644 --- a/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.cpp +++ b/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.cpp @@ -196,7 +196,6 @@ void RGBController_LogitechLightspeed::SetupZones() Lightspeed_logo_zone.leds_min = 1; Lightspeed_logo_zone.leds_max = 1; Lightspeed_logo_zone.leds_count = 1; - Lightspeed_logo_zone.matrix_map = NULL; zones.push_back(Lightspeed_logo_zone); Lightspeed_logo_led.value = (unsigned int)i; @@ -207,22 +206,15 @@ void RGBController_LogitechLightspeed::SetupZones() SetupColors(); } -void RGBController_LogitechLightspeed::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechLightspeed::DeviceUpdateLEDs() { for(std::vector::iterator led_index = leds.begin(); led_index != leds.end(); led_index++) { - UpdateZoneLEDs(led_index->value); + DeviceUpdateZoneLEDs(led_index->value); } } -void RGBController_LogitechLightspeed::UpdateZoneLEDs(int zone) +void RGBController_LogitechLightspeed::DeviceUpdateZoneLEDs(int zone) { unsigned char red = RGBGetRValue(colors[zone]); unsigned char grn = RGBGetGValue(colors[zone]); @@ -231,9 +223,9 @@ void RGBController_LogitechLightspeed::UpdateZoneLEDs(int zone) controller->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu, modes[active_mode].brightness); } -void RGBController_LogitechLightspeed::UpdateSingleLED(int led) +void RGBController_LogitechLightspeed::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_LogitechLightspeed::DeviceUpdateMode() diff --git a/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.h b/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.h index ea48ccf21..b349a2c21 100644 --- a/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.h +++ b/Controllers/LogitechController/LogitechLightspeedController/RGBController_LogitechLightspeed.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.cpp b/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.cpp index 3c2d4cad8..232a53ab6 100644 --- a/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.cpp +++ b/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.cpp @@ -61,7 +61,6 @@ void RGBController_LogitechX56::SetupZones() x56_zone.leds_min = 1; x56_zone.leds_max = 1; x56_zone.leds_count = 1; - x56_zone.matrix_map = NULL; zones.push_back(x56_zone); led x56_led; @@ -71,19 +70,12 @@ void RGBController_LogitechX56::SetupZones() SetupColors(); } -void RGBController_LogitechX56::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_LogitechX56::DeviceUpdateLEDs() { controller->SetColor(colors[0], modes[active_mode].brightness); } -void RGBController_LogitechX56::UpdateZoneLEDs(int /*zone*/) +void RGBController_LogitechX56::DeviceUpdateZoneLEDs(int /*zone*/) { /*---------------------------------------------------------*\ | Packet expects both LEDs | @@ -91,7 +83,7 @@ void RGBController_LogitechX56::UpdateZoneLEDs(int /*zone*/) DeviceUpdateLEDs(); } -void RGBController_LogitechX56::UpdateSingleLED(int /*led*/) +void RGBController_LogitechX56::DeviceUpdateSingleLED(int /*led*/) { /*---------------------------------------------------------*\ | Packet expects both LEDs | diff --git a/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.h b/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.h index b98b289b5..bdec63988 100644 --- a/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.h +++ b/Controllers/LogitechController/LogitechX56Controller/RGBController_LogitechX56.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/LuxaforController/RGBController_Luxafor.cpp b/Controllers/LuxaforController/RGBController_Luxafor.cpp index dd352c07a..9170921c0 100644 --- a/Controllers/LuxaforController/RGBController_Luxafor.cpp +++ b/Controllers/LuxaforController/RGBController_Luxafor.cpp @@ -137,7 +137,6 @@ void RGBController_Luxafor::SetupZones() flag_zone.leds_min = 3; flag_zone.leds_max = 3; flag_zone.leds_count = 3; - flag_zone.matrix_map = NULL; zones.push_back(flag_zone); for(std::size_t led_idx = 0; led_idx < flag_zone.leds_count; led_idx++) @@ -156,7 +155,6 @@ void RGBController_Luxafor::SetupZones() rear_zone.leds_min = 3; rear_zone.leds_max = 3; rear_zone.leds_count = 3; - rear_zone.matrix_map = NULL; zones.push_back(rear_zone); for(std::size_t led_idx = 0; led_idx < rear_zone.leds_count; led_idx++) @@ -172,30 +170,23 @@ void RGBController_Luxafor::SetupZones() SetupColors(); } -void RGBController_Luxafor::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*-----------------------------------------------------*\ - | This device does not support resizing zones | - \*-----------------------------------------------------*/ -} - void RGBController_Luxafor::DeviceUpdateLEDs() { for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - UpdateZoneLEDs((int)zone_idx); + DeviceUpdateZoneLEDs((int)zone_idx); } } -void RGBController_Luxafor::UpdateZoneLEDs(int zone) +void RGBController_Luxafor::DeviceUpdateZoneLEDs(int zone) { for(unsigned int led_idx = 0; led_idx < zones[zone].leds_count; led_idx++) { - UpdateSingleLED((int)(zones[zone].start_idx + led_idx)); + DeviceUpdateSingleLED((int)(zones[zone].start_idx + led_idx)); } } -void RGBController_Luxafor::UpdateSingleLED(int led) +void RGBController_Luxafor::DeviceUpdateSingleLED(int led) { if(modes[active_mode].color_mode == MODE_COLORS_PER_LED) { diff --git a/Controllers/LuxaforController/RGBController_Luxafor.h b/Controllers/LuxaforController/RGBController_Luxafor.h index a0d6fedfa..086971673 100644 --- a/Controllers/LuxaforController/RGBController_Luxafor.h +++ b/Controllers/LuxaforController/RGBController_Luxafor.h @@ -38,11 +38,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.cpp b/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.cpp index 6ac70a84f..12b727571 100644 --- a/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.cpp +++ b/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.cpp @@ -21,13 +21,12 @@ void RGBController_MNTKeyboard::CommonInit() modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR; modes[0].color_mode = MODE_COLORS_PER_LED; SetupZones(); - SetAllLEDs(ToRGBColor(255, 255, 255)); + SetAllColors(ToRGBColor(255, 255, 255)); DeviceUpdateLEDs(); } RGBController_MNTKeyboard::~RGBController_MNTKeyboard() { - delete zones[0].matrix_map; delete controller; } @@ -36,10 +35,7 @@ void RGBController_MNTKeyboard::SetupZones() zone new_zone; new_zone.type = ZONE_TYPE_MATRIX; new_zone.leds_count = KBD_ROWS * controller->kbd_cols; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = KBD_ROWS; - new_zone.matrix_map->width = controller->kbd_cols; - new_zone.matrix_map->map = (unsigned int *)matrix_keys; + new_zone.matrix_map.Set(KBD_ROWS, controller->kbd_cols, (unsigned int *)matrix_keys); zones.push_back(new_zone); for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++) { @@ -65,14 +61,11 @@ void RGBController_MNTKeyboard::DeviceUpdateLEDs() delete[] color_map; } -void RGBController_MNTKeyboard::ResizeZone(int, int) -{ -} -void RGBController_MNTKeyboard::UpdateZoneLEDs(int) +void RGBController_MNTKeyboard::DeviceUpdateZoneLEDs(int) { DeviceUpdateLEDs(); } -void RGBController_MNTKeyboard::UpdateSingleLED(int) +void RGBController_MNTKeyboard::DeviceUpdateSingleLED(int) { DeviceUpdateLEDs(); } diff --git a/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.h b/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.h index d7817bdee..751b1eebc 100644 --- a/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.h +++ b/Controllers/MNTKeyboardController/RGBController_MNTKeyboard.h @@ -21,17 +21,19 @@ class RGBController_MNTKeyboard : public RGBController { public: ~RGBController_MNTKeyboard(); - void SetupZones(); - void DeviceUpdateLEDs(); - void ResizeZone(int, int); - void UpdateZoneLEDs(int); - void UpdateSingleLED(int); + void SetupZones(); + + void DeviceUpdateLEDs(); + void DeviceUpdateZoneLEDs(int); + void DeviceUpdateSingleLED(int); + void DeviceUpdateMode(); protected: - const char **led_names; - unsigned int *matrix_keys; + const char ** led_names; + unsigned int * matrix_keys; + MNTKeyboardController * controller; + void CommonInit(); - MNTKeyboardController *controller; }; diff --git a/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp b/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp index 0132d186f..b2f58bd60 100644 --- a/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp +++ b/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp @@ -59,7 +59,6 @@ void RGBController_MSI3Zone::SetupZones() keyboard_zone.leds_min = 3; keyboard_zone.leds_max = 3; keyboard_zone.leds_count = 3; - keyboard_zone.matrix_map = NULL; zones.push_back(keyboard_zone); led left_led; @@ -83,7 +82,6 @@ void RGBController_MSI3Zone::SetupZones() aux_zone.leds_min = 1; aux_zone.leds_max = 1; aux_zone.leds_count = 1; - aux_zone.matrix_map = NULL; zones.push_back(aux_zone); led aux_led; @@ -93,24 +91,17 @@ void RGBController_MSI3Zone::SetupZones() SetupColors(); } -void RGBController_MSI3Zone::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_MSI3Zone::DeviceUpdateLEDs() { controller->SetLEDs(colors); } -void RGBController_MSI3Zone::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSI3Zone::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetLEDs(colors); } -void RGBController_MSI3Zone::UpdateSingleLED(int /*led*/) +void RGBController_MSI3Zone::DeviceUpdateSingleLED(int /*led*/) { controller->SetLEDs(colors); } diff --git a/Controllers/MSI3ZoneController/RGBController_MSI3Zone.h b/Controllers/MSI3ZoneController/RGBController_MSI3Zone.h index da68c7afe..95381c347 100644 --- a/Controllers/MSI3ZoneController/RGBController_MSI3Zone.h +++ b/Controllers/MSI3ZoneController/RGBController_MSI3Zone.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.cpp b/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.cpp index 0c69c37b7..84444ee36 100644 --- a/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.cpp +++ b/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.cpp @@ -28,7 +28,7 @@ int RGBController_MSIGPU::GetDeviceMode() return(active_mode); } -int RGBController_MSIGPU::GetModeSpeed() +int RGBController_MSIGPU::GetSpeed() { unsigned char mode_speed = controller->MSIGPURegisterRead(MSI_GPU_REG_SPEED); @@ -318,7 +318,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * controller_ptr) SetupZones(); active_mode = GetDeviceMode(); - modes[active_mode].speed = GetModeSpeed(); + modes[active_mode].speed = GetSpeed(); modes[active_mode].brightness = controller->MSIGPURegisterRead(MSI_GPU_REG_BRIGHTNESS) / MSI_GPU_BRIGHTNESS_MULTI; } @@ -338,7 +338,6 @@ void RGBController_MSIGPU::SetupZones() msi_gpu_zone.leds_min = 1; msi_gpu_zone.leds_max = 1; msi_gpu_zone.leds_count = 3; - msi_gpu_zone.matrix_map = NULL; zones.push_back(msi_gpu_zone); /*---------------------------------------------------------*\ @@ -374,13 +373,6 @@ void RGBController_MSIGPU::SetupZones() colors[2] = ToRGBColor(r3, g3, b3); } -void RGBController_MSIGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - bool RGBController_MSIGPU::TimeToSend() { /*-----------------------------------------------------*\ @@ -413,12 +405,12 @@ void RGBController_MSIGPU::DeviceUpdateLEDs() } } -void RGBController_MSIGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSIGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_MSIGPU::UpdateSingleLED(int /*led*/) +void RGBController_MSIGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.h b/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.h index 71f98c9c6..395240775 100644 --- a/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.h +++ b/Controllers/MSIGPUController/MSIGPUController/RGBController_MSIGPU.h @@ -19,11 +19,10 @@ public: ~RGBController_MSIGPU(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); @@ -34,5 +33,5 @@ private: bool TimeToSend(); int GetDeviceMode(); - int GetModeSpeed(); + int GetSpeed(); }; diff --git a/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.cpp b/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.cpp index 469fd1373..bfe9d078e 100644 --- a/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.cpp +++ b/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.cpp @@ -307,7 +307,6 @@ void RGBController_MSIGPUv2::SetupZones() msi_gpu_zone.leds_min = 1; msi_gpu_zone.leds_max = 1; msi_gpu_zone.leds_count = 1; - msi_gpu_zone.matrix_map = NULL; zones.push_back(msi_gpu_zone); /*---------------------------------------------------------*\ @@ -343,13 +342,6 @@ void RGBController_MSIGPUv2::SetupZones() } -void RGBController_MSIGPUv2::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_MSIGPUv2::DeviceUpdateAll(const mode& current_mode) { switch(current_mode.value) @@ -464,13 +456,13 @@ void RGBController_MSIGPUv2::DeviceUpdateLEDs() DeviceUpdateAll(modes[active_mode]); } -void RGBController_MSIGPUv2::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSIGPUv2::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateAll(modes[active_mode]); } -void RGBController_MSIGPUv2::UpdateSingleLED(int /*led*/) +void RGBController_MSIGPUv2::DeviceUpdateSingleLED(int /*led*/) { /*---------------------------------------------------------*\ | This device does not support updating single LEDs | diff --git a/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.h b/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.h index bb9599f6d..ebb64041b 100644 --- a/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.h +++ b/Controllers/MSIGPUController/MSIGPUv2Controller/RGBController_MSIGPUv2.h @@ -22,11 +22,10 @@ public: ~RGBController_MSIGPUv2(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.cpp b/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.cpp index f968db1b7..e2f69d501 100644 --- a/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.cpp +++ b/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.cpp @@ -46,14 +46,6 @@ RGBController_MSIKeyboard::~RGBController_MSIKeyboard() delete controller; } -void RGBController_MSIKeyboard::ResizeZone -( - int /*zone*/, - int /*new_size*/ -) -{ -} - void RGBController_MSIKeyboard::SetupZones() { } @@ -102,11 +94,11 @@ void RGBController_MSIKeyboard::DeviceUpdateLEDs() controller->SetMode(msi_mode, speed1, speed2, wave_direction, zone, ck); } -void RGBController_MSIKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSIKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_MSIKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_MSIKeyboard::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.h b/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.h index 2fc0ebad4..e25234992 100644 --- a/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.h +++ b/Controllers/MSIKeyboardController/MSIMysticLightKBController/RGBController_MSIMysticLightKB.h @@ -20,11 +20,10 @@ public: ~RGBController_MSIKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.cpp b/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.cpp index 15954de8f..d9978b4b5 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.cpp +++ b/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.cpp @@ -138,7 +138,6 @@ void RGBController_MSIMysticLight112::SetupZones() new_zone.type = ZONE_TYPE_LINEAR; } - new_zone.matrix_map = NULL; zones.push_back(new_zone); } @@ -164,14 +163,6 @@ void RGBController_MSIMysticLight112::SetupZones() } } -void RGBController_MSIMysticLight112::ResizeZone - ( - int /*zone*/, - int /*new_size*/ - ) -{ -} - void RGBController_MSIMysticLight112::DeviceUpdateLEDs() { for(std::size_t zone_idx = 0; zone_idx < zones.size(); ++zone_idx) @@ -184,7 +175,7 @@ void RGBController_MSIMysticLight112::DeviceUpdateLEDs() controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight112::UpdateZoneLEDs +void RGBController_MSIMysticLight112::DeviceUpdateZoneLEDs ( int zone ) @@ -196,7 +187,7 @@ void RGBController_MSIMysticLight112::UpdateZoneLEDs controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight112::UpdateSingleLED +void RGBController_MSIMysticLight112::DeviceUpdateSingleLED ( int led ) diff --git a/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.h b/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.h index a8d0d7cae..fe4149f26 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.h +++ b/Controllers/MSIMysticLightController/MSIMysticLight112Controller/RGBController_MSIMysticLight112.h @@ -21,11 +21,10 @@ public: ~RGBController_MSIMysticLight112(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.cpp b/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.cpp index 395008814..3fbf61dd2 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.cpp +++ b/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.cpp @@ -141,7 +141,6 @@ void RGBController_MSIMysticLight162::SetupZones() new_zone.type = ZONE_TYPE_LINEAR; } - new_zone.matrix_map = NULL; zones.push_back(new_zone); } @@ -167,14 +166,6 @@ void RGBController_MSIMysticLight162::SetupZones() } } -void RGBController_MSIMysticLight162::ResizeZone - ( - int /*zone*/, - int /*new_size*/ - ) -{ -} - void RGBController_MSIMysticLight162::DeviceUpdateLEDs() { for(std::size_t zone_idx = 0; zone_idx < zones.size(); ++zone_idx) @@ -187,7 +178,7 @@ void RGBController_MSIMysticLight162::DeviceUpdateLEDs() controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight162::UpdateZoneLEDs +void RGBController_MSIMysticLight162::DeviceUpdateZoneLEDs ( int zone ) @@ -199,7 +190,7 @@ void RGBController_MSIMysticLight162::UpdateZoneLEDs controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight162::UpdateSingleLED +void RGBController_MSIMysticLight162::DeviceUpdateSingleLED ( int led ) diff --git a/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.h b/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.h index 81f3f2259..bef68852b 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.h +++ b/Controllers/MSIMysticLightController/MSIMysticLight162Controller/RGBController_MSIMysticLight162.h @@ -23,11 +23,10 @@ public: ~RGBController_MSIMysticLight162(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.cpp b/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.cpp index 466976789..b1f8fc719 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.cpp +++ b/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.cpp @@ -199,8 +199,6 @@ void RGBController_MSIMysticLight185::SetupZones() new_zone.type = ZONE_TYPE_LINEAR; } - new_zone.matrix_map = NULL; - zones.push_back(new_zone); } } @@ -244,7 +242,7 @@ void RGBController_MSIMysticLight185::SetupZones() SetupColors(); } -void RGBController_MSIMysticLight185::ResizeZone +void RGBController_MSIMysticLight185::DeviceResizeZone ( int zone, int new_size @@ -280,7 +278,7 @@ void RGBController_MSIMysticLight185::DeviceUpdateLEDs() controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight185::UpdateZoneLEDs(int zone) +void RGBController_MSIMysticLight185::DeviceUpdateZoneLEDs(int zone) { for(int led_idx = zones[zone].leds_count - 1; led_idx >= 0; led_idx--) { @@ -289,7 +287,7 @@ void RGBController_MSIMysticLight185::UpdateZoneLEDs(int zone) controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight185::UpdateSingleLED +void RGBController_MSIMysticLight185::DeviceUpdateSingleLED ( int led ) diff --git a/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.h b/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.h index c2400ba7b..1090e505f 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.h +++ b/Controllers/MSIMysticLightController/MSIMysticLight185Controller/RGBController_MSIMysticLight185.h @@ -23,11 +23,11 @@ public: ~RGBController_MSIMysticLight185(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.cpp b/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.cpp index 80926d91b..302b8e89f 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.cpp +++ b/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.cpp @@ -44,14 +44,6 @@ RGBController_MSIMysticLight64::~RGBController_MSIMysticLight64() delete controller; } -void RGBController_MSIMysticLight64::ResizeZone -( - int /*zone*/, - int /*new_size*/ -) -{ -} - void RGBController_MSIMysticLight64::SetupZones() { zone msi_zone; @@ -60,7 +52,6 @@ void RGBController_MSIMysticLight64::SetupZones() msi_zone.leds_min = 1; msi_zone.leds_max = 1; msi_zone.leds_count = 1; - msi_zone.matrix_map = NULL; zones.push_back(msi_zone); led msi_led; @@ -96,12 +87,12 @@ void RGBController_MSIMysticLight64::DeviceUpdateLEDs() controller->SetMode(msi_mode, speed, brightness, num_colors, led_colors); } -void RGBController_MSIMysticLight64::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSIMysticLight64::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_MSIMysticLight64::UpdateSingleLED(int /*led*/) +void RGBController_MSIMysticLight64::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.h b/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.h index 16dca94c3..70d2964cf 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.h +++ b/Controllers/MSIMysticLightController/MSIMysticLight64Controller/RGBController_MSIMysticLight64.h @@ -23,11 +23,10 @@ public: ~RGBController_MSIMysticLight64(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.cpp b/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.cpp index 940082fe6..3f716f084 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.cpp +++ b/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.cpp @@ -183,8 +183,6 @@ void RGBController_MSIMysticLight761::SetupZones() new_zone.type = ZONE_TYPE_LINEAR; } - new_zone.matrix_map = NULL; - zones.push_back(new_zone); } } @@ -228,7 +226,7 @@ void RGBController_MSIMysticLight761::SetupZones() } -void RGBController_MSIMysticLight761::ResizeZone +void RGBController_MSIMysticLight761::DeviceResizeZone ( int zone, int new_size @@ -264,7 +262,7 @@ void RGBController_MSIMysticLight761::DeviceUpdateLEDs() controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight761::UpdateZoneLEDs(int zone) +void RGBController_MSIMysticLight761::DeviceUpdateZoneLEDs(int zone) { for(int led_idx = zones[zone].leds_count - 1; led_idx >= 0; led_idx--) { @@ -273,7 +271,7 @@ void RGBController_MSIMysticLight761::UpdateZoneLEDs(int zone) controller->Update((modes[active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE) != 0); } -void RGBController_MSIMysticLight761::UpdateSingleLED +void RGBController_MSIMysticLight761::DeviceUpdateSingleLED ( int led ) diff --git a/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.h b/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.h index 0a6b765ff..8aa841f21 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.h +++ b/Controllers/MSIMysticLightController/MSIMysticLight761Controller/RGBController_MSIMysticLight761.h @@ -22,11 +22,11 @@ public: ~RGBController_MSIMysticLight761(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/MSIOptixController/RGBController_MSIOptix.cpp b/Controllers/MSIOptixController/RGBController_MSIOptix.cpp index 0f92499d0..e460b0241 100644 --- a/Controllers/MSIOptixController/RGBController_MSIOptix.cpp +++ b/Controllers/MSIOptixController/RGBController_MSIOptix.cpp @@ -346,7 +346,6 @@ void RGBController_MSIOptix::SetupZones() new_zone.leds_min = MSI_OPTIX_NUMBER_OF_LEDS; new_zone.leds_max = MSI_OPTIX_NUMBER_OF_LEDS; new_zone.leds_count = MSI_OPTIX_NUMBER_OF_LEDS; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -360,26 +359,19 @@ void RGBController_MSIOptix::SetupZones() SetupColors(); } -void RGBController_MSIOptix::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_MSIOptix::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_MSIOptix::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSIOptix::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetDirect(colors, modes[active_mode].brightness); } -void RGBController_MSIOptix::UpdateSingleLED(int led) +void RGBController_MSIOptix::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_MSIOptix::DeviceUpdateMode() diff --git a/Controllers/MSIOptixController/RGBController_MSIOptix.h b/Controllers/MSIOptixController/RGBController_MSIOptix.h index b2a79bd74..9a0e2d0c5 100644 --- a/Controllers/MSIOptixController/RGBController_MSIOptix.h +++ b/Controllers/MSIOptixController/RGBController_MSIOptix.h @@ -21,11 +21,10 @@ public: ~RGBController_MSIOptix(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MSIRGBController/RGBController_MSIRGB.cpp b/Controllers/MSIRGBController/RGBController_MSIRGB.cpp index 6d2163e75..65d3d99db 100644 --- a/Controllers/MSIRGBController/RGBController_MSIRGB.cpp +++ b/Controllers/MSIRGBController/RGBController_MSIRGB.cpp @@ -55,7 +55,6 @@ void RGBController_MSIRGB::SetupZones() msi_zone.leds_min = 1; msi_zone.leds_max = 1; msi_zone.leds_count = 1; - msi_zone.matrix_map = NULL; zones.push_back(msi_zone); led msi_led; @@ -65,11 +64,6 @@ void RGBController_MSIRGB::SetupZones() SetupColors(); } -void RGBController_MSIRGB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_MSIRGB::DeviceUpdateLEDs() { RGBColor color = colors[0]; @@ -80,12 +74,12 @@ void RGBController_MSIRGB::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_MSIRGB::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSIRGB::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_MSIRGB::UpdateSingleLED(int /*led*/) +void RGBController_MSIRGB::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/MSIRGBController/RGBController_MSIRGB.h b/Controllers/MSIRGBController/RGBController_MSIRGB.h index 13f05b470..a42cb5394 100644 --- a/Controllers/MSIRGBController/RGBController_MSIRGB.h +++ b/Controllers/MSIRGBController/RGBController_MSIRGB.h @@ -21,11 +21,10 @@ public: ~RGBController_MSIRGB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp b/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp index 1cf93213d..9b9256194 100644 --- a/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp +++ b/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp @@ -150,7 +150,6 @@ void RGBController_MSIVigorGK30::SetupZones() new_zone.leds_min = MSI_VIGOR_GK30_LEDS_COUNT; new_zone.leds_max = MSI_VIGOR_GK30_LEDS_COUNT; new_zone.leds_count = MSI_VIGOR_GK30_LEDS_COUNT; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -164,24 +163,17 @@ void RGBController_MSIVigorGK30::SetupZones() SetupColors(); } -void RGBController_MSIVigorGK30::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_MSIVigorGK30::DeviceUpdateLEDs() { - UpdateSingleLED(0); + DeviceUpdateSingleLED(0); } -void RGBController_MSIVigorGK30::UpdateZoneLEDs(int /*zone*/) +void RGBController_MSIVigorGK30::DeviceUpdateZoneLEDs(int /*zone*/) { - UpdateSingleLED(0); + DeviceUpdateSingleLED(0); } -void RGBController_MSIVigorGK30::UpdateSingleLED(int /*led*/) +void RGBController_MSIVigorGK30::DeviceUpdateSingleLED(int /*led*/) { const mode& active = modes[active_mode]; diff --git a/Controllers/MSIVigorController/RGBController_MSIVigorGK30.h b/Controllers/MSIVigorController/RGBController_MSIVigorGK30.h index baa5d5b20..de9621efb 100644 --- a/Controllers/MSIVigorController/RGBController_MSIVigorGK30.h +++ b/Controllers/MSIVigorController/RGBController_MSIVigorGK30.h @@ -21,11 +21,10 @@ public: ~RGBController_MSIVigorGK30(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.cpp b/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.cpp index 35a289209..339be42d6 100644 --- a/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.cpp +++ b/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.cpp @@ -60,7 +60,6 @@ void RGBController_MadCatzCyborg::SetupZones() cyborg_zone.leds_min = 1; cyborg_zone.leds_max = 1; cyborg_zone.leds_count = 1; - cyborg_zone.matrix_map = NULL; zones.push_back(cyborg_zone); @@ -71,11 +70,6 @@ void RGBController_MadCatzCyborg::SetupZones() SetupColors(); } -void RGBController_MadCatzCyborg::ResizeZone(int /*zone*/, int /*new_size*/) -{ - // Single LED device - nothing to resize -} - void RGBController_MadCatzCyborg::DeviceUpdateLEDs() { if(colors.size() > 0) @@ -85,12 +79,12 @@ void RGBController_MadCatzCyborg::DeviceUpdateLEDs() } } -void RGBController_MadCatzCyborg::UpdateZoneLEDs(int /*zone*/) +void RGBController_MadCatzCyborg::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_MadCatzCyborg::UpdateSingleLED(int /*led*/) +void RGBController_MadCatzCyborg::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.h b/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.h index d3e5ebb87..414268465 100644 --- a/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.h +++ b/Controllers/MadCatzCyborgController/RGBController_MadCatzCyborg.h @@ -19,11 +19,10 @@ public: ~RGBController_MadCatzCyborg(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ManliGPUController/RGBController_ManliGPU.cpp b/Controllers/ManliGPUController/RGBController_ManliGPU.cpp index 84f5b7066..658db30d9 100644 --- a/Controllers/ManliGPUController/RGBController_ManliGPU.cpp +++ b/Controllers/ManliGPUController/RGBController_ManliGPU.cpp @@ -153,30 +153,22 @@ void RGBController_ManliGPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; zones.push_back(new_zone); SetupColors(); } -void RGBController_ManliGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ManliGPU::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_ManliGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_ManliGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_ManliGPU::UpdateSingleLED(int /*led*/) +void RGBController_ManliGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/ManliGPUController/RGBController_ManliGPU.h b/Controllers/ManliGPUController/RGBController_ManliGPU.h index 61435f5b1..28ff73a5a 100644 --- a/Controllers/ManliGPUController/RGBController_ManliGPU.h +++ b/Controllers/ManliGPUController/RGBController_ManliGPU.h @@ -23,11 +23,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.cpp b/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.cpp index c11a5f7ee..8cc6a9da6 100644 --- a/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.cpp +++ b/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.cpp @@ -250,31 +250,19 @@ RGBController_MintakaKeyboard::~RGBController_MintakaKeyboard() void RGBController_MintakaKeyboard::SetupZones() { - - /*---------------------------------------------------------*\ - | Create the keyboard zone usiung Keyboard Layout Manager | - \*---------------------------------------------------------*/ - zone new_zone; - new_zone.name = ZONE_EN_KEYBOARD; - new_zone.type = ZONE_TYPE_MATRIX; - KeyboardLayoutManager new_kb(KEYBOARD_LAYOUT_ISO_QWERTY, KEYBOARD_SIZE_SIXTY, mintaka_offset_values); - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_zone.matrix_map->height = new_kb.GetRowCount(); - new_zone.matrix_map->width = new_kb.GetColumnCount(); - - new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width]; - new_zone.leds_count = new_kb.GetKeyCount(); - new_zone.leds_min = new_zone.leds_count; - new_zone.leds_max = new_zone.leds_count; - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | + | Create the keyboard zone using Keyboard Layout Manager | \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, new_map->height, new_map->width); + zone new_zone; + new_zone.name = ZONE_EN_KEYBOARD; + new_zone.type = ZONE_TYPE_MATRIX; + new_zone.leds_count = new_kb.GetKeyCount(); + new_zone.leds_min = new_zone.leds_count; + new_zone.leds_max = new_zone.leds_count; + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); + controller->SetLedSequencePositions(mintaka_offset_values.default_values); /*---------------------------------------------------------*\ @@ -295,29 +283,22 @@ void RGBController_MintakaKeyboard::SetupZones() SetupColors(); } -void RGBController_MintakaKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_MintakaKeyboard::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_MintakaKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_MintakaKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetMode(modes, active_mode, colors); } -void RGBController_MintakaKeyboard::UpdateSingleLED(int led) +void RGBController_MintakaKeyboard::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_MintakaKeyboard::DeviceUpdateMode() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } diff --git a/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.h b/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.h index e986be522..ba06b97b3 100644 --- a/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.h +++ b/Controllers/MintakaKeyboardController/RGBController_MintakaKeyboard.h @@ -21,11 +21,10 @@ public: ~RGBController_MintakaKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.cpp b/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.cpp index aaf6cdb61..3e8e0e032 100644 --- a/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.cpp +++ b/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.cpp @@ -348,17 +348,6 @@ RGBController_Mountain60Keyboard::~RGBController_Mountain60Keyboard() mountain_thread->join(); delete mountain_thread; - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].type == ZONE_TYPE_MATRIX) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -368,19 +357,13 @@ void RGBController_Mountain60Keyboard::SetupZones() new_kb.ChangeKeys(mountain60_keyboard_overlay_no_numpad); zone new_zone; - matrix_map_type * new_map = new matrix_map_type; new_zone.name = "Mountain Everest 60"; new_zone.type = ZONE_TYPE_MATRIX; - new_zone.matrix_map = new_map; - new_zone.matrix_map->height = new_kb.GetRowCount(); - new_zone.matrix_map->width = new_kb.GetColumnCount(); - new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width]; new_zone.leds_count = new_kb.GetKeyCount(); new_zone.leds_min = new_zone.leds_count; new_zone.leds_max = new_zone.leds_count; - - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++) { @@ -395,13 +378,6 @@ void RGBController_Mountain60Keyboard::SetupZones() SetupColors(); } -void RGBController_Mountain60Keyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Mountain60Keyboard::DeviceUpdateLEDs() { unsigned char* color_data = new unsigned char[(leds.size()*4)]; @@ -423,12 +399,12 @@ void RGBController_Mountain60Keyboard::DeviceUpdateLEDs() delete[] color_data; } -void RGBController_Mountain60Keyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_Mountain60Keyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Mountain60Keyboard::UpdateSingleLED(int /*led*/) +void RGBController_Mountain60Keyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.h b/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.h index 00afae146..e813c8114 100644 --- a/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.h +++ b/Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.h @@ -32,11 +32,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.cpp b/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.cpp index 09e529bd7..2b878c6e6 100644 --- a/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.cpp +++ b/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.cpp @@ -688,17 +688,6 @@ RGBController_MountainKeyboard::RGBController_MountainKeyboard(MountainKeyboardC RGBController_MountainKeyboard::~RGBController_MountainKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -716,13 +705,9 @@ void RGBController_MountainKeyboard::SetupZones() new_zone.leds_min = zone_definitions[zone_idx].size; new_zone.leds_max = zone_definitions[zone_idx].size; new_zone.leds_count = zone_definitions[zone_idx].size; - new_zone.matrix_map = NULL; if (zone_definitions[zone_idx].type == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = zone_definitions[zone_idx].height; - new_zone.matrix_map->width = zone_definitions[zone_idx].width; - new_zone.matrix_map->map = zone_definitions[zone_idx].ptr; + new_zone.matrix_map.Set(zone_definitions[zone_idx].height, zone_definitions[zone_idx].width, zone_definitions[zone_idx].ptr); } zones.push_back(new_zone); } @@ -767,13 +752,6 @@ void RGBController_MountainKeyboard::SetupZones() SetupColors(); } -void RGBController_MountainKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_MountainKeyboard::DeviceUpdate(const mode& current_mode) { switch(current_mode.value) @@ -1016,12 +994,12 @@ void RGBController_MountainKeyboard::DeviceUpdateLEDs() DeviceUpdate(current_mode); } -void RGBController_MountainKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_MountainKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_MountainKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_MountainKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.h b/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.h index fd6e3643c..e094c69a8 100644 --- a/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.h +++ b/Controllers/MountainKeyboardController/RGBController_MountainKeyboard.h @@ -42,11 +42,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/N5312AController/RGBController_N5312A.cpp b/Controllers/N5312AController/RGBController_N5312A.cpp index 640fca90a..44f7c9833 100644 --- a/Controllers/N5312AController/RGBController_N5312A.cpp +++ b/Controllers/N5312AController/RGBController_N5312A.cpp @@ -97,7 +97,6 @@ void RGBController_N5312A::SetupZones() new_zone.leds_min = N5312A_NUMBER_OF_LEDS; new_zone.leds_max = N5312A_NUMBER_OF_LEDS; new_zone.leds_count = N5312A_NUMBER_OF_LEDS; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -111,26 +110,19 @@ void RGBController_N5312A::SetupZones() SetupColors(); } -void RGBController_N5312A::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_N5312A::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_N5312A::UpdateZoneLEDs(int /*zone*/) +void RGBController_N5312A::DeviceUpdateZoneLEDs(int /*zone*/) { controller->SetColor(colors[0]); } -void RGBController_N5312A::UpdateSingleLED(int led) +void RGBController_N5312A::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_N5312A::DeviceUpdateMode() diff --git a/Controllers/N5312AController/RGBController_N5312A.h b/Controllers/N5312AController/RGBController_N5312A.h index ba80a24c8..0ba51fa69 100644 --- a/Controllers/N5312AController/RGBController_N5312A.h +++ b/Controllers/N5312AController/RGBController_N5312A.h @@ -21,11 +21,10 @@ public: ~RGBController_N5312A(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.cpp b/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.cpp index d1cd5a521..791cfe70c 100644 --- a/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.cpp +++ b/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.cpp @@ -88,7 +88,7 @@ RGBController_NVIDIAIlluminationV1::~RGBController_NVIDIAIlluminationV1() delete controller; } -void RGBController_NVIDIAIlluminationV1::UpdateSingleLED(int) +void RGBController_NVIDIAIlluminationV1::DeviceUpdateSingleLED(int) { DeviceUpdateLEDs(); } @@ -114,7 +114,6 @@ void RGBController_NVIDIAIlluminationV1::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "Entire Zone"; leds.push_back(*new_led); zones.push_back(*new_zone); @@ -124,13 +123,6 @@ void RGBController_NVIDIAIlluminationV1::SetupZones() } -void RGBController_NVIDIAIlluminationV1::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_NVIDIAIlluminationV1::DeviceUpdateLEDs() { NVIDIAIllumination_Config nv_zone_config; @@ -142,7 +134,7 @@ void RGBController_NVIDIAIlluminationV1::DeviceUpdateLEDs() } } -void RGBController_NVIDIAIlluminationV1::UpdateZoneLEDs(int zone) +void RGBController_NVIDIAIlluminationV1::DeviceUpdateZoneLEDs(int zone) { NVIDIAIllumination_Config nv_zone_config; nv_zone_config.colors[0] = colors[zone]; diff --git a/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.h b/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.h index 6cce3dec2..5793360e3 100644 --- a/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.h +++ b/Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination_Windows_Linux.h @@ -24,11 +24,10 @@ class RGBController_NVIDIAIlluminationV1 : public RGBController ~RGBController_NVIDIAIlluminationV1(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.cpp b/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.cpp index 9c32f78f1..9d4318967 100644 --- a/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.cpp +++ b/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.cpp @@ -193,7 +193,6 @@ void RGBController_NZXTHue1::SetupZones() new_zone->leds_min = 0; new_zone->leds_max = 40; new_zone->leds_count = controller->num_leds; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); @@ -249,21 +248,17 @@ void RGBController_NZXTHue1::SetupZones() SetupColors(); } -void RGBController_NZXTHue1::ResizeZone(int /*zone*/, int /*new_size*/) -{ -} - void RGBController_NZXTHue1::DeviceUpdateLEDs() { controller->SetLEDs(zones[0].colors, zones[0].leds_count); } -void RGBController_NZXTHue1::UpdateZoneLEDs(int /*zone*/) +void RGBController_NZXTHue1::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_NZXTHue1::UpdateSingleLED(int /*led*/) +void RGBController_NZXTHue1::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.h b/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.h index b8ffe58cf..e4784ab06 100644 --- a/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.h +++ b/Controllers/NZXTHue1Controller/RGBController_NZXTHue1.h @@ -21,11 +21,10 @@ public: ~RGBController_NZXTHue1(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/NZXTHue2Controller/NZXTHue2Controller.h b/Controllers/NZXTHue2Controller/NZXTHue2Controller.h index 8bbfe7b60..aa7a081db 100644 --- a/Controllers/NZXTHue2Controller/NZXTHue2Controller.h +++ b/Controllers/NZXTHue2Controller/NZXTHue2Controller.h @@ -57,10 +57,12 @@ enum HUE_2_MODE_BREATHING = 0x07, /* Breathing mode */ HUE_2_MODE_CANDLE = 0x08, /* Candle Mode */ HUE_2_MODE_STARRY_NIGHT = 0x09, /* Starry Night mode */ - HUE_2_MODE_RAINBOW_FLOW = 0x0b, /* Rainbow Flow mode */ - HUE_2_MODE_SUPER_RAINBOW = 0x0c, /* Super Rainbow mode */ - HUE_2_MODE_RAINBOW_PULSE = 0x0d, /* Rainbow Pulse mode */ - HUE_2_NUM_MODES /* Number of Hue 2 modes */ + HUE_2_MODE_RAINBOW_FLOW = 0x0B, /* Rainbow Flow mode */ + HUE_2_MODE_SUPER_RAINBOW = 0x0C, /* Super Rainbow mode */ + HUE_2_MODE_RAINBOW_PULSE = 0x0D, /* Rainbow Pulse mode */ + HUE_2_NUM_MODES, /* Number of Hue 2 modes */ + + HUE_2_MODE_DIRECT = 0xFFFF, /* Dummy mode ID for direct mode*/ }; class NZXTHue2Controller diff --git a/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp b/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp index 036dbb5c5..dd292ebc5 100644 --- a/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp +++ b/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp @@ -34,10 +34,21 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt location = controller->GetLocation(); serial = controller->GetSerialString(); + SetupZones(); + SetupModes(); +} + +RGBController_NZXTHue2::~RGBController_NZXTHue2() +{ + delete controller; +} + +void RGBController_NZXTHue2::SetupModes() +{ mode Direct; Direct.name = "Direct"; - Direct.value = 0xFFFF; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.value = HUE_2_MODE_DIRECT; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE; Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); @@ -50,6 +61,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt Static.color_mode = MODE_COLORS_MODE_SPECIFIC; Static.colors.resize(1); modes.push_back(Static); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Static); + } mode Fading; Fading.name = "Fading"; @@ -63,17 +78,25 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt Fading.color_mode = MODE_COLORS_MODE_SPECIFIC; Fading.colors.resize(1); modes.push_back(Fading); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Fading); + } - mode SpectrumCycle; - SpectrumCycle.name = "Spectrum Cycle"; - SpectrumCycle.value = HUE_2_MODE_SPECTRUM; - SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR; - SpectrumCycle.speed_min = HUE_2_SPEED_SLOWEST; - SpectrumCycle.speed_max = HUE_2_SPEED_FASTEST; - SpectrumCycle.speed = HUE_2_SPEED_NORMAL; - SpectrumCycle.direction = MODE_DIRECTION_RIGHT; - SpectrumCycle.color_mode = MODE_COLORS_NONE; - modes.push_back(SpectrumCycle); + mode RainbowWave; + RainbowWave.name = "Rainbow Wave"; + RainbowWave.value = HUE_2_MODE_SPECTRUM; + RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR; + RainbowWave.speed_min = HUE_2_SPEED_SLOWEST; + RainbowWave.speed_max = HUE_2_SPEED_FASTEST; + RainbowWave.speed = HUE_2_SPEED_NORMAL; + RainbowWave.direction = MODE_DIRECTION_RIGHT; + RainbowWave.color_mode = MODE_COLORS_NONE; + modes.push_back(RainbowWave); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(RainbowWave); + } mode Marquee; Marquee.name = "Marquee"; @@ -88,6 +111,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC; Marquee.colors.resize(1); modes.push_back(Marquee); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Marquee); + } mode CoverMarquee; CoverMarquee.name = "Cover Marquee"; @@ -102,6 +129,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt CoverMarquee.color_mode = MODE_COLORS_MODE_SPECIFIC; CoverMarquee.colors.resize(1); modes.push_back(CoverMarquee); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(CoverMarquee); + } mode Alternating; Alternating.name = "Alternating"; @@ -116,6 +147,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt Alternating.color_mode = MODE_COLORS_MODE_SPECIFIC; Alternating.colors.resize(1); modes.push_back(Alternating); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Alternating); + } mode Pulsing; Pulsing.name = "Pulsing"; @@ -129,6 +164,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC; Pulsing.colors.resize(1) ; modes.push_back(Pulsing); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Pulsing); + } mode Breathing; Breathing.name = "Breathing"; @@ -142,6 +181,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC; Breathing.colors.resize( 1); modes.push_back(Breathing); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Breathing); + } mode Candle; Candle.name = "Candle"; @@ -155,6 +198,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt Candle.color_mode = MODE_COLORS_MODE_SPECIFIC; Candle.colors.resize(1) ; modes.push_back(Candle); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Candle); + } mode StarryNight; StarryNight.name = "Starry Night"; @@ -168,6 +215,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt StarryNight.color_mode = MODE_COLORS_MODE_SPECIFIC; StarryNight.colors.resize(1); modes.push_back(StarryNight); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(StarryNight); + } mode SuperRainbow; SuperRainbow.name = "Super Rainbow"; @@ -179,6 +230,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt SuperRainbow.direction = MODE_DIRECTION_RIGHT; SuperRainbow.color_mode = MODE_COLORS_NONE; modes.push_back(SuperRainbow); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(SuperRainbow); + } mode RainbowPulse; RainbowPulse.name = "Rainbow Pulse"; @@ -190,6 +245,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt RainbowPulse.direction = MODE_DIRECTION_RIGHT; RainbowPulse.color_mode = MODE_COLORS_NONE; modes.push_back(RainbowPulse); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(RainbowPulse); + } mode RainbowFlow; RainbowFlow.name = "Rainbow Flow"; @@ -201,13 +260,10 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* controller_pt RainbowFlow.direction = MODE_DIRECTION_RIGHT; RainbowFlow.color_mode = MODE_COLORS_NONE; modes.push_back(RainbowFlow); - - SetupZones(); -} - -RGBController_NZXTHue2::~RGBController_NZXTHue2() -{ - delete controller; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(RainbowFlow); + } } void RGBController_NZXTHue2::SetupZones() @@ -225,7 +281,6 @@ void RGBController_NZXTHue2::SetupZones() new_zone->leds_min = 0; new_zone->leds_max = 40; new_zone->leds_count = controller->channel_leds[zone_idx]; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); } @@ -370,7 +425,7 @@ void RGBController_NZXTHue2::SetupZones() SetupColors(); } -void RGBController_NZXTHue2::ResizeZone(int zone, int new_size) +void RGBController_NZXTHue2::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -390,25 +445,28 @@ void RGBController_NZXTHue2::DeviceUpdateLEDs() { for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - controller->SetChannelLEDs((unsigned char)zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_NZXTHue2::UpdateZoneLEDs(int zone) +void RGBController_NZXTHue2::DeviceUpdateZoneLEDs(int zone) { - controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + if(modes[active_mode].value == HUE_2_MODE_DIRECT) + { + controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + } } -void RGBController_NZXTHue2::UpdateSingleLED(int led) +void RGBController_NZXTHue2::DeviceUpdateSingleLED(int led) { unsigned int zone_idx = leds[led].value; - controller->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); + DeviceUpdateZoneLEDs(zone_idx); } void RGBController_NZXTHue2::DeviceUpdateMode() { - if(modes[active_mode].value == 0xFFFF) + if(modes[active_mode].value == HUE_2_MODE_DIRECT) { DeviceUpdateLEDs(); } @@ -416,27 +474,52 @@ void RGBController_NZXTHue2::DeviceUpdateMode() { for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - RGBColor* colors = NULL; - bool direction = false; + DeviceUpdateZoneMode(zone_idx); + } + } +} - if(modes[active_mode].direction == MODE_DIRECTION_LEFT) +void RGBController_NZXTHue2::DeviceUpdateZoneMode(int zone) +{ + if(modes[active_mode].value == HUE_2_MODE_DIRECT) + { + return; + } + else + { + RGBColor* colors = NULL; + bool direction = false; + mode* mode_ptr = NULL; + + if((zones[zone].active_mode >= 0) && (zones[zone].active_mode < (int)zones[zone].modes.size())) + { + mode_ptr = &zones[zone].modes[zones[zone].active_mode]; + } + else if(active_mode < (int)modes.size()) + { + mode_ptr = &modes[active_mode]; + } + + if(mode_ptr != NULL) + { + if(mode_ptr->direction == MODE_DIRECTION_LEFT) { direction = true; } - if(modes[active_mode].colors.size() > 0) + if(mode_ptr->colors.size() > 0) { - colors = &modes[active_mode].colors[0]; + colors = &mode_ptr->colors[0]; } controller->SetChannelEffect ( - (unsigned char)zone_idx, - modes[active_mode].value, - modes[active_mode].speed, + (unsigned char)zone, + mode_ptr->value, + mode_ptr->speed, direction, colors, - (unsigned int)modes[active_mode].colors.size() + (unsigned int)mode_ptr->colors.size() ); } } diff --git a/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.h b/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.h index ec6bc0429..19411119d 100644 --- a/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.h +++ b/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.h @@ -20,14 +20,17 @@ public: RGBController_NZXTHue2(NZXTHue2Controller* controller_ptr); ~RGBController_NZXTHue2(); + void SetupModes(); void SetupZones(); - void ResizeZone(int zone, int new_size); + + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); + void DeviceUpdateZoneMode(int zone); private: NZXTHue2Controller* controller; diff --git a/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.cpp b/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.cpp index 202dd648f..72f0a9ba5 100644 --- a/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.cpp +++ b/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.cpp @@ -32,50 +32,73 @@ RGBController_HuePlus::RGBController_HuePlus(HuePlusController* controller_ptr) description = "NZXT Hue+ Device"; location = controller->GetLocation(); + SetupZones(); + SetupModes(); +} + +RGBController_HuePlus::~RGBController_HuePlus() +{ + delete controller; +} + +void RGBController_HuePlus::SetupModes() +{ mode Direct; - Direct.name = "Direct"; - Direct.value = HUE_PLUS_MODE_DIRECT; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.value = HUE_PLUS_MODE_DIRECT; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); mode Fading; - Fading.name = "Fading"; - Fading.value = HUE_PLUS_MODE_FADING; - Fading.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; - Fading.speed_min = HUE_PLUS_SPEED_SLOWEST; - Fading.speed_max = HUE_PLUS_SPEED_FASTEST; - Fading.colors_min = 1; - Fading.colors_max = 8; - Fading.speed = HUE_PLUS_SPEED_NORMAL; - Fading.color_mode = MODE_COLORS_MODE_SPECIFIC; + Fading.name = "Fading"; + Fading.value = HUE_PLUS_MODE_FADING; + Fading.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; + Fading.speed_min = HUE_PLUS_SPEED_SLOWEST; + Fading.speed_max = HUE_PLUS_SPEED_FASTEST; + Fading.colors_min = 1; + Fading.colors_max = 8; + Fading.speed = HUE_PLUS_SPEED_NORMAL; + Fading.color_mode = MODE_COLORS_MODE_SPECIFIC; Fading.colors.resize(2); modes.push_back(Fading); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Fading); + } - mode SpectrumCycle; - SpectrumCycle.name = "Spectrum Cycle"; - SpectrumCycle.value = HUE_PLUS_MODE_SPECTRUM; - SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR; - SpectrumCycle.speed_min = HUE_PLUS_SPEED_SLOWEST; - SpectrumCycle.speed_max = HUE_PLUS_SPEED_FASTEST; - SpectrumCycle.speed = HUE_PLUS_SPEED_NORMAL; - SpectrumCycle.direction = MODE_DIRECTION_RIGHT; - SpectrumCycle.color_mode = MODE_COLORS_NONE; - modes.push_back(SpectrumCycle); + mode RainbowWave; + RainbowWave.name = "Rainbow Wave"; + RainbowWave.value = HUE_PLUS_MODE_SPECTRUM; + RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR; + RainbowWave.speed_min = HUE_PLUS_SPEED_SLOWEST; + RainbowWave.speed_max = HUE_PLUS_SPEED_FASTEST; + RainbowWave.speed = HUE_PLUS_SPEED_NORMAL; + RainbowWave.direction = MODE_DIRECTION_RIGHT; + RainbowWave.color_mode = MODE_COLORS_NONE; + modes.push_back(RainbowWave); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(RainbowWave); + } mode Marquee; - Marquee.name = "Marquee"; - Marquee.value = HUE_PLUS_MODE_MARQUEE; - Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; - Marquee.speed_min = HUE_PLUS_SPEED_SLOWEST; - Marquee.speed_max = HUE_PLUS_SPEED_FASTEST; - Marquee.colors_min = 1; - Marquee.colors_max = 1; - Marquee.speed = HUE_PLUS_SPEED_NORMAL; - Marquee.direction = MODE_DIRECTION_RIGHT; - Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC; + Marquee.name = "Marquee"; + Marquee.value = HUE_PLUS_MODE_MARQUEE; + Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; + Marquee.speed_min = HUE_PLUS_SPEED_SLOWEST; + Marquee.speed_max = HUE_PLUS_SPEED_FASTEST; + Marquee.colors_min = 1; + Marquee.colors_max = 1; + Marquee.speed = HUE_PLUS_SPEED_NORMAL; + Marquee.direction = MODE_DIRECTION_RIGHT; + Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC; Marquee.colors.resize(1); modes.push_back(Marquee); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Marquee); + } mode CoverMarquee; CoverMarquee.name = "Cover Marquee"; @@ -90,93 +113,118 @@ RGBController_HuePlus::RGBController_HuePlus(HuePlusController* controller_ptr) CoverMarquee.color_mode = MODE_COLORS_MODE_SPECIFIC; CoverMarquee.colors.resize(2); modes.push_back(CoverMarquee); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(CoverMarquee); + } mode Alternating; - Alternating.name = "Alternating"; - Alternating.value = HUE_PLUS_MODE_ALTERNATING; - Alternating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; - Alternating.speed_min = HUE_PLUS_SPEED_SLOWEST; - Alternating.speed_max = HUE_PLUS_SPEED_FASTEST; - Alternating.colors_min = 1; - Alternating.colors_max = 2; - Alternating.speed = HUE_PLUS_SPEED_NORMAL; - Alternating.direction = MODE_DIRECTION_RIGHT; - Alternating.color_mode = MODE_COLORS_MODE_SPECIFIC; + Alternating.name = "Alternating"; + Alternating.value = HUE_PLUS_MODE_ALTERNATING; + Alternating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; + Alternating.speed_min = HUE_PLUS_SPEED_SLOWEST; + Alternating.speed_max = HUE_PLUS_SPEED_FASTEST; + Alternating.colors_min = 1; + Alternating.colors_max = 2; + Alternating.speed = HUE_PLUS_SPEED_NORMAL; + Alternating.direction = MODE_DIRECTION_RIGHT; + Alternating.color_mode = MODE_COLORS_MODE_SPECIFIC; Alternating.colors.resize(2); modes.push_back(Alternating); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Alternating); + } mode Pulsing; - Pulsing.name = "Pulsing"; - Pulsing.value = HUE_PLUS_MODE_PULSING; - Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; - Pulsing.speed_min = HUE_PLUS_SPEED_SLOWEST; - Pulsing.speed_max = HUE_PLUS_SPEED_FASTEST; - Pulsing.colors_min = 1; - Pulsing.colors_max = 8; - Pulsing.speed = HUE_PLUS_SPEED_NORMAL; - Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC; + Pulsing.name = "Pulsing"; + Pulsing.value = HUE_PLUS_MODE_PULSING; + Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; + Pulsing.speed_min = HUE_PLUS_SPEED_SLOWEST; + Pulsing.speed_max = HUE_PLUS_SPEED_FASTEST; + Pulsing.colors_min = 1; + Pulsing.colors_max = 8; + Pulsing.speed = HUE_PLUS_SPEED_NORMAL; + Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC; Pulsing.colors.resize(2); modes.push_back(Pulsing); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Pulsing); + } mode Breathing; - Breathing.name = "Breathing"; - Breathing.value = HUE_PLUS_MODE_BREATHING; - Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_PER_LED_COLOR; - Breathing.speed_min = HUE_PLUS_SPEED_SLOWEST; - Breathing.speed_max = HUE_PLUS_SPEED_FASTEST; - Breathing.colors_min = 1; - Breathing.colors_max = 8; - Breathing.speed = HUE_PLUS_SPEED_NORMAL; - Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC; + Breathing.name = "Breathing"; + Breathing.value = HUE_PLUS_MODE_BREATHING; + Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_PER_LED_COLOR; + Breathing.speed_min = HUE_PLUS_SPEED_SLOWEST; + Breathing.speed_max = HUE_PLUS_SPEED_FASTEST; + Breathing.colors_min = 1; + Breathing.colors_max = 8; + Breathing.speed = HUE_PLUS_SPEED_NORMAL; + Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC; Breathing.colors.resize(2); modes.push_back(Breathing); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Breathing); + } mode Alert; - Alert.name = "Alert"; - Alert.value = HUE_PLUS_MODE_ALERT; - Alert.flags = 0; - Alert.color_mode = MODE_COLORS_NONE; + Alert.name = "Alert"; + Alert.value = HUE_PLUS_MODE_ALERT; + Alert.flags = 0; + Alert.color_mode = MODE_COLORS_NONE; modes.push_back(Alert); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Alert); + } mode Candlelight; - Candlelight.name = "Candlelight"; - Candlelight.value = HUE_PLUS_MODE_CANDLELIGHT; - Candlelight.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; - Candlelight.colors_min = 1; - Candlelight.colors_max = 1; - Candlelight.color_mode = MODE_COLORS_MODE_SPECIFIC; + Candlelight.name = "Candlelight"; + Candlelight.value = HUE_PLUS_MODE_CANDLELIGHT; + Candlelight.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; + Candlelight.colors_min = 1; + Candlelight.colors_max = 1; + Candlelight.color_mode = MODE_COLORS_MODE_SPECIFIC; Candlelight.colors.resize(1); modes.push_back(Candlelight); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Candlelight); + } mode Wings; - Wings.name = "Wings"; - Wings.value = HUE_PLUS_MODE_WINGS; - Wings.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; - Wings.speed_min = HUE_PLUS_SPEED_SLOWEST; - Wings.speed_max = HUE_PLUS_SPEED_FASTEST; - Wings.colors_min = 1; - Wings.colors_max = 1; - Wings.speed = HUE_PLUS_SPEED_NORMAL; - Wings.color_mode = MODE_COLORS_MODE_SPECIFIC; + Wings.name = "Wings"; + Wings.value = HUE_PLUS_MODE_WINGS; + Wings.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; + Wings.speed_min = HUE_PLUS_SPEED_SLOWEST; + Wings.speed_max = HUE_PLUS_SPEED_FASTEST; + Wings.colors_min = 1; + Wings.colors_max = 1; + Wings.speed = HUE_PLUS_SPEED_NORMAL; + Wings.color_mode = MODE_COLORS_MODE_SPECIFIC; Wings.colors.resize(1); modes.push_back(Wings); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Wings); + } mode Wave; - Wave.name = "Wave"; - Wave.value = HUE_PLUS_MODE_WAVE; - Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR; - Wave.speed_min = HUE_PLUS_SPEED_SLOWEST; - Wave.speed_max = HUE_PLUS_SPEED_FASTEST; - Wave.speed = HUE_PLUS_SPEED_NORMAL; - Wave.color_mode = MODE_COLORS_PER_LED; + Wave.name = "Wave"; + Wave.value = HUE_PLUS_MODE_WAVE; + Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR; + Wave.speed_min = HUE_PLUS_SPEED_SLOWEST; + Wave.speed_max = HUE_PLUS_SPEED_FASTEST; + Wave.speed = HUE_PLUS_SPEED_NORMAL; + Wave.color_mode = MODE_COLORS_PER_LED; modes.push_back(Wave); - - SetupZones(); -} - -RGBController_HuePlus::~RGBController_HuePlus() -{ - delete controller; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Wave); + } } void RGBController_HuePlus::SetupZones() @@ -208,7 +256,6 @@ void RGBController_HuePlus::SetupZones() zones[zone_idx].type = ZONE_TYPE_LINEAR; zones[zone_idx].leds_min = 0; zones[zone_idx].leds_max = 40; - zones[zone_idx].matrix_map = NULL; if(first_run) { @@ -237,7 +284,7 @@ void RGBController_HuePlus::SetupZones() SetupColors(); } -void RGBController_HuePlus::ResizeZone(int zone, int new_size) +void RGBController_HuePlus::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -256,25 +303,28 @@ void RGBController_HuePlus::DeviceUpdateLEDs() { for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - controller->SetChannelLEDs((unsigned char)zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_HuePlus::UpdateZoneLEDs(int zone) +void RGBController_HuePlus::DeviceUpdateZoneLEDs(int zone) { - controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + if(modes[active_mode].value == HUE_PLUS_MODE_DIRECT) + { + controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + } } -void RGBController_HuePlus::UpdateSingleLED(int led) +void RGBController_HuePlus::DeviceUpdateSingleLED(int led) { unsigned int zone_idx = leds[led].value; - controller->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); + DeviceUpdateZoneLEDs(zone_idx); } void RGBController_HuePlus::DeviceUpdateMode() { - if(modes[active_mode].value == HUE_PLUS_MODE_FIXED) + if(modes[active_mode].value == HUE_PLUS_MODE_DIRECT) { DeviceUpdateLEDs(); } @@ -282,27 +332,52 @@ void RGBController_HuePlus::DeviceUpdateMode() { for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - RGBColor* colors = NULL; - bool direction = false; + DeviceUpdateZoneMode(zone_idx); + } + } +} - if(modes[active_mode].direction == MODE_DIRECTION_LEFT) +void RGBController_HuePlus::DeviceUpdateZoneMode(int zone) +{ + if(modes[active_mode].value == HUE_PLUS_MODE_DIRECT) + { + return; + } + else + { + RGBColor* colors = NULL; + bool direction = false; + mode* mode_ptr = NULL; + + if((zones[zone].active_mode >= 0) && (zones[zone].active_mode < (int)zones[zone].modes.size())) + { + mode_ptr = &zones[zone].modes[zones[zone].active_mode]; + } + else if(active_mode < (int)modes.size()) + { + mode_ptr = &modes[active_mode]; + } + + if(mode_ptr != NULL) + { + if(mode_ptr->direction == MODE_DIRECTION_LEFT) { direction = true; } - if(modes[active_mode].colors.size() > 0) + if(mode_ptr->colors.size() > 0) { - colors = &modes[active_mode].colors[0]; + colors = &mode_ptr->colors[0]; } controller->SetChannelEffect ( - (unsigned char)zone_idx, - modes[active_mode].value, - modes[active_mode].speed, + (unsigned char)zone, + mode_ptr->value, + mode_ptr->speed, direction, colors, - (unsigned int)modes[active_mode].colors.size() + (unsigned int)mode_ptr->colors.size() ); } } diff --git a/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.h b/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.h index 9be3281d0..43902a006 100644 --- a/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.h +++ b/Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.h @@ -21,14 +21,17 @@ public: RGBController_HuePlus(HuePlusController* controller_ptr); ~RGBController_HuePlus(); + void SetupModes(); void SetupZones(); - void ResizeZone(int zone, int new_size); + + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); + void DeviceUpdateZoneMode(int zone); private: HuePlusController* controller; diff --git a/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp b/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp index 23541127e..fb880ccbe 100644 --- a/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp +++ b/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp @@ -216,7 +216,6 @@ void RGBController_NZXTKraken::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); zone ring_zone; @@ -225,7 +224,6 @@ void RGBController_NZXTKraken::SetupZones() ring_zone.leds_min = 8; ring_zone.leds_max = 8; ring_zone.leds_count = 8; - ring_zone.matrix_map = NULL; zones.push_back(ring_zone); /*---------------------------------------------------------*\ @@ -245,13 +243,6 @@ void RGBController_NZXTKraken::SetupZones() SetupColors(); } -void RGBController_NZXTKraken::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - std::vector> RGBController_NZXTKraken::GetColors(int zone, const mode& channel_mode) { std::vector> result; @@ -331,7 +322,7 @@ void RGBController_NZXTKraken::DeviceUpdateLEDs() } } -void RGBController_NZXTKraken::UpdateZoneLEDs(int zone) +void RGBController_NZXTKraken::DeviceUpdateZoneLEDs(int zone) { NZXTKrakenChannel_t channel; mode channel_mode = modes[active_mode]; @@ -350,10 +341,10 @@ void RGBController_NZXTKraken::UpdateZoneLEDs(int zone) UpdateChannel(channel, zone, channel_mode); } -void RGBController_NZXTKraken::UpdateSingleLED(int led) +void RGBController_NZXTKraken::DeviceUpdateSingleLED(int led) { int zone = (led > 0) ? 1 : 0; - UpdateZoneLEDs(zone); + DeviceUpdateZoneLEDs(zone); } void RGBController_NZXTKraken::DeviceUpdateMode() diff --git a/Controllers/NZXTKrakenController/RGBController_NZXTKraken.h b/Controllers/NZXTKrakenController/RGBController_NZXTKraken.h index 7f5acaac6..8f4633b69 100644 --- a/Controllers/NZXTKrakenController/RGBController_NZXTKraken.h +++ b/Controllers/NZXTKrakenController/RGBController_NZXTKraken.h @@ -22,11 +22,10 @@ public: ~RGBController_NZXTKraken(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/NZXTMouseController/RGBController_NZXTMouse.cpp b/Controllers/NZXTMouseController/RGBController_NZXTMouse.cpp index e9fa59d72..fabed35e1 100644 --- a/Controllers/NZXTMouseController/RGBController_NZXTMouse.cpp +++ b/Controllers/NZXTMouseController/RGBController_NZXTMouse.cpp @@ -58,7 +58,6 @@ void RGBController_NZXTMouse::SetupZones() left.leds_min = 3; left.leds_max = 3; left.leds_count = 3; - left.matrix_map = NULL; zones.push_back( left ); @@ -77,7 +76,6 @@ void RGBController_NZXTMouse::SetupZones() right.leds_min = 3; right.leds_max = 3; right.leds_count = 3; - right.matrix_map = NULL; zones.push_back( right ); @@ -92,22 +90,17 @@ void RGBController_NZXTMouse::SetupZones() SetupColors(); } -void RGBController_NZXTMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_NZXTMouse::DeviceUpdateLEDs() { controller->SetLEDs(&colors[0]); } -void RGBController_NZXTMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_NZXTMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_NZXTMouse::UpdateSingleLED(int /*led*/) +void RGBController_NZXTMouse::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/NZXTMouseController/RGBController_NZXTMouse.h b/Controllers/NZXTMouseController/RGBController_NZXTMouse.h index 5173af508..464e297e9 100644 --- a/Controllers/NZXTMouseController/RGBController_NZXTMouse.h +++ b/Controllers/NZXTMouseController/RGBController_NZXTMouse.h @@ -21,11 +21,10 @@ public: ~RGBController_NZXTMouse(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/NanoleafController/RGBController_Nanoleaf.cpp b/Controllers/NanoleafController/RGBController_Nanoleaf.cpp index 722a5fad8..e94cb34c5 100644 --- a/Controllers/NanoleafController/RGBController_Nanoleaf.cpp +++ b/Controllers/NanoleafController/RGBController_Nanoleaf.cpp @@ -95,7 +95,6 @@ void RGBController_Nanoleaf::SetupZones() led_zone.leds_count = (unsigned int)controller.GetPanelIds().size(); led_zone.leds_min = led_zone.leds_count; led_zone.leds_max = led_zone.leds_count; - led_zone.matrix_map = NULL; for(std::vector::const_iterator it = controller.GetPanelIds().begin(); it != controller.GetPanelIds().end(); ++it) { @@ -109,24 +108,17 @@ void RGBController_Nanoleaf::SetupZones() SetupColors(); } -void RGBController_Nanoleaf::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Nanoleaf::DeviceUpdateLEDs() { controller.UpdateLEDs(colors); } -void RGBController_Nanoleaf::UpdateZoneLEDs(int /*zone*/) +void RGBController_Nanoleaf::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Nanoleaf::UpdateSingleLED(int /*led*/) +void RGBController_Nanoleaf::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/NanoleafController/RGBController_Nanoleaf.h b/Controllers/NanoleafController/RGBController_Nanoleaf.h index 7d54db7b0..e514a6ad6 100644 --- a/Controllers/NanoleafController/RGBController_Nanoleaf.h +++ b/Controllers/NanoleafController/RGBController_Nanoleaf.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/NollieController/RGBController_Nollie.cpp b/Controllers/NollieController/RGBController_Nollie.cpp index 438d28355..8220d129a 100644 --- a/Controllers/NollieController/RGBController_Nollie.cpp +++ b/Controllers/NollieController/RGBController_Nollie.cpp @@ -132,8 +132,6 @@ void RGBController_Nollie::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[4]; @@ -151,7 +149,7 @@ void RGBController_Nollie::SetupZones() SetupColors(); } -void RGBController_Nollie::ResizeZone(int zone, int new_size) +void RGBController_Nollie::DeviceResizeZone(int zone, int new_size) { /*-----------------------------------------------------*\ | Set whether MOS is enabled or not | @@ -229,12 +227,12 @@ void RGBController_Nollie::DeviceUpdateLEDs() } -void RGBController_Nollie::UpdateZoneLEDs(int zone) +void RGBController_Nollie::DeviceUpdateZoneLEDs(int zone) { controller->SetChannelLEDs(channel_index[zone], zones[zone].colors, zones[zone].leds_count); } -void RGBController_Nollie::UpdateSingleLED(int led) +void RGBController_Nollie::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; controller->SetChannelLEDs(channel_index[channel], zones[channel].colors, zones[channel].leds_count); diff --git a/Controllers/NollieController/RGBController_Nollie.h b/Controllers/NollieController/RGBController_Nollie.h index 4cf589233..630907b7d 100644 --- a/Controllers/NollieController/RGBController_Nollie.h +++ b/Controllers/NollieController/RGBController_Nollie.h @@ -21,11 +21,11 @@ public: ~RGBController_Nollie(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/NvidiaESAController/RGBController_NvidiaESA.cpp b/Controllers/NvidiaESAController/RGBController_NvidiaESA.cpp index 9e9ea3af5..422d8f96b 100644 --- a/Controllers/NvidiaESAController/RGBController_NvidiaESA.cpp +++ b/Controllers/NvidiaESAController/RGBController_NvidiaESA.cpp @@ -70,7 +70,6 @@ void RGBController_NvidiaESA::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -82,29 +81,22 @@ void RGBController_NvidiaESA::SetupZones() SetupColors(); } -void RGBController_NvidiaESA::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_NvidiaESA::DeviceUpdateLEDs() { for(unsigned int zone = 0; zone < zones.size(); zone++) { - UpdateZoneLEDs(zone); + DeviceUpdateZoneLEDs(zone); } } -void RGBController_NvidiaESA::UpdateZoneLEDs(int zone) +void RGBController_NvidiaESA::DeviceUpdateZoneLEDs(int zone) { controller->SetZoneColor(zone, zones[zone].colors[0]); } -void RGBController_NvidiaESA::UpdateSingleLED(int /*led*/) +void RGBController_NvidiaESA::DeviceUpdateSingleLED(int /*led*/) { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } void RGBController_NvidiaESA::DeviceUpdateMode() diff --git a/Controllers/NvidiaESAController/RGBController_NvidiaESA.h b/Controllers/NvidiaESAController/RGBController_NvidiaESA.h index c09eb4ef8..da7301d8d 100644 --- a/Controllers/NvidiaESAController/RGBController_NvidiaESA.h +++ b/Controllers/NvidiaESAController/RGBController_NvidiaESA.h @@ -21,11 +21,10 @@ public: ~RGBController_NvidiaESA(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/OKSController/RGBController_OKSKeyboard.cpp b/Controllers/OKSController/RGBController_OKSKeyboard.cpp index 6f9d6c13c..8f37219c3 100644 --- a/Controllers/OKSController/RGBController_OKSKeyboard.cpp +++ b/Controllers/OKSController/RGBController_OKSKeyboard.cpp @@ -158,17 +158,6 @@ RGBController_OKSKeyboard::RGBController_OKSKeyboard(OKSKeyboardController* cont RGBController_OKSKeyboard::~RGBController_OKSKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -204,10 +193,7 @@ void RGBController_OKSKeyboard::SetupZones() new_zone.leds_min = zone_size; new_zone.leds_max = zone_size; new_zone.leds_count = zone_size; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = matrix_width; - new_zone.matrix_map->map = matrix_map_ptr; + new_zone.matrix_map.Set(6, matrix_width, matrix_map_ptr); zones.push_back(new_zone); total_led_count += zone_size; @@ -232,13 +218,6 @@ void RGBController_OKSKeyboard::SetupZones() SetupColors(); } -void RGBController_OKSKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_OKSKeyboard::DeviceUpdateLEDs() { unsigned char colordata[155*3]; @@ -247,7 +226,7 @@ void RGBController_OKSKeyboard::DeviceUpdateLEDs() unsigned int row_idx; unsigned int col_idx; - width = zones[0].matrix_map->width; + width = zones[0].matrix_map.width; for(std::size_t color_idx = 0; color_idx < 155; color_idx++) { colordata[(color_idx*3)+0] = 0x00; @@ -270,14 +249,14 @@ void RGBController_OKSKeyboard::DeviceUpdateLEDs() controller->SendColors(colordata, (unsigned int)colors.size() * 3); } -void RGBController_OKSKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_OKSKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_OKSKeyboard::UpdateSingleLED(int led) +void RGBController_OKSKeyboard::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_OKSKeyboard::DeviceUpdateMode() diff --git a/Controllers/OKSController/RGBController_OKSKeyboard.h b/Controllers/OKSController/RGBController_OKSKeyboard.h index 2eff92f9e..e4cc93794 100644 --- a/Controllers/OKSController/RGBController_OKSKeyboard.h +++ b/Controllers/OKSController/RGBController_OKSKeyboard.h @@ -60,11 +60,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.cpp b/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.cpp index 7c21d1352..48fa46b05 100644 --- a/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.cpp +++ b/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.cpp @@ -68,7 +68,6 @@ void RGBController_PNYARGBEpicXGPU::SetupZones() logo.leds_min = 4; logo.leds_max = 4; logo.leds_count = 4; - logo.matrix_map = NULL; zones.push_back(logo); for(std::size_t led_idx = 0; led_idx < logo.leds_count; led_idx++) @@ -92,7 +91,6 @@ void RGBController_PNYARGBEpicXGPU::SetupZones() front.leds_min = 20; front.leds_max = 20; front.leds_count = 20; - front.matrix_map = NULL; zones.push_back(front); for(std::size_t led_idx = 0; led_idx < front.leds_count; led_idx++) @@ -115,7 +113,6 @@ void RGBController_PNYARGBEpicXGPU::SetupZones() arrow.leds_min = 17; arrow.leds_max = 17; arrow.leds_count = 17; - arrow.matrix_map = NULL; zones.push_back(arrow); for(std::size_t led_idx = 0; led_idx < arrow.leds_count; led_idx++) @@ -132,30 +129,23 @@ void RGBController_PNYARGBEpicXGPU::SetupZones() SetupColors(); } -void RGBController_PNYARGBEpicXGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PNYARGBEpicXGPU::DeviceUpdateLEDs() { for(std::size_t i = 0; i < leds.size(); i++) { - UpdateSingleLED((int)i); + DeviceUpdateSingleLED((int)i); } } -void RGBController_PNYARGBEpicXGPU::UpdateZoneLEDs(int zone) +void RGBController_PNYARGBEpicXGPU::DeviceUpdateZoneLEDs(int zone) { for(unsigned int i = 0; i < zones[zone].leds_count; i++) { - UpdateSingleLED(zones[zone].start_idx + i); + DeviceUpdateSingleLED(zones[zone].start_idx + i); } } -void RGBController_PNYARGBEpicXGPU::UpdateSingleLED(int led) +void RGBController_PNYARGBEpicXGPU::DeviceUpdateSingleLED(int led) { controller->SetLEDDirect(leds[led].value, zone_led_idx[led], PNY_GPU_MODE_ARGB_DIRECT, colors[led]); } diff --git a/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.h b/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.h index a8b0a39e1..e46fdedc6 100644 --- a/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.h +++ b/Controllers/PNYARGBEpicXGPUController/RGBController_PNYARGBEpicXGPU.h @@ -24,11 +24,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PNYGPUController/RGBController_PNYGPU.cpp b/Controllers/PNYGPUController/RGBController_PNYGPU.cpp index 03365e219..cbe9d7e39 100644 --- a/Controllers/PNYGPUController/RGBController_PNYGPU.cpp +++ b/Controllers/PNYGPUController/RGBController_PNYGPU.cpp @@ -94,7 +94,6 @@ void RGBController_PNYGPU::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -106,24 +105,17 @@ void RGBController_PNYGPU::SetupZones() SetupColors(); } -void RGBController_PNYGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PNYGPU::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_PNYGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_PNYGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PNYGPU::UpdateSingleLED(int /*led*/) +void RGBController_PNYGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/PNYGPUController/RGBController_PNYGPU.h b/Controllers/PNYGPUController/RGBController_PNYGPU.h index 2c8058a80..b969bd02b 100644 --- a/Controllers/PNYGPUController/RGBController_PNYGPU.h +++ b/Controllers/PNYGPUController/RGBController_PNYGPU.h @@ -20,11 +20,10 @@ public: RGBController_PNYGPU(PNYGPUController* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.cpp b/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.cpp index f76d247ac..ec113caae 100644 --- a/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.cpp +++ b/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.cpp @@ -119,7 +119,6 @@ void RGBController_PNYLovelaceGPU::SetupZones() new_zone->leds_min = 3; new_zone->leds_max = 3; new_zone->leds_count = 3; - new_zone->matrix_map = NULL; led* new_led = new led(); new_led->name = "Fan LED"; @@ -137,24 +136,17 @@ void RGBController_PNYLovelaceGPU::SetupZones() SetupColors(); } -void RGBController_PNYLovelaceGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PNYLovelaceGPU::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_PNYLovelaceGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_PNYLovelaceGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_PNYLovelaceGPU::UpdateSingleLED(int /*led*/) +void RGBController_PNYLovelaceGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } @@ -168,9 +160,9 @@ void RGBController_PNYLovelaceGPU::DeviceUpdateMode() break; case PNY_GPU_MODE_STATIC: - for (int i = 0; i < 3; i++) + for(int i = 0; i < 3; i++) { - RGBColor color = GetLED(i); + RGBColor color = colors[i]; controller->SetDirect(i, RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color)); } break; diff --git a/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.h b/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.h index 0a42a41a6..c5b914f3e 100644 --- a/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.h +++ b/Controllers/PNYLovelaceGPUController/RGBController_PNYLovelaceGPU.h @@ -20,11 +20,10 @@ public: RGBController_PNYLovelaceGPU(PNYLovelaceGPUController* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PalitGPUController/RGBController_PalitGPU.cpp b/Controllers/PalitGPUController/RGBController_PalitGPU.cpp index 3dc861c65..a8aab69d7 100644 --- a/Controllers/PalitGPUController/RGBController_PalitGPU.cpp +++ b/Controllers/PalitGPUController/RGBController_PalitGPU.cpp @@ -60,7 +60,6 @@ void RGBController_PalitGPU::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -72,24 +71,17 @@ void RGBController_PalitGPU::SetupZones() SetupColors(); } -void RGBController_PalitGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PalitGPU::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_PalitGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_PalitGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PalitGPU::UpdateSingleLED(int /*led*/) +void RGBController_PalitGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/PalitGPUController/RGBController_PalitGPU.h b/Controllers/PalitGPUController/RGBController_PalitGPU.h index 443705bb4..108410f16 100644 --- a/Controllers/PalitGPUController/RGBController_PalitGPU.h +++ b/Controllers/PalitGPUController/RGBController_PalitGPU.h @@ -20,11 +20,10 @@ public: RGBController_PalitGPU(PalitGPUController* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PatriotViperController/RGBController_PatriotViper.cpp b/Controllers/PatriotViperController/RGBController_PatriotViper.cpp index 443d47d4e..56c77ee1f 100644 --- a/Controllers/PatriotViperController/RGBController_PatriotViper.cpp +++ b/Controllers/PatriotViperController/RGBController_PatriotViper.cpp @@ -141,7 +141,6 @@ void RGBController_PatriotViper::SetupZones() new_zone->leds_min = 5; new_zone->leds_max = 5; new_zone->leds_count = 5; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); /*---------------------------------------------------------*\ @@ -159,13 +158,6 @@ void RGBController_PatriotViper::SetupZones() SetupColors(); } -void RGBController_PatriotViper::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PatriotViper::DeviceUpdateLEDs() { if(viper->direct == true) @@ -192,12 +184,12 @@ void RGBController_PatriotViper::DeviceUpdateLEDs() } } -void RGBController_PatriotViper::UpdateZoneLEDs(int /*zone*/) +void RGBController_PatriotViper::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PatriotViper::UpdateSingleLED(int led) +void RGBController_PatriotViper::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/PatriotViperController/RGBController_PatriotViper.h b/Controllers/PatriotViperController/RGBController_PatriotViper.h index 1f83a0059..d9edd7b9e 100644 --- a/Controllers/PatriotViperController/RGBController_PatriotViper.h +++ b/Controllers/PatriotViperController/RGBController_PatriotViper.h @@ -21,11 +21,10 @@ public: ~RGBController_PatriotViper(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.cpp b/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.cpp index b14e6da6c..58090880f 100644 --- a/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.cpp +++ b/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.cpp @@ -56,7 +56,6 @@ void RGBController_PatriotViperMouse::SetupZones() left_zone.leds_min = 3; left_zone.leds_max = 3; left_zone.leds_count = 3; - left_zone.matrix_map = NULL; zones.push_back(left_zone); zone right_zone; @@ -65,7 +64,6 @@ void RGBController_PatriotViperMouse::SetupZones() right_zone.leds_min = 3; right_zone.leds_max = 3; right_zone.leds_count = 3; - right_zone.matrix_map = NULL; zones.push_back(right_zone); zone wheel_zone; @@ -74,7 +72,6 @@ void RGBController_PatriotViperMouse::SetupZones() wheel_zone.leds_min = 1; wheel_zone.leds_max = 1; wheel_zone.leds_count = 1; - wheel_zone.matrix_map = NULL; zones.push_back(wheel_zone); for(unsigned char i = 0x00; i < 0x07; i++) @@ -87,24 +84,17 @@ void RGBController_PatriotViperMouse::SetupZones() SetupColors(); } -void RGBController_PatriotViperMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PatriotViperMouse::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_PatriotViperMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_PatriotViperMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PatriotViperMouse::UpdateSingleLED(int /*led*/) +void RGBController_PatriotViperMouse::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.h b/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.h index 592f1c259..f980315db 100644 --- a/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.h +++ b/Controllers/PatriotViperMouseController/RGBController_PatriotViperMouse.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.cpp b/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.cpp index ade5429df..8a0852b0f 100644 --- a/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.cpp +++ b/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.cpp @@ -59,7 +59,6 @@ void RGBController_PatriotViperSteel::SetupZones() new_zone->leds_min = 5; new_zone->leds_max = 5; new_zone->leds_count = 5; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); /*---------------------------------------------------------*\ @@ -77,13 +76,6 @@ void RGBController_PatriotViperSteel::SetupZones() SetupColors(); } -void RGBController_PatriotViperSteel::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PatriotViperSteel::DeviceUpdateLEDs() { for(int led = 0; led < 5; led++) @@ -97,12 +89,12 @@ void RGBController_PatriotViperSteel::DeviceUpdateLEDs() } } -void RGBController_PatriotViperSteel::UpdateZoneLEDs(int /*zone*/) +void RGBController_PatriotViperSteel::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PatriotViperSteel::UpdateSingleLED(int led) +void RGBController_PatriotViperSteel::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.h b/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.h index 726319bda..0e5f214fc 100644 --- a/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.h +++ b/Controllers/PatriotViperSteelController/RGBController_PatriotViperSteel.h @@ -19,11 +19,10 @@ public: ~RGBController_PatriotViperSteel(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp b/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp index 544ea884c..4bdba3c0b 100644 --- a/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp +++ b/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp @@ -200,7 +200,7 @@ void DetectPhilipsHueControllers() { if(ResourceManager::get()->GetRGBControllers()[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device") { - ResourceManager::get()->GetRGBControllers()[controller_idx]->SetMode(0); + ResourceManager::get()->GetRGBControllers()[controller_idx]->SetActiveMode(0); break; } } diff --git a/Controllers/PhilipsHueController/RGBController_PhilipsHue.cpp b/Controllers/PhilipsHueController/RGBController_PhilipsHue.cpp index 303d44699..a6535bc7a 100644 --- a/Controllers/PhilipsHueController/RGBController_PhilipsHue.cpp +++ b/Controllers/PhilipsHueController/RGBController_PhilipsHue.cpp @@ -51,7 +51,6 @@ void RGBController_PhilipsHue::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -62,13 +61,6 @@ void RGBController_PhilipsHue::SetupZones() SetupColors(); } -void RGBController_PhilipsHue::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PhilipsHue::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -78,12 +70,12 @@ void RGBController_PhilipsHue::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_PhilipsHue::UpdateZoneLEDs(int /*zone*/) +void RGBController_PhilipsHue::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PhilipsHue::UpdateSingleLED(int /*led*/) +void RGBController_PhilipsHue::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/PhilipsHueController/RGBController_PhilipsHue.h b/Controllers/PhilipsHueController/RGBController_PhilipsHue.h index 2fdbbf3ca..a44d006e0 100644 --- a/Controllers/PhilipsHueController/RGBController_PhilipsHue.h +++ b/Controllers/PhilipsHueController/RGBController_PhilipsHue.h @@ -20,11 +20,10 @@ public: RGBController_PhilipsHue(PhilipsHueController* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp b/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp index e1b739b48..ca923a78e 100644 --- a/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp +++ b/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp @@ -77,7 +77,6 @@ void RGBController_PhilipsHueEntertainment::SetupZones() led_zone.leds_min = controller->GetNumLEDs(); led_zone.leds_max = controller->GetNumLEDs(); led_zone.leds_count = controller->GetNumLEDs(); - led_zone.matrix_map = NULL; zones.push_back(led_zone); for(unsigned int led_idx = 0; led_idx < controller->GetNumLEDs(); led_idx++) @@ -91,13 +90,6 @@ void RGBController_PhilipsHueEntertainment::SetupZones() SetupColors(); } -void RGBController_PhilipsHueEntertainment::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PhilipsHueEntertainment::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -108,12 +100,12 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateLEDs() } } -void RGBController_PhilipsHueEntertainment::UpdateZoneLEDs(int /*zone*/) +void RGBController_PhilipsHueEntertainment::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PhilipsHueEntertainment::UpdateSingleLED(int /*led*/) +void RGBController_PhilipsHueEntertainment::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -126,9 +118,9 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateMode() for(unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++) { - if(rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->active_mode == 0) + if(rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->GetActiveMode() == 0) { - rgb_controllers[controller_idx]->SetMode(1); + rgb_controllers[controller_idx]->SetActiveMode(1); } } @@ -148,7 +140,7 @@ void RGBController_PhilipsHueEntertainment::KeepaliveThreadFunction() { if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::seconds(5)) { - UpdateLEDs(); + UpdateLEDsInternal(); } } std::this_thread::sleep_for(1s); diff --git a/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.h b/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.h index a7b97dfd5..98b92dc91 100644 --- a/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.h +++ b/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.h @@ -22,11 +22,10 @@ public: RGBController_PhilipsHueEntertainment(PhilipsHueEntertainmentController* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PhilipsWizController/RGBController_PhilipsWiz.cpp b/Controllers/PhilipsWizController/RGBController_PhilipsWiz.cpp index 049699aba..39a1b8e9d 100644 --- a/Controllers/PhilipsWizController/RGBController_PhilipsWiz.cpp +++ b/Controllers/PhilipsWizController/RGBController_PhilipsWiz.cpp @@ -385,7 +385,6 @@ void RGBController_PhilipsWiz::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -396,13 +395,6 @@ void RGBController_PhilipsWiz::SetupZones() SetupColors(); } -void RGBController_PhilipsWiz::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PhilipsWiz::DeviceUpdateLEDs() { if (modes[active_mode].value == PHILLIPSWIZ_MODE_STATIC) @@ -415,12 +407,12 @@ void RGBController_PhilipsWiz::DeviceUpdateLEDs() } } -void RGBController_PhilipsWiz::UpdateZoneLEDs(int /*zone*/) +void RGBController_PhilipsWiz::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PhilipsWiz::UpdateSingleLED(int /*led*/) +void RGBController_PhilipsWiz::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/PhilipsWizController/RGBController_PhilipsWiz.h b/Controllers/PhilipsWizController/RGBController_PhilipsWiz.h index d6acd7f49..018fdcd26 100644 --- a/Controllers/PhilipsWizController/RGBController_PhilipsWiz.h +++ b/Controllers/PhilipsWizController/RGBController_PhilipsWiz.h @@ -21,11 +21,10 @@ public: ~RGBController_PhilipsWiz(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.cpp b/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.cpp index 3e56b4a26..9c92b182e 100644 --- a/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.cpp +++ b/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.cpp @@ -197,7 +197,6 @@ void RGBController_PowerColorRedDevilV1::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; zones.push_back(*new_zone); /*---------------------------------------------------------*\ @@ -212,24 +211,17 @@ void RGBController_PowerColorRedDevilV1::SetupZones() SetupColors(); } -void RGBController_PowerColorRedDevilV1::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PowerColorRedDevilV1::DeviceUpdateLEDs() { controller->SetLEDColorAll(colors[0]); } -void RGBController_PowerColorRedDevilV1::UpdateZoneLEDs(int /*zone*/) +void RGBController_PowerColorRedDevilV1::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PowerColorRedDevilV1::UpdateSingleLED(int led) +void RGBController_PowerColorRedDevilV1::DeviceUpdateSingleLED(int led) { controller->SetLEDColor(led, colors[led]); } diff --git a/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.h b/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.h index 136729413..630c95a0b 100644 --- a/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.h +++ b/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/RGBController_PowerColorRedDevilV1.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.cpp b/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.cpp index 877b5cea7..f4c43f7e7 100644 --- a/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.cpp +++ b/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.cpp @@ -173,7 +173,6 @@ void RGBController_PowerColorRedDevilV2::SetupZones() stripe1.leds_min = 3; stripe1.leds_max = 3; stripe1.leds_count = 3; - stripe1.matrix_map = NULL; zones.push_back(stripe1); zone stripe2; @@ -182,7 +181,6 @@ void RGBController_PowerColorRedDevilV2::SetupZones() stripe2.leds_min = 3; stripe2.leds_max = 3; stripe2.leds_count = 3; - stripe2.matrix_map = NULL; zones.push_back(stripe2); static unsigned int hellstone_map[2][7] = @@ -197,10 +195,7 @@ void RGBController_PowerColorRedDevilV2::SetupZones() hellstone.leds_min = 14; hellstone.leds_max = 14; hellstone.leds_count = 14; - hellstone.matrix_map = new matrix_map_type; - hellstone.matrix_map->height = 2; - hellstone.matrix_map->width = 7; - hellstone.matrix_map->map = (unsigned int *)hellstone_map; + hellstone.matrix_map.Set(2, 7, (unsigned int *)hellstone_map); zones.push_back(hellstone); zone devil; @@ -209,7 +204,6 @@ void RGBController_PowerColorRedDevilV2::SetupZones() devil.leds_min = 4; devil.leds_max = 4; devil.leds_count = 4; - devil.matrix_map = NULL; zones.push_back(devil); /*------------------------------------------------------------------*\ @@ -246,13 +240,6 @@ void RGBController_PowerColorRedDevilV2::SetupZones() SetupColors(); } -void RGBController_PowerColorRedDevilV2::ResizeZone(int, int) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PowerColorRedDevilV2::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -298,12 +285,12 @@ void RGBController_PowerColorRedDevilV2::DeviceUpdateLEDs() colors_copy = colors; } -void RGBController_PowerColorRedDevilV2::UpdateZoneLEDs(int) +void RGBController_PowerColorRedDevilV2::DeviceUpdateZoneLEDs(int) { DeviceUpdateLEDs(); } -void RGBController_PowerColorRedDevilV2::UpdateSingleLED(int) +void RGBController_PowerColorRedDevilV2::DeviceUpdateSingleLED(int) { DeviceUpdateLEDs(); } diff --git a/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.h b/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.h index 75391b044..c04210920 100644 --- a/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.h +++ b/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/RGBController_PowerColorRedDevilV2.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int, int); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int); - void UpdateSingleLED(int); + void DeviceUpdateZoneLEDs(int); + void DeviceUpdateSingleLED(int); void DeviceUpdateMode(); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.cpp b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.cpp index 32ab8f5e4..dc702e8a3 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.cpp +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.cpp @@ -257,13 +257,7 @@ RGBController_QMKOpenRGBRev9::RGBController_QMKOpenRGBRev9(QMKOpenRGBRev9Control RGBController_QMKOpenRGBRev9::~RGBController_QMKOpenRGBRev9() { - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } + delete controller; } void RGBController_QMKOpenRGBRev9::SetupZones() @@ -350,10 +344,7 @@ void RGBController_QMKOpenRGBRev9::SetupZones() keys_zone.leds_min = number_of_key_leds; keys_zone.leds_max = keys_zone.leds_min; keys_zone.leds_count = keys_zone.leds_min; - keys_zone.matrix_map = new matrix_map_type; - keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size(); - keys_zone.matrix_map->height = (unsigned int)matrix_map.size(); - keys_zone.matrix_map->map = flat_matrix_map.data(); + keys_zone.matrix_map.Set((unsigned int)matrix_map[0].size(), (unsigned int)matrix_map.size(), flat_matrix_map.data()); zones.push_back(keys_zone); /*---------------------------------------------------------*\ @@ -367,10 +358,7 @@ void RGBController_QMKOpenRGBRev9::SetupZones() underglow_zone.leds_min = number_of_underglow_leds; underglow_zone.leds_max = underglow_zone.leds_min; underglow_zone.leds_count = underglow_zone.leds_min; - underglow_zone.matrix_map = new matrix_map_type; - underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size(); - underglow_zone.matrix_map->height = (unsigned int)underglow_map.size(); - underglow_zone.matrix_map->map = flat_underglow_map.data(); + underglow_zone.matrix_map.Set((unsigned int)underglow_map[0].size(), (unsigned int)underglow_map.size(), flat_underglow_map.data()); zones.push_back(underglow_zone); } @@ -404,24 +392,17 @@ void RGBController_QMKOpenRGBRev9::SetupZones() } } -void RGBController_QMKOpenRGBRev9::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_QMKOpenRGBRev9::DeviceUpdateLEDs() { controller->DirectModeSetLEDs(colors, controller->GetTotalNumberOfLEDs()); } -void RGBController_QMKOpenRGBRev9::UpdateZoneLEDs(int /*zone*/) +void RGBController_QMKOpenRGBRev9::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_QMKOpenRGBRev9::UpdateSingleLED(int led) +void RGBController_QMKOpenRGBRev9::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.h b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.h index 7f9b4fdf5..5d6c668ee 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.h +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRev9Controller/RGBController_QMKOpenRGBRev9.h @@ -31,11 +31,10 @@ public: ~RGBController_QMKOpenRGBRev9(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.cpp b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.cpp index 6edd3b69d..95b6ee6a0 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.cpp +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.cpp @@ -259,13 +259,7 @@ RGBController_QMKOpenRGBRevB::RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBControl RGBController_QMKOpenRGBRevB::~RGBController_QMKOpenRGBRevB() { - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } + delete controller; } void RGBController_QMKOpenRGBRevB::SetupZones() @@ -349,10 +343,7 @@ void RGBController_QMKOpenRGBRevB::SetupZones() keys_zone.leds_min = number_of_key_leds; keys_zone.leds_max = keys_zone.leds_min; keys_zone.leds_count = keys_zone.leds_min; - keys_zone.matrix_map = new matrix_map_type; - keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size(); - keys_zone.matrix_map->height = (unsigned int)matrix_map.size(); - keys_zone.matrix_map->map = flat_matrix_map.data(); + keys_zone.matrix_map.Set((unsigned int)matrix_map[0].size(), (unsigned int)matrix_map.size(), flat_matrix_map.data()); zones.push_back(keys_zone); /*---------------------------------------------------------*\ @@ -366,10 +357,7 @@ void RGBController_QMKOpenRGBRevB::SetupZones() underglow_zone.leds_min = number_of_underglow_leds; underglow_zone.leds_max = underglow_zone.leds_min; underglow_zone.leds_count = underglow_zone.leds_min; - underglow_zone.matrix_map = new matrix_map_type; - underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size(); - underglow_zone.matrix_map->height = (unsigned int)underglow_map.size(); - underglow_zone.matrix_map->map = flat_underglow_map.data(); + underglow_zone.matrix_map.Set((unsigned int)underglow_map[0].size(), (unsigned int)underglow_map.size(), flat_underglow_map.data()); zones.push_back(underglow_zone); } @@ -403,24 +391,17 @@ void RGBController_QMKOpenRGBRevB::SetupZones() } } -void RGBController_QMKOpenRGBRevB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_QMKOpenRGBRevB::DeviceUpdateLEDs() { controller->DirectModeSetLEDs(colors, controller->GetTotalNumberOfLEDs()); } -void RGBController_QMKOpenRGBRevB::UpdateZoneLEDs(int /*zone*/) +void RGBController_QMKOpenRGBRevB::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_QMKOpenRGBRevB::UpdateSingleLED(int led) +void RGBController_QMKOpenRGBRevB::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.h b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.h index 5fa010d45..4518738f4 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.h +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevBController/RGBController_QMKOpenRGBRevB.h @@ -31,11 +31,10 @@ public: ~RGBController_QMKOpenRGBRevB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.cpp b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.cpp index f15568690..a04cf5aad 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.cpp +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.cpp @@ -258,13 +258,7 @@ RGBController_QMKOpenRGBRevD::RGBController_QMKOpenRGBRevD(QMKOpenRGBRevDControl RGBController_QMKOpenRGBRevD::~RGBController_QMKOpenRGBRevD() { - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } + delete controller; } void RGBController_QMKOpenRGBRevD::SetupZones() @@ -344,10 +338,7 @@ void RGBController_QMKOpenRGBRevD::SetupZones() keys_zone.leds_min = number_of_key_leds; keys_zone.leds_max = keys_zone.leds_min; keys_zone.leds_count = keys_zone.leds_min; - keys_zone.matrix_map = new matrix_map_type; - keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size(); - keys_zone.matrix_map->height = (unsigned int)matrix_map.size(); - keys_zone.matrix_map->map = flat_matrix_map.data(); + keys_zone.matrix_map.Set((unsigned int)matrix_map[0].size(), (unsigned int)matrix_map.size(), flat_matrix_map.data()); zones.push_back(keys_zone); /*---------------------------------------------------------*\ @@ -361,10 +352,7 @@ void RGBController_QMKOpenRGBRevD::SetupZones() underglow_zone.leds_min = number_of_underglow_leds; underglow_zone.leds_max = underglow_zone.leds_min; underglow_zone.leds_count = underglow_zone.leds_min; - underglow_zone.matrix_map = new matrix_map_type; - underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size(); - underglow_zone.matrix_map->height = (unsigned int)underglow_map.size(); - underglow_zone.matrix_map->map = flat_underglow_map.data(); + underglow_zone.matrix_map.Set((unsigned int)underglow_map[0].size(), (unsigned int)underglow_map.size(), flat_underglow_map.data()); zones.push_back(underglow_zone); } @@ -404,24 +392,17 @@ void RGBController_QMKOpenRGBRevD::SetupZones() } } -void RGBController_QMKOpenRGBRevD::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_QMKOpenRGBRevD::DeviceUpdateLEDs() { controller->DirectModeSetLEDs(colors, controller->GetTotalNumberOfLEDs()); } -void RGBController_QMKOpenRGBRevD::UpdateZoneLEDs(int /*zone*/) +void RGBController_QMKOpenRGBRevD::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_QMKOpenRGBRevD::UpdateSingleLED(int led) +void RGBController_QMKOpenRGBRevD::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.h b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.h index d04da47f6..4f2fdf16d 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.h +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevDController/RGBController_QMKOpenRGBRevD.h @@ -30,11 +30,10 @@ public: ~RGBController_QMKOpenRGBRevD(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.cpp b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.cpp index df35d2ed8..3bdd22b98 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.cpp +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.cpp @@ -274,13 +274,7 @@ RGBController_QMKOpenRGBRevE::RGBController_QMKOpenRGBRevE(QMKOpenRGBRevDControl RGBController_QMKOpenRGBRevE::~RGBController_QMKOpenRGBRevE() { - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } + delete controller; } void RGBController_QMKOpenRGBRevE::SetupZones() @@ -360,10 +354,7 @@ void RGBController_QMKOpenRGBRevE::SetupZones() keys_zone.leds_min = number_of_key_leds; keys_zone.leds_max = keys_zone.leds_min; keys_zone.leds_count = keys_zone.leds_min; - keys_zone.matrix_map = new matrix_map_type; - keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size(); - keys_zone.matrix_map->height = (unsigned int)matrix_map.size(); - keys_zone.matrix_map->map = flat_matrix_map.data(); + keys_zone.matrix_map.Set((unsigned int)matrix_map[0].size(), (unsigned int)matrix_map.size(), flat_matrix_map.data()); zones.push_back(keys_zone); /*---------------------------------------------------------*\ @@ -377,10 +368,7 @@ void RGBController_QMKOpenRGBRevE::SetupZones() underglow_zone.leds_min = number_of_underglow_leds; underglow_zone.leds_max = underglow_zone.leds_min; underglow_zone.leds_count = underglow_zone.leds_min; - underglow_zone.matrix_map = new matrix_map_type; - underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size(); - underglow_zone.matrix_map->height = (unsigned int)underglow_map.size(); - underglow_zone.matrix_map->map = flat_underglow_map.data(); + underglow_zone.matrix_map.Set((unsigned int)underglow_map[0].size(), (unsigned int)underglow_map.size(), flat_underglow_map.data()); zones.push_back(underglow_zone); } @@ -420,24 +408,17 @@ void RGBController_QMKOpenRGBRevE::SetupZones() } } -void RGBController_QMKOpenRGBRevE::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_QMKOpenRGBRevE::DeviceUpdateLEDs() { controller->DirectModeSetLEDs(colors, controller->GetTotalNumberOfLEDs()); } -void RGBController_QMKOpenRGBRevE::UpdateZoneLEDs(int /*zone*/) +void RGBController_QMKOpenRGBRevE::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_QMKOpenRGBRevE::UpdateSingleLED(int led) +void RGBController_QMKOpenRGBRevE::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); diff --git a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.h b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.h index 8d1ed4ca6..480401c6a 100644 --- a/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.h +++ b/Controllers/QMKController/QMKOpenRGBController/QMKOpenRGBRevEController/RGBController_QMKOpenRGBRevE.h @@ -31,11 +31,10 @@ public: ~RGBController_QMKOpenRGBRevE(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.cpp b/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.cpp index a8a667888..4f77447da 100644 --- a/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.cpp +++ b/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.cpp @@ -194,15 +194,12 @@ void RGBController_QMKVialRGB::SetupZones() \*-----------------------------------------------------*/ zone keyboard; - keyboard.name = "Keyboard"; - keyboard.type = ZONE_TYPE_MATRIX; - keyboard.leds_min = controller->GetLEDCount(); - keyboard.leds_max = controller->GetLEDCount(); - keyboard.leds_count = controller->GetLEDCount(); - keyboard.matrix_map = new matrix_map_type; - keyboard.matrix_map->height = height; - keyboard.matrix_map->width = width; - keyboard.matrix_map->map = matrix_map; + keyboard.name = "Keyboard"; + keyboard.type = ZONE_TYPE_MATRIX; + keyboard.leds_min = controller->GetLEDCount(); + keyboard.leds_max = controller->GetLEDCount(); + keyboard.leds_count = controller->GetLEDCount(); + keyboard.matrix_map.Set(height, width, matrix_map); zones.push_back(keyboard); @@ -220,22 +217,17 @@ void RGBController_QMKVialRGB::SetupZones() SetupColors(); } -void RGBController_QMKVialRGB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_QMKVialRGB::DeviceUpdateLEDs() { controller->SendLEDs(colors.size(), colors.data()); } -void RGBController_QMKVialRGB::UpdateZoneLEDs(int /*zone*/) +void RGBController_QMKVialRGB::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_QMKVialRGB::UpdateSingleLED(int /*led*/) +void RGBController_QMKVialRGB::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.h b/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.h index 40a2670fe..a262a9dcf 100644 --- a/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.h +++ b/Controllers/QMKController/QMKVialRGBController/RGBController_QMKVialRGB.h @@ -21,11 +21,10 @@ public: ~RGBController_QMKVialRGB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RazerController/RazerController/RGBController_Razer.cpp b/Controllers/RazerController/RazerController/RGBController_Razer.cpp index abda18dc0..56a16dc00 100644 --- a/Controllers/RazerController/RazerController/RGBController_Razer.cpp +++ b/Controllers/RazerController/RazerController/RGBController_Razer.cpp @@ -206,12 +206,6 @@ void RGBController_Razer::SetupZones() KeyboardLayoutManager new_kb(new_layout, device_list[device_index]->layout->base_size, device_list[device_index]->layout->key_values); - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_map->height = device_list[device_index]->zones[zone_id]->rows; - new_map->width = device_list[device_index]->zones[zone_id]->cols; - new_map->map = new unsigned int[new_map->height * new_map->width]; - if(device_list[device_index]->layout->base_size != KEYBOARD_SIZE::KEYBOARD_SIZE_EMPTY) { /*---------------------------------------------------------*\ @@ -220,11 +214,7 @@ void RGBController_Razer::SetupZones() keyboard_keymap_overlay_values* temp = device_list[device_index]->layout; new_kb.ChangeKeys(*temp); - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_INDEX, new_map->height, new_map->width); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_INDEX, device_list[device_index]->zones[zone_id]->rows, device_list[device_index]->zones[zone_id]->cols); } zones.push_back(new_zone); @@ -234,9 +224,9 @@ void RGBController_Razer::SetupZones() \*---------------------------------------------------------*/ if(new_kb.GetKeyCount() > 0) { - for(std::size_t row = 0; row < zones[zone_id].matrix_map->height; row++) + for(std::size_t row = 0; row < zones[zone_id].matrix_map.height; row++) { - for(std::size_t col = 0; col < zones[zone_id].matrix_map->width; col++) + for(std::size_t col = 0; col < zones[zone_id].matrix_map.width; col++) { led new_led; @@ -255,25 +245,19 @@ void RGBController_Razer::SetupZones() | Handle all other matrix type zones by filling in all | | entries | \*---------------------------------------------------------*/ - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_map->height = device_list[device_index]->zones[zone_id]->rows; - new_map->width = device_list[device_index]->zones[zone_id]->cols; - new_map->map = new unsigned int[new_map->height * new_map->width]; + new_zone.matrix_map.height = device_list[device_index]->zones[zone_id]->rows; + new_zone.matrix_map.width = device_list[device_index]->zones[zone_id]->cols; + new_zone.matrix_map.map.resize(new_zone.matrix_map.height * new_zone.matrix_map.width); - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_zone.matrix_map.height; y++) { - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_zone.matrix_map.width; x++) { - new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x; + new_zone.matrix_map.map[(y * new_zone.matrix_map.width) + x] = (y * new_zone.matrix_map.width) + x; } } } } - else - { - new_zone.matrix_map = NULL; - } zones.push_back(new_zone); @@ -300,24 +284,17 @@ void RGBController_Razer::SetupZones() SetupColors(); } -void RGBController_Razer::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Razer::DeviceUpdateLEDs() { controller->SetLEDs(&colors[0]); } -void RGBController_Razer::UpdateZoneLEDs(int /*zone*/) +void RGBController_Razer::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Razer::UpdateSingleLED(int /*led*/) +void RGBController_Razer::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RazerController/RazerController/RGBController_Razer.h b/Controllers/RazerController/RazerController/RGBController_Razer.h index 86f1550ae..c6ad9b28f 100644 --- a/Controllers/RazerController/RazerController/RGBController_Razer.h +++ b/Controllers/RazerController/RazerController/RGBController_Razer.h @@ -35,11 +35,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RazerController/RazerController/RGBController_RazerAddressable.cpp b/Controllers/RazerController/RazerController/RGBController_RazerAddressable.cpp index a21945d39..f658d1ab3 100644 --- a/Controllers/RazerController/RazerController/RGBController_RazerAddressable.cpp +++ b/Controllers/RazerController/RazerController/RGBController_RazerAddressable.cpp @@ -182,26 +182,18 @@ void RGBController_RazerAddressable::SetupZones() if(zones[zone_count].type == ZONE_TYPE_MATRIX) { - matrix_map_type * new_map = new matrix_map_type; - zones[zone_count].matrix_map = new_map; + zones[zone_count].matrix_map.height = device_list[device_index]->zones[zone_id]->rows; + zones[zone_count].matrix_map.width = device_list[device_index]->zones[zone_id]->cols; + zones[zone_count].matrix_map.map.resize(zones[zone_count].matrix_map.height * zones[zone_count].matrix_map.width); - new_map->height = device_list[device_index]->zones[zone_id]->rows; - new_map->width = device_list[device_index]->zones[zone_id]->cols; - - new_map->map = new unsigned int[new_map->height * new_map->width]; - - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < zones[zone_count].matrix_map.height; y++) { - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < zones[zone_count].matrix_map.width; x++) { - new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x; + zones[zone_count].matrix_map.map[(y * zones[zone_count].matrix_map.width) + x] = (y * zones[zone_count].matrix_map.width) + x; } } } - else - { - zones[zone_count].matrix_map = NULL; - } zone_count++; } @@ -221,7 +213,7 @@ void RGBController_RazerAddressable::SetupZones() SetupColors(); } -void RGBController_RazerAddressable::ResizeZone(int zone, int new_size) +void RGBController_RazerAddressable::DeviceResizeZone(int zone, int new_size) { /*---------------------------------------------------------*\ | Only the Razer Chroma Addressable RGB Controller supports | @@ -263,12 +255,12 @@ void RGBController_RazerAddressable::DeviceUpdateLEDs() controller->SetLEDs(&colors_buf[0]); } -void RGBController_RazerAddressable::UpdateZoneLEDs(int /*zone*/) +void RGBController_RazerAddressable::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RazerAddressable::UpdateSingleLED(int /*led*/) +void RGBController_RazerAddressable::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RazerController/RazerController/RGBController_RazerAddressable.h b/Controllers/RazerController/RazerController/RGBController_RazerAddressable.h index 48398c908..37de640be 100644 --- a/Controllers/RazerController/RazerController/RGBController_RazerAddressable.h +++ b/Controllers/RazerController/RazerController/RGBController_RazerAddressable.h @@ -33,11 +33,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.cpp b/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.cpp index 0edbe570d..704bd7ad3 100644 --- a/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.cpp +++ b/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.cpp @@ -89,25 +89,18 @@ void RGBController_RazerHanbo::SetupZones() if(new_zone.type == ZONE_TYPE_MATRIX) { - matrix_map_type * new_map = new matrix_map_type; + new_zone.matrix_map.height = device_list[device_index]->zones[zone_id]->rows; + new_zone.matrix_map.width = device_list[device_index]->zones[zone_id]->cols; + new_zone.matrix_map.map.resize(new_zone.matrix_map.height * new_zone.matrix_map.width); - new_zone.matrix_map = new_map; - new_map->height = device_list[device_index]->zones[zone_id]->rows; - new_map->width = device_list[device_index]->zones[zone_id]->cols; - new_map->map = new unsigned int[new_map->height * new_map->width]; - - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_zone.matrix_map.height; y++) { - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_zone.matrix_map.width; x++) { - new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x; + new_zone.matrix_map.map[(y * new_zone.matrix_map.width) + x] = (y * new_zone.matrix_map.width) + x; } } } - else - { - new_zone.matrix_map = NULL; - } zones.push_back(new_zone); } @@ -137,19 +130,12 @@ void RGBController_RazerHanbo::SetupZones() SetupColors(); } -void RGBController_RazerHanbo::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RazerHanbo::DeviceUpdateLEDs() { - UpdateZoneLEDs(PUMP); - UpdateZoneLEDs(FAN1); - UpdateZoneLEDs(FAN2); - UpdateZoneLEDs(FAN3); + DeviceUpdateZoneLEDs(PUMP); + DeviceUpdateZoneLEDs(FAN1); + DeviceUpdateZoneLEDs(FAN2); + DeviceUpdateZoneLEDs(FAN3); } /*---------------------------------------------------------*\ @@ -157,12 +143,12 @@ void RGBController_RazerHanbo::DeviceUpdateLEDs() | Transactions are straight forward when grouped this way. | \*---------------------------------------------------------*/ -void RGBController_RazerHanbo::UpdateZoneLEDs(int zoneid) +void RGBController_RazerHanbo::DeviceUpdateZoneLEDs(int zoneid) { controller->SetZoneLeds(zoneid, this->zones[zoneid]); } -void RGBController_RazerHanbo::UpdateSingleLED(int /*led*/) +void RGBController_RazerHanbo::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.h b/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.h index f0aa7bf4e..99e61bb21 100644 --- a/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.h +++ b/Controllers/RazerController/RazerHanboController/RGBController_RazerHanbo.h @@ -29,11 +29,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.cpp b/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.cpp index 2aec5cc88..3ad018265 100644 --- a/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.cpp +++ b/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.cpp @@ -116,26 +116,18 @@ void RGBController_RazerKraken::SetupZones() if(new_zone.type == ZONE_TYPE_MATRIX) { - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; + new_zone.matrix_map.height = device_list[device_index]->zones[zone_id]->rows; + new_zone.matrix_map.width = device_list[device_index]->zones[zone_id]->cols; + new_zone.matrix_map.map.resize(new_zone.matrix_map.height * new_zone.matrix_map.width); - new_map->height = device_list[device_index]->zones[zone_id]->rows; - new_map->width = device_list[device_index]->zones[zone_id]->cols; - - new_map->map = new unsigned int[new_map->height * new_map->width]; - - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_zone.matrix_map.height; y++) { - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_zone.matrix_map.width; x++) { - new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x; + new_zone.matrix_map.map[(y * new_zone.matrix_map.width) + x] = (y * new_zone.matrix_map.width) + x; } } } - else - { - new_zone.matrix_map = NULL; - } zones.push_back(new_zone); } @@ -165,13 +157,6 @@ void RGBController_RazerKraken::SetupZones() SetupColors(); } -void RGBController_RazerKraken::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RazerKraken::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -181,12 +166,12 @@ void RGBController_RazerKraken::DeviceUpdateLEDs() controller->SetModeCustom(red, grn, blu); } -void RGBController_RazerKraken::UpdateZoneLEDs(int /*zone*/) +void RGBController_RazerKraken::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RazerKraken::UpdateSingleLED(int /*led*/) +void RGBController_RazerKraken::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.h b/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.h index 24aaff174..aadf9d277 100644 --- a/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.h +++ b/Controllers/RazerController/RazerKrakenController/RGBController_RazerKraken.h @@ -31,11 +31,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.cpp b/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.cpp index 4028c0d53..900474cb5 100644 --- a/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.cpp +++ b/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.cpp @@ -95,26 +95,18 @@ void RGBController_RazerKrakenV3::SetupZones() if(new_zone.type == ZONE_TYPE_MATRIX) { - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; + new_zone.matrix_map.height = device_list[device_index]->zones[zone_id]->rows; + new_zone.matrix_map.width = device_list[device_index]->zones[zone_id]->cols; + new_zone.matrix_map.map.resize(new_zone.matrix_map.height * new_zone.matrix_map.width); - new_map->height = device_list[device_index]->zones[zone_id]->rows; - new_map->width = device_list[device_index]->zones[zone_id]->cols; - - new_map->map = new unsigned int[new_map->height * new_map->width]; - - for(unsigned int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_zone.matrix_map.height; y++) { - for(unsigned int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_zone.matrix_map.width; x++) { - new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x; + new_zone.matrix_map.map[(y * new_zone.matrix_map.width) + x] = (y * new_zone.matrix_map.width) + x; } } } - else - { - new_zone.matrix_map = NULL; - } zones.push_back(new_zone); } @@ -144,11 +136,6 @@ void RGBController_RazerKrakenV3::SetupZones() SetupColors(); } -void RGBController_RazerKrakenV3::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_RazerKrakenV3::DeviceUpdateLEDs() { if(modes[active_mode].value == RAZER_KRAKEN_V3_MODE_DIRECT) @@ -157,12 +144,12 @@ void RGBController_RazerKrakenV3::DeviceUpdateLEDs() } } -void RGBController_RazerKrakenV3::UpdateZoneLEDs(int /*zone*/) +void RGBController_RazerKrakenV3::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RazerKrakenV3::UpdateSingleLED(int /*led*/) +void RGBController_RazerKrakenV3::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.h b/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.h index e9763162e..640e6d1f6 100644 --- a/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.h +++ b/Controllers/RazerController/RazerKrakenV3Controller/RGBController_RazerKrakenV3.h @@ -29,11 +29,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.cpp b/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.cpp index b3eb59914..fbcfd02a5 100644 --- a/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.cpp +++ b/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.cpp @@ -71,7 +71,6 @@ void RGBController_RazerKrakenV4::SetupZones() new_zone.leds_count = device_list[device_index]->zones[zone_id]->cols; new_zone.leds_min = new_zone.leds_count; new_zone.leds_max = new_zone.leds_count; - new_zone.matrix_map = NULL; zones.push_back(new_zone); @@ -95,11 +94,6 @@ void RGBController_RazerKrakenV4::SetupZones() SetupColors(); } -void RGBController_RazerKrakenV4::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_RazerKrakenV4::DeviceUpdateLEDs() { if(modes[active_mode].value == RAZER_KRAKEN_V4_MODE_DIRECT) @@ -108,12 +102,12 @@ void RGBController_RazerKrakenV4::DeviceUpdateLEDs() } } -void RGBController_RazerKrakenV4::UpdateZoneLEDs(int /*zone*/) +void RGBController_RazerKrakenV4::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RazerKrakenV4::UpdateSingleLED(int /*led*/) +void RGBController_RazerKrakenV4::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.h b/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.h index 4ad0c4801..19b7e54c3 100644 --- a/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.h +++ b/Controllers/RazerController/RazerKrakenV4Controller/RGBController_RazerKrakenV4.h @@ -28,11 +28,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.cpp b/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.cpp index efb063c99..c946cd80c 100644 --- a/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.cpp +++ b/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.cpp @@ -312,21 +312,19 @@ void RGBController_RedSquareKeyrox::SetupZones() unsigned int zone_size = 0; zone z; - z.name = ZONE_EN_KEYBOARD; - z.type = ZONE_TYPE_MATRIX; + z.name = ZONE_EN_KEYBOARD; + z.type = ZONE_TYPE_MATRIX; - z.matrix_map = new matrix_map_type; - z.matrix_map->height = keyboard->height; - z.matrix_map->width = keyboard->width; - - z.matrix_map->map = new unsigned int[keyboard->height * keyboard->width]; + z.matrix_map.height = keyboard->height; + z.matrix_map.width = keyboard->width; + z.matrix_map.map.resize(keyboard->height * keyboard->width); for(unsigned int h = 0; h < keyboard->height; h++) { for(unsigned int w = 0; w < keyboard->width; w++) { unsigned int key = keyboard->matrix_map[h][w]; - z.matrix_map->map[h * keyboard->width + w] = key; + z.matrix_map.map[h * keyboard->width + w] = key; if(key != NA) { @@ -347,24 +345,17 @@ void RGBController_RedSquareKeyrox::SetupZones() SetupColors(); } -void RGBController_RedSquareKeyrox::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RedSquareKeyrox::DeviceUpdateLEDs() { controller->SetLEDsData(modes, active_mode, colors); } -void RGBController_RedSquareKeyrox::UpdateZoneLEDs(int /*zone*/) +void RGBController_RedSquareKeyrox::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RedSquareKeyrox::UpdateSingleLED(int /*led*/) +void RGBController_RedSquareKeyrox::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.h b/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.h index 693e5e2ba..c6b563c59 100644 --- a/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.h +++ b/Controllers/RedSquareKeyroxController/RedSquareKeyroxController/RGBController_RedSquareKeyrox.h @@ -21,11 +21,10 @@ public: ~RGBController_RedSquareKeyrox(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.cpp b/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.cpp index 07bd67eee..29dc6c66f 100644 --- a/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.cpp +++ b/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.cpp @@ -201,30 +201,18 @@ RGBController_RedSquareKeyroxTKLClassic::~RGBController_RedSquareKeyroxTKLClassi void RGBController_RedSquareKeyroxTKLClassic::SetupZones() { + KeyboardLayoutManager new_kb(KEYBOARD_LAYOUT_ANSI_QWERTY, KEYBOARD_SIZE_TKL, keyrox_tkl_offset_values); + /*---------------------------------------------------------*\ | Create the keyboard zone usiung Keyboard Layout Manager | \*---------------------------------------------------------*/ zone new_zone; - new_zone.name = ZONE_EN_KEYBOARD; - new_zone.type = ZONE_TYPE_MATRIX; - - KeyboardLayoutManager new_kb(KEYBOARD_LAYOUT_ANSI_QWERTY, KEYBOARD_SIZE_TKL, keyrox_tkl_offset_values); - - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_zone.matrix_map->height = KEYROX_TKL_CLASSIC_HEIGHT; - new_zone.matrix_map->width = KEYROX_TKL_CLASSIC_WIDTH; - - new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width]; - new_zone.leds_count = new_kb.GetKeyCount(); - new_zone.leds_min = new_zone.leds_count; - new_zone.leds_max = new_zone.leds_count; - - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, new_map->height, new_map->width); + new_zone.name = ZONE_EN_KEYBOARD; + new_zone.type = ZONE_TYPE_MATRIX; + new_zone.leds_count = new_kb.GetKeyCount(); + new_zone.leds_min = new_zone.leds_count; + new_zone.leds_max = new_zone.leds_count; + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT, KEYROX_TKL_CLASSIC_HEIGHT, KEYROX_TKL_CLASSIC_WIDTH); /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | @@ -244,24 +232,17 @@ void RGBController_RedSquareKeyroxTKLClassic::SetupZones() SetupColors(); } -void RGBController_RedSquareKeyroxTKLClassic::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RedSquareKeyroxTKLClassic::DeviceUpdateLEDs() { controller->SetLEDsData(colors, leds); } -void RGBController_RedSquareKeyroxTKLClassic::UpdateZoneLEDs(int /*zone*/) +void RGBController_RedSquareKeyroxTKLClassic::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RedSquareKeyroxTKLClassic::UpdateSingleLED(int /*led*/) +void RGBController_RedSquareKeyroxTKLClassic::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.h b/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.h index df69f9db7..843b79ac0 100644 --- a/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.h +++ b/Controllers/RedSquareKeyroxController/RedSquareKeyroxTKLClassicController/RGBController_RedSquareKeyroxTKLClassic.h @@ -26,11 +26,10 @@ public: ~RGBController_RedSquareKeyroxTKLClassic(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RedragonController/RGBController_RedragonMouse.cpp b/Controllers/RedragonController/RGBController_RedragonMouse.cpp index 41e8b1a1e..c970e4079 100644 --- a/Controllers/RedragonController/RGBController_RedragonMouse.cpp +++ b/Controllers/RedragonController/RGBController_RedragonMouse.cpp @@ -84,7 +84,6 @@ void RGBController_RedragonMouse::SetupZones() mouse_zone.leds_min = REDRAGON_MOUSE_LED_COUNT; mouse_zone.leds_max = REDRAGON_MOUSE_LED_COUNT; mouse_zone.leds_count = REDRAGON_MOUSE_LED_COUNT; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); led mouse_led; @@ -94,13 +93,6 @@ void RGBController_RedragonMouse::SetupZones() SetupColors(); } -void RGBController_RedragonMouse::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RedragonMouse::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -111,12 +103,12 @@ void RGBController_RedragonMouse::DeviceUpdateLEDs() controller->SendMouseApply(); } -void RGBController_RedragonMouse::UpdateZoneLEDs(int /*zone*/) +void RGBController_RedragonMouse::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RedragonMouse::UpdateSingleLED(int /*led*/) +void RGBController_RedragonMouse::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RedragonController/RGBController_RedragonMouse.h b/Controllers/RedragonController/RGBController_RedragonMouse.h index 2f5620a04..6dd11f38e 100644 --- a/Controllers/RedragonController/RGBController_RedragonMouse.h +++ b/Controllers/RedragonController/RGBController_RedragonMouse.h @@ -21,11 +21,10 @@ public: ~RGBController_RedragonMouse(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.cpp b/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.cpp index 02df76a79..b2aa84abf 100644 --- a/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.cpp +++ b/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.cpp @@ -142,7 +142,6 @@ void RGBController_RobobloqLightStrip::SetupZones() zone.leds_count = sides[i].count; zone.leds_min = zone.leds_count; zone.leds_max = zone.leds_count; - zone.matrix_map = NULL; } for(int i = 0; i < led_count; i++) @@ -155,13 +154,6 @@ void RGBController_RobobloqLightStrip::SetupZones() SetupColors(); } -void RGBController_RobobloqLightStrip::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*-----------------------------------------------------*\ - | This device does not support resizing zones | - \*-----------------------------------------------------*/ -} - void RGBController_RobobloqLightStrip::DeviceUpdateLEDs() { if(modes[active_mode].value == ROBOBLOQ_MODE_DIRECT) @@ -170,12 +162,12 @@ void RGBController_RobobloqLightStrip::DeviceUpdateLEDs() } } -void RGBController_RobobloqLightStrip::UpdateZoneLEDs(int /*zone*/) +void RGBController_RobobloqLightStrip::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RobobloqLightStrip::UpdateSingleLED(int led) +void RGBController_RobobloqLightStrip::DeviceUpdateSingleLED(int led) { controller->SetLEDColor(led, modes[active_mode].colors[0]); } diff --git a/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.h b/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.h index 3b3d50f63..58c15f76e 100644 --- a/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.h +++ b/Controllers/RobobloqLightStripController/RGBController_RobobloqLightStrip.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.cpp b/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.cpp index af16f0d1b..732a08e96 100644 --- a/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.cpp +++ b/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.cpp @@ -123,7 +123,6 @@ void RGBController_RoccatBurst::SetupZones() new_zone.leds_min = leds_count; new_zone.leds_max = leds_count; new_zone.leds_count = leds_count; - new_zone.matrix_map = NULL; zones.push_back(new_zone); std::string led_names[2] = @@ -142,19 +141,12 @@ void RGBController_RoccatBurst::SetupZones() SetupColors(); } -void RGBController_RoccatBurst::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatBurst::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_RoccatBurst::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatBurst::DeviceUpdateZoneLEDs(int /*zone_idx*/) { const mode& active = modes[active_mode]; @@ -169,9 +161,9 @@ void RGBController_RoccatBurst::UpdateZoneLEDs(int /*zone_idx*/) } -void RGBController_RoccatBurst::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatBurst::DeviceUpdateSingleLED(int /*led_idx*/) { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } void RGBController_RoccatBurst::DeviceUpdateMode() diff --git a/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.h b/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.h index cea02ea59..256f00f7a 100644 --- a/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.h +++ b/Controllers/RoccatController/RoccatBurstController/RGBController_RoccatBurst.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatBurst(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.cpp b/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.cpp index 1f8bc7b6d..a5c78a53a 100644 --- a/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.cpp +++ b/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.cpp @@ -98,7 +98,6 @@ void RGBController_RoccatBurstProAir::SetupZones() new_zone.leds_min = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS; new_zone.leds_max = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS; new_zone.leds_count = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS; - new_zone.matrix_map = NULL; zones.push_back(new_zone); std::string led_names[ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS] = @@ -119,26 +118,19 @@ void RGBController_RoccatBurstProAir::SetupZones() SetupColors(); } -void RGBController_RoccatBurstProAir::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatBurstProAir::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_RoccatBurstProAir::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatBurstProAir::DeviceUpdateZoneLEDs(int /*zone_idx*/) { controller->SetColors(colors); } -void RGBController_RoccatBurstProAir::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatBurstProAir::DeviceUpdateSingleLED(int /*led_idx*/) { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } void RGBController_RoccatBurstProAir::DeviceUpdateMode() diff --git a/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.h b/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.h index 8dac6f068..0274ec45e 100644 --- a/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.h +++ b/Controllers/RoccatController/RoccatBurstProAirController/RGBController_RoccatBurstProAir.h @@ -21,10 +21,11 @@ public: ~RGBController_RoccatBurstProAir(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); + void DeviceUpdateMode(); private: diff --git a/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.cpp b/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.cpp index 5cbc09b68..88b39d7bd 100644 --- a/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.cpp +++ b/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.cpp @@ -58,7 +58,6 @@ void RGBController_RoccatElo::SetupZones() new_zone.leds_min = ROCCAT_ELO_LEDS_COUNT; new_zone.leds_max = ROCCAT_ELO_LEDS_COUNT; new_zone.leds_count = ROCCAT_ELO_LEDS_COUNT; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -67,24 +66,17 @@ void RGBController_RoccatElo::SetupZones() SetupColors(); } -void RGBController_RoccatElo::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatElo::DeviceUpdateLEDs() { controller->SendDirect(colors[0]); } -void RGBController_RoccatElo::UpdateZoneLEDs(int /*zone*/) +void RGBController_RoccatElo::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_RoccatElo::UpdateSingleLED(int /*led*/) +void RGBController_RoccatElo::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.h b/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.h index 541591564..1287a47c7 100644 --- a/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.h +++ b/Controllers/RoccatController/RoccatEloController/RGBController_RoccatElo.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatElo(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.cpp b/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.cpp index b28176120..5a325061c 100644 --- a/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.cpp +++ b/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.cpp @@ -56,7 +56,6 @@ void RGBController_RoccatHordeAimo::SetupZones() new_zone.leds_min = NUMBER_OF_LEDS; new_zone.leds_max = NUMBER_OF_LEDS; new_zone.leds_count = NUMBER_OF_LEDS; - new_zone.matrix_map = NULL; zones.push_back(new_zone); for(unsigned int i = 0; i < NUMBER_OF_LEDS; i++) @@ -69,26 +68,19 @@ void RGBController_RoccatHordeAimo::SetupZones() SetupColors(); } -void RGBController_RoccatHordeAimo::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatHordeAimo::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } -void RGBController_RoccatHordeAimo::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatHordeAimo::DeviceUpdateZoneLEDs(int /*zone_idx*/) { controller->SetColors(colors); } -void RGBController_RoccatHordeAimo::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatHordeAimo::DeviceUpdateSingleLED(int /*led_idx*/) { - UpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(0); } void RGBController_RoccatHordeAimo::DeviceUpdateMode() diff --git a/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.h b/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.h index 251bcc139..472ee4de6 100644 --- a/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.h +++ b/Controllers/RoccatController/RoccatHordeAimoController/RGBController_RoccatHordeAimo.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatHordeAimo(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.cpp b/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.cpp index b46b04424..52b43c7e9 100644 --- a/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.cpp +++ b/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.cpp @@ -64,7 +64,6 @@ void RGBController_RoccatKoneAimo::SetupZones() WHEEL_zone.leds_min = 1; WHEEL_zone.leds_max = 1; WHEEL_zone.leds_count = 1; - WHEEL_zone.matrix_map = NULL; zones.push_back(WHEEL_zone); zones_channel.push_back(SCROLL_WHEEL); @@ -80,7 +79,6 @@ void RGBController_RoccatKoneAimo::SetupZones() STRIP_LEFT_zone.leds_min = 4; STRIP_LEFT_zone.leds_max = 4; STRIP_LEFT_zone.leds_count = 4; - STRIP_LEFT_zone.matrix_map = NULL; zones.push_back(STRIP_LEFT_zone); zones_channel.push_back(STRIP_LEFT); @@ -99,7 +97,6 @@ void RGBController_RoccatKoneAimo::SetupZones() STRIP_RIGHT_zone.leds_min = 4; STRIP_RIGHT_zone.leds_max = 4; STRIP_RIGHT_zone.leds_count = 4; - STRIP_RIGHT_zone.matrix_map = NULL; zones.push_back(STRIP_RIGHT_zone); zones_channel.push_back(STRIP_RIGHT); @@ -118,7 +115,6 @@ void RGBController_RoccatKoneAimo::SetupZones() LOWER_LEFT_zone.leds_min = 1; LOWER_LEFT_zone.leds_max = 1; LOWER_LEFT_zone.leds_count = 1; - LOWER_LEFT_zone.matrix_map = NULL; zones.push_back(LOWER_LEFT_zone); zones_channel.push_back(LOWER_LEFT); @@ -134,7 +130,6 @@ void RGBController_RoccatKoneAimo::SetupZones() LOWER_RIGHT_zone.leds_min = 1; LOWER_RIGHT_zone.leds_max = 1; LOWER_RIGHT_zone.leds_count = 1; - LOWER_RIGHT_zone.matrix_map = NULL; zones.push_back(LOWER_RIGHT_zone); zones_channel.push_back(LOWER_RIGHT); @@ -159,13 +154,6 @@ void RGBController_RoccatKoneAimo::SetupZones() } } -void RGBController_RoccatKoneAimo::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatKoneAimo::DeviceUpdateLEDs() { /*---------------------------------------------------------*\ @@ -181,7 +169,7 @@ void RGBController_RoccatKoneAimo::DeviceUpdateLEDs() controller->SendUpdate(); } -void RGBController_RoccatKoneAimo::UpdateZoneLEDs(int zone_idx) +void RGBController_RoccatKoneAimo::DeviceUpdateZoneLEDs(int zone_idx) { /*---------------------------------------------------------*\ | Set colors for one channel of leds | @@ -193,7 +181,7 @@ void RGBController_RoccatKoneAimo::UpdateZoneLEDs(int zone_idx) controller->SendUpdate(); } -void RGBController_RoccatKoneAimo::UpdateSingleLED(int led_idx) +void RGBController_RoccatKoneAimo::DeviceUpdateSingleLED(int led_idx) { /*---------------------------------------------------------*\ | Get channel corresponding to led | diff --git a/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.h b/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.h index 33e0ec4e4..176203176 100644 --- a/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.h +++ b/Controllers/RoccatController/RoccatKoneAimoController/RGBController_RoccatKoneAimo.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatKoneAimo(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.cpp b/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.cpp index ea6b4e14f..9f7a0cebb 100644 --- a/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.cpp +++ b/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.cpp @@ -132,7 +132,6 @@ void RGBController_RoccatKoneProAir::SetupZones() new_zone.leds_min = ROCCAT_KONE_PRO_AIR_LED_COUNT; new_zone.leds_max = ROCCAT_KONE_PRO_AIR_LED_COUNT; new_zone.leds_count = ROCCAT_KONE_PRO_AIR_LED_COUNT; - new_zone.matrix_map = NULL; zones.push_back(new_zone); std::string led_names[2] = @@ -151,13 +150,6 @@ void RGBController_RoccatKoneProAir::SetupZones() SetupColors(); } -void RGBController_RoccatKoneProAir::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatKoneProAir::DeviceUpdateLEDs() { const mode& active = modes[active_mode]; @@ -172,12 +164,12 @@ void RGBController_RoccatKoneProAir::DeviceUpdateLEDs() } } -void RGBController_RoccatKoneProAir::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatKoneProAir::DeviceUpdateZoneLEDs(int /*zone_idx*/) { DeviceUpdateLEDs(); } -void RGBController_RoccatKoneProAir::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatKoneProAir::DeviceUpdateSingleLED(int /*led_idx*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.h b/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.h index d0564ab5e..2d9c60235 100644 --- a/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.h +++ b/Controllers/RoccatController/RoccatKoneProAirController/RGBController_RoccatKoneProAir.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatKoneProAir(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.cpp b/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.cpp index 3855d7645..9cef5b3f3 100644 --- a/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.cpp +++ b/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.cpp @@ -125,7 +125,6 @@ void RGBController_RoccatKonePro::SetupZones() new_zone.leds_min = ROCCAT_KONE_PRO_LED_COUNT; new_zone.leds_max = ROCCAT_KONE_PRO_LED_COUNT; new_zone.leds_count = ROCCAT_KONE_PRO_LED_COUNT; - new_zone.matrix_map = NULL; zones.push_back(new_zone); std::string led_names[2] = @@ -144,13 +143,6 @@ void RGBController_RoccatKonePro::SetupZones() SetupColors(); } -void RGBController_RoccatKonePro::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatKonePro::DeviceUpdateLEDs() { const mode& active = modes[active_mode]; @@ -165,12 +157,12 @@ void RGBController_RoccatKonePro::DeviceUpdateLEDs() } } -void RGBController_RoccatKonePro::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatKonePro::DeviceUpdateZoneLEDs(int /*zone_idx*/) { DeviceUpdateLEDs(); } -void RGBController_RoccatKonePro::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatKonePro::DeviceUpdateSingleLED(int /*led_idx*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.h b/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.h index 1a629e94a..1608d80e9 100644 --- a/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.h +++ b/Controllers/RoccatController/RoccatKoneProController/RGBController_RoccatKonePro.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatKonePro(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.cpp b/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.cpp index 72fc88f7b..ec6e1565b 100644 --- a/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.cpp +++ b/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.cpp @@ -180,7 +180,6 @@ void RGBController_RoccatKoneXP::SetupZones() left.leds_min = 9; left.leds_max = 9; left.leds_count = 9; - left.matrix_map = NULL; zones.push_back(left); for (uint8_t i = 1; i <= 9; i++) { @@ -195,7 +194,6 @@ void RGBController_RoccatKoneXP::SetupZones() right.leds_min = 9; right.leds_max = 9; right.leds_count = 9; - right.matrix_map = NULL; zones.push_back(right); for (uint8_t i = 1; i <= 9; i++) { @@ -210,7 +208,6 @@ void RGBController_RoccatKoneXP::SetupZones() wheel.leds_min = 1; wheel.leds_max = 1; wheel.leds_count = 1; - wheel.matrix_map = NULL; zones.push_back(wheel); led wheel_led; @@ -223,7 +220,6 @@ void RGBController_RoccatKoneXP::SetupZones() dpi.leds_min = 1; dpi.leds_max = 1; dpi.leds_count = 1; - dpi.matrix_map = NULL; zones.push_back(dpi); led dpi_led; @@ -233,13 +229,6 @@ void RGBController_RoccatKoneXP::SetupZones() SetupColors(); } -void RGBController_RoccatKoneXP::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatKoneXP::DeviceUpdateLEDs() { if(modes[active_mode].value == ROCCAT_KONE_XP_MODE_DIRECT) @@ -252,12 +241,12 @@ void RGBController_RoccatKoneXP::DeviceUpdateLEDs() } } -void RGBController_RoccatKoneXP::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatKoneXP::DeviceUpdateZoneLEDs(int /*zone_idx*/) { DeviceUpdateLEDs(); } -void RGBController_RoccatKoneXP::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatKoneXP::DeviceUpdateSingleLED(int /*led_idx*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.h b/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.h index aae4dd769..4f3f39681 100644 --- a/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.h +++ b/Controllers/RoccatController/RoccatKoneXPController/RGBController_RoccatKoneXP.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatKoneXP(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.cpp b/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.cpp index 9f9fdb524..e2b1c05bc 100644 --- a/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.cpp +++ b/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.cpp @@ -94,7 +94,6 @@ void RGBController_RoccatKova::SetupZones() Mouse.leds_count = ROCCAT_KOVA_LED_COUNT; Mouse.leds_min = ROCCAT_KOVA_LED_COUNT; Mouse.leds_max = ROCCAT_KOVA_LED_COUNT; - Mouse.matrix_map = NULL; zones.push_back(Mouse); led WheelLED; @@ -110,24 +109,17 @@ void RGBController_RoccatKova::SetupZones() SetupColors(); } -void RGBController_RoccatKova::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatKova::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_RoccatKova::UpdateZoneLEDs(int /*zone*/) +void RGBController_RoccatKova::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_RoccatKova::UpdateSingleLED(int /*led*/) +void RGBController_RoccatKova::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.h b/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.h index a1d183667..9ca5bd11b 100644 --- a/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.h +++ b/Controllers/RoccatController/RoccatKovaController/RGBController_RoccatKova.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.cpp b/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.cpp index f08daafe1..3befa0e32 100644 --- a/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.cpp +++ b/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.cpp @@ -144,7 +144,6 @@ void RGBController_RoccatSenseAimo::SetupZones() pad.leds_min = 2; pad.leds_max = 2; pad.leds_count = 2; - pad.matrix_map = NULL; zones.push_back(pad); led left_led; @@ -158,13 +157,6 @@ void RGBController_RoccatSenseAimo::SetupZones() SetupColors(); } -void RGBController_RoccatSenseAimo::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatSenseAimo::DeviceUpdateLEDs() { if(modes[active_mode].value == ROCCAT_SENSE_AIMO_MODE_DIRECT) @@ -177,12 +169,12 @@ void RGBController_RoccatSenseAimo::DeviceUpdateLEDs() } } -void RGBController_RoccatSenseAimo::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatSenseAimo::DeviceUpdateZoneLEDs(int /*zone_idx*/) { DeviceUpdateLEDs(); } -void RGBController_RoccatSenseAimo::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatSenseAimo::DeviceUpdateSingleLED(int /*led_idx*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.h b/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.h index 1e8db803b..921abecc4 100644 --- a/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.h +++ b/Controllers/RoccatController/RoccatSenseAimoController/RGBController_RoccatSenseAimo.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatSenseAimo(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.cpp b/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.cpp index 0b2a5cf50..e9aa98fe5 100644 --- a/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.cpp +++ b/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.cpp @@ -158,10 +158,7 @@ void RGBController_RoccatVulcanKeyboard::SetupZones() keyboard_zone.leds_min = keyboard[layout].size; keyboard_zone.leds_max = keyboard[layout].size; keyboard_zone.leds_count = keyboard[layout].size; - keyboard_zone.matrix_map = new matrix_map_type; - keyboard_zone.matrix_map->height = keyboard[layout].rows; - keyboard_zone.matrix_map->width = keyboard[layout].cols; - keyboard_zone.matrix_map->map = keyboard[layout].matrix_map; + keyboard_zone.matrix_map.Set(keyboard[layout].rows, keyboard[layout].cols, keyboard[layout].matrix_map); zones.push_back(keyboard_zone); for(int led_id = 0; led_id < keyboard[layout].size; led_id++) @@ -181,13 +178,6 @@ void RGBController_RoccatVulcanKeyboard::SetupZones() DeviceUpdateLEDs(); } -void RGBController_RoccatVulcanKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_RoccatVulcanKeyboard::DeviceUpdateLEDs() { if(modes[active_mode].value == ROCCAT_VULCAN_MODE_DIRECT) @@ -207,12 +197,12 @@ void RGBController_RoccatVulcanKeyboard::DeviceUpdateLEDs() } } -void RGBController_RoccatVulcanKeyboard::UpdateZoneLEDs(int /*zone_idx*/) +void RGBController_RoccatVulcanKeyboard::DeviceUpdateZoneLEDs(int /*zone_idx*/) { DeviceUpdateLEDs(); } -void RGBController_RoccatVulcanKeyboard::UpdateSingleLED(int /*led_idx*/) +void RGBController_RoccatVulcanKeyboard::DeviceUpdateSingleLED(int /*led_idx*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.h b/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.h index 0a840100b..4c7e01fac 100644 --- a/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.h +++ b/Controllers/RoccatController/RoccatVulcanKeyboardController/RGBController_RoccatVulcanKeyboard.h @@ -21,11 +21,10 @@ public: ~RGBController_RoccatVulcanKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.cpp b/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.cpp index b1f3fd17e..8e70ff79d 100644 --- a/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.cpp +++ b/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.cpp @@ -133,8 +133,6 @@ void RGBController_SRGBmodsLEDControllerV1::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[4]; @@ -152,7 +150,7 @@ void RGBController_SRGBmodsLEDControllerV1::SetupZones() SetupColors(); } -void RGBController_SRGBmodsLEDControllerV1::ResizeZone(int zone, int new_size) +void RGBController_SRGBmodsLEDControllerV1::DeviceResizeZone(int zone, int new_size) { if((size_t)zone >= zones.size()) { @@ -185,12 +183,12 @@ void RGBController_SRGBmodsLEDControllerV1::DeviceUpdateLEDs() } } -void RGBController_SRGBmodsLEDControllerV1::UpdateZoneLEDs(int /*zone*/) +void RGBController_SRGBmodsLEDControllerV1::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SRGBmodsLEDControllerV1::UpdateSingleLED(int /*led*/) +void RGBController_SRGBmodsLEDControllerV1::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.h b/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.h index b1d55ab5d..53dc4b1b3 100644 --- a/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.h +++ b/Controllers/SRGBmodsController/SRGBmodsLEDControllerV1/RGBController_SRGBmodsLEDControllerV1.h @@ -23,11 +23,11 @@ public: ~RGBController_SRGBmodsLEDControllerV1(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.cpp b/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.cpp index fbd855cb7..f5f101cf0 100644 --- a/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.cpp +++ b/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.cpp @@ -92,8 +92,6 @@ void RGBController_SRGBmodsPico::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[4]; @@ -111,7 +109,7 @@ void RGBController_SRGBmodsPico::SetupZones() SetupColors(); } -void RGBController_SRGBmodsPico::ResizeZone(int zone, int new_size) +void RGBController_SRGBmodsPico::DeviceResizeZone(int zone, int new_size) { if((size_t)zone >= zones.size()) { @@ -137,12 +135,12 @@ void RGBController_SRGBmodsPico::DeviceUpdateLEDs() } } -void RGBController_SRGBmodsPico::UpdateZoneLEDs(int zone) +void RGBController_SRGBmodsPico::DeviceUpdateZoneLEDs(int zone) { controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); } -void RGBController_SRGBmodsPico::UpdateSingleLED(int led) +void RGBController_SRGBmodsPico::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; diff --git a/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.h b/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.h index badffae3b..9aeef0f43 100644 --- a/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.h +++ b/Controllers/SRGBmodsController/SRGBmodsPicoController/RGBController_SRGBmodsPico.h @@ -24,11 +24,11 @@ public: ~RGBController_SRGBmodsPico(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.cpp b/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.cpp index 170136e77..3a49d4d36 100644 --- a/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.cpp +++ b/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.cpp @@ -113,7 +113,6 @@ void RGBController_SapphireNitroGlowV1::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -168,13 +167,6 @@ void RGBController_SapphireNitroGlowV1::ReadConfiguration() modes[(unsigned int)active_mode].brightness = controller->GetBrightness(); } -void RGBController_SapphireNitroGlowV1::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SapphireNitroGlowV1::DeviceUpdateLEDs() { RGBColor color = colors[0]; @@ -185,12 +177,12 @@ void RGBController_SapphireNitroGlowV1::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_SapphireNitroGlowV1::UpdateZoneLEDs(int /*zone*/) +void RGBController_SapphireNitroGlowV1::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SapphireNitroGlowV1::UpdateSingleLED(int /*led*/) +void RGBController_SapphireNitroGlowV1::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.h b/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.h index 1bf8209bb..9febe9b58 100644 --- a/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.h +++ b/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/RGBController_SapphireNitroGlowV1.h @@ -21,11 +21,10 @@ public: ~RGBController_SapphireNitroGlowV1(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.cpp b/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.cpp index 3ecb12db6..9744c4a2e 100644 --- a/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.cpp +++ b/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.cpp @@ -113,7 +113,6 @@ void RGBController_SapphireNitroGlowV3::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -178,13 +177,6 @@ void RGBController_SapphireNitroGlowV3::ReadConfiguration() } } -void RGBController_SapphireNitroGlowV3::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SapphireNitroGlowV3::DeviceUpdateLEDs() { RGBColor color = colors[0]; @@ -195,12 +187,12 @@ void RGBController_SapphireNitroGlowV3::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_SapphireNitroGlowV3::UpdateZoneLEDs(int /*zone*/) +void RGBController_SapphireNitroGlowV3::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SapphireNitroGlowV3::UpdateSingleLED(int /*led*/) +void RGBController_SapphireNitroGlowV3::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.h b/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.h index 4a00d7190..31c3f4867 100644 --- a/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.h +++ b/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/RGBController_SapphireNitroGlowV3.h @@ -21,11 +21,10 @@ public: ~RGBController_SapphireNitroGlowV3(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SeagateController/RGBController_Seagate.cpp b/Controllers/SeagateController/RGBController_Seagate.cpp index bc00a9299..b457f5f34 100644 --- a/Controllers/SeagateController/RGBController_Seagate.cpp +++ b/Controllers/SeagateController/RGBController_Seagate.cpp @@ -76,7 +76,6 @@ void RGBController_Seagate::SetupZones() led_zone.leds_min = 6; led_zone.leds_max = 6; led_zone.leds_count = 6; - led_zone.matrix_map = NULL; zones.push_back(led_zone); for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++) @@ -90,27 +89,20 @@ void RGBController_Seagate::SetupZones() SetupColors(); } -void RGBController_Seagate::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Seagate::DeviceUpdateLEDs() { for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++) { - UpdateSingleLED(led_idx); + DeviceUpdateSingleLED(led_idx); } } -void RGBController_Seagate::UpdateZoneLEDs(int /*zone*/) +void RGBController_Seagate::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Seagate::UpdateSingleLED(int led) +void RGBController_Seagate::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/SeagateController/RGBController_Seagate.h b/Controllers/SeagateController/RGBController_Seagate.h index 7c5221a41..767685050 100644 --- a/Controllers/SeagateController/RGBController_Seagate.h +++ b/Controllers/SeagateController/RGBController_Seagate.h @@ -22,14 +22,11 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); - void DeviceSaveMode(); private: diff --git a/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.cpp b/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.cpp index 0109f96a8..d5b268a58 100644 --- a/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.cpp +++ b/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.cpp @@ -129,17 +129,12 @@ void RGBController_GenesisXenon200::SetupZones() } -void RGBController_GenesisXenon200::ResizeZone(int /*zone*/, int /*new_size*/) +void RGBController_GenesisXenon200::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_GenesisXenon200::UpdateZoneLEDs(int /*zone*/) -{ - -} - -void RGBController_GenesisXenon200::UpdateSingleLED(int /*led*/) +void RGBController_GenesisXenon200::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.h b/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.h index 02ad9fd20..6cd8eda7c 100644 --- a/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.h +++ b/Controllers/SinowealthController/GenesisXenon200Controller/RGBController_GenesisXenon200.h @@ -31,11 +31,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.cpp b/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.cpp index 3a0f2f548..bfe801c2f 100644 --- a/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.cpp +++ b/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.cpp @@ -191,7 +191,6 @@ void RGBController_Sinowealth1007::SetupZones() new_zone.leds_min = controller->GetLEDCount(); new_zone.leds_max = controller->GetLEDCount(); new_zone.leds_count = controller->GetLEDCount(); - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -207,24 +206,17 @@ void RGBController_Sinowealth1007::SetupZones() SetupColors(); } -void RGBController_Sinowealth1007::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Sinowealth1007::DeviceUpdateLEDs() { controller->SetLEDColors(colors); } -void RGBController_Sinowealth1007::UpdateZoneLEDs(int /*zone*/) +void RGBController_Sinowealth1007::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Sinowealth1007::UpdateSingleLED(int /*led*/) +void RGBController_Sinowealth1007::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.h b/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.h index 080c1fc94..d995f3e3e 100644 --- a/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.h +++ b/Controllers/SinowealthController/Sinowealth1007Controller/RGBController_Sinowealth1007.h @@ -21,11 +21,10 @@ public: ~RGBController_Sinowealth1007(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.cpp b/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.cpp index 4abd24a34..3e9eb2cea 100644 --- a/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.cpp +++ b/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.cpp @@ -165,7 +165,6 @@ void RGBController_Sinowealth::SetupZones() new_zone.leds_min = controller->GetLEDCount(); new_zone.leds_max = controller->GetLEDCount(); new_zone.leds_count = controller->GetLEDCount(); - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -181,24 +180,17 @@ void RGBController_Sinowealth::SetupZones() SetupColors(); } -void RGBController_Sinowealth::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Sinowealth::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_Sinowealth::UpdateZoneLEDs(int /*zone*/) +void RGBController_Sinowealth::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Sinowealth::UpdateSingleLED(int /*led*/) +void RGBController_Sinowealth::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.h b/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.h index 0f2f31632..e7e296678 100644 --- a/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.h +++ b/Controllers/SinowealthController/SinowealthController/RGBController_Sinowealth.h @@ -21,11 +21,10 @@ public: ~RGBController_Sinowealth(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.cpp b/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.cpp index a3d9b9dd1..7cab7dfa6 100644 --- a/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.cpp +++ b/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.cpp @@ -166,22 +166,17 @@ void RGBController_GMOW::SetupZones() } -void RGBController_GMOW::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_GMOW::DeviceUpdateLEDs() { } -void RGBController_GMOW::UpdateZoneLEDs(int /*zone*/) +void RGBController_GMOW::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_GMOW::UpdateSingleLED(int /*led*/) +void RGBController_GMOW::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.h b/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.h index c2f0dad21..6c229957e 100644 --- a/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.h +++ b/Controllers/SinowealthController/SinowealthGMOWController/RGBController_SinowealthGMOW.h @@ -21,11 +21,10 @@ public: ~RGBController_GMOW(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.cpp b/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.cpp index 3a13456c8..bf0d1ace3 100644 --- a/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.cpp +++ b/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.cpp @@ -92,15 +92,9 @@ void RGBController_SinowealthKeyboard10c::SetupZones() device.keyboard_layout.key_values); new_kb.ChangeKeys(device.keyboard_layout.edit_keys); - matrix_map_type* new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_zone.matrix_map->height = new_kb.GetRowCount(); - new_zone.matrix_map->width = new_kb.GetColumnCount(); - - new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width]; - new_zone.leds_count = new_kb.GetRowCount() * new_kb.GetColumnCount(); - new_zone.leds_min = new_zone.leds_count; - new_zone.leds_max = new_zone.leds_count; + new_zone.leds_count = new_kb.GetRowCount() * new_kb.GetColumnCount(); + new_zone.leds_min = new_zone.leds_count; + new_zone.leds_max = new_zone.leds_count; /*---------------------------------------------------------*\ | These keyboards use sparse LED indexes — for example, a | @@ -112,13 +106,13 @@ void RGBController_SinowealthKeyboard10c::SetupZones() | LED exists. | \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_VALUE, new_map->height, new_map->width); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_VALUE); leds.resize(new_zone.leds_count); for(unsigned int i = 0, j = 0; i < new_zone.leds_count; i++) { - if(new_map->map[i] == 0xFFFFFFFF) + if(new_zone.matrix_map.map[i] == 0xFFFFFFFF) { continue; } @@ -128,7 +122,7 @@ void RGBController_SinowealthKeyboard10c::SetupZones() new_led.name = new_kb.GetKeyNameAt(j); new_led.value = new_kb.GetKeyValueAt(j); - leds[new_map->map[i]] = new_led; + leds[new_zone.matrix_map.map[i]] = new_led; j++; } @@ -138,25 +132,18 @@ void RGBController_SinowealthKeyboard10c::SetupZones() SetupColors(); } -void RGBController_SinowealthKeyboard10c::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SinowealthKeyboard10c::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); controller->SetLEDsDirect(colors); } -void RGBController_SinowealthKeyboard10c::UpdateZoneLEDs(int /*zone*/) +void RGBController_SinowealthKeyboard10c::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SinowealthKeyboard10c::UpdateSingleLED(int /*led*/) +void RGBController_SinowealthKeyboard10c::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -171,7 +158,7 @@ void RGBController_SinowealthKeyboard10c::KeepaliveThreadFunction() { if(active_mode == MODE_DIRECT && (std::chrono::steady_clock::now() - last_update_time) > 1s) { - UpdateLEDs(); + UpdateLEDsInternal(); } std::this_thread::sleep_for(500ms); } diff --git a/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.h b/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.h index 6ebad9f32..3d356fe7f 100644 --- a/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.h +++ b/Controllers/SinowealthController/SinowealthKeyboard10cController/RGBController_SinowealthKeyboard10c.h @@ -21,11 +21,10 @@ public: ~RGBController_SinowealthKeyboard10c(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.cpp b/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.cpp index 8d012b7da..6f8001867 100644 --- a/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.cpp +++ b/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.cpp @@ -377,10 +377,7 @@ void RGBController_SinowealthKeyboard16::SetupZones() new_zone.leds_count = controller->GetLEDCount(); new_zone.leds_min = new_zone.leds_count; new_zone.leds_max = new_zone.leds_count; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 22; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; + new_zone.matrix_map.Set(6, 22, (unsigned int *)&matrix_map); zones.push_back(new_zone); @@ -397,24 +394,17 @@ void RGBController_SinowealthKeyboard16::SetupZones() SetupColors(); } -void RGBController_SinowealthKeyboard16::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SinowealthKeyboard16::DeviceUpdateLEDs() { controller->SetLEDsDirect(colors); } -void RGBController_SinowealthKeyboard16::UpdateZoneLEDs(int /*zone*/) +void RGBController_SinowealthKeyboard16::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SinowealthKeyboard16::UpdateSingleLED(int /*led*/) +void RGBController_SinowealthKeyboard16::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -458,6 +448,4 @@ void RGBController_SinowealthKeyboard16::DeviceUpdateMode() std::fill(colors.begin(), colors.end(), ActiveMode.colors[0]); } } - - SignalUpdate(); } diff --git a/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.h b/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.h index 22c551da7..ac29f828d 100644 --- a/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.h +++ b/Controllers/SinowealthController/SinowealthKeyboard16Controller/RGBController_SinowealthKeyboard16.h @@ -23,11 +23,10 @@ public: ~RGBController_SinowealthKeyboard16(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.cpp b/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.cpp index c33608163..84902d222 100644 --- a/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.cpp +++ b/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.cpp @@ -79,17 +79,6 @@ RGBController_SinowealthKeyboard90::RGBController_SinowealthKeyboard90(Sinowealt RGBController_SinowealthKeyboard90::~RGBController_SinowealthKeyboard90() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -105,10 +94,7 @@ void RGBController_SinowealthKeyboard90::SetupZones() new_zone.leds_min = new_zone.leds_count; new_zone.leds_max = new_zone.leds_count; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; + new_zone.matrix_map.Set(6, 23, (unsigned int *)&matrix_map); zones.push_back(new_zone); @@ -123,13 +109,6 @@ void RGBController_SinowealthKeyboard90::SetupZones() SetupColors(); } -void RGBController_SinowealthKeyboard90::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SinowealthKeyboard90::DeviceUpdateLEDs() { controller->SendMode(modes[active_mode].value, modes[active_mode].brightness); @@ -146,12 +125,12 @@ void RGBController_SinowealthKeyboard90::DeviceUpdateLEDs() controller->SendCommit(); } -void RGBController_SinowealthKeyboard90::UpdateZoneLEDs(int /*zone*/) +void RGBController_SinowealthKeyboard90::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SinowealthKeyboard90::UpdateSingleLED(int /*key*/) +void RGBController_SinowealthKeyboard90::DeviceUpdateSingleLED(int /*key*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.h b/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.h index 175f36507..5e109bff4 100644 --- a/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.h +++ b/Controllers/SinowealthController/SinowealthKeyboard90Controller/RGBController_SinowealthKeyboard90.h @@ -20,11 +20,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.cpp b/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.cpp index 36fca8a7e..04cb96794 100644 --- a/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.cpp +++ b/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.cpp @@ -421,10 +421,7 @@ void RGBController_SinowealthKeyboard::SetupZones() new_zone.leds_min = 86; new_zone.leds_max = 86; new_zone.leds_count = 86; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 17; - new_zone.matrix_map->map = (unsigned int *)&tkl_matrix_map; + new_zone.matrix_map.Set(6, 17, (unsigned int *)&tkl_matrix_map); zones.push_back(new_zone); @@ -441,24 +438,17 @@ void RGBController_SinowealthKeyboard::SetupZones() SetupColors(); } -void RGBController_SinowealthKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SinowealthKeyboard::DeviceUpdateLEDs() { controller->SetLEDsDirect(colors); } -void RGBController_SinowealthKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_SinowealthKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SinowealthKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_SinowealthKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.h b/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.h index 755384d0c..bb43cf494 100644 --- a/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.h +++ b/Controllers/SinowealthController/SinowealthKeyboardController/RGBController_SinowealthKeyboard.h @@ -20,11 +20,10 @@ public: ~RGBController_SinowealthKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.cpp b/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.cpp index 24351462d..b764a12be 100644 --- a/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.cpp +++ b/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.cpp @@ -99,21 +99,15 @@ void RGBController_SkyloongGK104Pro::SetupZones() } ); - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_zone.matrix_map->height = new_kb.GetRowCount(); - new_zone.matrix_map->width = new_kb.GetColumnCount(); - - new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width]; - new_zone.leds_count = new_kb.GetKeyCount(); - new_zone.leds_min = new_zone.leds_count; - new_zone.leds_max = new_zone.leds_count; + new_zone.leds_count = new_kb.GetKeyCount(); + new_zone.leds_min = new_zone.leds_count; + new_zone.leds_max = new_zone.leds_count; /*---------------------------------------------------------*\ | Matrix map still uses declared zone rows and columns | | as the packet structure depends on the matrix map | \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, new_map->height, new_map->width); + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | @@ -134,24 +128,17 @@ void RGBController_SkyloongGK104Pro::SetupZones() SetupColors(); } -void RGBController_SkyloongGK104Pro::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SkyloongGK104Pro::DeviceUpdateLEDs() { controller->SendColorPacket(colors, &leds, modes[active_mode].brightness); } -void RGBController_SkyloongGK104Pro::UpdateZoneLEDs(int /*zone*/) +void RGBController_SkyloongGK104Pro::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SkyloongGK104Pro::UpdateSingleLED(int /*led*/) +void RGBController_SkyloongGK104Pro::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.h b/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.h index 489ac594b..8afd47e7d 100644 --- a/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.h +++ b/Controllers/SkyloongController/RGBController_SkyloongGK104Pro.h @@ -24,11 +24,10 @@ public: ~RGBController_SkyloongGK104Pro(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.cpp b/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.cpp index 813b833f0..9e2ec64df 100644 --- a/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.cpp +++ b/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.cpp @@ -63,7 +63,6 @@ void RGBController_SonyDS4::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "Controller LED"; @@ -75,13 +74,6 @@ void RGBController_SonyDS4::SetupZones() SetupColors(); } -void RGBController_SonyDS4::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SonyDS4::DeviceUpdateLEDs() { unsigned char red = char(RGBGetRValue(colors[0])); @@ -90,12 +82,12 @@ void RGBController_SonyDS4::DeviceUpdateLEDs() controller->SetColors(red, green, blue); } -void RGBController_SonyDS4::UpdateZoneLEDs(int /*zone*/) +void RGBController_SonyDS4::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SonyDS4::UpdateSingleLED(int /*led*/) +void RGBController_SonyDS4::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.h b/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.h index 68bfc006e..3663381d3 100644 --- a/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.h +++ b/Controllers/SonyGamepadController/SonyDS4Controller/RGBController_SonyDS4.h @@ -21,11 +21,10 @@ public: ~RGBController_SonyDS4(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.cpp b/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.cpp index cb2a64943..21a138a76 100644 --- a/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.cpp +++ b/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.cpp @@ -90,7 +90,6 @@ void RGBController_SonyDualSense::SetupZones() lightbar.leds_min = SONY_DUALSENSE_LIGHTBAR_LED_COUNT; lightbar.leds_max = SONY_DUALSENSE_LIGHTBAR_LED_COUNT; lightbar.leds_count = SONY_DUALSENSE_LIGHTBAR_LED_COUNT; - lightbar.matrix_map = NULL; zones.push_back(lightbar); zone playerleds; @@ -99,7 +98,6 @@ void RGBController_SonyDualSense::SetupZones() playerleds.leds_min = SONY_DUALSENSE_PLAYER_LED_COUNT; playerleds.leds_max = SONY_DUALSENSE_PLAYER_LED_COUNT; playerleds.leds_count = SONY_DUALSENSE_PLAYER_LED_COUNT; - playerleds.matrix_map = NULL; zones.push_back(playerleds); leds.resize(SONY_DUALSENSE_LIGHTBAR_LED_COUNT + SONY_DUALSENSE_PLAYER_LED_COUNT); @@ -114,24 +112,17 @@ void RGBController_SonyDualSense::SetupZones() SetupColors(); } -void RGBController_SonyDualSense::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SonyDualSense::DeviceUpdateLEDs() { controller->SetColors(colors, modes[active_mode].brightness, modes[active_mode].value); } -void RGBController_SonyDualSense::UpdateZoneLEDs(int /*zone*/) +void RGBController_SonyDualSense::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SonyDualSense::UpdateSingleLED(int /*led*/) +void RGBController_SonyDualSense::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.h b/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.h index e8552385e..232198d28 100644 --- a/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.h +++ b/Controllers/SonyGamepadController/SonyDualSenseController/RGBController_SonyDualSense.h @@ -21,11 +21,10 @@ public: ~RGBController_SonyDualSense(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp index 25af8061e..e1ccc5813 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp @@ -83,7 +83,6 @@ void RGBController_SteelSeriesApex3::SetupZones() curr_zone.leds_min = led_count; curr_zone.leds_max = led_count; curr_zone.leds_count = led_count; - curr_zone.matrix_map = NULL; zones.push_back(curr_zone); for(size_t i = 0; i < curr_zone.leds_count; i++) @@ -96,24 +95,17 @@ void RGBController_SteelSeriesApex3::SetupZones() SetupColors(); } -void RGBController_SteelSeriesApex3::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesApex3::DeviceUpdateLEDs() { controller->SetColor(colors, modes[active_mode].value, modes[active_mode].brightness); } -void RGBController_SteelSeriesApex3::UpdateZoneLEDs(int /*zone*/) +void RGBController_SteelSeriesApex3::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SteelSeriesApex3::UpdateSingleLED(int /*led*/) +void RGBController_SteelSeriesApex3::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.h b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.h index 36ed6dbbc..37c7bdd48 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.h +++ b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.h @@ -27,11 +27,10 @@ public: ~RGBController_SteelSeriesApex3(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp b/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp index 863583aac..3c9c22ccd 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp @@ -65,18 +65,6 @@ RGBController_SteelSeriesApex::RGBController_SteelSeriesApex(SteelSeriesApexBase RGBController_SteelSeriesApex::~RGBController_SteelSeriesApex() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - free(zones[zone_index].matrix_map->map); - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -103,18 +91,15 @@ void RGBController_SteelSeriesApex::SetupZones() if(zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->map = (unsigned int *) malloc(matrix_mapsize*sizeof(unsigned int)); + new_zone.matrix_map.height = MATRIX_HEIGHT; + new_zone.matrix_map.width = MATRIX_WIDTH; + new_zone.matrix_map.map.resize(MATRIX_HEIGHT * MATRIX_WIDTH); if((proto_type == APEX) || (proto_type == APEX_M) || (proto_type == APEX_9_TKL) || (proto_type == APEX_9_MINI)) { - SetSkuRegion(*new_zone.matrix_map, sku); + SetSkuRegion(&new_zone.matrix_map, sku); } } - else - { - new_zone.matrix_map = NULL; - } if((proto_type == APEX) || (proto_type == APEX_M) || (proto_type == APEX_9_TKL) || (proto_type == APEX_9_MINI)) { @@ -130,25 +115,18 @@ void RGBController_SteelSeriesApex::SetupZones() SetupColors(); } -void RGBController_SteelSeriesApex::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesApex::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); controller->SetLEDsDirect(colors); } -void RGBController_SteelSeriesApex::UpdateZoneLEDs(int /*zone*/) +void RGBController_SteelSeriesApex::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_SteelSeriesApex::UpdateSingleLED(int /*led*/) +void RGBController_SteelSeriesApex::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.h b/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.h index 3b0404346..2ecf1ee92 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.h @@ -23,11 +23,10 @@ public: ~RGBController_SteelSeriesApex(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesApexRegions.h b/Controllers/SteelSeriesController/SteelSeriesApexRegions.h index cb65ba8b3..064d53c81 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexRegions.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexRegions.h @@ -434,12 +434,10 @@ static const std::map patch_lookup = { "64533", { {}, apex_iso_region_patch, apex_nor_keyname_lookup }}, }; -static void SetSkuRegion (matrix_map_type& input, std::string& sku) +static void SetSkuRegion(matrix_map_type* input, std::string& sku) { std::map::const_iterator it = patch_lookup.find(sku); unsigned int local_matrix [MATRIX_HEIGHT][MATRIX_WIDTH] = MATRIX_MAP_ANSI; - input.height = MATRIX_HEIGHT; - input.width = MATRIX_WIDTH; if(it != patch_lookup.end()) { @@ -452,7 +450,7 @@ static void SetSkuRegion (matrix_map_type& input, std::string& sku) local_matrix[it->second.region_patch[i].row][it->second.region_patch[i].column] = it->second.region_patch[i].value; } } - memcpy(input.map, (unsigned int *)local_matrix, sizeof(unsigned int)*MATRIX_HEIGHT*MATRIX_WIDTH); + memcpy(input->map.data(), (unsigned int *)local_matrix, sizeof(unsigned int)*MATRIX_HEIGHT*MATRIX_WIDTH); } static void SetSkuLedNames (std::vector& input, std::string& sku, unsigned int led_count) diff --git a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp index 6a72d760f..62c8568b1 100644 --- a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp @@ -64,7 +64,6 @@ void RGBController_SteelSeriesArctis5::SetupZones() zone.leds_min = 1; zone.leds_max = 1; zone.leds_count = 1; - zone.matrix_map = NULL; zones.push_back(zone); led mouse_led; @@ -75,29 +74,22 @@ void RGBController_SteelSeriesArctis5::SetupZones() SetupColors(); } -void RGBController_SteelSeriesArctis5::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesArctis5::DeviceUpdateLEDs() { for(unsigned int i = 0; i < zones.size(); i++) { - UpdateZoneLEDs(i); + DeviceUpdateZoneLEDs(i); } } -void RGBController_SteelSeriesArctis5::UpdateZoneLEDs(int zone) +void RGBController_SteelSeriesArctis5::DeviceUpdateZoneLEDs(int zone) { controller->SetColor(zone, colors[zone]); } -void RGBController_SteelSeriesArctis5::UpdateSingleLED(int led) +void RGBController_SteelSeriesArctis5::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_SteelSeriesArctis5::DeviceUpdateMode() diff --git a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.h b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.h index 6c6b6da2e..f1b6a4a4b 100644 --- a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.h +++ b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.h @@ -21,11 +21,10 @@ public: ~RGBController_SteelSeriesArctis5(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp b/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp index 2411158ff..96a8329dc 100644 --- a/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp @@ -62,7 +62,6 @@ void RGBController_SteelSeriesOldApex::SetupZones() qwerty_zone.leds_min = 1; qwerty_zone.leds_max = 1; qwerty_zone.leds_count = 1; - qwerty_zone.matrix_map = NULL; zones.push_back(qwerty_zone); led qwerty_led; @@ -75,7 +74,6 @@ void RGBController_SteelSeriesOldApex::SetupZones() tenkey_zone.leds_min = 1; tenkey_zone.leds_max = 1; tenkey_zone.leds_count = 1; - tenkey_zone.matrix_map = NULL; zones.push_back(tenkey_zone); led tenkey_led; @@ -88,7 +86,6 @@ void RGBController_SteelSeriesOldApex::SetupZones() function_zone.leds_min = 1; function_zone.leds_max = 1; function_zone.leds_count = 1; - function_zone.matrix_map = NULL; zones.push_back(function_zone); led function_led; @@ -101,7 +98,6 @@ void RGBController_SteelSeriesOldApex::SetupZones() mx_zone.leds_min = 1; mx_zone.leds_max = 1; mx_zone.leds_count = 1; - mx_zone.matrix_map = NULL; zones.push_back(mx_zone); led mx_led; @@ -114,7 +110,6 @@ void RGBController_SteelSeriesOldApex::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led logo_led; @@ -124,13 +119,6 @@ void RGBController_SteelSeriesOldApex::SetupZones() SetupColors(); } -void RGBController_SteelSeriesOldApex::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesOldApex::DeviceUpdateLEDs() { // Due to the inefficient packet design of the OG Apex @@ -168,7 +156,7 @@ void RGBController_SteelSeriesOldApex::DeviceUpdateLEDs() controller->SetColorDetailed(qwerty, tenkey, functionkey, mxkey, logo); } -void RGBController_SteelSeriesOldApex::UpdateZoneLEDs(int /*zone*/) +void RGBController_SteelSeriesOldApex::DeviceUpdateZoneLEDs(int /*zone*/) { // updating for one zone is pointless, // all zones have to be blasted anyway @@ -177,7 +165,7 @@ void RGBController_SteelSeriesOldApex::UpdateZoneLEDs(int /*zone*/) } -void RGBController_SteelSeriesOldApex::UpdateSingleLED(int /*led*/) +void RGBController_SteelSeriesOldApex::DeviceUpdateSingleLED(int /*led*/) { // Each zone is one LED, however // updating for one zone is pointless, diff --git a/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.h b/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.h index c8429f9cc..eb27c241f 100644 --- a/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.h +++ b/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.h @@ -27,11 +27,10 @@ public: ~RGBController_SteelSeriesOldApex(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp index 2d149638a..ab08eb336 100644 --- a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp @@ -58,7 +58,6 @@ void RGBController_SteelSeriesQCKMat::SetupZones() mousemat_zone.leds_min = 2; mousemat_zone.leds_max = 2; mousemat_zone.leds_count = 2; - mousemat_zone.matrix_map = NULL; zones.push_back(mousemat_zone); led bot_led; @@ -72,19 +71,12 @@ void RGBController_SteelSeriesQCKMat::SetupZones() SetupColors(); } -void RGBController_SteelSeriesQCKMat::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesQCKMat::DeviceUpdateLEDs() { controller->SetColors(colors); } -void RGBController_SteelSeriesQCKMat::UpdateZoneLEDs(int /*zone*/) +void RGBController_SteelSeriesQCKMat::DeviceUpdateZoneLEDs(int /*zone*/) { /*---------------------------------------------------------*\ | Packet expects both LEDs | @@ -92,7 +84,7 @@ void RGBController_SteelSeriesQCKMat::UpdateZoneLEDs(int /*zone*/) DeviceUpdateLEDs(); } -void RGBController_SteelSeriesQCKMat::UpdateSingleLED(int /*led*/) +void RGBController_SteelSeriesQCKMat::DeviceUpdateSingleLED(int /*led*/) { /*---------------------------------------------------------*\ | Packet expects both LEDs | diff --git a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.h b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.h index f4277428c..2eb3b9bef 100644 --- a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.h +++ b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.h @@ -21,11 +21,10 @@ public: ~RGBController_SteelSeriesQCKMat(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp index 6e8955aa9..dcd291f1b 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp @@ -128,7 +128,6 @@ void RGBController_SteelSeriesRival3::SetupZones() zone.leds_min = 1; zone.leds_max = 1; zone.leds_count = 1; - zone.matrix_map = NULL; zones.push_back(zone); led mouse_led; @@ -139,28 +138,21 @@ void RGBController_SteelSeriesRival3::SetupZones() SetupColors(); } -void RGBController_SteelSeriesRival3::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesRival3::DeviceUpdateLEDs() { for(unsigned int i = 0; i < zones.size(); i++) { - UpdateZoneLEDs(i); + DeviceUpdateZoneLEDs(i); } DeviceUpdateMode(); } -void RGBController_SteelSeriesRival3::UpdateZoneLEDs(int zone) +void RGBController_SteelSeriesRival3::DeviceUpdateZoneLEDs(int zone) { - UpdateSingleLED(zone); + DeviceUpdateSingleLED(zone); } -void RGBController_SteelSeriesRival3::UpdateSingleLED(int led) +void RGBController_SteelSeriesRival3::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.h b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.h index 2f86a836e..58df7b4d6 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.h +++ b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.h @@ -22,11 +22,10 @@ public: ~RGBController_SteelSeriesRival3(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp b/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp index 81d6e42b4..f58cb6696 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp @@ -94,7 +94,6 @@ void RGBController_SteelSeriesRival::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led logo_led; @@ -112,7 +111,6 @@ void RGBController_SteelSeriesRival::SetupZones() wheel_zone.leds_min = 1; wheel_zone.leds_max = 1; wheel_zone.leds_count = 1; - wheel_zone.matrix_map = NULL; zones.push_back(wheel_zone); led wheel_led; @@ -131,7 +129,6 @@ void RGBController_SteelSeriesRival::SetupZones() wheel_zone.leds_min = 1; wheel_zone.leds_max = 1; wheel_zone.leds_count = 1; - wheel_zone.matrix_map = NULL; zones.push_back(wheel_zone); led wheel_led; @@ -145,7 +142,6 @@ void RGBController_SteelSeriesRival::SetupZones() mouse_zone.leds_min = 6; mouse_zone.leds_max = 6; mouse_zone.leds_count = 6; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); for(const steelseries_rival_led_info led_info: rival_650_leds) @@ -167,7 +163,6 @@ void RGBController_SteelSeriesRival::SetupZones() wheel_zone.leds_min = 1; wheel_zone.leds_max = 1; wheel_zone.leds_count = 1; - wheel_zone.matrix_map = NULL; zones.push_back(wheel_zone); led wheel_led; @@ -181,7 +176,6 @@ void RGBController_SteelSeriesRival::SetupZones() mouse_zone.leds_min = 6; mouse_zone.leds_max = 6; mouse_zone.leds_count = 6; - mouse_zone.matrix_map = NULL; zones.push_back(mouse_zone); for(const steelseries_rival_led_info led_info: rival_600_leds) @@ -196,13 +190,6 @@ void RGBController_SteelSeriesRival::SetupZones() SetupColors(); } -void RGBController_SteelSeriesRival::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesRival::DeviceUpdateLEDs() { for(unsigned int i = 0; i < leds.size(); i++) @@ -214,7 +201,7 @@ void RGBController_SteelSeriesRival::DeviceUpdateLEDs() } } -void RGBController_SteelSeriesRival::UpdateZoneLEDs(int zone) +void RGBController_SteelSeriesRival::DeviceUpdateZoneLEDs(int zone) { for(unsigned int i = 0; i < zones[zone].leds_count; i++) { @@ -225,7 +212,7 @@ void RGBController_SteelSeriesRival::UpdateZoneLEDs(int zone) } } -void RGBController_SteelSeriesRival::UpdateSingleLED(int led) +void RGBController_SteelSeriesRival::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.h b/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.h index 499d0a07d..398519b9d 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.h +++ b/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.h @@ -21,11 +21,10 @@ public: ~RGBController_SteelSeriesRival(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp b/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp index 38bc10e6a..b42f13ff4 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp @@ -77,7 +77,6 @@ void RGBController_SteelSeriesSensei::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led logo_led; @@ -90,7 +89,6 @@ void RGBController_SteelSeriesSensei::SetupZones() wheel_zone.leds_min = 1; wheel_zone.leds_max = 1; wheel_zone.leds_count = 1; - wheel_zone.matrix_map = NULL; zones.push_back(wheel_zone); led wheel_led; @@ -100,20 +98,13 @@ void RGBController_SteelSeriesSensei::SetupZones() SetupColors(); } -void RGBController_SteelSeriesSensei::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesSensei::DeviceUpdateLEDs() { - UpdateZoneLEDs(0); - UpdateZoneLEDs(1); + DeviceUpdateZoneLEDs(0); + DeviceUpdateZoneLEDs(1); } -void RGBController_SteelSeriesSensei::UpdateZoneLEDs(int zone) +void RGBController_SteelSeriesSensei::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -133,13 +124,13 @@ void RGBController_SteelSeriesSensei::UpdateZoneLEDs(int zone) } } -void RGBController_SteelSeriesSensei::UpdateSingleLED(int led) +void RGBController_SteelSeriesSensei::DeviceUpdateSingleLED(int led) { /*---------------------------------------------------------*\ | Each zone only has a single LED, so we can use the LED ID | | to reference the existing zone code. | \*---------------------------------------------------------*/ - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_SteelSeriesSensei::DeviceUpdateMode() diff --git a/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.h b/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.h index ef9f72d88..5f99a4add 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.h +++ b/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.h @@ -22,11 +22,10 @@ public: ~RGBController_SteelSeriesSensei(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp index 2df279c37..14873ab30 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp @@ -56,7 +56,6 @@ void RGBController_SteelSeriesSiberia::SetupZones() earpiece_zone.leds_min = 1; earpiece_zone.leds_max = 1; earpiece_zone.leds_count = 1; - earpiece_zone.matrix_map = NULL; zones.push_back(earpiece_zone); led earpiece_led; @@ -66,13 +65,6 @@ void RGBController_SteelSeriesSiberia::SetupZones() SetupColors(); } -void RGBController_SteelSeriesSiberia::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_SteelSeriesSiberia::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -81,7 +73,7 @@ void RGBController_SteelSeriesSiberia::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_SteelSeriesSiberia::UpdateZoneLEDs(int zone) +void RGBController_SteelSeriesSiberia::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -90,11 +82,11 @@ void RGBController_SteelSeriesSiberia::UpdateZoneLEDs(int zone) controller->SetColor(red, grn, blu); } -void RGBController_SteelSeriesSiberia::UpdateSingleLED(int led) +void RGBController_SteelSeriesSiberia::DeviceUpdateSingleLED(int led) { /* Each zone only has a single LED, so we can use the LED ID to reference * the existing zone code. */ - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_SteelSeriesSiberia::DeviceUpdateMode() diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.h b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.h index 0c244131a..e37602e55 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.h +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.h @@ -21,11 +21,10 @@ public: ~RGBController_SteelSeriesSiberia(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.cpp b/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.cpp index 6acfe635a..24345f4b5 100644 --- a/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.cpp +++ b/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.cpp @@ -48,16 +48,15 @@ RGBController_ElgatoStreamDeck::~RGBController_ElgatoStreamDeck() void RGBController_ElgatoStreamDeck::SetupZones() { + unsigned int matrix_map[15] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + zone deck_zone; deck_zone.name = "Button Matrix"; deck_zone.type = ZONE_TYPE_MATRIX; deck_zone.leds_min = 15; deck_zone.leds_max = 15; deck_zone.leds_count = 15; - deck_zone.matrix_map = new matrix_map_type; - deck_zone.matrix_map->height = 3; - deck_zone.matrix_map->width = 5; - deck_zone.matrix_map->map = new unsigned int[15]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + deck_zone.matrix_map.Set(3, 5, matrix_map); zones.push_back(deck_zone); @@ -107,21 +106,16 @@ void RGBController_ElgatoStreamDeck::DeviceUpdateLEDs() controller->SendFullFrame(buttonImages); } -void RGBController_ElgatoStreamDeck::UpdateZoneLEDs(int /*zone*/) +void RGBController_ElgatoStreamDeck::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ElgatoStreamDeck::UpdateSingleLED(int /*led*/) +void RGBController_ElgatoStreamDeck::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } -void RGBController_ElgatoStreamDeck::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_ElgatoStreamDeck::DeviceUpdateMode() { diff --git a/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.h b/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.h index beff981fd..54b56f387 100644 --- a/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.h +++ b/Controllers/StreamDeckController/RGBController_ElgatoStreamDeck.h @@ -21,11 +21,10 @@ public: ~RGBController_ElgatoStreamDeck(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/TForceXtreemController/RGBController_TForceXtreem.cpp b/Controllers/TForceXtreemController/RGBController_TForceXtreem.cpp index 0622582d3..3ca0f1cab 100644 --- a/Controllers/TForceXtreemController/RGBController_TForceXtreem.cpp +++ b/Controllers/TForceXtreemController/RGBController_TForceXtreem.cpp @@ -365,7 +365,7 @@ int RGBController_TForceXtreem::GetDeviceMode() void RGBController_TForceXtreem::DeviceUpdateLEDs() { - if(GetMode() == 0) + if(GetActiveMode() == 0) { controller->SetAllColorsDirect(&colors[0]); } @@ -376,7 +376,7 @@ void RGBController_TForceXtreem::DeviceUpdateLEDs() } -void RGBController_TForceXtreem::UpdateZoneLEDs(int zone) +void RGBController_TForceXtreem::DeviceUpdateZoneLEDs(int zone) { for(std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++) { @@ -386,7 +386,7 @@ void RGBController_TForceXtreem::UpdateZoneLEDs(int zone) unsigned char grn = RGBGetGValue(color); unsigned char blu = RGBGetBValue(color); - if(GetMode() == 0) + if(GetActiveMode() == 0) { controller->SetLEDColorDirect(led, red, grn, blu); } @@ -397,14 +397,14 @@ void RGBController_TForceXtreem::UpdateZoneLEDs(int zone) } } -void RGBController_TForceXtreem::UpdateSingleLED(int led) +void RGBController_TForceXtreem::DeviceUpdateSingleLED(int led) { RGBColor color = colors[led]; unsigned char red = RGBGetRValue(color); unsigned char grn = RGBGetGValue(color); unsigned char blu = RGBGetBValue(color); - if(GetMode() == 0) + if(GetActiveMode() == 0) { controller->SetLEDColorDirect(led, red, grn, blu); } @@ -425,7 +425,6 @@ void RGBController_TForceXtreem::SetupZones() new_zone.leds_min = XTREEM_LED_COUNT; new_zone.leds_max = XTREEM_LED_COUNT; new_zone.leds_count = XTREEM_LED_COUNT; - new_zone.matrix_map = NULL; zones.push_back(new_zone); /*---------------------------------------------------------*\ @@ -442,13 +441,6 @@ void RGBController_TForceXtreem::SetupZones() SetupColors(); } -void RGBController_TForceXtreem::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_TForceXtreem::DeviceUpdateMode() { if(modes[active_mode].value == 0xFFFF) diff --git a/Controllers/TForceXtreemController/RGBController_TForceXtreem.h b/Controllers/TForceXtreemController/RGBController_TForceXtreem.h index 40b2b87cc..2239494b4 100644 --- a/Controllers/TForceXtreemController/RGBController_TForceXtreem.h +++ b/Controllers/TForceXtreemController/RGBController_TForceXtreem.h @@ -22,11 +22,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/TecknetController/RGBController_Tecknet.cpp b/Controllers/TecknetController/RGBController_Tecknet.cpp index cf881e72d..085bebdd3 100644 --- a/Controllers/TecknetController/RGBController_Tecknet.cpp +++ b/Controllers/TecknetController/RGBController_Tecknet.cpp @@ -78,7 +78,6 @@ void RGBController_Tecknet::SetupZones() Tecknet_zone.leds_min = 1; Tecknet_zone.leds_max = 1; Tecknet_zone.leds_count = 1; - Tecknet_zone.matrix_map = NULL; zones.push_back(Tecknet_zone); led Tecknet_led; @@ -88,13 +87,6 @@ void RGBController_Tecknet::SetupZones() SetupColors(); } -void RGBController_Tecknet::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | Not implemented for this device | - \*---------------------------------------------------------*/ -} - void RGBController_Tecknet::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -103,7 +95,7 @@ void RGBController_Tecknet::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_Tecknet::UpdateZoneLEDs(int zone) +void RGBController_Tecknet::DeviceUpdateZoneLEDs(int zone) { RGBColor color = colors[zone]; unsigned char red = RGBGetRValue(color); @@ -112,9 +104,9 @@ void RGBController_Tecknet::UpdateZoneLEDs(int zone) controller->SetColor(red, grn, blu); } -void RGBController_Tecknet::UpdateSingleLED(int led) +void RGBController_Tecknet::DeviceUpdateSingleLED(int led) { - UpdateZoneLEDs(led); + DeviceUpdateZoneLEDs(led); } void RGBController_Tecknet::DeviceUpdateMode() diff --git a/Controllers/TecknetController/RGBController_Tecknet.h b/Controllers/TecknetController/RGBController_Tecknet.h index ef6bf053d..2ee711076 100644 --- a/Controllers/TecknetController/RGBController_Tecknet.h +++ b/Controllers/TecknetController/RGBController_Tecknet.h @@ -21,11 +21,10 @@ public: ~RGBController_Tecknet(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp b/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp index 0ddbdce9f..c5b68ac02 100644 --- a/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp +++ b/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp @@ -212,17 +212,6 @@ RGBController_PoseidonZRGB::RGBController_PoseidonZRGB(PoseidonZRGBController* c RGBController_PoseidonZRGB::~RGBController_PoseidonZRGB() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -240,10 +229,7 @@ void RGBController_PoseidonZRGB::SetupZones() new_zone.leds_min = zone_sizes[zone_idx]; new_zone.leds_max = zone_sizes[zone_idx]; new_zone.leds_count = zone_sizes[zone_idx]; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 23; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; + new_zone.matrix_map.Set(6, 23, (unsigned int *)&matrix_map); zones.push_back(new_zone); total_led_count += zone_sizes[zone_idx]; @@ -259,13 +245,6 @@ void RGBController_PoseidonZRGB::SetupZones() SetupColors(); } -void RGBController_PoseidonZRGB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_PoseidonZRGB::DeviceUpdateLEDs() { if(active_mode == 0) @@ -278,12 +257,12 @@ void RGBController_PoseidonZRGB::DeviceUpdateLEDs() } } -void RGBController_PoseidonZRGB::UpdateZoneLEDs(int /*zone*/) +void RGBController_PoseidonZRGB::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_PoseidonZRGB::UpdateSingleLED(int /*led*/) +void RGBController_PoseidonZRGB::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.h b/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.h index b3f7ecb58..f1f441840 100644 --- a/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.h +++ b/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.h @@ -21,11 +21,10 @@ public: ~RGBController_PoseidonZRGB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp index 602c4d39f..1e4e3e2e4 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp @@ -168,8 +168,6 @@ void RGBController_ThermaltakeRiing::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[3]; @@ -189,7 +187,7 @@ void RGBController_ThermaltakeRiing::SetupZones() SetupColors(); } -void RGBController_ThermaltakeRiing::ResizeZone(int zone, int new_size) +void RGBController_ThermaltakeRiing::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -212,12 +210,12 @@ void RGBController_ThermaltakeRiing::DeviceUpdateLEDs() } } -void RGBController_ThermaltakeRiing::UpdateZoneLEDs(int zone) +void RGBController_ThermaltakeRiing::DeviceUpdateZoneLEDs(int zone) { controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); } -void RGBController_ThermaltakeRiing::UpdateSingleLED(int led) +void RGBController_ThermaltakeRiing::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.h b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.h index 0801a1af5..7018dcd91 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.h +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.h @@ -21,11 +21,11 @@ public: ~RGBController_ThermaltakeRiing(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.cpp b/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.cpp index bc612bb79..c237f04e8 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.cpp +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.cpp @@ -94,8 +94,6 @@ void RGBController_ThermaltakeRiingQuad::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[3]; @@ -115,7 +113,7 @@ void RGBController_ThermaltakeRiingQuad::SetupZones() SetupColors(); } -void RGBController_ThermaltakeRiingQuad::ResizeZone(int zone, int new_size) +void RGBController_ThermaltakeRiingQuad::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -138,12 +136,12 @@ void RGBController_ThermaltakeRiingQuad::DeviceUpdateLEDs() } } -void RGBController_ThermaltakeRiingQuad::UpdateZoneLEDs(int zone) +void RGBController_ThermaltakeRiingQuad::DeviceUpdateZoneLEDs(int zone) { controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); } -void RGBController_ThermaltakeRiingQuad::UpdateSingleLED(int led) +void RGBController_ThermaltakeRiingQuad::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.h b/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.h index 3f497121f..cf406da88 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.h +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingQuadController/RGBController_ThermaltakeRiingQuad.h @@ -21,11 +21,11 @@ public: ~RGBController_ThermaltakeRiingQuad(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.cpp b/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.cpp index 1c8282ae7..dc7257925 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.cpp +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.cpp @@ -94,8 +94,6 @@ void RGBController_ThermaltakeRiingTrio::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[3]; @@ -115,7 +113,7 @@ void RGBController_ThermaltakeRiingTrio::SetupZones() SetupColors(); } -void RGBController_ThermaltakeRiingTrio::ResizeZone(int zone, int new_size) +void RGBController_ThermaltakeRiingTrio::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -138,12 +136,12 @@ void RGBController_ThermaltakeRiingTrio::DeviceUpdateLEDs() } } -void RGBController_ThermaltakeRiingTrio::UpdateZoneLEDs(int zone) +void RGBController_ThermaltakeRiingTrio::DeviceUpdateZoneLEDs(int zone) { controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); } -void RGBController_ThermaltakeRiingTrio::UpdateSingleLED(int led) +void RGBController_ThermaltakeRiingTrio::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.h b/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.h index fbf65147c..27201fc69 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.h +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingTrioController/RGBController_ThermaltakeRiingTrio.h @@ -21,11 +21,11 @@ public: ~RGBController_ThermaltakeRiingTrio(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ThingMController/RGBController_BlinkController.cpp b/Controllers/ThingMController/RGBController_BlinkController.cpp index da9659872..a34342fa5 100644 --- a/Controllers/ThingMController/RGBController_BlinkController.cpp +++ b/Controllers/ThingMController/RGBController_BlinkController.cpp @@ -80,7 +80,6 @@ void RGBController_BlinkController::SetupZones() Blink_zone.leds_min = 2; Blink_zone.leds_max = 2; Blink_zone.leds_count = 2; - Blink_zone.matrix_map = NULL; zones.push_back(Blink_zone); led Blink_led; @@ -93,30 +92,22 @@ void RGBController_BlinkController::SetupZones() leds.push_back(Blink_led); SetupColors(); - -} - -void RGBController_BlinkController::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ } void RGBController_BlinkController::DeviceUpdateLEDs() { for(std::size_t led = 0; led < colors.size(); led++) { - UpdateSingleLED((int)led); + DeviceUpdateSingleLED((int)led); } } -void RGBController_BlinkController::UpdateZoneLEDs(int /*zone*/) +void RGBController_BlinkController::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_BlinkController::UpdateSingleLED(int led) +void RGBController_BlinkController::DeviceUpdateSingleLED(int led) { unsigned char red = RGBGetRValue(colors[led]); unsigned char grn = RGBGetGValue(colors[led]); diff --git a/Controllers/ThingMController/RGBController_BlinkController.h b/Controllers/ThingMController/RGBController_BlinkController.h index 8558a7497..39c305aec 100644 --- a/Controllers/ThingMController/RGBController_BlinkController.h +++ b/Controllers/ThingMController/RGBController_BlinkController.h @@ -21,11 +21,10 @@ public: ~RGBController_BlinkController(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.cpp b/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.cpp index f14af35b8..1b2cd0efa 100644 --- a/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.cpp +++ b/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.cpp @@ -91,7 +91,6 @@ void RGBController_TrustGXT114::SetupZones() new_zone.leds_min = TRUST_GXT_114_NUMBER_OF_LEDS; new_zone.leds_max = TRUST_GXT_114_NUMBER_OF_LEDS; new_zone.leds_count = TRUST_GXT_114_NUMBER_OF_LEDS; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -105,24 +104,17 @@ void RGBController_TrustGXT114::SetupZones() SetupColors(); } -void RGBController_TrustGXT114::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_TrustGXT114::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_TrustGXT114::UpdateZoneLEDs(int /*zone*/) +void RGBController_TrustGXT114::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_TrustGXT114::UpdateSingleLED(int /*led*/) +void RGBController_TrustGXT114::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.h b/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.h index d6c679854..7dcc08a70 100644 --- a/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.h +++ b/Controllers/TrustController/TrustGXT114Controller/RGBController_TrustGXT114.h @@ -21,11 +21,10 @@ public: ~RGBController_TrustGXT114(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.cpp b/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.cpp index 5e6a8af79..e8ce8b190 100644 --- a/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.cpp +++ b/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.cpp @@ -95,7 +95,6 @@ void RGBController_TrustGXT180::SetupZones() new_zone.leds_min = TRUST_GXT_180_NUMBER_OF_LEDS; new_zone.leds_max = TRUST_GXT_180_NUMBER_OF_LEDS; new_zone.leds_count = TRUST_GXT_180_NUMBER_OF_LEDS; - new_zone.matrix_map = nullptr; zones.emplace_back(new_zone); @@ -109,24 +108,17 @@ void RGBController_TrustGXT180::SetupZones() SetupColors(); } -void RGBController_TrustGXT180::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_TrustGXT180::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_TrustGXT180::UpdateZoneLEDs(int /*zone*/) +void RGBController_TrustGXT180::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_TrustGXT180::UpdateSingleLED(int /*led*/) +void RGBController_TrustGXT180::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.h b/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.h index fe8b45c3a..75d06cba9 100644 --- a/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.h +++ b/Controllers/TrustController/TrustGXT180Controller/RGBController_TrustGXT180.h @@ -21,11 +21,10 @@ public: ~RGBController_TrustGXT180(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.cpp b/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.cpp index 59716dc62..fabe774d1 100644 --- a/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.cpp +++ b/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.cpp @@ -293,18 +293,6 @@ RGBController_ValkyrieKeyboard::RGBController_ValkyrieKeyboard(ValkyrieKeyboardC RGBController_ValkyrieKeyboard::~RGBController_ValkyrieKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - break; - } - delete controller; } @@ -352,10 +340,7 @@ void RGBController_ValkyrieKeyboard::SetupZones() new_zone.leds_min = zone_size; new_zone.leds_max = zone_size; new_zone.leds_count = zone_size; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = matrix_width; - new_zone.matrix_map->map = matrix_map_ptr; + new_zone.matrix_map.Set(6, matrix_width, matrix_map_ptr); zones.push_back(new_zone); total_led_count += zone_size; @@ -381,13 +366,6 @@ void RGBController_ValkyrieKeyboard::SetupZones() SetupColors(); } -void RGBController_ValkyrieKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ValkyrieKeyboard::DeviceUpdateLEDs() { unsigned char colordata[1024]; @@ -402,12 +380,12 @@ void RGBController_ValkyrieKeyboard::DeviceUpdateLEDs() controller->SendColors(colordata, sizeof(colordata)); } -void RGBController_ValkyrieKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_ValkyrieKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ValkyrieKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_ValkyrieKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.h b/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.h index 6eb8606fa..fb1ee7908 100644 --- a/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.h +++ b/Controllers/ValkyrieKeyboardController/RGBController_ValkyrieKeyboard.h @@ -28,10 +28,11 @@ public: ~RGBController_ValkyrieKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); + void DeviceUpdateMode(); private: diff --git a/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.cpp b/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.cpp index 8457a4708..f65ddc419 100644 --- a/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.cpp +++ b/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.cpp @@ -92,7 +92,6 @@ void RGBController_XG270QC::SetupZones() base.leds_min = 1; base.leds_max = 1; base.leds_count = 1; - base.matrix_map = NULL; zones.push_back(base); zone rear; @@ -101,7 +100,6 @@ void RGBController_XG270QC::SetupZones() rear.leds_min = 1; rear.leds_max = 1; rear.leds_count = 1; - rear.matrix_map = NULL; zones.push_back(rear); led d; @@ -117,24 +115,17 @@ void RGBController_XG270QC::SetupZones() SetupColors(); } -void RGBController_XG270QC::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_XG270QC::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_XG270QC::UpdateZoneLEDs(int /*zone*/) +void RGBController_XG270QC::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_XG270QC::UpdateSingleLED(int /*led*/) +void RGBController_XG270QC::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.h b/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.h index 60adc768f..0839f2cec 100644 --- a/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.h +++ b/Controllers/ViewSonicController/XG270QC/RGBController_XG270QC.h @@ -18,11 +18,10 @@ public: RGBController_XG270QC(VS_XG270QC_Controller* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.cpp b/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.cpp index c88a09fee..ea2734b5c 100644 --- a/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.cpp +++ b/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.cpp @@ -113,7 +113,6 @@ void RGBController_XG270QG::SetupZones() base.leds_min = 1; base.leds_max = 1; base.leds_count = 1; - base.matrix_map = NULL; zones.push_back(base); zone rear; @@ -122,7 +121,6 @@ void RGBController_XG270QG::SetupZones() rear.leds_min = 1; rear.leds_max = 1; rear.leds_count = 1; - rear.matrix_map = NULL; zones.push_back(rear); led d; @@ -138,24 +136,17 @@ void RGBController_XG270QG::SetupZones() SetupColors(); } -void RGBController_XG270QG::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_XG270QG::DeviceUpdateLEDs() { DeviceUpdateMode(); } -void RGBController_XG270QG::UpdateZoneLEDs(int /*zone*/) +void RGBController_XG270QG::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_XG270QG::UpdateSingleLED(int /*led*/) +void RGBController_XG270QG::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.h b/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.h index a9e21ffc2..d6ac59a0a 100644 --- a/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.h +++ b/Controllers/ViewSonicController/XG270QG/RGBController_XG270QG.h @@ -20,11 +20,10 @@ public: RGBController_XG270QG(VS_XG270QG_Controller* controller_ptr); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.cpp b/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.cpp index ef3c7341e..68ad6297e 100644 --- a/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.cpp +++ b/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.cpp @@ -763,21 +763,10 @@ void RGBController_WinbondGamingKeyboard::SetupZones() KeyboardLayoutManager new_kb(controller->GetLayout(), kb_size, *layouts); - matrix_map_type * new_map = new matrix_map_type; - new_zone.matrix_map = new_map; - new_zone.matrix_map->height = new_kb.GetRowCount(); - new_zone.matrix_map->width = new_kb.GetColumnCount(); - - new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width]; - new_zone.leds_count = new_kb.GetKeyCount(); - new_zone.leds_min = new_zone.leds_count; - new_zone.leds_max = new_zone.leds_count; - - /*---------------------------------------------------------*\ - | Matrix map still uses declared zone rows and columns | - | as the packet structure depends on the matrix map | - \*---------------------------------------------------------*/ - new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT); + new_zone.leds_count = new_kb.GetKeyCount(); + new_zone.leds_min = new_zone.leds_count; + new_zone.leds_max = new_zone.leds_count; + new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT); /*---------------------------------------------------------*\ | Create LEDs for the Matrix zone | @@ -808,7 +797,6 @@ void RGBController_WinbondGamingKeyboard::SetupZones() logo_zone.leds_min = 1; logo_zone.leds_max = 1; logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; led zone_led; zone_led.name = "Logo LEDs"; @@ -823,24 +811,17 @@ void RGBController_WinbondGamingKeyboard::SetupZones() #undef KV -void RGBController_WinbondGamingKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_WinbondGamingKeyboard::DeviceUpdateLEDs() { controller->SetLEDsData(colors, leds, modes[active_mode].brightness); } -void RGBController_WinbondGamingKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_WinbondGamingKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_WinbondGamingKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_WinbondGamingKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.h b/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.h index d15a11af2..32efa8148 100644 --- a/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.h +++ b/Controllers/WinbondGamingKeyboardController/RGBController_WinbondGamingKeyboard.h @@ -38,14 +38,13 @@ public: RGBController_WinbondGamingKeyboard(WinbondGamingKeyboardController* ctrl); ~RGBController_WinbondGamingKeyboard(); - void SetupZones() override; - void ResizeZone(int zone, int new_size) override; + void SetupZones(); - void DeviceUpdateLEDs() override; - void UpdateZoneLEDs(int zone) override; - void UpdateSingleLED(int led) override; + void DeviceUpdateLEDs(); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); - void DeviceUpdateMode() override; + void DeviceUpdateMode(); private: WinbondGamingKeyboardController* controller; diff --git a/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.cpp b/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.cpp index 4327abc60..d5981abc8 100644 --- a/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.cpp +++ b/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.cpp @@ -635,17 +635,6 @@ RGBController_WootingKeyboard::RGBController_WootingKeyboard(WootingKeyboardCont RGBController_WootingKeyboard::~RGBController_WootingKeyboard() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for (unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if (zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -724,8 +713,6 @@ void RGBController_WootingKeyboard::SetupZones() } } - - zone new_zone; new_zone.name = name.append(" zone"); @@ -733,23 +720,13 @@ void RGBController_WootingKeyboard::SetupZones() new_zone.leds_min = total_led_count; new_zone.leds_max = total_led_count; new_zone.leds_count = total_led_count; - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = (unsigned int)matrix_rows; - new_zone.matrix_map->width = (unsigned int)matrix_columns; - new_zone.matrix_map->map = new_matrix; + new_zone.matrix_map.Set((unsigned int)matrix_rows, (unsigned int)matrix_columns, new_matrix); zones.push_back(new_zone); SetupColors(); } -void RGBController_WootingKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_WootingKeyboard::DeviceUpdateLEDs() { RGBColor framebuffer[WOOTING_RGB_ROWS * WOOTING_RGB_COLUMNS] = {0}; @@ -763,12 +740,12 @@ void RGBController_WootingKeyboard::DeviceUpdateLEDs() controller->SendDirect(&framebuffer[0], WOOTING_RGB_ROWS * WOOTING_RGB_COLUMNS); } -void RGBController_WootingKeyboard::UpdateZoneLEDs(int /*zone*/) +void RGBController_WootingKeyboard::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_WootingKeyboard::UpdateSingleLED(int /*led*/) +void RGBController_WootingKeyboard::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.h b/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.h index e37c4d9bc..ed5c2ed21 100644 --- a/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.h +++ b/Controllers/WootingKeyboardController/RGBController_WootingKeyboard.h @@ -21,11 +21,10 @@ public: ~RGBController_WootingKeyboard(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/WushiController/RGBController_WushiL50USB.cpp b/Controllers/WushiController/RGBController_WushiL50USB.cpp index 1acfd2cc4..f6233db89 100644 --- a/Controllers/WushiController/RGBController_WushiL50USB.cpp +++ b/Controllers/WushiController/RGBController_WushiL50USB.cpp @@ -102,7 +102,6 @@ void RGBController_WushiL50USB::SetupZones() new_zone.leds_count = WUSHI_L50_NUM_LEDS; new_zone.leds_max = new_zone.leds_count; new_zone.leds_min = new_zone.leds_count; - new_zone.matrix_map = NULL; zones.push_back(new_zone); @@ -118,13 +117,6 @@ void RGBController_WushiL50USB::SetupZones() SetupColors(); } -void RGBController_WushiL50USB::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_WushiL50USB::DeviceUpdateLEDs() { if(modes[active_mode].color_mode == MODE_COLORS_PER_LED) @@ -142,12 +134,12 @@ void RGBController_WushiL50USB::DeviceUpdateLEDs() controller->setMode(&state); } -void RGBController_WushiL50USB::UpdateZoneLEDs(int /*zone*/) +void RGBController_WushiL50USB::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_WushiL50USB::UpdateSingleLED(int /*led*/) +void RGBController_WushiL50USB::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/WushiController/RGBController_WushiL50USB.h b/Controllers/WushiController/RGBController_WushiL50USB.h index cd2b976be..b29923719 100644 --- a/Controllers/WushiController/RGBController_WushiL50USB.h +++ b/Controllers/WushiController/RGBController_WushiL50USB.h @@ -20,11 +20,10 @@ public: ~RGBController_WushiL50USB(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); void DeviceSaveMode(); diff --git a/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.cpp b/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.cpp index 2522a4af3..b7f7ff637 100644 --- a/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.cpp +++ b/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.cpp @@ -239,13 +239,6 @@ RGBController_XPGSummoner::RGBController_XPGSummoner(XPGSummonerController *cont \*---------------------------------------------------------*/ RGBController_XPGSummoner::~RGBController_XPGSummoner() { - for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if(zones[zone_index].matrix_map != NULL) - { - delete zones[zone_index].matrix_map; - } - } delete controller; } @@ -270,15 +263,9 @@ void RGBController_XPGSummoner::SetupZones() if(new_zone.type == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = 6; - new_zone.matrix_map->width = 21; - new_zone.matrix_map->map = (unsigned int *)&ordered_matrix; - } - else - { - new_zone.matrix_map = NULL; + new_zone.matrix_map.Set(6, 21, (unsigned int *)&ordered_matrix); } + zones.push_back(new_zone); size_t linear_idx = 0; @@ -301,14 +288,6 @@ void RGBController_XPGSummoner::SetupZones() SetupColors(); } -/*---------------------------------------------------------*\ -| ResizeZone: Not supported for this device | -\*---------------------------------------------------------*/ -void RGBController_XPGSummoner::ResizeZone(int /*zone*/, int /*new_size*/) -{ - // This device does not support resizing zones -} - /*---------------------------------------------------------*\ | DeviceUpdateLEDs: Updates LED colors | \*---------------------------------------------------------*/ @@ -405,17 +384,17 @@ void RGBController_XPGSummoner::DeviceUpdateLEDs() } /*---------------------------------------------------------*\ -| UpdateZoneLEDs: Updates all LEDs in a zone | +| DeviceUpdateZoneLEDs: Updates all LEDs in a zone | \*---------------------------------------------------------*/ -void RGBController_XPGSummoner::UpdateZoneLEDs(int /*zone*/) +void RGBController_XPGSummoner::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } /*---------------------------------------------------------*\ -| UpdateSingleLED: Updates a single LED | +| DeviceUpdateSingleLED: Updates a single LED | \*---------------------------------------------------------*/ -void RGBController_XPGSummoner::UpdateSingleLED(int /*led*/) +void RGBController_XPGSummoner::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -427,4 +406,3 @@ void RGBController_XPGSummoner::DeviceUpdateMode() { DeviceUpdateLEDs(); } - diff --git a/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.h b/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.h index 87371f837..c7f033aab 100644 --- a/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.h +++ b/Controllers/XPGSummonerKeyboardController/RGBController_XPGSummoner.h @@ -21,10 +21,11 @@ public: ~RGBController_XPGSummoner(); void SetupZones(); - void ResizeZone(int zone, int new_size); + void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); + void DeviceUpdateMode(); private: diff --git a/Controllers/YeelightController/RGBController_Yeelight.cpp b/Controllers/YeelightController/RGBController_Yeelight.cpp index b97d754ee..d31182178 100644 --- a/Controllers/YeelightController/RGBController_Yeelight.cpp +++ b/Controllers/YeelightController/RGBController_Yeelight.cpp @@ -76,7 +76,6 @@ void RGBController_Yeelight::SetupZones() led_zone.leds_min = 1; led_zone.leds_max = 1; led_zone.leds_count = 1; - led_zone.matrix_map = NULL; zones.push_back(led_zone); led new_led; @@ -87,13 +86,6 @@ void RGBController_Yeelight::SetupZones() SetupColors(); } -void RGBController_Yeelight::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_Yeelight::DeviceUpdateLEDs() { unsigned char red = RGBGetRValue(colors[0]); @@ -103,12 +95,12 @@ void RGBController_Yeelight::DeviceUpdateLEDs() controller->SetColor(red, grn, blu); } -void RGBController_Yeelight::UpdateZoneLEDs(int /*zone*/) +void RGBController_Yeelight::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_Yeelight::UpdateSingleLED(int /*led*/) +void RGBController_Yeelight::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/YeelightController/RGBController_Yeelight.h b/Controllers/YeelightController/RGBController_Yeelight.h index 2e33e4b81..69adaca1c 100644 --- a/Controllers/YeelightController/RGBController_Yeelight.h +++ b/Controllers/YeelightController/RGBController_Yeelight.h @@ -21,11 +21,10 @@ public: ~RGBController_Yeelight(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.cpp b/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.cpp index 24a06c81b..f8f693857 100644 --- a/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.cpp +++ b/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.cpp @@ -432,17 +432,6 @@ RGBController_ZETBladeOptical::RGBController_ZETBladeOptical(ZETBladeOpticalCont RGBController_ZETBladeOptical::~RGBController_ZETBladeOptical() { - /*---------------------------------------------------------*\ - | Delete the matrix map | - \*---------------------------------------------------------*/ - for (unsigned int zone_index = 0; zone_index < zones.size(); zone_index++) - { - if (zones[zone_index].matrix_map != nullptr) - { - delete zones[zone_index].matrix_map; - } - } - delete controller; } @@ -463,14 +452,7 @@ void RGBController_ZETBladeOptical::SetupZones() if (zone_types[zone_idx] == ZONE_TYPE_MATRIX) { - new_zone.matrix_map = new matrix_map_type; - new_zone.matrix_map->height = ZET_BLADE_OPTICAL_ROWS; - new_zone.matrix_map->width = ZET_BLADE_OPTICAL_COLUMNS; - new_zone.matrix_map->map = (unsigned int *)&matrix_map; - } - else - { - new_zone.matrix_map = nullptr; + new_zone.matrix_map.Set(ZET_BLADE_OPTICAL_ROWS, ZET_BLADE_OPTICAL_COLUMNS, (unsigned int *)&matrix_map); } zones.push_back(new_zone); @@ -488,13 +470,6 @@ void RGBController_ZETBladeOptical::SetupZones() SetupColors(); } -void RGBController_ZETBladeOptical::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - void RGBController_ZETBladeOptical::DeviceUpdateLEDs() { last_update_time = std::chrono::steady_clock::now(); @@ -505,12 +480,12 @@ void RGBController_ZETBladeOptical::DeviceUpdateLEDs() } } -void RGBController_ZETBladeOptical::UpdateZoneLEDs(int /*zone*/) +void RGBController_ZETBladeOptical::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_ZETBladeOptical::UpdateSingleLED(int /*led*/) +void RGBController_ZETBladeOptical::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.h b/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.h index d4712cb0f..e45068d86 100644 --- a/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.h +++ b/Controllers/ZETKeyboardController/RGBController_ZETBladeOptical.h @@ -30,11 +30,10 @@ public: ~RGBController_ZETBladeOptical(); void SetupZones(); - void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.cpp b/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.cpp index d4de8e9e8..18d2d6d60 100644 --- a/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.cpp +++ b/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.cpp @@ -34,10 +34,21 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont location = controller->GetLocationString(); serial = controller->GetSerialString(); + SetupZones(); + SetupModes(); +} + +RGBController_ZalmanZSync::~RGBController_ZalmanZSync() +{ + delete controller; +} + +void RGBController_ZalmanZSync::SetupModes() +{ mode Direct; Direct.name = "Direct"; - Direct.value = 0xFFFF; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.value = ZALMAN_Z_SYNC_MODE_DIRECT; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE; Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); @@ -51,6 +62,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont RainbowWave.direction = MODE_DIRECTION_RIGHT; RainbowWave.color_mode = MODE_COLORS_NONE; modes.push_back(RainbowWave); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(RainbowWave); + } mode ColorShift; ColorShift.name = "Color Shift"; @@ -64,6 +79,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC; ColorShift.colors.resize(2); modes.push_back(ColorShift); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(ColorShift); + } mode ColorPulse; ColorPulse.name = "Color Pulse"; @@ -77,6 +96,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont ColorPulse.color_mode = MODE_COLORS_MODE_SPECIFIC; ColorPulse.colors.resize(2); modes.push_back(ColorPulse); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(ColorPulse); + } mode ColorWave; ColorWave.name = "Color Wave"; @@ -91,6 +114,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC; ColorWave.colors.resize(2); modes.push_back(ColorWave); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(ColorWave); + } mode Static; Static.name = "Static"; @@ -101,6 +128,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont Static.color_mode = MODE_COLORS_MODE_SPECIFIC; Static.colors.resize(1); modes.push_back(Static); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Static); + } mode Temperature; Temperature.name = "Temperature"; @@ -111,6 +142,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont Temperature.color_mode = MODE_COLORS_MODE_SPECIFIC; Temperature.colors.resize(3); modes.push_back(Temperature); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Temperature); + } mode Visor; Visor.name = "Visor"; @@ -124,6 +159,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont Visor.color_mode = MODE_COLORS_MODE_SPECIFIC; Visor.colors.resize(2); modes.push_back(Visor); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Visor); + } mode Marquee; Marquee.name = "Marquee"; @@ -138,6 +177,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC; Marquee.colors.resize(1); modes.push_back(Marquee); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Marquee); + } mode Blink; Blink.name = "Blink"; @@ -151,6 +194,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont Blink.color_mode = MODE_COLORS_MODE_SPECIFIC; Blink.colors.resize(2); modes.push_back(Blink); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Blink); + } mode Sequential; Sequential.name = "Sequential"; @@ -165,6 +212,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont Sequential.color_mode = MODE_COLORS_MODE_SPECIFIC; Sequential.colors.resize(1); modes.push_back(Sequential); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Sequential); + } mode Rainbow; Rainbow.name = "Rainbow"; @@ -175,13 +226,10 @@ RGBController_ZalmanZSync::RGBController_ZalmanZSync(ZalmanZSyncController* cont Rainbow.speed = ZALMAN_Z_SYNC_SPEED_MEDIUM; Rainbow.color_mode = MODE_COLORS_NONE; modes.push_back(Rainbow); - - SetupZones(); -} - -RGBController_ZalmanZSync::~RGBController_ZalmanZSync() -{ - delete controller; + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx].modes.push_back(Rainbow); + } } void RGBController_ZalmanZSync::SetupZones() @@ -228,8 +276,6 @@ void RGBController_ZalmanZSync::SetupZones() zones[channel_idx].leds_count = 0; } - zones[channel_idx].matrix_map = NULL; - for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++) { char led_idx_string[4]; @@ -247,7 +293,7 @@ void RGBController_ZalmanZSync::SetupZones() SetupColors(); } -void RGBController_ZalmanZSync::ResizeZone(int zone, int new_size) +void RGBController_ZalmanZSync::DeviceResizeZone(int zone, int new_size) { if((size_t) zone >= zones.size()) { @@ -264,61 +310,89 @@ void RGBController_ZalmanZSync::ResizeZone(int zone, int new_size) void RGBController_ZalmanZSync::DeviceUpdateLEDs() { - for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + for(unsigned char zone_idx = 0; zone_idx < (unsigned char)zones.size(); zone_idx++) { - if(zones[zone_idx].leds_count > 0) - { - controller->SetChannelLEDs((unsigned char)zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count); - } + DeviceUpdateZoneLEDs(zone_idx); } } -void RGBController_ZalmanZSync::UpdateZoneLEDs(int zone) +void RGBController_ZalmanZSync::DeviceUpdateZoneLEDs(int zone) { - controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + if(modes[active_mode].value == ZALMAN_Z_SYNC_MODE_DIRECT) + { + controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count); + } } -void RGBController_ZalmanZSync::UpdateSingleLED(int led) +void RGBController_ZalmanZSync::DeviceUpdateSingleLED(int led) { unsigned int channel = leds_channel[led]; - controller->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count); + DeviceUpdateZoneLEDs(channel); } void RGBController_ZalmanZSync::DeviceUpdateMode() { - if(modes[active_mode].value == 0xFFFF) + if(modes[active_mode].value == ZALMAN_Z_SYNC_MODE_DIRECT) { DeviceUpdateLEDs(); } else { - for(int channel = 0; channel < ZALMAN_Z_SYNC_NUM_CHANNELS; channel++) + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - unsigned int direction = 0; - bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM); + DeviceUpdateZoneMode(zone_idx); + } + } +} - if(modes[active_mode].direction == MODE_DIRECTION_RIGHT) +void RGBController_ZalmanZSync::DeviceUpdateZoneMode(int zone) +{ + if(modes[active_mode].value == ZALMAN_Z_SYNC_MODE_DIRECT) + { + return; + } + else + { + unsigned int direction = 0; + mode* mode_ptr = NULL; + bool random = false; + + if((zones[zone].active_mode >= 0) && (zones[zone].active_mode < (int)zones[zone].modes.size())) + { + mode_ptr = &zones[zone].modes[zones[zone].active_mode]; + } + else if(active_mode < (int)modes.size()) + { + mode_ptr = &modes[active_mode]; + } + + if(mode_ptr != NULL) + { + random = (mode_ptr->color_mode == MODE_COLORS_RANDOM); + + if(mode_ptr->direction == MODE_DIRECTION_RIGHT) { direction = 1; } unsigned char mode_colors[9]; + memset(mode_colors, 0, sizeof(mode_colors)); - if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC) + if(mode_ptr->color_mode == MODE_COLORS_MODE_SPECIFIC) { - for(std::size_t i = 0; i < modes[active_mode].colors.size(); i++) + for(std::size_t i = 0; i < mode_ptr->colors.size(); i++) { - mode_colors[(3 * i) + 0] = RGBGetRValue(modes[active_mode].colors[i]); - mode_colors[(3 * i) + 1] = RGBGetGValue(modes[active_mode].colors[i]); - mode_colors[(3 * i) + 2] = RGBGetBValue(modes[active_mode].colors[i]); + mode_colors[(3 * i) + 0] = RGBGetRValue(mode_ptr->colors[i]); + mode_colors[(3 * i) + 1] = RGBGetGValue(mode_ptr->colors[i]); + mode_colors[(3 * i) + 2] = RGBGetBValue(mode_ptr->colors[i]); } } - controller->SetChannelEffect(channel, - zones[channel].leds_count, - modes[active_mode].value, - modes[active_mode].speed, + controller->SetChannelEffect(zone, + zones[zone].leds_count, + mode_ptr->value, + mode_ptr->speed, direction, random, mode_colors[0], diff --git a/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.h b/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.h index bbcb67046..4b1bf53a2 100644 --- a/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.h +++ b/Controllers/ZalmanZSyncController/RGBController_ZalmanZSync.h @@ -20,14 +20,17 @@ public: RGBController_ZalmanZSync(ZalmanZSyncController* controller_ptr); ~RGBController_ZalmanZSync(); + void SetupModes(); void SetupZones(); - void ResizeZone(int zone, int new_size); + + void DeviceResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); + void DeviceUpdateZoneMode(int zone); private: ZalmanZSyncController* controller; diff --git a/Controllers/ZalmanZSyncController/ZalmanZSyncController.h b/Controllers/ZalmanZSyncController/ZalmanZSyncController.h index 8d1ef63a4..a092e19a5 100644 --- a/Controllers/ZalmanZSyncController/ZalmanZSyncController.h +++ b/Controllers/ZalmanZSyncController/ZalmanZSyncController.h @@ -89,6 +89,7 @@ enum ZALMAN_Z_SYNC_MODE_BLINK = 0x08, /* Blink mode */ ZALMAN_Z_SYNC_MODE_SEQUENTIAL = 0x09, /* Sequential mode */ ZALMAN_Z_SYNC_MODE_RAINBOW = 0x0A, /* Rainbow mode */ + ZALMAN_Z_SYNC_MODE_DIRECT = 0xFFFF, /* Dummy mode ID for direct mode */ }; class ZalmanZSyncController diff --git a/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.cpp b/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.cpp index ffdd54cd7..8c0ce4430 100644 --- a/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.cpp +++ b/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.cpp @@ -101,7 +101,6 @@ void RGBController_ZotacTuringGPU::SetupZones() new_zone->leds_min = 1; new_zone->leds_max = 1; new_zone->leds_count = 1; - new_zone->matrix_map = NULL; new_led->name = "GPU LED"; @@ -124,15 +123,6 @@ void RGBController_ZotacTuringGPU::SetupInitialValues() controller->GetMode(colors[0], active_mode, speed); modes[active_mode].speed = speed; - - SignalUpdate(); -} - -void RGBController_ZotacTuringGPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ } void RGBController_ZotacTuringGPU::DeviceUpdateLEDs() @@ -140,12 +130,12 @@ void RGBController_ZotacTuringGPU::DeviceUpdateLEDs() DeviceUpdateMode(); } -void RGBController_ZotacTuringGPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_ZotacTuringGPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_ZotacTuringGPU::UpdateSingleLED(int /*led*/) +void RGBController_ZotacTuringGPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.h b/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.h index a48d31af4..b4c8253e2 100644 --- a/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.h +++ b/Controllers/ZotacTuringGPUController/RGBController_ZotacTuringGPU.h @@ -23,11 +23,9 @@ public: void SetupInitialValues(); void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.cpp b/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.cpp index 626ad64f7..a43fcab1f 100644 --- a/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.cpp +++ b/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.cpp @@ -356,7 +356,6 @@ void RGBController_ZotacV2GPU::SetupZones() new_zone.leds_min = 1; new_zone.leds_max = 1; new_zone.leds_count = 1; - new_zone.matrix_map = NULL; zones.push_back(new_zone); SetupColors(); @@ -414,15 +413,6 @@ void RGBController_ZotacV2GPU::SetupInitialValues() modes[active_mode].speed = zoneConfig.speed; modes[active_mode].brightness = zoneConfig.brightness; modes[active_mode].direction = zoneConfig.direction; - - SignalUpdate(); -} - -void RGBController_ZotacV2GPU::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ } void RGBController_ZotacV2GPU::DeviceUpdateLEDs() @@ -430,12 +420,12 @@ void RGBController_ZotacV2GPU::DeviceUpdateLEDs() DeviceUpdateMode(); } -void RGBController_ZotacV2GPU::UpdateZoneLEDs(int /*zone*/) +void RGBController_ZotacV2GPU::DeviceUpdateZoneLEDs(int /*zone*/) { DeviceUpdateMode(); } -void RGBController_ZotacV2GPU::UpdateSingleLED(int /*led*/) +void RGBController_ZotacV2GPU::DeviceUpdateSingleLED(int /*led*/) { DeviceUpdateMode(); } diff --git a/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.h b/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.h index 40dbecd53..c787fcf21 100644 --- a/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.h +++ b/Controllers/ZotacV2GPUController/RGBController_ZotacV2GPU.h @@ -23,11 +23,9 @@ public: void SetupInitialValues(); void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void DeviceUpdateMode(); diff --git a/Documentation/RGBControllerAPI.md b/Documentation/RGBControllerAPI.md index e84d666cf..bd84c3005 100644 --- a/Documentation/RGBControllerAPI.md +++ b/Documentation/RGBControllerAPI.md @@ -276,31 +276,31 @@ Returns the `name` string of the given mode in the `modes` vector. Returns the `name` string of the given zone in the `zones` vector. -### `std::string GetLEDName(int led)` +### `std::string GetLEDDisplayName(int led)` Returns the `name` string of the given LED in the `leds` vector. -### `RGBColor GetLED(unsigned int led)` +### `RGBColor GetColor(unsigned int led)` Returns the color value of the given LED in the `colors` vector. -### `void SetLED(unsigned int led, RGBColor color)` +### `void SetColor(unsigned int led, RGBColor color)` Sets the color value of the given LED in the `colors` vector. -### `void SetAllLEDs(RGBColor color)` +### `void SetAllColors(RGBColor color)` Sets the color value of all LEDs in the `colors` vector. -### `void SetAllZoneLEDs(int zone, RGBColor color)` +### `void SetAllZoneColors(int zone, RGBColor color)` Sets the color value of all LEDs in the given zone in the `colors` vector. -### `int GetMode()` +### `int GetActiveMode()` Returns the active mode index of the device. The returned int should line up with the `modes` vector. -### `void SetMode(int mode)` +### `void SetActiveMode(int mode)` Sets the active mode index of the device. The mode should be the index in the `modes` vector of the mode you wish to set. diff --git a/KeyboardLayoutManager/KeyboardLayoutManager.cpp b/KeyboardLayoutManager/KeyboardLayoutManager.cpp index 2378de979..fd4c37d28 100644 --- a/KeyboardLayoutManager/KeyboardLayoutManager.cpp +++ b/KeyboardLayoutManager/KeyboardLayoutManager.cpp @@ -999,29 +999,35 @@ unsigned int KeyboardLayoutManager::GetColumnCount() return cols; } -void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr) +matrix_map_type KeyboardLayoutManager::GetKeyMap() { - GetKeyMap(map_ptr, KEYBOARD_MAP_FILL_TYPE_INDEX, rows, cols); + return GetKeyMap(KEYBOARD_MAP_FILL_TYPE_INDEX, rows, cols); } -void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_TYPE fill_type) +matrix_map_type KeyboardLayoutManager::GetKeyMap(KEYBOARD_MAP_FILL_TYPE fill_type) { - GetKeyMap(map_ptr, fill_type, rows, cols); + return GetKeyMap(fill_type, rows, cols); } -void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_TYPE fill_type, uint8_t height = 0, uint8_t width = 0) +matrix_map_type KeyboardLayoutManager::GetKeyMap(KEYBOARD_MAP_FILL_TYPE fill_type, uint8_t height = 0, uint8_t width = 0) { + matrix_map_type matrix_map; + unsigned int no_key = -1; width = std::max(width, cols); height = std::max(height, rows); + matrix_map.width = width; + matrix_map.height = height; + matrix_map.map.resize(width * height); + for(unsigned int r = 0; r < height; r++) { unsigned int offset = r * width; for(unsigned int c = 0; c < width; c++) { - map_ptr[offset + c] = no_key; + matrix_map.map[offset + c] = no_key; } } @@ -1031,19 +1037,21 @@ void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_T switch(fill_type) { case KEYBOARD_MAP_FILL_TYPE_COUNT: - map_ptr[offset] = i; + matrix_map.map[offset] = i; break; case KEYBOARD_MAP_FILL_TYPE_VALUE: - map_ptr[offset] = keymap[i].value; + matrix_map.map[offset] = keymap[i].value; break; case KEYBOARD_MAP_FILL_TYPE_INDEX: default: - map_ptr[offset] = offset; + matrix_map.map[offset] = offset; break; } } + + return(matrix_map); } void KeyboardLayoutManager::UpdateDimensions() diff --git a/KeyboardLayoutManager/KeyboardLayoutManager.h b/KeyboardLayoutManager/KeyboardLayoutManager.h index 9af394873..60acf8c01 100644 --- a/KeyboardLayoutManager/KeyboardLayoutManager.h +++ b/KeyboardLayoutManager/KeyboardLayoutManager.h @@ -15,6 +15,7 @@ #include #include #include +#include "RGBController.h" #include "RGBControllerKeyNames.h" extern const char* KLM_CLASS_NAME; @@ -132,10 +133,9 @@ public: unsigned int GetRowCount(); unsigned int GetColumnCount(); - void GetKeyMap(unsigned int* map_ptr); - void GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_TYPE fill_type); - void GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_TYPE fill_type, - std::uint8_t height, std::uint8_t width); + matrix_map_type GetKeyMap(); + matrix_map_type GetKeyMap(KEYBOARD_MAP_FILL_TYPE fill_type); + matrix_map_type GetKeyMap(KEYBOARD_MAP_FILL_TYPE fill_type, std::uint8_t height, std::uint8_t width); private: void OpCodeSwitch(key_set change_keys); diff --git a/ProfileManager.cpp b/ProfileManager.cpp index 72fe6f557..bc556e948 100644 --- a/ProfileManager.cpp +++ b/ProfileManager.cpp @@ -87,8 +87,8 @@ bool ProfileManager::SaveProfile(std::string profile_name, bool sizes) | Ignore remote and virtual controllers when saving | | sizes | \*-----------------------------------------------------*/ - if(sizes && (controllers[controller_index]->flags & CONTROLLER_FLAG_REMOTE - || controllers[controller_index]->flags & CONTROLLER_FLAG_VIRTUAL)) + if(sizes && (controllers[controller_index]->GetFlags() & CONTROLLER_FLAG_REMOTE + || controllers[controller_index]->GetFlags() & CONTROLLER_FLAG_VIRTUAL)) { break; } @@ -275,7 +275,7 @@ bool ProfileManager::LoadDeviceFromListWithOptions | Test if saved controller data matches this controller | \*---------------------------------------------------------*/ if((temp_controller_used[temp_index] == false ) - &&(temp_controller->type == load_controller->type ) + &&(temp_controller->GetDeviceType() == load_controller->GetDeviceType() ) &&(temp_controller->GetName() == load_controller->GetName() ) &&(temp_controller->GetDescription() == load_controller->GetDescription()) &&(temp_controller->GetVersion() == load_controller->GetVersion() ) @@ -296,12 +296,12 @@ bool ProfileManager::LoadDeviceFromListWithOptions { for(std::size_t zone_idx = 0; zone_idx < temp_controller->zones.size(); zone_idx++) { - if((temp_controller->zones[zone_idx].name == load_controller->zones[zone_idx].name ) - &&(temp_controller->zones[zone_idx].type == load_controller->zones[zone_idx].type ) - &&(temp_controller->zones[zone_idx].leds_min == load_controller->zones[zone_idx].leds_min ) - &&(temp_controller->zones[zone_idx].leds_max == load_controller->zones[zone_idx].leds_max )) + if((temp_controller->GetZoneName(zone_idx) == load_controller->GetZoneName(zone_idx) ) + &&(temp_controller->GetZoneType(zone_idx) == load_controller->GetZoneType(zone_idx) ) + &&(temp_controller->GetZoneLEDsMin(zone_idx) == load_controller->GetZoneLEDsMin(zone_idx) ) + &&(temp_controller->GetZoneLEDsMax(zone_idx) == load_controller->GetZoneLEDsMax(zone_idx) )) { - if(temp_controller->zones[zone_idx].leds_count != load_controller->zones[zone_idx].leds_count) + if(temp_controller->GetZoneLEDsCount(zone_idx) != load_controller->GetZoneLEDsCount(zone_idx)) { load_controller->ResizeZone((int)zone_idx, temp_controller->zones[zone_idx].leds_count); } @@ -332,15 +332,15 @@ bool ProfileManager::LoadDeviceFromListWithOptions { for(std::size_t mode_index = 0; mode_index < temp_controller->modes.size(); mode_index++) { - if((temp_controller->modes[mode_index].name == load_controller->modes[mode_index].name ) - &&(temp_controller->modes[mode_index].value == load_controller->modes[mode_index].value ) - &&(temp_controller->modes[mode_index].flags == load_controller->modes[mode_index].flags ) - &&(temp_controller->modes[mode_index].speed_min == load_controller->modes[mode_index].speed_min ) - &&(temp_controller->modes[mode_index].speed_max == load_controller->modes[mode_index].speed_max ) - //&&(temp_controller->modes[mode_index].brightness_min == load_controller->modes[mode_index].brightness_min) - //&&(temp_controller->modes[mode_index].brightness_max == load_controller->modes[mode_index].brightness_max) - &&(temp_controller->modes[mode_index].colors_min == load_controller->modes[mode_index].colors_min ) - &&(temp_controller->modes[mode_index].colors_max == load_controller->modes[mode_index].colors_max )) + if((temp_controller->GetModeName(mode_index) == load_controller->GetModeName(mode_index) ) + &&(temp_controller->GetModeValue(mode_index) == load_controller->GetModeValue(mode_index) ) + &&(temp_controller->GetModeFlags(mode_index) == load_controller->GetModeFlags(mode_index) ) + &&(temp_controller->GetModeSpeedMin(mode_index) == load_controller->GetModeSpeedMin(mode_index) ) + &&(temp_controller->GetModeSpeedMax(mode_index) == load_controller->GetModeSpeedMax(mode_index) ) + //&&(temp_controller->GetModeBrightnessMin(mode_index) == load_controller->GetModeBrightnessMin(mode_index)) + //&&(temp_controller->GetModeBrightnessMax(mode_index) == load_controller->GetModeBrightnessMax(mode_index)) + &&(temp_controller->GetModeColorsMin(mode_index) == load_controller->GetModeColorsMin(mode_index) ) + &&(temp_controller->GetModeColorsMax(mode_index) == load_controller->GetModeColorsMax(mode_index) )) { load_controller->modes[mode_index].speed = temp_controller->modes[mode_index].speed; load_controller->modes[mode_index].brightness = temp_controller->modes[mode_index].brightness; @@ -349,7 +349,7 @@ bool ProfileManager::LoadDeviceFromListWithOptions load_controller->modes[mode_index].colors.resize(temp_controller->modes[mode_index].colors.size()); - for(std::size_t mode_color_index = 0; mode_color_index < temp_controller->modes[mode_index].colors.size(); mode_color_index++) + for(std::size_t mode_color_index = 0; mode_color_index < temp_controller->GetModeColorsCount(mode_index); mode_color_index++) { load_controller->modes[mode_index].colors[mode_color_index] = temp_controller->modes[mode_index].colors[mode_color_index]; } diff --git a/RGBController/RGBController.cpp b/RGBController/RGBController.cpp index b1bfd6b89..eb607dffc 100644 --- a/RGBController/RGBController.cpp +++ b/RGBController/RGBController.cpp @@ -11,12 +11,51 @@ \*---------------------------------------------------------*/ #include +#include "nlohmann/json.hpp" #include "RGBController.h" using namespace std::chrono_literals; +matrix_map_type::matrix_map_type() +{ + Reset(); +} + +matrix_map_type::matrix_map_type(unsigned int height, unsigned int width, unsigned int * map) +{ + Set(height, width, map); +} + +matrix_map_type::~matrix_map_type() +{ +} + +void matrix_map_type::Reset() +{ + Set(0, 0, NULL); +} + +void matrix_map_type::Set(unsigned int height, unsigned int width, unsigned int * map) +{ + this->height = height; + this->width = width; + this->map.resize(height * width); + + if(map != NULL) + { + memcpy(this->map.data(), map, (height * width * sizeof(unsigned int))); + } + else + { + memset(this->map.data(), 0, (height * width * sizeof(unsigned int))); + } +} + mode::mode() { + /*-----------------------------------------------------*\ + | Initialize mode variables | + \*-----------------------------------------------------*/ name = ""; value = 0; flags = 0; @@ -37,8 +76,26 @@ mode::~mode() colors.clear(); } +segment::segment() +{ + /*-----------------------------------------------------*\ + | Initialize zone variables | + \*-----------------------------------------------------*/ + name = ""; + type = 0; + start_idx = 0; + leds_count = 0; +} + +segment::~segment() +{ +} + zone::zone() { + /*-----------------------------------------------------*\ + | Initialize zone variables | + \*-----------------------------------------------------*/ name = ""; type = 0; leds = NULL; @@ -47,34 +104,59 @@ zone::zone() leds_count = 0; leds_min = 0; leds_max = 0; - matrix_map = NULL; flags = 0; + active_mode = -1; } zone::~zone() { - + segments.clear(); } RGBController::RGBController() { - flags = 0; + /*-----------------------------------------------------*\ + | Initialize RGBController variables | + \*-----------------------------------------------------*/ + description = ""; + location = ""; + name = ""; + serial = ""; + vendor = ""; + version = ""; + active_mode = 0; + flags = 0; + type = DEVICE_TYPE_UNKNOWN; + + /*-----------------------------------------------------*\ + | Initialize device thread | + \*-----------------------------------------------------*/ DeviceThreadRunning = true; - DeviceCallThread = new std::thread(&RGBController::DeviceCallThreadFunction, this); + DeviceCallThread = new std::thread(&RGBController::DeviceCallThreadFunction, this); } RGBController::~RGBController() { + /*-----------------------------------------------------*\ + | Stop device thread | + \*-----------------------------------------------------*/ DeviceThreadRunning = false; DeviceCallThread->join(); delete DeviceCallThread; + /*-----------------------------------------------------*\ + | Clear member vectors | + \*-----------------------------------------------------*/ + led_alt_names.clear(); leds.clear(); colors.clear(); zones.clear(); modes.clear(); } +/*---------------------------------------------------------*\ +| Controller Information Functions | +\*---------------------------------------------------------*/ std::string RGBController::GetName() { return(name); @@ -105,37 +187,1372 @@ std::string RGBController::GetLocation() return(location); } +device_type RGBController::GetDeviceType() +{ + return(type); +} + +unsigned int RGBController::GetFlags() +{ + return(flags); +} + +/*---------------------------------------------------------*\ +| Hidden Flag Functions | +\*---------------------------------------------------------*/ +bool RGBController::GetHidden() +{ + return(flags & CONTROLLER_FLAG_HIDDEN); +} + +void RGBController::SetHidden(bool hidden) +{ + if(hidden) + { + flags |= CONTROLLER_FLAG_HIDDEN; + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_HIDDEN); + } + else + { + flags &= ~CONTROLLER_FLAG_HIDDEN; + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_UNHIDDEN); + } +} + +/*---------------------------------------------------------*\ +| Zone Functions | +\*---------------------------------------------------------*/ +int RGBController::GetZoneActiveMode(unsigned int zone) +{ + int active_mode; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + active_mode = zones[zone].active_mode; + } + else + { + active_mode = 0; + } + AccessMutex.unlock_shared(); + + return(active_mode); +} + +RGBColor RGBController::GetZoneColor(unsigned int zone, unsigned int color_index) +{ + RGBColor color; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (color_index < zones[zone].leds_count)) + { + color = zones[zone].colors[color_index]; + } + else + { + color = 0; + } + AccessMutex.unlock_shared(); + + return(color); +} + +RGBColor* RGBController::GetZoneColorsPointer(unsigned int zone) +{ + /*-----------------------------------------------------*\ + | This function assumes the caller has locked the mutex | + | before calling and will unlock the mutex after | + | updating the colors. | + \*-----------------------------------------------------*/ + if(zone < zones.size()) + { + return(zones[zone].colors); + } + else + { + return(NULL); + } +} + +std::size_t RGBController::GetZoneCount() +{ + return(zones.size()); +} + +unsigned int RGBController::GetZoneFlags(unsigned int zone) +{ + unsigned int flags; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + flags = zones[zone].flags; + } + else + { + flags = 0; + } + AccessMutex.unlock_shared(); + + return(flags); +} + +unsigned int RGBController::GetZoneLEDsCount(unsigned int zone) +{ + unsigned int leds_count; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + leds_count = zones[zone].leds_count; + } + else + { + leds_count = 0; + } + AccessMutex.unlock_shared(); + + return(leds_count); +} + +unsigned int RGBController::GetZoneLEDsMax(unsigned int zone) +{ + unsigned int leds_max; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + leds_max = zones[zone].leds_max; + } + else + { + leds_max = 0; + } + AccessMutex.unlock_shared(); + + return(leds_max); +} + +unsigned int RGBController::GetZoneLEDsMin(unsigned int zone) +{ + unsigned int leds_min; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + leds_min = zones[zone].leds_min; + } + else + { + leds_min = 0; + } + AccessMutex.unlock_shared(); + + return(leds_min); +} + +unsigned int RGBController::GetZoneMatrixMapHeight(unsigned int zone) +{ + unsigned int height; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + height = zones[zone].matrix_map.height; + } + else + { + height = 0; + } + AccessMutex.unlock_shared(); + + return(height); +} + +const unsigned int* RGBController::GetZoneMatrixMap(unsigned int zone) +{ + unsigned int* map; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + map = zones[zone].matrix_map.map.data(); + } + else + { + map = 0; + } + AccessMutex.unlock_shared(); + + return(map); +} + +unsigned int RGBController::GetZoneMatrixMapWidth(unsigned int zone) +{ + unsigned int width; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + width = zones[zone].matrix_map.width; + } + else + { + width = 0; + } + AccessMutex.unlock_shared(); + + return(width); +} + +std::size_t RGBController::GetZoneModeCount(unsigned int zone) +{ + std::size_t mode_count; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + mode_count = zones[zone].modes.size(); + } + else + { + mode_count = 0; + } + AccessMutex.unlock_shared(); + + return(mode_count); +} + +unsigned int RGBController::GetZoneModeBrightness(unsigned int zone, unsigned int mode) +{ + unsigned int brightness; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + brightness = zones[zone].modes[mode].brightness; + } + else + { + brightness = 0; + } + AccessMutex.unlock_shared(); + + return(brightness); +} + +unsigned int RGBController::GetZoneModeBrightnessMax(unsigned int zone, unsigned int mode) +{ + unsigned int brightness_max; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + brightness_max = zones[zone].modes[mode].brightness_max; + } + else + { + brightness_max = 0; + } + AccessMutex.unlock_shared(); + + return(brightness_max); +} + +unsigned int RGBController::GetZoneModeBrightnessMin(unsigned int zone, unsigned int mode) +{ + unsigned int brightness_min; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + brightness_min = zones[zone].modes[mode].brightness_min; + } + else + { + brightness_min = 0; + } + AccessMutex.unlock_shared(); + + return(brightness_min); +} + +RGBColor RGBController::GetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index) +{ + RGBColor color; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size()) && (color_index < zones[zone].modes[mode].colors.size())) + { + color = zones[zone].modes[mode].colors[color_index]; + } + else + { + color = 0; + } + AccessMutex.unlock_shared(); + + return(color); +} + +unsigned int RGBController::GetZoneModeColorMode(unsigned int zone, unsigned int mode) +{ + unsigned int color_mode; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + color_mode = zones[zone].modes[mode].color_mode; + } + else + { + color_mode = 0; + } + AccessMutex.unlock_shared(); + + return(color_mode); +} + +std::size_t RGBController::GetZoneModeColorsCount(unsigned int zone, unsigned int mode) +{ + std::size_t colors_count; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + colors_count = zones[zone].modes[mode].colors.size(); + } + else + { + colors_count = 0; + } + AccessMutex.unlock_shared(); + + return(colors_count); +} + +unsigned int RGBController::GetZoneModeColorsMax(unsigned int zone, unsigned int mode) +{ + unsigned int colors_max; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + colors_max = zones[zone].modes[mode].colors_max; + } + else + { + colors_max = 0; + } + AccessMutex.unlock_shared(); + + return(colors_max); +} + +unsigned int RGBController::GetZoneModeColorsMin(unsigned int zone, unsigned int mode) +{ + unsigned int colors_min; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + colors_min = zones[zone].modes[mode].colors_min; + } + else + { + colors_min = 0; + } + AccessMutex.unlock_shared(); + + return(colors_min); +} + +unsigned int RGBController::GetZoneModeDirection(unsigned int zone, unsigned int mode) +{ + unsigned int direction; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + direction = zones[zone].modes[mode].direction; + } + else + { + direction = 0; + } + AccessMutex.unlock_shared(); + + return(direction); +} + +unsigned int RGBController::GetZoneModeFlags(unsigned int zone, unsigned int mode) +{ + unsigned int flags; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + flags = zones[zone].modes[mode].flags; + } + else + { + flags = 0; + } + AccessMutex.unlock_shared(); + + return(flags); +} + +std::string RGBController::GetZoneModeName(unsigned int zone, unsigned int mode) +{ + std::string name; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + name = zones[zone].modes[mode].name; + } + else + { + name = ""; + } + AccessMutex.unlock_shared(); + + return(name); +} + +unsigned int RGBController::GetZoneModeSpeed(unsigned int zone, unsigned int mode) +{ + unsigned int speed; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + speed = zones[zone].modes[mode].speed; + } + else + { + speed = 0; + } + AccessMutex.unlock_shared(); + + return(speed); +} + +unsigned int RGBController::GetZoneModeSpeedMax(unsigned int zone, unsigned int mode) +{ + unsigned int speed_max; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + speed_max = zones[zone].modes[mode].speed_max; + } + else + { + speed_max = 0; + } + AccessMutex.unlock_shared(); + + return(speed_max); +} + +unsigned int RGBController::GetZoneModeSpeedMin(unsigned int zone, unsigned int mode) +{ + unsigned int speed_min; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + speed_min = zones[zone].modes[mode].speed_min; + } + else + { + speed_min = 0; + } + AccessMutex.unlock_shared(); + + return(speed_min); +} + +int RGBController::GetZoneModeValue(unsigned int zone, unsigned int mode) +{ + unsigned int value; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + value = zones[zone].modes[mode].value; + } + else + { + value = 0; + } + AccessMutex.unlock_shared(); + + return(value); +} + +std::string RGBController::GetZoneName(unsigned int zone) +{ + std::string name; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + name = zones[zone].name; + } + else + { + name = ""; + } + AccessMutex.unlock_shared(); + + return(name); +} + +std::size_t RGBController::GetZoneSegmentCount(unsigned int zone) +{ + std::size_t count; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + count = zones[zone].segments.size(); + } + else + { + count = 0; + } + AccessMutex.unlock_shared(); + + return(count); +} + +unsigned int RGBController::GetZoneSegmentLEDsCount(unsigned int zone, unsigned int segment) +{ + unsigned int leds_count; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (segment < zones[zone].segments.size())) + { + leds_count = zones[zone].segments[segment].leds_count; + } + else + { + leds_count = 0; + } + AccessMutex.unlock_shared(); + + return(leds_count); +} + +unsigned int RGBController::GetZoneSegmentMatrixMapHeight(unsigned int zone, unsigned int segment) +{ + unsigned int height; + + if(zone < zones.size()) + { + if(segment < zones[zone].segments.size()) + { + height = zones[zone].segments[segment].matrix_map.height; + } + else + { + height = 0; + } + } + else + { + height = 0; + } + + return(height); +} + +const unsigned int * RGBController::GetZoneSegmentMatrixMap(unsigned int zone, unsigned int segment) +{ + unsigned int* map; + + if(zone < zones.size()) + { + if(segment < zones[zone].segments.size()) + { + map = zones[zone].segments[segment].matrix_map.map.data(); + } + else + { + map = 0; + } + } + else + { + map = 0; + } + + return(map); +} + +unsigned int RGBController::GetZoneSegmentMatrixMapWidth(unsigned int zone, unsigned int segment) +{ + unsigned int width; + + if(zone < zones.size()) + { + if(segment < zones[zone].segments.size()) + { + width = zones[zone].segments[segment].matrix_map.width; + } + else + { + width = 0; + } + } + else + { + width = 0; + } + + return(width); +} + +std::string RGBController::GetZoneSegmentName(unsigned int zone, unsigned int segment) +{ + std::string name; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (segment < zones[zone].segments.size())) + { + name = zones[zone].segments[segment].name; + } + else + { + name = ""; + } + AccessMutex.unlock_shared(); + + return(name); +} + +unsigned int RGBController::GetZoneSegmentStartIndex(unsigned int zone, unsigned int segment) +{ + unsigned int start_idx; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (segment < zones[zone].segments.size())) + { + start_idx = zones[zone].segments[segment].start_idx; + } + else + { + start_idx = 0; + } + AccessMutex.unlock_shared(); + + return(start_idx); +} + +unsigned int RGBController::GetZoneSegmentType(unsigned int zone, unsigned int segment) +{ + zone_type type; + + AccessMutex.lock_shared(); + if((zone < zones.size()) && (segment < zones[zone].segments.size())) + { + type = zones[zone].segments[segment].type; + } + else + { + type = 0; + } + AccessMutex.unlock_shared(); + + return(type); +} + +unsigned int RGBController::GetZoneStartIndex(unsigned int zone) +{ + unsigned int start_idx; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + start_idx = zones[zone].start_idx; + } + else + { + start_idx = 0; + } + AccessMutex.unlock_shared(); + + return(start_idx); +} + +zone_type RGBController::GetZoneType(unsigned int zone) +{ + zone_type type; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + type = zones[zone].type; + } + else + { + type = 0; + } + AccessMutex.unlock_shared(); + + return(type); +} + +unsigned int RGBController::GetLEDsInZone(unsigned int zone) +{ + unsigned int leds_count; + + AccessMutex.lock_shared(); + if(zone < zones.size()) + { + leds_count = LEDsInZone(zone); + } + else + { + leds_count = 0; + } + AccessMutex.unlock_shared(); + + return(leds_count); +} + +void RGBController::SetZoneActiveMode(unsigned int zone, int mode) +{ + AccessMutex.lock(); + if(zone < zones.size()) + { + zones[zone].active_mode = mode; + AccessMutex.unlock(); + + UpdateZoneMode(zone); + } + else + { + AccessMutex.unlock(); + } +} + +void RGBController::SetZoneModeBrightness(unsigned int zone, unsigned int mode, unsigned int brightness) +{ + AccessMutex.lock(); + if((zone < zones.size()) + && (mode < zones[zone].modes.size()) + && (((zones[zone].modes[mode].brightness_max >= zones[zone].modes[mode].brightness_min) && (brightness >= zones[zone].modes[mode].brightness_min) && (brightness <= zones[zone].modes[mode].brightness_max)) + || ((zones[zone].modes[mode].brightness_max <= zones[zone].modes[mode].brightness_min) && (brightness <= zones[zone].modes[mode].brightness_min) && (brightness >= zones[zone].modes[mode].brightness_max)))) + { + zones[zone].modes[mode].brightness = brightness; + } + AccessMutex.unlock(); +} + +void RGBController::SetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index, RGBColor color) +{ + AccessMutex.lock(); + if((zone < zones.size()) && (mode < zones[zone].modes.size()) && (color_index < zones[zone].modes[mode].colors.size())) + { + zones[zone].modes[mode].colors[color_index] = color; + } + AccessMutex.unlock(); +} + +void RGBController::SetZoneModeColorMode(unsigned int zone, unsigned int mode, unsigned int color_mode) +{ + AccessMutex.lock(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + zones[zone].modes[mode].color_mode = color_mode; + } + AccessMutex.unlock(); +} + +void RGBController::SetZoneModeColorsCount(unsigned int zone, unsigned int mode, std::size_t count) +{ + AccessMutex.lock(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + zones[zone].modes[mode].colors.resize(count); + } + AccessMutex.unlock(); +} + +void RGBController::SetZoneModeDirection(unsigned int zone, unsigned int mode, unsigned int direction) +{ + AccessMutex.lock(); + if((zone < zones.size()) && (mode < zones[zone].modes.size())) + { + zones[zone].modes[mode].direction = direction; + } + AccessMutex.unlock(); +} + +void RGBController::SetZoneModeSpeed(unsigned int zone, unsigned int mode, unsigned int speed) +{ + AccessMutex.lock(); + if((zone < zones.size()) + && (mode < zones[zone].modes.size()) + && (((zones[zone].modes[mode].speed_max >= zones[zone].modes[mode].speed_min) && (speed >= zones[zone].modes[mode].speed_min) && (speed <= zones[zone].modes[mode].speed_max)) + || ((zones[zone].modes[mode].speed_max <= zones[zone].modes[mode].speed_min) && (speed <= zones[zone].modes[mode].speed_min) && (speed >= zones[zone].modes[mode].speed_max)))) + { + zones[zone].modes[mode].speed = speed; + } + AccessMutex.unlock(); +} + +bool RGBController::SupportsPerZoneModes() +{ + bool supports_per_zone_modes = false; + + AccessMutex.lock_shared(); + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + if(zones[zone_idx].modes.size() > 0) + { + supports_per_zone_modes = true; + break; + } + } + AccessMutex.unlock_shared(); + + return(supports_per_zone_modes); +} + +/*---------------------------------------------------------*\ +| Mode Functions | +\*---------------------------------------------------------*/ +std::size_t RGBController::GetModeCount() +{ + return(modes.size()); +} + +unsigned int RGBController::GetModeBrightness(unsigned int mode) +{ + unsigned int brightness; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + brightness = modes[mode].brightness; + } + else + { + brightness = 0; + } + AccessMutex.unlock_shared(); + + return(brightness); +} + +unsigned int RGBController::GetModeBrightnessMax(unsigned int mode) +{ + unsigned int brightness_max; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + brightness_max = modes[mode].brightness_max; + } + else + { + brightness_max = 0; + } + AccessMutex.unlock_shared(); + + return(brightness_max); +} + +unsigned int RGBController::GetModeBrightnessMin(unsigned int mode) +{ + unsigned int brightness_min; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + brightness_min = modes[mode].brightness_min; + } + else + { + brightness_min = 0; + } + AccessMutex.unlock_shared(); + + return(brightness_min); +} + +RGBColor RGBController::GetModeColor(unsigned int mode, unsigned int color_index) +{ + RGBColor color; + + AccessMutex.lock_shared(); + if((mode < modes.size()) && (color_index < modes[mode].colors.size())) + { + color = modes[mode].colors[color_index]; + } + else + { + color = 0; + } + AccessMutex.unlock_shared(); + + return(color); +} + +unsigned int RGBController::GetModeColorMode(unsigned int mode) +{ + unsigned int color_mode; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + color_mode = modes[mode].color_mode; + } + else + { + color_mode = 0; + } + AccessMutex.unlock_shared(); + + return(color_mode); +} + +std::size_t RGBController::GetModeColorsCount(unsigned int mode) +{ + std::size_t count; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + count = modes[mode].colors.size(); + } + else + { + count = 0; + } + AccessMutex.unlock_shared(); + + return(count); +} + +unsigned int RGBController::GetModeColorsMax(unsigned int mode) +{ + unsigned int colors_max; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + colors_max = modes[mode].colors_max; + } + else + { + colors_max = 0; + } + AccessMutex.unlock_shared(); + + return(colors_max); +} + +unsigned int RGBController::GetModeColorsMin(unsigned int mode) +{ + unsigned int colors_min; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + colors_min = modes[mode].colors_min; + } + else + { + colors_min = 0; + } + AccessMutex.unlock_shared(); + + return(colors_min); +} + +unsigned int RGBController::GetModeDirection(unsigned int mode) +{ + unsigned int direction; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + direction = modes[mode].direction; + } + else + { + direction = 0; + } + AccessMutex.unlock_shared(); + + return(direction); +} + +unsigned int RGBController::GetModeFlags(unsigned int mode) +{ + unsigned int flags; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + flags = modes[mode].flags; + } + else + { + flags = 0; + } + AccessMutex.unlock_shared(); + + return(flags); +} + std::string RGBController::GetModeName(unsigned int mode) { return(modes[mode].name); } -std::string RGBController::GetZoneName(unsigned int zone) +unsigned int RGBController::GetModeSpeed(unsigned int mode) { - return(zones[zone].name); + unsigned int speed; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + speed = modes[mode].speed; + } + else + { + speed = 0; + } + AccessMutex.unlock_shared(); + + return(speed); +} + +unsigned int RGBController::GetModeSpeedMax(unsigned int mode) +{ + unsigned int speed_max; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + speed_max = modes[mode].speed_max; + } + else + { + speed_max = 0; + } + AccessMutex.unlock_shared(); + + return(speed_max); +} + +unsigned int RGBController::GetModeSpeedMin(unsigned int mode) +{ + unsigned int speed_min; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + speed_min = modes[mode].speed_min; + } + else + { + speed_min = 0; + } + AccessMutex.unlock_shared(); + + return(speed_min); +} + +int RGBController::GetModeValue(unsigned int mode) +{ + int value; + + AccessMutex.lock_shared(); + if(mode < modes.size()) + { + value = modes[mode].value; + } + else + { + value = 0; + } + AccessMutex.unlock_shared(); + + return(value); +} + +void RGBController::SetModeBrightness(unsigned int mode, unsigned int brightness) +{ + AccessMutex.lock(); + if((mode < modes.size()) + && (((modes[mode].brightness_max >= modes[mode].brightness_min) && (brightness >= modes[mode].brightness_min) && (brightness <= modes[mode].brightness_max)) + || ((modes[mode].brightness_max <= modes[mode].brightness_min) && (brightness <= modes[mode].brightness_min) && (brightness >= modes[mode].brightness_max)))) + { + modes[mode].brightness = brightness; + } + AccessMutex.unlock(); +} + +void RGBController::SetModeColor(unsigned int mode, unsigned int color_index, RGBColor color) +{ + AccessMutex.lock(); + if((mode < modes.size()) && (color_index < modes[mode].colors.size())) + { + modes[mode].colors[color_index] = color; + } + AccessMutex.unlock(); +} + +void RGBController::SetModeColorMode(unsigned int mode, unsigned int color_mode) +{ + AccessMutex.lock(); + if(mode < modes.size()) + { + modes[mode].color_mode = color_mode; + } + AccessMutex.unlock(); +} + +void RGBController::SetModeColorsCount(unsigned int mode, std::size_t count) +{ + AccessMutex.lock(); + if((mode < modes.size()) && (count >= modes[mode].colors_min) && (count <= modes[mode].colors_max)) + { + modes[mode].colors.resize(count); + } + AccessMutex.unlock(); +} + +void RGBController::SetModeDirection(unsigned int mode, unsigned int direction) +{ + AccessMutex.lock(); + if(mode < modes.size()) + { + modes[mode].direction = direction; + } + AccessMutex.unlock(); +} + +void RGBController::SetModeSpeed(unsigned int mode, unsigned int speed) +{ + AccessMutex.lock(); + if((mode < modes.size()) + && (((modes[mode].speed_max >= modes[mode].speed_min) && (speed >= modes[mode].speed_min) && (speed <= modes[mode].speed_max)) + || ((modes[mode].speed_max <= modes[mode].speed_min) && (speed <= modes[mode].speed_min) && (speed >= modes[mode].speed_max)))) + { + modes[mode].speed = speed; + } + AccessMutex.unlock(); +} + +int RGBController::GetActiveMode() +{ + return(active_mode); +} + +void RGBController::SetActiveMode(int mode) +{ + /*-----------------------------------------------------*\ + | If the newly set active mode requires entire device, | + | set all the per-zone active modes to the entire | + | device mode. | + \*-----------------------------------------------------*/ + if(modes[mode].flags & MODE_FLAG_REQUIRES_ENTIRE_DEVICE) + { + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + SetZoneActiveMode(zone_idx, -1); + } + } + + AccessMutex.lock(); + active_mode = mode; + + AccessMutex.unlock(); + + UpdateMode(); +} + +void RGBController::SetCustomMode() +{ + /*-----------------------------------------------------*\ + | Search the Controller's mode list for a suitable | + | per-LED custom mode in the following order: | + | 1. Direct | + | 2. Custom | + | 3. Static | + \*-----------------------------------------------------*/ + #define NUM_CUSTOM_MODE_NAMES 3 + + const std::string custom_mode_names[] = + { + "Direct", + "Custom", + "Static" + }; + + for(unsigned int custom_mode_idx = 0; custom_mode_idx < NUM_CUSTOM_MODE_NAMES; custom_mode_idx++) + { + for(unsigned int mode_idx = 0; mode_idx < modes.size(); mode_idx++) + { + if((modes[mode_idx].name == custom_mode_names[custom_mode_idx]) + && ((modes[mode_idx].color_mode == MODE_COLORS_PER_LED) + || (modes[mode_idx].color_mode == MODE_COLORS_MODE_SPECIFIC))) + { + active_mode = mode_idx; + return; + } + } + } + + UpdateMode(); +} + +/*---------------------------------------------------------*\ +| LED Functions | +\*---------------------------------------------------------*/ +std::size_t RGBController::GetLEDCount() +{ + return(leds.size()); } std::string RGBController::GetLEDName(unsigned int led) { - if(led < led_alt_names.size()) - { - if(led_alt_names[led] != "") - { - return(led_alt_names[led]); - } - } + std::string name; - return(leds[led].name); + AccessMutex.lock_shared(); + if(led < leds.size()) + { + name = leds[led].name; + } + else + { + name = ""; + } + AccessMutex.unlock_shared(); + + return(name); } +unsigned int RGBController::GetLEDValue(unsigned int led) +{ + unsigned int value; + + AccessMutex.lock_shared(); + if(led < leds.size()) + { + value = leds[led].value; + } + else + { + value = 0; + } + AccessMutex.unlock_shared(); + + return(value); +} + +std::string RGBController::GetLEDDisplayName(unsigned int led) +{ + std::string name; + + AccessMutex.lock_shared(); + if((led < led_alt_names.size()) && (led_alt_names[led] != "")) + { + name = led_alt_names[led]; + } + else if(led < leds.size()) + { + name = leds[led].name; + } + else + { + name = ""; + } + AccessMutex.unlock_shared(); + + return(name); +} + +/*---------------------------------------------------------*\ +| Color Functions | +\*---------------------------------------------------------*/ +RGBColor RGBController::GetColor(unsigned int led) +{ + RGBColor color; + + AccessMutex.lock_shared(); + if(led < colors.size()) + { + color = colors[led]; + } + else + { + color = 0; + } + AccessMutex.unlock_shared(); + + return(color); +} + +RGBColor* RGBController::GetColorsPointer() +{ + return(&colors[0]); +} + +void RGBController::SetColor(unsigned int led, RGBColor color) +{ + AccessMutex.lock(); + if(led < colors.size()) + { + colors[led] = color; + } + AccessMutex.unlock(); +} + +void RGBController::SetAllColors(RGBColor color) +{ + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + SetAllZoneColors((int)zone_idx, color); + } +} + +void RGBController::SetAllZoneColors(int zone, RGBColor color) +{ + AccessMutex.lock(); + for(std::size_t color_idx = 0; color_idx < LEDsInZone(zone); color_idx++) + { + zones[zone].colors[color_idx] = color; + } + AccessMutex.unlock(); +} + +/*---------------------------------------------------------*\ +| Serialized Description Functions | +\*---------------------------------------------------------*/ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_version) { - unsigned int data_ptr = 0; - unsigned int data_size = 0; + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock_shared(); - /*---------------------------------------------------------*\ - | Calculate data size | - \*---------------------------------------------------------*/ + unsigned int data_ptr = 0; + unsigned int data_size = 0; + + /*-----------------------------------------------------*\ + | Calculate data size | + \*-----------------------------------------------------*/ unsigned short name_len = (unsigned short)strlen(name.c_str()) + 1; unsigned short vendor_len = (unsigned short)strlen(vendor.c_str()) + 1; unsigned short description_len = (unsigned short)strlen(description.c_str()) + 1; @@ -212,35 +1629,28 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio data_size += sizeof(zones[zone_index].leds_max); data_size += sizeof(zones[zone_index].leds_count); - if(zones[zone_index].matrix_map == NULL) - { - zone_matrix_len[zone_index] = 0; - } - else - { - zone_matrix_len[zone_index] = (unsigned short)((2 * sizeof(unsigned int)) + (zones[zone_index].matrix_map->height * zones[zone_index].matrix_map->width * sizeof(unsigned int))); - } + zone_matrix_len[zone_index] = (unsigned short)((2 * sizeof(unsigned int)) + (zones[zone_index].matrix_map.height * zones[zone_index].matrix_map.width * sizeof(unsigned int))); data_size += sizeof(zone_matrix_len[zone_index]); data_size += zone_matrix_len[zone_index]; if(protocol_version >= 4) { - /*---------------------------------------------------------*\ - | Number of segments in zone | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Number of segments in zone | + \*---------------------------------------------*/ data_size += sizeof(unsigned short); for(size_t segment_index = 0; segment_index < zones[zone_index].segments.size(); segment_index++) { - /*---------------------------------------------------------*\ - | Length of segment name string | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Length of segment name string | + \*-----------------------------------------*/ data_size += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Segment name string data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment name string data | + \*-----------------------------------------*/ data_size += (unsigned int)strlen(zones[zone_index].segments[segment_index].name.c_str()) + 1; data_size += sizeof(zones[zone_index].segments[segment_index].type); @@ -249,9 +1659,9 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio } } - /*---------------------------------------------------------*\ - | Zone flags | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Zone flags | + \*-------------------------------------------------*/ if(protocol_version >= 5) { data_size += sizeof(unsigned int); @@ -269,19 +1679,19 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio data_size += sizeof(leds[led_index].value); } - /*---------------------------------------------------------*\ - | LED alternate names | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | LED alternate names | + \*-----------------------------------------------------*/ if(protocol_version >= 5) { - /*-----------------------------------------------------*\ - | Number of LED alternate names | - \*-----------------------------------------------------*/ + /*-------------------------------------------------*\ + | Number of LED alternate names | + \*-------------------------------------------------*/ data_size += sizeof(num_led_alt_names); - /*-----------------------------------------------------*\ - | LED alternate name strings | - \*-----------------------------------------------------*/ + /*-------------------------------------------------*\ + | LED alternate name strings | + \*-------------------------------------------------*/ for(std::size_t led_idx = 0; led_idx < led_alt_names.size(); led_idx++) { data_size += sizeof(unsigned short); @@ -289,9 +1699,9 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio } } - /*---------------------------------------------------------*\ - | Controller flags | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Controller flags | + \*-----------------------------------------------------*/ if(protocol_version >= 5) { data_size += sizeof(flags); @@ -300,35 +1710,35 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio data_size += sizeof(num_colors); data_size += num_colors * sizeof(RGBColor); - /*---------------------------------------------------------*\ - | Create data buffer | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Create data buffer | + \*-----------------------------------------------------*/ unsigned char *data_buf = new unsigned char[data_size]; - /*---------------------------------------------------------*\ - | Copy in data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in data size | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &data_size, sizeof(data_size)); data_ptr += sizeof(data_size); - /*---------------------------------------------------------*\ - | Copy in type | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in type | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &type, sizeof(device_type)); data_ptr += sizeof(device_type); - /*---------------------------------------------------------*\ - | Copy in name (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in name (size+data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &name_len, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], name.c_str()); data_ptr += name_len; - /*---------------------------------------------------------*\ - | Copy in vendor (size+data) if protocol 1 or higher | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in vendor (size+data) if protocol 1 or higher | + \*-----------------------------------------------------*/ if(protocol_version >= 1) { memcpy(&data_buf[data_ptr], &vendor_len, sizeof(unsigned short)); @@ -338,96 +1748,96 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio data_ptr += vendor_len; } - /*---------------------------------------------------------*\ - | Copy in description (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in description (size+data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &description_len, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], description.c_str()); data_ptr += description_len; - /*---------------------------------------------------------*\ - | Copy in version (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in version (size+data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &version_len, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], version.c_str()); data_ptr += version_len; - /*---------------------------------------------------------*\ - | Copy in serial (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in serial (size+data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &serial_len, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], serial.c_str()); data_ptr += serial_len; - /*---------------------------------------------------------*\ - | Copy in location (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in location (size+data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &location_len, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], location.c_str()); data_ptr += location_len; - /*---------------------------------------------------------*\ - | Copy in number of modes (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of modes (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_modes, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in active mode (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in active mode (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &active_mode, sizeof(active_mode)); data_ptr += sizeof(active_mode); - /*---------------------------------------------------------*\ - | Copy in modes | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in modes | + \*-----------------------------------------------------*/ for(int mode_index = 0; mode_index < num_modes; mode_index++) { - /*---------------------------------------------------------*\ - | Copy in mode name (size+data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode name (size+data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &mode_name_len[mode_index], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], modes[mode_index].name.c_str()); data_ptr += mode_name_len[mode_index]; - /*---------------------------------------------------------*\ - | Copy in mode value (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode value (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].value, sizeof(modes[mode_index].value)); data_ptr += sizeof(modes[mode_index].value); - /*---------------------------------------------------------*\ - | Copy in mode flags (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode flags (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].flags, sizeof(modes[mode_index].flags)); data_ptr += sizeof(modes[mode_index].flags); - /*---------------------------------------------------------*\ - | Copy in mode speed_min (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode speed_min (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].speed_min, sizeof(modes[mode_index].speed_min)); data_ptr += sizeof(modes[mode_index].speed_min); - /*---------------------------------------------------------*\ - | Copy in mode speed_max (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode speed_max (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].speed_max, sizeof(modes[mode_index].speed_max)); data_ptr += sizeof(modes[mode_index].speed_max); - /*---------------------------------------------------------*\ - | Copy in mode brightness_min and brightness_max (data) if | - | protocol 3 or higher | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode brightness_min and brightness_max | + | (data) if protocol 3 or higher | + \*-------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&data_buf[data_ptr], &modes[mode_index].brightness_min, sizeof(modes[mode_index].brightness_min)); @@ -437,251 +1847,254 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio data_ptr += sizeof(modes[mode_index].brightness_max); } - /*---------------------------------------------------------*\ - | Copy in mode colors_min (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode colors_min (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].colors_min, sizeof(modes[mode_index].colors_min)); data_ptr += sizeof(modes[mode_index].colors_min); - /*---------------------------------------------------------*\ - | Copy in mode colors_max (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode colors_max (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].colors_max, sizeof(modes[mode_index].colors_max)); data_ptr += sizeof(modes[mode_index].colors_max); - /*---------------------------------------------------------*\ - | Copy in mode speed (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode speed (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].speed, sizeof(modes[mode_index].speed)); data_ptr += sizeof(modes[mode_index].speed); - /*---------------------------------------------------------*\ - | Copy in mode brightness (data) if protocol 3 or higher | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode brightness (data) if protocol 3 or | + | higher | + \*-------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&data_buf[data_ptr], &modes[mode_index].brightness, sizeof(modes[mode_index].brightness)); data_ptr += sizeof(modes[mode_index].brightness); } - /*---------------------------------------------------------*\ - | Copy in mode direction (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode direction (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].direction, sizeof(modes[mode_index].direction)); data_ptr += sizeof(modes[mode_index].direction); - /*---------------------------------------------------------*\ - | Copy in mode color_mode (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode color_mode (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].color_mode, sizeof(modes[mode_index].color_mode)); data_ptr += sizeof(modes[mode_index].color_mode); - /*---------------------------------------------------------*\ - | Copy in mode number of colors | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode number of colors | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &mode_num_colors[mode_index], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in mode mode colors | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode mode colors | + \*-------------------------------------------------*/ for(int color_index = 0; color_index < mode_num_colors[mode_index]; color_index++) { - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in color (data) | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode_index].colors[color_index], sizeof(modes[mode_index].colors[color_index])); data_ptr += sizeof(modes[mode_index].colors[color_index]); } } - /*---------------------------------------------------------*\ - | Copy in number of zones (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of zones (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_zones, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in zones | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in zones | + \*-----------------------------------------------------*/ for(int zone_index = 0; zone_index < num_zones; zone_index++) { - /*---------------------------------------------------------*\ - | Copy in zone name (size+data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone name (size+data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &zone_name_len[zone_index], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], zones[zone_index].name.c_str()); data_ptr += zone_name_len[zone_index]; - /*---------------------------------------------------------*\ - | Copy in zone type (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone type (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].type, sizeof(zones[zone_index].type)); data_ptr += sizeof(zones[zone_index].type); - /*---------------------------------------------------------*\ - | Check for resizable effects-only zone. For protocol | - | versions that do not support this feature, we have to | - | overwrite the leds_min/max/count parameters to 1 so that | - | the zone appears a fixed size to older clients. | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Check for resizable effects-only zone. For | + | protocol versions that do not support this | + | feature, we have to overwrite the | + | leds_min/max/count parameters to 1 so that the | + | zone appears a fixed size to older clients. | + \*-------------------------------------------------*/ if((zones[zone_index].flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY) && (protocol_version < 5)) { - /*---------------------------------------------------------*\ - | Create a temporary variable to hold the fixed value of 1 | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Create a temporary variable to hold the fixed | + | value of 1 | + \*---------------------------------------------*/ unsigned int tmp_size = 1; - /*---------------------------------------------------------*\ - | Copy in temporary minimum LED count (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in temporary minimum LED count (data) | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &tmp_size, sizeof(tmp_size)); data_ptr += sizeof(tmp_size); - /*---------------------------------------------------------*\ - | Copy in temporary maximum LED count (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in temporary maximum LED count (data) | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &tmp_size, sizeof(tmp_size)); data_ptr += sizeof(tmp_size); - /*---------------------------------------------------------*\ - | Copy in temporary LED count (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in temporary LED count (data) | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &tmp_size, sizeof(tmp_size)); data_ptr += sizeof(tmp_size); } else { - /*---------------------------------------------------------*\ - | Copy in zone minimum LED count (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in zone minimum LED count (data) | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].leds_min, sizeof(zones[zone_index].leds_min)); data_ptr += sizeof(zones[zone_index].leds_min); - /*---------------------------------------------------------*\ - | Copy in zone maximum LED count (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in zone maximum LED count (data) | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].leds_max, sizeof(zones[zone_index].leds_max)); data_ptr += sizeof(zones[zone_index].leds_max); - /*---------------------------------------------------------*\ - | Copy in zone LED count (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in zone LED count (data) | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].leds_count, sizeof(zones[zone_index].leds_count)); data_ptr += sizeof(zones[zone_index].leds_count); } - /*---------------------------------------------------------*\ - | Copy in size of zone matrix | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in size of zone matrix | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &zone_matrix_len[zone_index], sizeof(zone_matrix_len[zone_index])); data_ptr += sizeof(zone_matrix_len[zone_index]); - /*---------------------------------------------------------*\ - | Copy in matrix data if size is nonzero | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in matrix data if size is nonzero | + \*-------------------------------------------------*/ if(zone_matrix_len[zone_index] > 0) { - /*---------------------------------------------------------*\ - | Copy in matrix height | - \*---------------------------------------------------------*/ - memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map->height, sizeof(zones[zone_index].matrix_map->height)); - data_ptr += sizeof(zones[zone_index].matrix_map->height); + /*---------------------------------------------*\ + | Copy in matrix height | + \*---------------------------------------------*/ + memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map.height, sizeof(zones[zone_index].matrix_map.height)); + data_ptr += sizeof(zones[zone_index].matrix_map.height); - /*---------------------------------------------------------*\ - | Copy in matrix width | - \*---------------------------------------------------------*/ - memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map->width, sizeof(zones[zone_index].matrix_map->width)); - data_ptr += sizeof(zones[zone_index].matrix_map->width); + /*---------------------------------------------*\ + | Copy in matrix width | + \*---------------------------------------------*/ + memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map.width, sizeof(zones[zone_index].matrix_map.width)); + data_ptr += sizeof(zones[zone_index].matrix_map.width); - /*---------------------------------------------------------*\ - | Copy in matrix map | - \*---------------------------------------------------------*/ - for(unsigned int matrix_idx = 0; matrix_idx < (zones[zone_index].matrix_map->height * zones[zone_index].matrix_map->width); matrix_idx++) + /*---------------------------------------------*\ + | Copy in matrix map | + \*---------------------------------------------*/ + for(unsigned int matrix_idx = 0; matrix_idx < (zones[zone_index].matrix_map.height * zones[zone_index].matrix_map.width); matrix_idx++) { - memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map->map[matrix_idx], sizeof(zones[zone_index].matrix_map->map[matrix_idx])); - data_ptr += sizeof(zones[zone_index].matrix_map->map[matrix_idx]); + memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map.map[matrix_idx], sizeof(zones[zone_index].matrix_map.map[matrix_idx])); + data_ptr += sizeof(zones[zone_index].matrix_map.map[matrix_idx]); } } - /*---------------------------------------------------------*\ - | Copy in segments | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in segments | + \*-------------------------------------------------*/ if(protocol_version >= 4) { unsigned short num_segments = (unsigned short)zones[zone_index].segments.size(); - /*---------------------------------------------------------*\ - | Number of segments in zone | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Number of segments in zone | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_segments, sizeof(num_segments)); data_ptr += sizeof(num_segments); for(int segment_index = 0; segment_index < num_segments; segment_index++) { - /*---------------------------------------------------------*\ - | Length of segment name string | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Length of segment name string | + \*-----------------------------------------*/ unsigned short segment_name_length = (unsigned short)strlen(zones[zone_index].segments[segment_index].name.c_str()) + 1; memcpy(&data_buf[data_ptr], &segment_name_length, sizeof(segment_name_length)); data_ptr += sizeof(segment_name_length); - /*---------------------------------------------------------*\ - | Segment name string data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment name string data | + \*-----------------------------------------*/ strcpy((char *)&data_buf[data_ptr], zones[zone_index].segments[segment_index].name.c_str()); data_ptr += segment_name_length; - /*---------------------------------------------------------*\ - | Segment type data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment type data | + \*-----------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].segments[segment_index].type, sizeof(zones[zone_index].segments[segment_index].type)); data_ptr += sizeof(zones[zone_index].segments[segment_index].type); - /*---------------------------------------------------------*\ - | Segment start index data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment start index data | + \*-----------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].segments[segment_index].start_idx, sizeof(zones[zone_index].segments[segment_index].start_idx)); data_ptr += sizeof(zones[zone_index].segments[segment_index].start_idx); - /*---------------------------------------------------------*\ - | Segment LED count data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment LED count data | + \*-----------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].segments[segment_index].leds_count, sizeof(zones[zone_index].segments[segment_index].leds_count)); data_ptr += sizeof(zones[zone_index].segments[segment_index].leds_count); } } - /*---------------------------------------------------------*\ - | Copy in zone flags | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone flags | + \*-------------------------------------------------*/ if(protocol_version >= 5) { - /*---------------------------------------------------------*\ - | Zone flags | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Zone flags | + \*---------------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone_index].flags, sizeof(zones[zone_index].flags)); data_ptr += sizeof(zones[zone_index].flags); } } - /*---------------------------------------------------------*\ - | Copy in number of LEDs (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of LEDs (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_leds, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in LEDs | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in LEDs | + \*-----------------------------------------------------*/ for(int led_index = 0; led_index < num_leds; led_index++) { - /*---------------------------------------------------------*\ - | Copy in LED name (size+data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in LED name (size+data) | + \*-------------------------------------------------*/ unsigned short ledname_len = (unsigned short)strlen(leds[led_index].name.c_str()) + 1; memcpy(&data_buf[data_ptr], &ledname_len, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -689,47 +2102,47 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio strcpy((char *)&data_buf[data_ptr], leds[led_index].name.c_str()); data_ptr += ledname_len; - /*---------------------------------------------------------*\ - | Copy in LED value (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in LED value (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &leds[led_index].value, sizeof(leds[led_index].value)); data_ptr += sizeof(leds[led_index].value); } - /*---------------------------------------------------------*\ - | Copy in number of colors (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of colors (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_colors, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in colors | + \*-----------------------------------------------------*/ for(int color_index = 0; color_index < num_colors; color_index++) { - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &colors[color_index], sizeof(colors[color_index])); data_ptr += sizeof(colors[color_index]); } - /*---------------------------------------------------------*\ - | LED alternate names data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | LED alternate names data | + \*-----------------------------------------------------*/ if(protocol_version >= 5) { - /*---------------------------------------------------------*\ - | Number of LED alternate name strings | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Number of LED alternate name strings | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_led_alt_names, sizeof(num_led_alt_names)); data_ptr += sizeof(num_led_alt_names); for(std::size_t led_idx = 0; led_idx < led_alt_names.size(); led_idx++) { - /*---------------------------------------------------------*\ - | Copy in LED alternate name (size+data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in LED alternate name (size+data) | + \*---------------------------------------------*/ unsigned short string_length = (unsigned short)strlen(led_alt_names[led_idx].c_str()) + 1; memcpy(&data_buf[data_ptr], &string_length, sizeof(string_length)); @@ -740,9 +2153,9 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio } } - /*---------------------------------------------------------*\ - | Controller flags data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Controller flags data | + \*-----------------------------------------------------*/ if(protocol_version >= 5) { memcpy(&data_buf[data_ptr], &flags, sizeof(flags)); @@ -756,24 +2169,34 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio delete[] zone_matrix_len; delete[] mode_num_colors; + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock_shared(); + return(data_buf); } void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int protocol_version) { + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock(); + unsigned int data_ptr = 0; data_ptr += sizeof(unsigned int); - /*---------------------------------------------------------*\ - | Copy in type | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in type | + \*-----------------------------------------------------*/ memcpy(&type, &data_buf[data_ptr], sizeof(device_type)); data_ptr += sizeof(device_type); - /*---------------------------------------------------------*\ - | Copy in name | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in name | + \*-----------------------------------------------------*/ unsigned short name_len; memcpy(&name_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -781,9 +2204,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int name = (char *)&data_buf[data_ptr]; data_ptr += name_len; - /*---------------------------------------------------------*\ - | Copy in vendor if protocol version is 1 or higher | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in vendor if protocol version is 1 or higher | + \*-----------------------------------------------------*/ if(protocol_version >= 1) { unsigned short vendor_len; @@ -794,9 +2217,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int data_ptr += vendor_len; } - /*---------------------------------------------------------*\ - | Copy in description | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in description | + \*-----------------------------------------------------*/ unsigned short description_len; memcpy(&description_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -804,9 +2227,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int description = (char *)&data_buf[data_ptr]; data_ptr += description_len; - /*---------------------------------------------------------*\ - | Copy in version | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in version | + \*-----------------------------------------------------*/ unsigned short version_len; memcpy(&version_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -814,9 +2237,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int version = (char *)&data_buf[data_ptr]; data_ptr += version_len; - /*---------------------------------------------------------*\ - | Copy in serial | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in serial | + \*-----------------------------------------------------*/ unsigned short serial_len; memcpy(&serial_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -824,9 +2247,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int serial = (char *)&data_buf[data_ptr]; data_ptr += serial_len; - /*---------------------------------------------------------*\ - | Copy in location | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in location | + \*-----------------------------------------------------*/ unsigned short location_len; memcpy(&location_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -834,29 +2257,29 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int location = (char *)&data_buf[data_ptr]; data_ptr += location_len; - /*---------------------------------------------------------*\ - | Copy in number of modes (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of modes (data) | + \*-----------------------------------------------------*/ unsigned short num_modes; memcpy(&num_modes, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in active mode (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in active mode (data) | + \*-----------------------------------------------------*/ memcpy(&active_mode, &data_buf[data_ptr], sizeof(active_mode)); data_ptr += sizeof(active_mode); - /*---------------------------------------------------------*\ - | Copy in modes | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in modes | + \*-----------------------------------------------------*/ for(int mode_index = 0; mode_index < num_modes; mode_index++) { mode new_mode; - /*---------------------------------------------------------*\ - | Copy in mode name (size+data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode name (size+data) | + \*-------------------------------------------------*/ unsigned short modename_len; memcpy(&modename_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -864,34 +2287,34 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int new_mode.name = (char *)&data_buf[data_ptr]; data_ptr += modename_len; - /*---------------------------------------------------------*\ - | Copy in mode value (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode value (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.value, &data_buf[data_ptr], sizeof(new_mode.value)); data_ptr += sizeof(new_mode.value); - /*---------------------------------------------------------*\ - | Copy in mode flags (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode flags (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.flags, &data_buf[data_ptr], sizeof(new_mode.flags)); data_ptr += sizeof(new_mode.flags); - /*---------------------------------------------------------*\ - | Copy in mode speed_min (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode speed_min (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.speed_min, &data_buf[data_ptr], sizeof(new_mode.speed_min)); data_ptr += sizeof(new_mode.speed_min); - /*---------------------------------------------------------*\ - | Copy in mode speed_max (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode speed_max (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.speed_max, &data_buf[data_ptr], sizeof(new_mode.speed_max)); data_ptr += sizeof(new_mode.speed_max); - /*---------------------------------------------------------*\ - | Copy in mode brightness min and max if protocol version | - | is 3 or higher | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode brightness min and max if protocol | + | version is 3 or higher | + \*-------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&new_mode.brightness_min, &data_buf[data_ptr], sizeof(new_mode.brightness_min)); @@ -901,60 +2324,61 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int data_ptr += sizeof(new_mode.brightness_max); } - /*---------------------------------------------------------*\ - | Copy in mode colors_min (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode colors_min (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.colors_min, &data_buf[data_ptr], sizeof(new_mode.colors_min)); data_ptr += sizeof(new_mode.colors_min); - /*---------------------------------------------------------*\ - | Copy in mode colors_max (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode colors_max (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.colors_max, &data_buf[data_ptr], sizeof(new_mode.colors_max)); data_ptr += sizeof(new_mode.colors_max); - /*---------------------------------------------------------*\ - | Copy in mode speed (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode speed (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.speed, &data_buf[data_ptr], sizeof(new_mode.speed)); data_ptr += sizeof(new_mode.speed); - /*---------------------------------------------------------*\ - | Copy in mode brightness if protocol version is 3 or higher| - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode brightness if protocol version is 3 | + | or higher | + \*-------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&new_mode.brightness, &data_buf[data_ptr], sizeof(new_mode.brightness)); data_ptr += sizeof(new_mode.brightness); } - /*---------------------------------------------------------*\ - | Copy in mode direction (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode direction (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.direction, &data_buf[data_ptr], sizeof(new_mode.direction)); data_ptr += sizeof(new_mode.direction); - /*---------------------------------------------------------*\ - | Copy in mode color_mode (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode color_mode (data) | + \*-------------------------------------------------*/ memcpy(&new_mode.color_mode, &data_buf[data_ptr], sizeof(new_mode.color_mode)); data_ptr += sizeof(new_mode.color_mode); - /*---------------------------------------------------------*\ - | Copy in mode number of colors | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode number of colors | + \*-------------------------------------------------*/ unsigned short mode_num_colors; memcpy(&mode_num_colors, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in mode mode colors | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in mode mode colors | + \*-------------------------------------------------*/ for(int color_index = 0; color_index < mode_num_colors; color_index++) { - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in color (data) | + \*---------------------------------------------*/ RGBColor new_color; memcpy(&new_color, &data_buf[data_ptr], sizeof(RGBColor)); data_ptr += sizeof(modes[mode_index].colors[color_index]); @@ -965,23 +2389,23 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int modes.push_back(new_mode); } - /*---------------------------------------------------------*\ - | Copy in number of zones (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of zones (data) | + \*-----------------------------------------------------*/ unsigned short num_zones; memcpy(&num_zones, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in zones | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in zones | + \*-----------------------------------------------------*/ for(int zone_index = 0; zone_index < num_zones; zone_index++) { zone new_zone; - /*---------------------------------------------------------*\ - | Copy in zone name (size+data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone name (size+data) | + \*-------------------------------------------------*/ unsigned short zonename_len; memcpy(&zonename_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -989,88 +2413,76 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int new_zone.name = (char *)&data_buf[data_ptr]; data_ptr += zonename_len; - /*---------------------------------------------------------*\ - | Copy in zone type (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone type (data) | + \*-------------------------------------------------*/ memcpy(&new_zone.type, &data_buf[data_ptr], sizeof(new_zone.type)); data_ptr += sizeof(new_zone.type); - /*---------------------------------------------------------*\ - | Copy in zone minimum LED count (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone minimum LED count (data) | + \*-------------------------------------------------*/ memcpy(&new_zone.leds_min, &data_buf[data_ptr], sizeof(new_zone.leds_min)); data_ptr += sizeof(new_zone.leds_min); - /*---------------------------------------------------------*\ - | Copy in zone maximum LED count (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone maximum LED count (data) | + \*-------------------------------------------------*/ memcpy(&new_zone.leds_max, &data_buf[data_ptr], sizeof(new_zone.leds_max)); data_ptr += sizeof(new_zone.leds_max); - /*---------------------------------------------------------*\ - | Copy in zone LED count (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone LED count (data) | + \*-------------------------------------------------*/ memcpy(&new_zone.leds_count, &data_buf[data_ptr], sizeof(new_zone.leds_count)); data_ptr += sizeof(new_zone.leds_count); - /*---------------------------------------------------------*\ - | Copy in size of zone matrix | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in size of zone matrix | + \*-------------------------------------------------*/ unsigned short zone_matrix_len; memcpy(&zone_matrix_len, &data_buf[data_ptr], sizeof(zone_matrix_len)); data_ptr += sizeof(zone_matrix_len); - /*---------------------------------------------------------*\ - | Copy in matrix data if size is nonzero | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in matrix data if size is nonzero | + \*-------------------------------------------------*/ if(zone_matrix_len > 0) { - /*---------------------------------------------------------*\ - | Create a map data structure to fill in and attach it to | - | the new zone | - \*---------------------------------------------------------*/ - matrix_map_type * new_map = new matrix_map_type; + /*---------------------------------------------*\ + | Copy in matrix height | + \*---------------------------------------------*/ + memcpy(&new_zone.matrix_map.height, &data_buf[data_ptr], sizeof(new_zone.matrix_map.height)); + data_ptr += sizeof(new_zone.matrix_map.height); - new_zone.matrix_map = new_map; + /*---------------------------------------------*\ + | Copy in matrix width | + \*---------------------------------------------*/ + memcpy(&new_zone.matrix_map.width, &data_buf[data_ptr], sizeof(new_zone.matrix_map.width)); + data_ptr += sizeof(new_zone.matrix_map.width); - /*---------------------------------------------------------*\ - | Copy in matrix height | - \*---------------------------------------------------------*/ - memcpy(&new_map->height, &data_buf[data_ptr], sizeof(new_map->height)); - data_ptr += sizeof(new_map->height); + /*---------------------------------------------*\ + | Copy in matrix map | + \*---------------------------------------------*/ + new_zone.matrix_map.map.resize(new_zone.matrix_map.height * new_zone.matrix_map.width); - /*---------------------------------------------------------*\ - | Copy in matrix width | - \*---------------------------------------------------------*/ - memcpy(&new_map->width, &data_buf[data_ptr], sizeof(new_map->width)); - data_ptr += sizeof(new_map->width); - - /*---------------------------------------------------------*\ - | Copy in matrix map | - \*---------------------------------------------------------*/ - new_map->map = new unsigned int[new_map->height * new_map->width]; - - for(unsigned int matrix_idx = 0; matrix_idx < (new_map->height * new_map->width); matrix_idx++) + for(unsigned int matrix_idx = 0; matrix_idx < (new_zone.matrix_map.height * new_zone.matrix_map.width); matrix_idx++) { - memcpy(&new_map->map[matrix_idx], &data_buf[data_ptr], sizeof(new_map->map[matrix_idx])); - data_ptr += sizeof(new_map->map[matrix_idx]); + memcpy(&new_zone.matrix_map.map[matrix_idx], &data_buf[data_ptr], sizeof(new_zone.matrix_map.map[matrix_idx])); + data_ptr += sizeof(new_zone.matrix_map.map[matrix_idx]); } } - else - { - new_zone.matrix_map = NULL; - } - /*---------------------------------------------------------*\ - | Copy in segments | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in segments | + \*-------------------------------------------------*/ if(protocol_version >= 4) { unsigned short num_segments = 0; - /*---------------------------------------------------------*\ - | Number of segments in zone | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Number of segments in zone | + \*---------------------------------------------*/ memcpy(&num_segments, &data_buf[data_ptr], sizeof(num_segments)); data_ptr += sizeof(num_segments); @@ -1078,9 +2490,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int { segment new_segment; - /*---------------------------------------------------------*\ - | Copy in segment name (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Copy in segment name (size+data) | + \*-----------------------------------------*/ unsigned short segmentname_len; memcpy(&segmentname_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -1088,21 +2500,21 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int new_segment.name = (char *)&data_buf[data_ptr]; data_ptr += segmentname_len; - /*---------------------------------------------------------*\ - | Segment type data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment type data | + \*-----------------------------------------*/ memcpy(&new_segment.type, &data_buf[data_ptr], sizeof(new_segment.type)); data_ptr += sizeof(new_segment.type); - /*---------------------------------------------------------*\ - | Segment start index data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment start index data | + \*-----------------------------------------*/ memcpy(&new_segment.start_idx, &data_buf[data_ptr], sizeof(new_segment.start_idx)); data_ptr += sizeof(new_segment.start_idx); - /*---------------------------------------------------------*\ - | Segment LED count data | - \*---------------------------------------------------------*/ + /*-----------------------------------------*\ + | Segment LED count data | + \*-----------------------------------------*/ memcpy(&new_segment.leds_count, &data_buf[data_ptr], sizeof(new_segment.leds_count)); data_ptr += sizeof(new_segment.leds_count); @@ -1110,9 +2522,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int } } - /*---------------------------------------------------------*\ - | Copy in zone flags | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in zone flags | + \*-------------------------------------------------*/ if(protocol_version >= 5) { memcpy(&new_zone.flags, &data_buf[data_ptr], sizeof(new_zone.flags)); @@ -1122,23 +2534,23 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int zones.push_back(new_zone); } - /*---------------------------------------------------------*\ - | Copy in number of LEDs (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of LEDs (data) | + \*-----------------------------------------------------*/ unsigned short num_leds; memcpy(&num_leds, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in LEDs | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in LEDs | + \*-----------------------------------------------------*/ for(int led_index = 0; led_index < num_leds; led_index++) { led new_led; - /*---------------------------------------------------------*\ - | Copy in LED name (size+data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in LED name (size+data) | + \*-------------------------------------------------*/ unsigned short ledname_len; memcpy(&ledname_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -1146,46 +2558,46 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int new_led.name = (char *)&data_buf[data_ptr]; data_ptr += ledname_len; - /*---------------------------------------------------------*\ - | Copy in LED value (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in LED value (data) | + \*-------------------------------------------------*/ memcpy(&new_led.value, &data_buf[data_ptr], sizeof(new_led.value)); data_ptr += sizeof(new_led.value); leds.push_back(new_led); } - /*---------------------------------------------------------*\ - | Copy in number of colors (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of colors (data) | + \*-----------------------------------------------------*/ unsigned short num_colors; memcpy(&num_colors, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in colors | + \*-----------------------------------------------------*/ for(int color_index = 0; color_index < num_colors; color_index++) { RGBColor new_color; - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ memcpy(&new_color, &data_buf[data_ptr], sizeof(RGBColor)); data_ptr += sizeof(RGBColor); colors.push_back(new_color); } - /*---------------------------------------------------------*\ - | Copy in LED alternate names data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in LED alternate names data | + \*-----------------------------------------------------*/ if(protocol_version >= 5) { - /*---------------------------------------------------------*\ - | Copy in number of LED alternate names | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in number of LED alternate names | + \*-------------------------------------------------*/ unsigned short num_led_alt_names; memcpy(&num_led_alt_names, &data_buf[data_ptr], sizeof(num_led_alt_names)); @@ -1195,9 +2607,9 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int { unsigned short string_length = 0; - /*---------------------------------------------------------*\ - | Copy in LED alternate name string (size+data) | - \*---------------------------------------------------------*/ + /*---------------------------------------------*\ + | Copy in LED alternate name string (size+data) | + \*---------------------------------------------*/ memcpy(&string_length, &data_buf[data_ptr], sizeof(string_length)); data_ptr += sizeof(string_length); @@ -1206,32 +2618,42 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int } } - /*---------------------------------------------------------*\ - | Copy in controller flags data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in controller flags data | + \*-----------------------------------------------------*/ if(protocol_version >= 5) { memcpy(&flags, &data_buf[data_ptr], sizeof(flags)); data_ptr += sizeof(flags); } - /*---------------------------------------------------------*\ - | Setup colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock(); + + /*-----------------------------------------------------*\ + | Setup colors | + \*-----------------------------------------------------*/ SetupColors(); } unsigned char * RGBController::GetModeDescription(int mode, unsigned int protocol_version) { - unsigned int data_ptr = 0; - unsigned int data_size = 0; + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock_shared(); + + unsigned int data_ptr = 0; + unsigned int data_size = 0; unsigned short mode_name_len; unsigned short mode_num_colors; - /*---------------------------------------------------------*\ - | Calculate data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Calculate data size | + \*-----------------------------------------------------*/ mode_name_len = (unsigned short)strlen(modes[mode].name.c_str()) + 1; mode_num_colors = (unsigned short)modes[mode].colors.size(); @@ -1260,60 +2682,60 @@ unsigned char * RGBController::GetModeDescription(int mode, unsigned int protoco data_size += sizeof(mode_num_colors); data_size += (mode_num_colors * sizeof(RGBColor)); - /*---------------------------------------------------------*\ - | Create data buffer | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Create data buffer | + \*-----------------------------------------------------*/ unsigned char *data_buf = new unsigned char[data_size]; - /*---------------------------------------------------------*\ - | Copy in data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in data size | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &data_size, sizeof(data_size)); data_ptr += sizeof(data_size); - /*---------------------------------------------------------*\ - | Copy in mode index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode index | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &mode, sizeof(int)); data_ptr += sizeof(int); - /*---------------------------------------------------------*\ - | Copy in mode name (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode name (size+data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &mode_name_len, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); strcpy((char *)&data_buf[data_ptr], modes[mode].name.c_str()); data_ptr += mode_name_len; - /*---------------------------------------------------------*\ - | Copy in mode value (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode value (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].value, sizeof(modes[mode].value)); data_ptr += sizeof(modes[mode].value); - /*---------------------------------------------------------*\ - | Copy in mode flags (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode flags (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].flags, sizeof(modes[mode].flags)); data_ptr += sizeof(modes[mode].flags); - /*---------------------------------------------------------*\ - | Copy in mode speed_min (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode speed_min (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].speed_min, sizeof(modes[mode].speed_min)); data_ptr += sizeof(modes[mode].speed_min); - /*---------------------------------------------------------*\ - | Copy in mode speed_max (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode speed_max (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].speed_max, sizeof(modes[mode].speed_max)); data_ptr += sizeof(modes[mode].speed_max); - /*---------------------------------------------------------*\ - | Copy in mode brightness min and max if protocol version | - | is 3 or higher | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode brightness min and max if protocol | + | version is 3 or higher | + \*-----------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&data_buf[data_ptr], &modes[mode].brightness_min, sizeof(modes[mode].brightness_min)); @@ -1323,98 +2745,113 @@ unsigned char * RGBController::GetModeDescription(int mode, unsigned int protoco data_ptr += sizeof(modes[mode].brightness_max); } - /*---------------------------------------------------------*\ - | Copy in mode colors_min (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode colors_min (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].colors_min, sizeof(modes[mode].colors_min)); data_ptr += sizeof(modes[mode].colors_min); - /*---------------------------------------------------------*\ - | Copy in mode colors_max (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode colors_max (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].colors_max, sizeof(modes[mode].colors_max)); data_ptr += sizeof(modes[mode].colors_max); - /*---------------------------------------------------------*\ - | Copy in mode speed (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode speed (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].speed, sizeof(modes[mode].speed)); data_ptr += sizeof(modes[mode].speed); - /*---------------------------------------------------------*\ - | Copy in mode brightness if protocol version is 3 or higher| - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode brightness if protocol version is 3 or | + | higher | + \*-----------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&data_buf[data_ptr], &modes[mode].brightness, sizeof(modes[mode].brightness)); data_ptr += sizeof(modes[mode].brightness); } - /*---------------------------------------------------------*\ - | Copy in mode direction (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode direction (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].direction, sizeof(modes[mode].direction)); data_ptr += sizeof(modes[mode].direction); - /*---------------------------------------------------------*\ - | Copy in mode color_mode (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode color_mode (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].color_mode, sizeof(modes[mode].color_mode)); data_ptr += sizeof(modes[mode].color_mode); - /*---------------------------------------------------------*\ - | Copy in mode number of colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode number of colors | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &mode_num_colors, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in mode mode colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode mode colors | + \*-----------------------------------------------------*/ for(int color_index = 0; color_index < mode_num_colors; color_index++) { - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &modes[mode].colors[color_index], sizeof(modes[mode].colors[color_index])); data_ptr += sizeof(modes[mode].colors[color_index]); } + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock_shared(); + return(data_buf); } void RGBController::SetModeDescription(unsigned char* data_buf, unsigned int protocol_version) { + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock(); + int mode_idx; unsigned int data_ptr = sizeof(unsigned int); - /*---------------------------------------------------------*\ - | Copy in mode index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode index | + \*-----------------------------------------------------*/ memcpy(&mode_idx, &data_buf[data_ptr], sizeof(int)); data_ptr += sizeof(int); - /*---------------------------------------------------------*\ - | Check if we aren't reading beyond the list of modes. | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Check if we aren't reading beyond the list of modes. | + \*-----------------------------------------------------*/ if(((size_t) mode_idx) > modes.size()) { + /*-------------------------------------------------*\ + | Unlock access mutex | + \*-------------------------------------------------*/ + AccessMutex.unlock_shared(); return; } - /*---------------------------------------------------------*\ - | Get pointer to target mode | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Get pointer to target mode | + \*-----------------------------------------------------*/ mode * new_mode = &modes[mode_idx]; - /*---------------------------------------------------------*\ - | Set active mode to the new mode | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Set active mode to the new mode | + \*-----------------------------------------------------*/ active_mode = mode_idx; - /*---------------------------------------------------------*\ - | Copy in mode name (size+data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode name (size+data) | + \*-----------------------------------------------------*/ unsigned short modename_len; memcpy(&modename_len, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); @@ -1422,34 +2859,34 @@ void RGBController::SetModeDescription(unsigned char* data_buf, unsigned int pro new_mode->name = (char *)&data_buf[data_ptr]; data_ptr += modename_len; - /*---------------------------------------------------------*\ - | Copy in mode value (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode value (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->value, &data_buf[data_ptr], sizeof(new_mode->value)); data_ptr += sizeof(new_mode->value); - /*---------------------------------------------------------*\ - | Copy in mode flags (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode flags (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->flags, &data_buf[data_ptr], sizeof(new_mode->flags)); data_ptr += sizeof(new_mode->flags); - /*---------------------------------------------------------*\ - | Copy in mode speed_min (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode speed_min (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->speed_min, &data_buf[data_ptr], sizeof(new_mode->speed_min)); data_ptr += sizeof(new_mode->speed_min); - /*---------------------------------------------------------*\ - | Copy in mode speed_max (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode speed_max (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->speed_max, &data_buf[data_ptr], sizeof(new_mode->speed_max)); data_ptr += sizeof(new_mode->speed_max); - /*---------------------------------------------------------*\ - | Copy in mode brightness_min and brightness_max (data) if | - | protocol 3 or higher | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode brightness_min and brightness_max (data) | + | if protocol 3 or higher | + \*-----------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&new_mode->brightness_min, &data_buf[data_ptr], sizeof(new_mode->brightness_min)); @@ -1459,295 +2896,372 @@ void RGBController::SetModeDescription(unsigned char* data_buf, unsigned int pro data_ptr += sizeof(new_mode->brightness_max); } - /*---------------------------------------------------------*\ - | Copy in mode colors_min (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode colors_min (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->colors_min, &data_buf[data_ptr], sizeof(new_mode->colors_min)); data_ptr += sizeof(new_mode->colors_min); - /*---------------------------------------------------------*\ - | Copy in mode colors_max (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode colors_max (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->colors_max, &data_buf[data_ptr], sizeof(new_mode->colors_max)); data_ptr += sizeof(new_mode->colors_max); - /*---------------------------------------------------------*\ - | Copy in mode speed (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode speed (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->speed, &data_buf[data_ptr], sizeof(new_mode->speed)); data_ptr += sizeof(new_mode->speed); - /*---------------------------------------------------------*\ - | Copy in mode brightness (data) if protocol 3 or higher | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode brightness (data) if protocol 3 or higher| + \*-----------------------------------------------------*/ if(protocol_version >= 3) { memcpy(&new_mode->brightness, &data_buf[data_ptr], sizeof(new_mode->brightness)); data_ptr += sizeof(new_mode->brightness); } - /*---------------------------------------------------------*\ - | Copy in mode direction (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode direction (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->direction, &data_buf[data_ptr], sizeof(new_mode->direction)); data_ptr += sizeof(new_mode->direction); - /*---------------------------------------------------------*\ - | Copy in mode color_mode (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode color_mode (data) | + \*-----------------------------------------------------*/ memcpy(&new_mode->color_mode, &data_buf[data_ptr], sizeof(new_mode->color_mode)); data_ptr += sizeof(new_mode->color_mode); - /*---------------------------------------------------------*\ - | Copy in mode number of colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode number of colors | + \*-----------------------------------------------------*/ unsigned short mode_num_colors; memcpy(&mode_num_colors, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in mode mode colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in mode mode colors | + \*-----------------------------------------------------*/ new_mode->colors.clear(); for(int color_index = 0; color_index < mode_num_colors; color_index++) { - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ RGBColor new_color; memcpy(&new_color, &data_buf[data_ptr], sizeof(RGBColor)); data_ptr += sizeof(RGBColor); new_mode->colors.push_back(new_color); } + + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock(); } unsigned char * RGBController::GetColorDescription() { - unsigned int data_ptr = 0; - unsigned int data_size = 0; + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock_shared(); + + unsigned int data_ptr = 0; + unsigned int data_size = 0; unsigned short num_colors = (unsigned short)colors.size(); - /*---------------------------------------------------------*\ - | Calculate data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Calculate data size | + \*-----------------------------------------------------*/ data_size += sizeof(data_size); data_size += sizeof(num_colors); data_size += num_colors * sizeof(RGBColor); - /*---------------------------------------------------------*\ - | Create data buffer | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Create data buffer | + \*-----------------------------------------------------*/ unsigned char *data_buf = new unsigned char[data_size]; - /*---------------------------------------------------------*\ - | Copy in data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in data size | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &data_size, sizeof(data_size)); data_ptr += sizeof(data_size); - /*---------------------------------------------------------*\ - | Copy in number of colors (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of colors (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_colors, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in colors | + \*-----------------------------------------------------*/ for(int color_index = 0; color_index < num_colors; color_index++) { - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &colors[color_index], sizeof(colors[color_index])); data_ptr += sizeof(colors[color_index]); } + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock_shared(); + return(data_buf); } void RGBController::SetColorDescription(unsigned char* data_buf) { + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock(); + unsigned int data_ptr = sizeof(unsigned int); - /*---------------------------------------------------------*\ - | Copy in number of colors (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of colors (data) | + \*-----------------------------------------------------*/ unsigned short num_colors; memcpy(&num_colors, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Check if we aren't reading beyond the list of colors. | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Check if we aren't reading beyond the list of colors. | + \*-----------------------------------------------------*/ if(((size_t)num_colors) > colors.size()) { + /*-------------------------------------------------*\ + | Unlock access mutex | + \*-------------------------------------------------*/ + AccessMutex.unlock(); return; } - /*---------------------------------------------------------*\ - | Copy in colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in colors | + \*-----------------------------------------------------*/ for(int color_index = 0; color_index < num_colors; color_index++) { RGBColor new_color; - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ memcpy(&new_color, &data_buf[data_ptr], sizeof(RGBColor)); data_ptr += sizeof(RGBColor); colors[color_index] = new_color; } + + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock(); } unsigned char * RGBController::GetZoneColorDescription(int zone) { - unsigned int data_ptr = 0; - unsigned int data_size = 0; + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock_shared(); + + unsigned int data_ptr = 0; + unsigned int data_size = 0; unsigned short num_colors = zones[zone].leds_count; - /*---------------------------------------------------------*\ - | Calculate data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Calculate data size | + \*-----------------------------------------------------*/ data_size += sizeof(data_size); data_size += sizeof(zone); data_size += sizeof(num_colors); data_size += num_colors * sizeof(RGBColor); - /*---------------------------------------------------------*\ - | Create data buffer | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Create data buffer | + \*-----------------------------------------------------*/ unsigned char *data_buf = new unsigned char[data_size]; - /*---------------------------------------------------------*\ - | Copy in data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in data size | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &data_size, sizeof(data_size)); data_ptr += sizeof(data_size); - /*---------------------------------------------------------*\ - | Copy in zone index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in zone index | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &zone, sizeof(zone)); data_ptr += sizeof(zone); - /*---------------------------------------------------------*\ - | Copy in number of colors (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of colors (data) | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &num_colors, sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in colors | + \*-----------------------------------------------------*/ for(int color_index = 0; color_index < num_colors; color_index++) { - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ memcpy(&data_buf[data_ptr], &zones[zone].colors[color_index], sizeof(zones[zone].colors[color_index])); data_ptr += sizeof(zones[zone].colors[color_index]); } + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock_shared(); + return(data_buf); } void RGBController::SetZoneColorDescription(unsigned char* data_buf) { + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock(); + unsigned int data_ptr = sizeof(unsigned int); unsigned int zone_idx; - /*---------------------------------------------------------*\ - | Copy in zone index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in zone index | + \*-----------------------------------------------------*/ memcpy(&zone_idx, &data_buf[data_ptr], sizeof(zone_idx)); data_ptr += sizeof(zone_idx); - /*---------------------------------------------------------*\ - | Check if we aren't reading beyond the list of zones. | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Check if we aren't reading beyond the list of zones. | + \*-----------------------------------------------------*/ if(((size_t)zone_idx) > zones.size()) { + /*-------------------------------------------------*\ + | Unlock access mutex | + \*-------------------------------------------------*/ + AccessMutex.unlock(); return; } - /*---------------------------------------------------------*\ - | Copy in number of colors (data) | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in number of colors (data) | + \*-----------------------------------------------------*/ unsigned short num_colors; memcpy(&num_colors, &data_buf[data_ptr], sizeof(unsigned short)); data_ptr += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Copy in colors | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in colors | + \*-----------------------------------------------------*/ for(int color_index = 0; color_index < num_colors; color_index++) { RGBColor new_color; - /*---------------------------------------------------------*\ - | Copy in color (data) | - \*---------------------------------------------------------*/ + /*-------------------------------------------------*\ + | Copy in color (data) | + \*-------------------------------------------------*/ memcpy(&new_color, &data_buf[data_ptr], sizeof(RGBColor)); data_ptr += sizeof(RGBColor); zones[zone_idx].colors[color_index] = new_color; } + + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock(); } unsigned char * RGBController::GetSingleLEDColorDescription(int led) { - /*---------------------------------------------------------*\ - | Fixed size descrption: | - | int: LED index | - | RGBColor: LED color | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock_shared(); + + /*-----------------------------------------------------*\ + | Fixed size descrption: | + | int: LED index | + | RGBColor: LED color | + \*-----------------------------------------------------*/ unsigned char *data_buf = new unsigned char[sizeof(int) + sizeof(RGBColor)]; - /*---------------------------------------------------------*\ - | Copy in LED index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in LED index | + \*-----------------------------------------------------*/ memcpy(&data_buf[0], &led, sizeof(int)); - /*---------------------------------------------------------*\ - | Copy in LED color | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in LED color | + \*-----------------------------------------------------*/ memcpy(&data_buf[sizeof(led)], &colors[led], sizeof(RGBColor)); + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock_shared(); + return(data_buf); } void RGBController::SetSingleLEDColorDescription(unsigned char* data_buf) { - /*---------------------------------------------------------*\ - | Fixed size descrption: | - | int: LED index | - | RGBColor: LED color | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock(); + + /*-----------------------------------------------------*\ + | Fixed size descrption: | + | int: LED index | + | RGBColor: LED color | + \*-----------------------------------------------------*/ int led_idx; - /*---------------------------------------------------------*\ - | Copy in LED index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in LED index | + \*-----------------------------------------------------*/ memcpy(&led_idx, &data_buf[0], sizeof(led_idx)); - /*---------------------------------------------------------*\ - | Check if we aren't reading beyond the list of leds. | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Check if we aren't reading beyond the list of leds. | + \*-----------------------------------------------------*/ if(((size_t)led_idx) > leds.size()) { + /*-------------------------------------------------*\ + | Unlock access mutex | + \*-------------------------------------------------*/ + AccessMutex.unlock(); return; } - /*---------------------------------------------------------*\ - | Copy in LED color | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in LED color | + \*-----------------------------------------------------*/ memcpy(&colors[led_idx], &data_buf[sizeof(led_idx)], sizeof(RGBColor)); + + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock(); } unsigned char * RGBController::GetSegmentDescription(int zone, segment new_segment) @@ -1755,79 +3269,89 @@ unsigned char * RGBController::GetSegmentDescription(int zone, segment new_segme unsigned int data_ptr = 0; unsigned int data_size = 0; - /*---------------------------------------------------------*\ - | Length of data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock_shared(); + + /*-----------------------------------------------------*\ + | Length of data size | + \*-----------------------------------------------------*/ data_size += sizeof(data_size); - /*---------------------------------------------------------*\ - | Length of zone index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Length of zone index | + \*-----------------------------------------------------*/ data_size += sizeof(zone); - /*---------------------------------------------------------*\ - | Length of segment name string | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Length of segment name string | + \*-----------------------------------------------------*/ data_size += sizeof(unsigned short); - /*---------------------------------------------------------*\ - | Segment name string data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment name string data | + \*-----------------------------------------------------*/ data_size += (unsigned int)strlen(new_segment.name.c_str()) + 1; data_size += sizeof(new_segment.type); data_size += sizeof(new_segment.start_idx); data_size += sizeof(new_segment.leds_count); - /*---------------------------------------------------------*\ - | Create data buffer | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Create data buffer | + \*-----------------------------------------------------*/ unsigned char *data_buf = new unsigned char[data_size]; - /*---------------------------------------------------------*\ - | Copy in data size | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in data size | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &data_size, sizeof(data_size)); data_ptr += sizeof(data_size); - /*---------------------------------------------------------*\ - | Copy in zone index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in zone index | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &zone, sizeof(zone)); data_ptr += sizeof(zone); - /*---------------------------------------------------------*\ - | Length of segment name string | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Length of segment name string | + \*-----------------------------------------------------*/ unsigned short segment_name_length = (unsigned short)strlen(new_segment.name.c_str()) + 1; memcpy(&data_buf[data_ptr], &segment_name_length, sizeof(segment_name_length)); data_ptr += sizeof(segment_name_length); - /*---------------------------------------------------------*\ - | Segment name string data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment name string data | + \*-----------------------------------------------------*/ strcpy((char *)&data_buf[data_ptr], new_segment.name.c_str()); data_ptr += segment_name_length; - /*---------------------------------------------------------*\ - | Segment type data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment type data | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &new_segment.type, sizeof(new_segment.type)); data_ptr += sizeof(new_segment.type); - /*---------------------------------------------------------*\ - | Segment start index data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment start index data | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &new_segment.start_idx, sizeof(new_segment.start_idx)); data_ptr += sizeof(new_segment.start_idx); - /*---------------------------------------------------------*\ - | Segment LED count data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment LED count data | + \*-----------------------------------------------------*/ memcpy(&data_buf[data_ptr], &new_segment.leds_count, sizeof(new_segment.leds_count)); data_ptr += sizeof(new_segment.leds_count); + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock_shared(); + return(data_buf); } @@ -1835,51 +3359,51 @@ void RGBController::SetSegmentDescription(unsigned char* data_buf) { unsigned int data_ptr = sizeof(unsigned int); - /*---------------------------------------------------------*\ - | Copy in zone index | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Copy in zone index | + \*-----------------------------------------------------*/ unsigned int zone_idx; memcpy(&zone_idx, &data_buf[data_ptr], sizeof(zone_idx)); data_ptr += sizeof(zone_idx); - /*---------------------------------------------------------*\ - | Length of segment name string | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Length of segment name string | + \*-----------------------------------------------------*/ unsigned short segment_name_length; memcpy(&segment_name_length, &data_buf[data_ptr], sizeof(segment_name_length)); data_ptr += sizeof(segment_name_length); - /*---------------------------------------------------------*\ - | Segment name string data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment name string data | + \*-----------------------------------------------------*/ char * segment_name = new char[segment_name_length]; memcpy(segment_name, &data_buf[data_ptr], segment_name_length); data_ptr += segment_name_length; - /*---------------------------------------------------------*\ - | Segment type data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment type data | + \*-----------------------------------------------------*/ zone_type segment_type; memcpy(&segment_type, &data_buf[data_ptr], sizeof(segment_type)); data_ptr += sizeof(segment_type); - /*---------------------------------------------------------*\ - | Segment start index data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment start index data | + \*-----------------------------------------------------*/ unsigned int segment_start_idx; memcpy(&segment_start_idx, &data_buf[data_ptr], sizeof(segment_start_idx)); data_ptr += sizeof(segment_start_idx); - /*---------------------------------------------------------*\ - | Segment LED count data | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Segment LED count data | + \*-----------------------------------------------------*/ unsigned int segment_leds_count; memcpy(&segment_leds_count, &data_buf[data_ptr], sizeof(segment_leds_count)); data_ptr += sizeof(segment_leds_count); - /*---------------------------------------------------------*\ - | Add new segment | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Add new segment | + \*-----------------------------------------------------*/ segment new_segment; new_segment.name = segment_name; @@ -1892,35 +3416,790 @@ void RGBController::SetSegmentDescription(unsigned char* data_buf) delete[] segment_name; } +/*---------------------------------------------------------*\ +| JSON Description Functions | +\*---------------------------------------------------------*/ +nlohmann::json RGBController::GetDeviceDescriptionJSON() +{ + nlohmann::json controller_json; + + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock_shared(); + + /*-----------------------------------------------------*\ + | Controller information strings | + \*-----------------------------------------------------*/ + controller_json["description"] = description; + controller_json["location"] = location; + controller_json["name"] = name; + controller_json["serial"] = serial; + controller_json["vendor"] = vendor; + controller_json["version"] = version; + + /*-----------------------------------------------------*\ + | Controller variables | + \*-----------------------------------------------------*/ + controller_json["active_mode"] = active_mode; + controller_json["flags"] = flags; + controller_json["type"] = type; + + /*-----------------------------------------------------*\ + | Colors | + \*-----------------------------------------------------*/ + for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++) + { + controller_json["colors"][color_idx] = colors[color_idx]; + } + + /*-----------------------------------------------------*\ + | LEDs | + \*-----------------------------------------------------*/ + for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++) + { + controller_json["leds"][led_idx] = GetLEDDescriptionJSON(leds[led_idx]); + } + + /*-----------------------------------------------------*\ + | LED alternate names | + \*-----------------------------------------------------*/ + for(std::size_t led_alt_name_idx = 0; led_alt_name_idx < led_alt_names.size(); led_alt_name_idx++) + { + controller_json["led_alt_names"][led_alt_name_idx] = led_alt_names[led_alt_name_idx]; + } + + /*-----------------------------------------------------*\ + | Modes | + \*-----------------------------------------------------*/ + for(std::size_t mode_idx = 0; mode_idx < modes.size(); mode_idx++) + { + controller_json["modes"][mode_idx] = GetModeDescriptionJSON(modes[mode_idx]); + } + + /*-----------------------------------------------------*\ + | Zones | + \*-----------------------------------------------------*/ + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + controller_json["zones"][zone_idx] = GetZoneDescriptionJSON(zones[zone_idx]); + } + + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock_shared(); + + return(controller_json); +} + +nlohmann::json RGBController::GetLEDDescriptionJSON(led led) +{ + nlohmann::json led_json; + + /*-----------------------------------------------------*\ + | LED Information | + \*-----------------------------------------------------*/ + led_json["name"] = led.name; + led_json["value"] = led.value; + + return(led_json); +} + +nlohmann::json RGBController::GetMatrixMapDescriptionJSON(matrix_map_type matrix_map) +{ + nlohmann::json matrix_map_json; + + matrix_map_json["height"] = matrix_map.height; + matrix_map_json["width"] = matrix_map.width; + + for(unsigned int matrix_map_idx = 0; matrix_map_idx < (matrix_map.height * matrix_map.width); matrix_map_idx++) + { + matrix_map_json["map"][matrix_map_idx] = matrix_map.map[matrix_map_idx]; + } + + return(matrix_map_json); +} + +nlohmann::json RGBController::GetModeDescriptionJSON(mode mode) +{ + nlohmann::json mode_json; + + /*-----------------------------------------------------*\ + | Mode Information | + \*-----------------------------------------------------*/ + mode_json["name"] = mode.name; + mode_json["value"] = mode.value; + mode_json["flags"] = mode.flags; + mode_json["speed_min"] = mode.speed_min; + mode_json["speed_max"] = mode.speed_max; + mode_json["brightness_min"] = mode.brightness_min; + mode_json["brightness_max"] = mode.brightness_max; + mode_json["colors_min"] = mode.colors_min; + mode_json["colors_max"] = mode.colors_max; + + /*-----------------------------------------------------*\ + | Mode Settings | + \*-----------------------------------------------------*/ + mode_json["speed"] = mode.speed; + mode_json["brightness"] = mode.brightness; + mode_json["direction"] = mode.direction; + mode_json["color_mode"] = mode.color_mode; + + for(std::size_t color_idx = 0; color_idx < mode.colors.size(); color_idx++) + { + mode_json["colors"][color_idx] = mode.colors[color_idx]; + } + + return(mode_json); +} + +nlohmann::json RGBController::GetSegmentDescriptionJSON(segment segment) +{ + nlohmann::json segment_json; + + /*-----------------------------------------------------*\ + | Segment Information | + \*-----------------------------------------------------*/ + segment_json["name"] = segment.name; + segment_json["type"] = segment.type; + segment_json["start_idx"] = segment.start_idx; + segment_json["leds_count"] = segment.leds_count; + segment_json["matrix_map"] = GetMatrixMapDescriptionJSON(segment.matrix_map); + + return(segment_json); +} + +nlohmann::json RGBController::GetZoneDescriptionJSON(zone zone) +{ + nlohmann::json zone_json; + + /*-----------------------------------------------------*\ + | Zone Information | + \*-----------------------------------------------------*/ + zone_json["name"] = zone.name; + zone_json["type"] = zone.type; + zone_json["leds_count"] = zone.leds_count; + zone_json["leds_min"] = zone.leds_min; + zone_json["leds_max"] = zone.leds_max; + zone_json["matrix_map"] = GetMatrixMapDescriptionJSON(zone.matrix_map); + + for(std::size_t segment_idx = 0; segment_idx < zone.segments.size(); segment_idx++) + { + zone_json["segments"][segment_idx] = GetSegmentDescriptionJSON(zone.segments[segment_idx]); + } + + zone_json["flags"] = zone.flags; + + for(std::size_t mode_idx = 0; mode_idx < zone.modes.size(); mode_idx++) + { + zone_json["modes"][mode_idx] = GetModeDescriptionJSON(zone.modes[mode_idx]); + } + + if(zone.modes.size() > 0) + { + zone_json["active_mode"] = zone.active_mode; + } + + return(zone_json); +} + +void RGBController::SetDeviceDescriptionJSON(nlohmann::json controller_json) +{ + /*-----------------------------------------------------*\ + | Lock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.lock(); + + /*-----------------------------------------------------*\ + | Controller information strings | + \*-----------------------------------------------------*/ + if(controller_json.contains("description")) + { + description = controller_json["description"]; + } + + if(controller_json.contains("location")) + { + location = controller_json["location"]; + } + + if(controller_json.contains("name")) + { + name = controller_json["name"]; + } + + if(controller_json.contains("serial")) + { + serial = controller_json["serial"]; + } + + if(controller_json.contains("vendor")) + { + vendor = controller_json["vendor"]; + } + + if(controller_json.contains("version")) + { + version = controller_json["version"]; + } + + /*-----------------------------------------------------*\ + | Controller variables | + \*-----------------------------------------------------*/ + if(controller_json.contains("active_mode")) + { + active_mode = controller_json["active_mode"]; + } + + if(controller_json.contains("flags")) + { + flags = controller_json["flags"]; + } + + if(controller_json.contains("type")) + { + type = controller_json["type"]; + } + + /*-----------------------------------------------------*\ + | Colors | + \*-----------------------------------------------------*/ + if(controller_json.contains("colors")) + { + colors.resize(controller_json["colors"].size()); + + for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++) + { + colors[color_idx] = controller_json["colors"][color_idx]; + } + } + + /*-----------------------------------------------------*\ + | LEDs | + \*-----------------------------------------------------*/ + if(controller_json.contains("leds")) + { + leds.resize(controller_json["leds"].size()); + + for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++) + { + leds[led_idx] = SetLEDDescriptionJSON(controller_json["leds"][led_idx]); + } + } + + /*-----------------------------------------------------*\ + | LED alternate names | + \*-----------------------------------------------------*/ + if(controller_json.contains("led_alt_names")) + { + led_alt_names.resize(controller_json["led_alt_names"].size()); + + for(std::size_t led_alt_name_idx = 0; led_alt_name_idx < led_alt_names.size(); led_alt_name_idx++) + { + led_alt_names[led_alt_name_idx] = controller_json["led_alt_names"][led_alt_name_idx]; + } + } + + /*-----------------------------------------------------*\ + | Modes | + \*-----------------------------------------------------*/ + if(controller_json.contains("modes")) + { + modes.resize(controller_json["modes"].size()); + + for(std::size_t mode_idx = 0; mode_idx < modes.size(); mode_idx++) + { + modes[mode_idx] = SetModeDescriptionJSON(controller_json["modes"][mode_idx]); + } + } + + /*-----------------------------------------------------*\ + | Zones | + \*-----------------------------------------------------*/ + if(controller_json.contains("zones")) + { + zones.resize(controller_json["zones"].size()); + + for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + zones[zone_idx] = SetZoneDescriptionJSON(controller_json["zones"][zone_idx]); + } + } + + /*-----------------------------------------------------*\ + | Unlock access mutex | + \*-----------------------------------------------------*/ + AccessMutex.unlock(); + + /*-----------------------------------------------------*\ + | Setup colors | + \*-----------------------------------------------------*/ + SetupColors(); +} + +led RGBController::SetLEDDescriptionJSON(nlohmann::json led_json) +{ + led new_led; + + /*-----------------------------------------------------*\ + | LED Information | + \*-----------------------------------------------------*/ + if(led_json.contains("name")) + { + new_led.name = led_json["name"]; + } + + if(led_json.contains("value")) + { + new_led.value = led_json["value"]; + } + + return(new_led); +} + +matrix_map_type RGBController::SetMatrixMapDescriptionJSON(nlohmann::json matrix_map_json) +{ + matrix_map_type matrix_map; + + if(matrix_map_json["matrix_map"].contains("width") && + matrix_map_json["matrix_map"].contains("height") && + matrix_map_json["matrix_map"].contains("map")) + { + matrix_map.width = matrix_map_json["matrix_map"]["width"]; + matrix_map.height = matrix_map_json["matrix_map"]["height"]; + + matrix_map.map.resize(matrix_map.width * matrix_map.height); + + for(unsigned int matrix_map_idx = 0; matrix_map_idx < matrix_map.width * matrix_map.height; matrix_map_idx++) + { + matrix_map.map[matrix_map_idx] = matrix_map_json["matrix_map"]["map"][matrix_map_idx]; + } + } + + return(matrix_map); +} + +mode RGBController::SetModeDescriptionJSON(nlohmann::json mode_json) +{ + mode new_mode; + + /*-----------------------------------------------------*\ + | Mode Information | + \*-----------------------------------------------------*/ + if(mode_json.contains("name")) + { + new_mode.name = mode_json["name"]; + } + + if(mode_json.contains("value")) + { + new_mode.value = mode_json["value"]; + } + + if(mode_json.contains("flags")) + { + new_mode.flags = mode_json["flags"]; + } + + if(mode_json.contains("speed_min")) + { + new_mode.speed_min = mode_json["speed_min"]; + } + + if(mode_json.contains("speed_max")) + { + new_mode.speed_max = mode_json["speed_max"]; + } + + if(mode_json.contains("brightness_min")) + { + new_mode.brightness_min = mode_json["brightness_min"]; + } + + if(mode_json.contains("brightness_max")) + { + new_mode.brightness_max = mode_json["brightness_max"]; + } + + if(mode_json.contains("colors_min")) + { + new_mode.colors_min = mode_json["colors_min"]; + } + + if(mode_json.contains("colors_max")) + { + new_mode.colors_max = mode_json["colors_max"]; + } + + /*-----------------------------------------------------*\ + | Mode Settings | + \*-----------------------------------------------------*/ + if(mode_json.contains("speed")) + { + new_mode.speed = mode_json["speed"]; + } + + if(mode_json.contains("brightness")) + { + new_mode.brightness = mode_json["brightness"]; + } + + if(mode_json.contains("direction")) + { + new_mode.direction = mode_json["direction"]; + } + + if(mode_json.contains("color_mode")) + { + new_mode.color_mode = mode_json["color_mode"]; + } + + if(mode_json.contains("colors")) + { + new_mode.colors.resize(mode_json["colors"].size()); + + for(std::size_t color_idx = 0; color_idx < new_mode.colors.size(); color_idx++) + { + new_mode.colors[color_idx] = mode_json["colors"][color_idx]; + } + } + + return(new_mode); +} + +segment RGBController::SetSegmentDescriptionJSON(nlohmann::json segment_json) +{ + segment new_segment; + + /*-----------------------------------------------------*\ + | Segment Information | + \*-----------------------------------------------------*/ + if(segment_json.contains("name")) + { + new_segment.name = segment_json["name"]; + } + + if(segment_json.contains("type")) + { + new_segment.type = segment_json["type"]; + } + + if(segment_json.contains("start_idx")) + { + new_segment.start_idx = segment_json["start_idx"]; + } + + if(segment_json.contains("leds_count")) + { + new_segment.leds_count = segment_json["leds_count"]; + } + + if(segment_json.contains("matrix_map")) + { + new_segment.matrix_map = SetMatrixMapDescriptionJSON(segment_json["matrix_map"]); + } + + return(new_segment); +} + +zone RGBController::SetZoneDescriptionJSON(nlohmann::json zone_json) +{ + zone new_zone; + + /*-----------------------------------------------------*\ + | Zone Information | + \*-----------------------------------------------------*/ + if(zone_json.contains("name")) + { + new_zone.name = zone_json["name"]; + } + + if(zone_json.contains("type")) + { + new_zone.type = zone_json["type"]; + } + + if(zone_json.contains("leds_count")) + { + new_zone.leds_count = zone_json["leds_count"]; + } + + if(zone_json.contains("leds_min")) + { + new_zone.leds_min = zone_json["leds_min"]; + } + + if(zone_json.contains("leds_max")) + { + new_zone.leds_max = zone_json["leds_max"]; + } + + if(zone_json.contains("matrix_map")) + { + new_zone.matrix_map = SetMatrixMapDescriptionJSON(zone_json["matrix_map"]); + } + + if(zone_json.contains("segments")) + { + new_zone.segments.resize(zone_json["segments"].size()); + + for(std::size_t segment_idx = 0; segment_idx < new_zone.segments.size(); segment_idx++) + { + new_zone.segments[segment_idx] = SetSegmentDescriptionJSON(zone_json["segments"][segment_idx]); + } + } + + if(zone_json.contains("flags")) + { + new_zone.flags = zone_json["flags"]; + } + + if(zone_json.contains("modes")) + { + new_zone.modes.resize(zone_json["modes"].size()); + + for(std::size_t mode_idx = 0; mode_idx < new_zone.modes.size(); mode_idx++) + { + new_zone.modes[mode_idx] = SetModeDescriptionJSON(zone_json["modes"][mode_idx]); + } + } + + if(zone_json.contains("active_mode")) + { + new_zone.active_mode = zone_json["active_mode"]; + } + + return(new_zone); +} + +/*---------------------------------------------------------*\ +| Update Callback Functions | +\*---------------------------------------------------------*/ +void RGBController::RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg) +{ + UpdateMutex.lock(); + UpdateCallbacks.push_back(new_callback); + UpdateCallbackArgs.push_back(new_callback_arg); + UpdateMutex.unlock(); +} + +void RGBController::UnregisterUpdateCallback(void * callback_arg) +{ + UpdateMutex.lock(); + for(unsigned int callback_idx = 0; callback_idx < UpdateCallbackArgs.size(); callback_idx++ ) + { + if(UpdateCallbackArgs[callback_idx] == callback_arg) + { + UpdateCallbackArgs.erase(UpdateCallbackArgs.begin() + callback_idx); + UpdateCallbacks.erase(UpdateCallbacks.begin() + callback_idx); + + break; + } + } + UpdateMutex.unlock(); +} + +void RGBController::ClearCallbacks() +{ + UpdateMutex.lock(); + UpdateCallbacks.clear(); + UpdateCallbackArgs.clear(); + UpdateMutex.unlock(); +} + +void RGBController::SignalUpdate(unsigned int update_reason) +{ + UpdateMutex.lock(); + + /*-----------------------------------------------------*\ + | Client info has changed, call the callbacks | + \*-----------------------------------------------------*/ + for(unsigned int callback_idx = 0; callback_idx < UpdateCallbacks.size(); callback_idx++) + { + UpdateCallbacks[callback_idx](UpdateCallbackArgs[callback_idx], update_reason); + } + + UpdateMutex.unlock(); +} + +/*---------------------------------------------------------*\ +| Device Update Functions | +\*---------------------------------------------------------*/ +void RGBController::UpdateLEDs() +{ + CallFlag_UpdateLEDs = true; + + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_UPDATELEDS); +} + +void RGBController::UpdateZoneLEDs(int zone) +{ + AccessMutex.lock_shared(); + DeviceUpdateZoneLEDs(zone); + AccessMutex.unlock_shared(); +} + +void RGBController::UpdateSingleLED(int led) +{ + AccessMutex.lock_shared(); + DeviceUpdateSingleLED(led); + AccessMutex.unlock_shared(); +} + +void RGBController::UpdateMode() +{ + CallFlag_UpdateMode = true; + + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_UPDATEMODE); +} + +void RGBController::UpdateZoneMode(int zone) +{ + AccessMutex.lock_shared(); + DeviceUpdateZoneMode(zone); + AccessMutex.unlock_shared(); +} + +void RGBController::SaveMode() +{ + AccessMutex.lock_shared(); + DeviceSaveMode(); + AccessMutex.unlock_shared(); + + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_SAVEMODE); +} + +void RGBController::DeviceCallThreadFunction() +{ + CallFlag_UpdateLEDs = false; + CallFlag_UpdateMode = false; + + while(DeviceThreadRunning.load() == true) + { + if(CallFlag_UpdateMode.load() == true) + { + if(flags & CONTROLLER_FLAG_RESET_BEFORE_UPDATE) + { + AccessMutex.lock_shared(); + CallFlag_UpdateMode = false; + DeviceUpdateMode(); + AccessMutex.unlock_shared(); + } + else + { + AccessMutex.lock_shared(); + DeviceUpdateMode(); + CallFlag_UpdateMode = false; + AccessMutex.unlock_shared(); + } + } + if(CallFlag_UpdateLEDs.load() == true) + { + if(flags & CONTROLLER_FLAG_RESET_BEFORE_UPDATE) + { + AccessMutex.lock_shared(); + CallFlag_UpdateLEDs = false; + DeviceUpdateLEDs(); + AccessMutex.unlock_shared(); + } + else + { + AccessMutex.lock_shared(); + DeviceUpdateLEDs(); + CallFlag_UpdateLEDs = false; + AccessMutex.unlock_shared(); + } + } + else + { + std::this_thread::sleep_for(1ms); + } + } +} + +void RGBController::ClearSegments(int zone) +{ + AccessMutex.lock(); + zones[zone].segments.clear(); + AccessMutex.unlock(); + + zones[zone].flags |= ZONE_FLAG_MANUALLY_CONFIGURED; + + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_CLEARSEGMENTS); +} + +void RGBController::AddSegment(int zone, segment new_segment) +{ + AccessMutex.lock(); + zones[zone].segments.push_back(new_segment); + AccessMutex.unlock(); + + zones[zone].flags |= ZONE_FLAG_MANUALLY_CONFIGURED; + + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_ADDSEGMENT); +} + +void RGBController::ResizeZone(int zone, int new_size) +{ + AccessMutex.lock(); + DeviceResizeZone(zone, new_size); + AccessMutex.unlock(); + + zones[zone].flags |= ZONE_FLAG_MANUALLY_CONFIGURED; + + SignalUpdate(RGBCONTROLLER_UPDATE_REASON_RESIZEZONE); +} + +/*---------------------------------------------------------*\ +| Functions not part of interface for internal use only | +\*---------------------------------------------------------*/ +unsigned int RGBController::LEDsInZone(unsigned int zone) +{ + unsigned int leds_count; + + leds_count = zones[zone].leds_count; + + if(zones[zone].flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY) + { + if(leds_count > 1) + { + leds_count = 1; + } + } + + return(leds_count); +} + void RGBController::SetupColors() { unsigned int total_led_count; unsigned int zone_led_count; - /*---------------------------------------------------------*\ - | Determine total number of LEDs on the device | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Determine total number of LEDs on the device | + \*-----------------------------------------------------*/ total_led_count = 0; for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { - total_led_count += GetLEDsInZone((unsigned int)zone_idx); + total_led_count += LEDsInZone((unsigned int)zone_idx); } - /*---------------------------------------------------------*\ - | Set the size of the color buffer to the number of LEDs | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Set the size of the color buffer to the number of LEDs| + \*-----------------------------------------------------*/ colors.resize(total_led_count); - /*---------------------------------------------------------*\ - | Set the color buffer pointers on each zone | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Set the color buffer pointers on each zone | + \*-----------------------------------------------------*/ total_led_count = 0; for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { zones[zone_idx].start_idx = total_led_count; - zone_led_count = GetLEDsInZone((unsigned int)zone_idx); + zone_led_count = LEDsInZone((unsigned int)zone_idx); if((colors.size() > 0) && (zone_led_count > 0)) { @@ -1945,226 +4224,66 @@ void RGBController::SetupColors() } } -unsigned int RGBController::GetLEDsInZone(unsigned int zone) -{ - unsigned int leds_count = zones[zone].leds_count; - - if(zones[zone].flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY) - { - if(leds_count > 1) - { - leds_count = 1; - } - } - - return(leds_count); -} - -RGBColor RGBController::GetLED(unsigned int led) -{ - if(led < colors.size()) - { - return(colors[led]); - } - else - { - return(0x00000000); - } -} - -void RGBController::SetLED(unsigned int led, RGBColor color) -{ - if(led < colors.size()) - { - colors[led] = color; - } -} - -void RGBController::SetAllLEDs(RGBColor color) -{ - for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) - { - SetAllZoneLEDs((int)zone_idx, color); - } -} - -void RGBController::SetAllZoneLEDs(int zone, RGBColor color) -{ - for (std::size_t color_idx = 0; color_idx < GetLEDsInZone(zone); color_idx++) - { - zones[zone].colors[color_idx] = color; - } -} - -int RGBController::GetMode() -{ - return(active_mode); -} - -void RGBController::SetMode(int mode) -{ - active_mode = mode; - - UpdateMode(); -} - -void RGBController::RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg) -{ - UpdateCallbacks.push_back(new_callback); - UpdateCallbackArgs.push_back(new_callback_arg); -} - -void RGBController::UnregisterUpdateCallback(void * callback_arg) -{ - for(unsigned int callback_idx = 0; callback_idx < UpdateCallbackArgs.size(); callback_idx++ ) - { - if(UpdateCallbackArgs[callback_idx] == callback_arg) - { - UpdateCallbackArgs.erase(UpdateCallbackArgs.begin() + callback_idx); - UpdateCallbacks.erase(UpdateCallbacks.begin() + callback_idx); - - break; - } - } -} - -void RGBController::ClearCallbacks() -{ - UpdateCallbacks.clear(); - UpdateCallbackArgs.clear(); -} - -void RGBController::SignalUpdate() -{ - UpdateMutex.lock(); - - /*-------------------------------------------------*\ - | Client info has changed, call the callbacks | - \*-------------------------------------------------*/ - for(unsigned int callback_idx = 0; callback_idx < UpdateCallbacks.size(); callback_idx++) - { - UpdateCallbacks[callback_idx](UpdateCallbackArgs[callback_idx]); - } - - UpdateMutex.unlock(); -} -void RGBController::UpdateLEDs() +void RGBController::UpdateLEDsInternal() { CallFlag_UpdateLEDs = true; - - SignalUpdate(); } -void RGBController::UpdateMode() +/*---------------------------------------------------------*\ +| Functions to be implemented in device implementation | +\*---------------------------------------------------------*/ +void RGBController::DeviceResizeZone(int /*zone*/, int /*new_size*/) { - CallFlag_UpdateMode = true; -} - -void RGBController::SaveMode() -{ - DeviceSaveMode(); + /*-----------------------------------------------------*\ + | If not implemented by controller, does nothing | + \*-----------------------------------------------------*/ } void RGBController::DeviceUpdateLEDs() { - + /*-----------------------------------------------------*\ + | If not implemented by controller, does nothing | + \*-----------------------------------------------------*/ } -void RGBController::SetCustomMode() +void RGBController::DeviceUpdateZoneLEDs(int /*zone*/) { - /*-------------------------------------------------*\ - | Search the Controller's mode list for a suitable | - | per-LED custom mode in the following order: | - | 1. Direct | - | 2. Custom | - | 3. Static | - \*-------------------------------------------------*/ - #define NUM_CUSTOM_MODE_NAMES 3 + /*-----------------------------------------------------*\ + | If not implemented by controller, does nothing | + \*-----------------------------------------------------*/ +} - const std::string custom_mode_names[] = - { - "Direct", - "Custom", - "Static" - }; - - for(unsigned int custom_mode_idx = 0; custom_mode_idx < NUM_CUSTOM_MODE_NAMES; custom_mode_idx++) - { - for(unsigned int mode_idx = 0; mode_idx < modes.size(); mode_idx++) - { - if((modes[mode_idx].name == custom_mode_names[custom_mode_idx]) - && ((modes[mode_idx].color_mode == MODE_COLORS_PER_LED) - || (modes[mode_idx].color_mode == MODE_COLORS_MODE_SPECIFIC))) - { - active_mode = mode_idx; - return; - } - } - } +void RGBController::DeviceUpdateSingleLED(int /*led*/) +{ + /*-----------------------------------------------------*\ + | If not implemented by controller, does nothing | + \*-----------------------------------------------------*/ } void RGBController::DeviceUpdateMode() { - + /*-----------------------------------------------------*\ + | If not implemented by controller, does nothing | + \*-----------------------------------------------------*/ } -void RGBController::DeviceCallThreadFunction() +void RGBController::DeviceUpdateZoneMode(int /*zone*/) { - CallFlag_UpdateLEDs = false; - CallFlag_UpdateMode = false; - - while(DeviceThreadRunning.load() == true) - { - if(CallFlag_UpdateMode.load() == true) - { - if(flags & CONTROLLER_FLAG_RESET_BEFORE_UPDATE) - { - CallFlag_UpdateMode = false; - DeviceUpdateMode(); - } - else - { - DeviceUpdateMode(); - CallFlag_UpdateMode = false; - } - } - if(CallFlag_UpdateLEDs.load() == true) - { - if(flags & CONTROLLER_FLAG_RESET_BEFORE_UPDATE) - { - CallFlag_UpdateLEDs = false; - DeviceUpdateLEDs(); - } - else - { - DeviceUpdateLEDs(); - CallFlag_UpdateLEDs = false; - } - } - else - { - std::this_thread::sleep_for(1ms); - } - } + /*-----------------------------------------------------*\ + | If not implemented by controller, does nothing | + \*-----------------------------------------------------*/ } void RGBController::DeviceSaveMode() { - /*-------------------------------------------------*\ - | If not implemented by controller, does nothing | - \*-------------------------------------------------*/ -} - -void RGBController::ClearSegments(int zone) -{ - zones[zone].segments.clear(); -} - -void RGBController::AddSegment(int zone, segment new_segment) -{ - zones[zone].segments.push_back(new_segment); + /*-----------------------------------------------------*\ + | If not implemented by controller, does nothing | + \*-----------------------------------------------------*/ } +/*---------------------------------------------------------*\ +| Non-class functions | +\*---------------------------------------------------------*/ std::string device_type_to_str(device_type type) { switch(type) diff --git a/RGBController/RGBController.h b/RGBController/RGBController.h index 364adca01..890686e93 100644 --- a/RGBController/RGBController.h +++ b/RGBController/RGBController.h @@ -18,10 +18,12 @@ #include #include #include +#include +#include "nlohmann/json.hpp" -/*------------------------------------------------------------------*\ -| RGB Color Type and Conversion Macros | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| RGB Color Type and Conversion Macros | +\*---------------------------------------------------------*/ typedef unsigned int RGBColor; #define RGBGetRValue(rgb) (rgb & 0x000000FF) @@ -32,9 +34,9 @@ typedef unsigned int RGBColor; #define RGBToBGRColor(rgb) ((rgb & 0xFF) << 16 | (rgb & 0xFF00) | (rgb & 0xFF0000) >> 16) -/*------------------------------------------------------------------*\ -| Mode Flags | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Mode Flags | +\*---------------------------------------------------------*/ enum { MODE_FLAG_HAS_SPEED = (1 << 0), /* Mode has speed parameter */ @@ -47,11 +49,13 @@ enum MODE_FLAG_HAS_RANDOM_COLOR = (1 << 7), /* Mode has random color option */ MODE_FLAG_MANUAL_SAVE = (1 << 8), /* Mode can manually be saved */ MODE_FLAG_AUTOMATIC_SAVE = (1 << 9), /* Mode automatically saves */ + MODE_FLAG_REQUIRES_ENTIRE_DEVICE = (1 << 10),/* Mode always applies to entire */ + /* device, overrides per-zone modes */ }; -/*------------------------------------------------------------------*\ -| Mode Directions | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Mode Directions | +\*---------------------------------------------------------*/ enum { MODE_DIRECTION_LEFT = 0, /* Mode direction left */ @@ -62,9 +66,9 @@ enum MODE_DIRECTION_VERTICAL = 5, /* Mode direction vertical */ }; -/*------------------------------------------------------------------*\ -| Mode Color Types | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Mode Color Types | +\*---------------------------------------------------------*/ enum { MODE_COLORS_NONE = 0, /* Mode has no colors */ @@ -73,15 +77,15 @@ enum MODE_COLORS_RANDOM = 3, /* Mode has random colors selected */ }; -/*------------------------------------------------------------------*\ -| Mode Class | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Mode Class | +\*---------------------------------------------------------*/ class mode { public: - /*--------------------------------------------------------------*\ - | Mode Information | - \*--------------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Mode Information | + \*-----------------------------------------------------*/ std::string name; /* Mode name */ int value; /* Device-specific mode value */ unsigned int flags; /* Mode flags bitfield */ @@ -92,9 +96,9 @@ public: unsigned int colors_min; /* minimum number of mode colors*/ unsigned int colors_max; /* maximum numver of mode colors*/ - /*--------------------------------------------------------------*\ - | Mode Settings | - \*--------------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Mode Settings | + \*-----------------------------------------------------*/ unsigned int speed; /* Mode speed parameter value */ unsigned int brightness; /* Mode brightness value */ unsigned int direction; /* Mode direction value */ @@ -102,67 +106,91 @@ public: std::vector colors; /* mode-specific colors */ - /*--------------------------------------------------------------*\ - | Mode Constructor / Destructor | - \*--------------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Mode Constructor / Destructor | + \*-----------------------------------------------------*/ mode(); ~mode(); }; -/*------------------------------------------------------------------*\ -| LED Struct | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| LED Struct | +\*---------------------------------------------------------*/ typedef struct { + /*-----------------------------------------------------*\ + | LED Information | + \*-----------------------------------------------------*/ std::string name; /* LED name */ unsigned int value; /* Device-specific LED value */ } led; -/*------------------------------------------------------------------*\ -| Zone Flags | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Zone Flags | +\*---------------------------------------------------------*/ enum { ZONE_FLAG_RESIZE_EFFECTS_ONLY = (1 << 0), /* Zone is resizable, but only for */ /* effects - treat as single LED */ + ZONE_FLAG_MANUALLY_CONFIGURED = (1 << 15),/* Zone has been manually configured*/ }; -/*------------------------------------------------------------------*\ -| Zone Types | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Zone Types | +\*---------------------------------------------------------*/ typedef int zone_type; enum { ZONE_TYPE_SINGLE, ZONE_TYPE_LINEAR, - ZONE_TYPE_MATRIX + ZONE_TYPE_MATRIX, + ZONE_TYPE_LINEAR_LOOP, + ZONE_TYPE_MATRIX_LOOP_X, + ZONE_TYPE_MATRIX_LOOP_Y, + ZONE_TYPE_SEGMENTED }; -/*------------------------------------------------------------------*\ -| Matrix Map Struct | -\*------------------------------------------------------------------*/ -typedef struct +/*---------------------------------------------------------*\ +| Matrix Map Struct | +\*---------------------------------------------------------*/ +class matrix_map_type { - unsigned int height; - unsigned int width; - unsigned int * map; -} matrix_map_type; +public: + unsigned int height; + unsigned int width; + std::vector map; -/*------------------------------------------------------------------*\ -| Segment Struct | -\*------------------------------------------------------------------*/ -typedef struct + matrix_map_type(); + matrix_map_type(unsigned int height, unsigned int width, unsigned int * map); + ~matrix_map_type(); + + void Reset(); + void Set(unsigned int height, unsigned int width, unsigned int * map); +}; + +/*---------------------------------------------------------*\ +| Segment Class | +\*---------------------------------------------------------*/ +class segment { +public: std::string name; /* Segment name */ zone_type type; /* Segment type */ unsigned int start_idx; /* Start index within zone */ unsigned int leds_count; /* Number of LEDs in segment*/ -} segment; + matrix_map_type matrix_map; /* Matrix map */ -/*------------------------------------------------------------------*\ -| Zone Class | -\*------------------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Zone Constructor / Destructor | + \*-----------------------------------------------------*/ + segment(); + ~segment(); +}; + +/*---------------------------------------------------------*\ +| Zone Class | +\*---------------------------------------------------------*/ class zone { public: @@ -174,23 +202,26 @@ public: unsigned int leds_count; /* Number of LEDs in zone */ unsigned int leds_min; /* Minimum number of LEDs */ unsigned int leds_max; /* Maximum number of LEDs */ - matrix_map_type * matrix_map; /* Matrix map pointer */ + matrix_map_type matrix_map; /* Matrix map */ std::vector segments; /* Segments in zone */ unsigned int flags; /* Zone flags bitfield */ + std::vector modes; /* Zone-specific modes */ + int active_mode; /* Active zone-specific mode*/ - /*--------------------------------------------------------------*\ - | Zone Constructor / Destructor | - \*--------------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Zone Constructor / Destructor | + \*-----------------------------------------------------*/ zone(); ~zone(); }; -/*------------------------------------------------------------------*\ -| Device Types | -| The enum order should be maintained as is for the API however | -| DEVICE_TYPE_UNKNOWN needs to remain last. Any new device types | -| need to be inserted at the end of the list but before unknown. | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Device Types | +| The enum order should be maintained as is for the API | +| however DEVICE_TYPE_UNKNOWN needs to remain last. Any | +| new device types need to be inserted at the end of the | +| list but before unknown. | +\*---------------------------------------------------------*/ typedef int device_type; enum @@ -219,131 +250,243 @@ enum DEVICE_TYPE_UNKNOWN, }; -/*------------------------------------------------------------------*\ -| Controller Flags | -\*------------------------------------------------------------------*/ +/*---------------------------------------------------------*\ +| Controller Flags | +\*---------------------------------------------------------*/ enum { CONTROLLER_FLAG_LOCAL = (1 << 0), /* Device is local to this instance */ CONTROLLER_FLAG_REMOTE = (1 << 1), /* Device is on a remote instance */ CONTROLLER_FLAG_VIRTUAL = (1 << 2), /* Device is a virtual device */ + CONTROLLER_FLAG_HIDDEN = (1 << 3), /* Device is hidden */ CONTROLLER_FLAG_RESET_BEFORE_UPDATE = (1 << 8), /* Device resets update flag before */ /* calling update function */ }; -/*------------------------------------------------------------------*\ -| RGBController Callback Types | -\*------------------------------------------------------------------*/ -typedef void (*RGBControllerCallback)(void *); +/*---------------------------------------------------------*\ +| RGBController Callback Types | +\*---------------------------------------------------------*/ +typedef void (*RGBControllerCallback)(void *, unsigned int); + +/*---------------------------------------------------------*\ +| Update Reason Codes | +\*---------------------------------------------------------*/ +enum +{ + RGBCONTROLLER_UPDATE_REASON_UPDATELEDS, /* UpdateLEDs() called */ + RGBCONTROLLER_UPDATE_REASON_UPDATEMODE, /* UpdateMode() called */ + RGBCONTROLLER_UPDATE_REASON_SAVEMODE, /* SaveMode() called */ + RGBCONTROLLER_UPDATE_REASON_RESIZEZONE, /* ResizeZone() called */ + RGBCONTROLLER_UPDATE_REASON_CLEARSEGMENTS, /* ClearSegments() called */ + RGBCONTROLLER_UPDATE_REASON_ADDSEGMENT, /* AddSegment() called */ + RGBCONTROLLER_UPDATE_REASON_HIDDEN, /* Hidden flag set */ + RGBCONTROLLER_UPDATE_REASON_UNHIDDEN, /* Hidden flag cleared */ +}; std::string device_type_to_str(device_type type); class RGBControllerInterface { public: - virtual void SetupColors() = 0; + /*-----------------------------------------------------*\ + | Controller Information | + \*-----------------------------------------------------*/ + virtual std::string GetName() = 0; + virtual std::string GetVendor() = 0; + virtual std::string GetDescription() = 0; + virtual std::string GetVersion() = 0; + virtual std::string GetSerial() = 0; + virtual std::string GetLocation() = 0; - virtual unsigned int GetLEDsInZone(unsigned int zone) = 0; - virtual std::string GetName() = 0; - virtual std::string GetVendor() = 0; - virtual std::string GetDescription() = 0; - virtual std::string GetVersion() = 0; - virtual std::string GetSerial() = 0; - virtual std::string GetLocation() = 0; + virtual device_type GetDeviceType() = 0; + virtual unsigned int GetFlags() = 0; - virtual std::string GetModeName(unsigned int mode) = 0; - virtual std::string GetZoneName(unsigned int zone) = 0; - virtual std::string GetLEDName(unsigned int led) = 0; + /*-----------------------------------------------------*\ + | Hidden Flag Functions | + \*-----------------------------------------------------*/ + virtual bool GetHidden() = 0; + virtual void SetHidden(bool hidden) = 0; - virtual RGBColor GetLED(unsigned int led) = 0; - virtual void SetLED(unsigned int led, RGBColor color) = 0; - virtual void SetAllLEDs(RGBColor color) = 0; - virtual void SetAllZoneLEDs(int zone, RGBColor color) = 0; + /*-----------------------------------------------------*\ + | Zone Functions | + \*-----------------------------------------------------*/ + virtual int GetZoneActiveMode(unsigned int zone) = 0; + virtual RGBColor GetZoneColor(unsigned int zone, unsigned int color_index) = 0; + virtual RGBColor* GetZoneColorsPointer(unsigned int zone) = 0; + virtual std::size_t GetZoneCount() = 0; + virtual unsigned int GetZoneFlags(unsigned int zone) = 0; + virtual unsigned int GetZoneLEDsCount(unsigned int zone) = 0; + virtual unsigned int GetZoneLEDsMax(unsigned int zone) = 0; + virtual unsigned int GetZoneLEDsMin(unsigned int zone) = 0; + virtual unsigned int GetZoneMatrixMapHeight(unsigned int zone) = 0; + virtual const unsigned int * GetZoneMatrixMap(unsigned int zone) = 0; + virtual unsigned int GetZoneMatrixMapWidth(unsigned int zone) = 0; + virtual std::size_t GetZoneModeCount(unsigned int zone) = 0; + virtual unsigned int GetZoneModeBrightness(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeBrightnessMax(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeBrightnessMin(unsigned int zone, unsigned int mode) = 0; + virtual RGBColor GetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index) = 0; + virtual unsigned int GetZoneModeColorMode(unsigned int zone, unsigned int mode) = 0; + virtual std::size_t GetZoneModeColorsCount(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeColorsMax(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeColorsMin(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeDirection(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeFlags(unsigned int zone, unsigned int mode) = 0; + virtual std::string GetZoneModeName(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeSpeed(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeSpeedMax(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeSpeedMin(unsigned int zone, unsigned int mode) = 0; + virtual int GetZoneModeValue(unsigned int zone, unsigned int mode) = 0; + virtual std::string GetZoneName(unsigned int zone) = 0; + virtual std::size_t GetZoneSegmentCount(unsigned int zone) = 0; + virtual unsigned int GetZoneSegmentLEDsCount(unsigned int zone, unsigned int segment) = 0; + virtual unsigned int GetZoneSegmentMatrixMapHeight(unsigned int zone, unsigned int segment) = 0; + virtual const unsigned int * GetZoneSegmentMatrixMap(unsigned int zone, unsigned int segment) = 0; + virtual unsigned int GetZoneSegmentMatrixMapWidth(unsigned int zone, unsigned int segment) = 0; + virtual std::string GetZoneSegmentName(unsigned int zone, unsigned int segment) = 0; + virtual unsigned int GetZoneSegmentStartIndex(unsigned int zone, unsigned int segment) = 0; + virtual unsigned int GetZoneSegmentType(unsigned int zone, unsigned int segment) = 0; + virtual unsigned int GetZoneStartIndex(unsigned int zone) = 0; + virtual zone_type GetZoneType(unsigned int zone) = 0; - virtual int GetMode() = 0; - virtual void SetMode(int mode) = 0; + virtual unsigned int GetLEDsInZone(unsigned int zone) = 0; - virtual unsigned char * GetDeviceDescription(unsigned int protocol_version) = 0; - virtual void ReadDeviceDescription(unsigned char* data_buf, unsigned int protocol_version) = 0; + virtual void SetZoneActiveMode(unsigned int zone, int mode) = 0; + virtual void SetZoneModeBrightness(unsigned int zone, unsigned int mode, unsigned int brightness) = 0; + virtual void SetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index, RGBColor color) = 0; + virtual void SetZoneModeColorMode(unsigned int zone, unsigned int mode, unsigned int color_mode) = 0; + virtual void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, std::size_t count) = 0; + virtual void SetZoneModeDirection(unsigned int zone, unsigned int mode, unsigned int direction) = 0; + virtual void SetZoneModeSpeed(unsigned int zone, unsigned int mode, unsigned int speed) = 0; - virtual unsigned char * GetModeDescription(int mode, unsigned int protocol_version) = 0; - virtual void SetModeDescription(unsigned char* data_buf, unsigned int protocol_version) = 0; + virtual bool SupportsPerZoneModes() = 0; - virtual unsigned char * GetColorDescription() = 0; - virtual void SetColorDescription(unsigned char* data_buf) = 0; + /*-----------------------------------------------------*\ + | Mode Functions | + \*-----------------------------------------------------*/ + virtual std::size_t GetModeCount() = 0; + virtual unsigned int GetModeBrightness(unsigned int mode) = 0; + virtual unsigned int GetModeBrightnessMax(unsigned int mode) = 0; + virtual unsigned int GetModeBrightnessMin(unsigned int mode) = 0; + virtual RGBColor GetModeColor(unsigned int mode, unsigned int color_index) = 0; + virtual unsigned int GetModeColorMode(unsigned int mode) = 0; + virtual std::size_t GetModeColorsCount(unsigned int mode) = 0; + virtual unsigned int GetModeColorsMax(unsigned int mode) = 0; + virtual unsigned int GetModeColorsMin(unsigned int mode) = 0; + virtual unsigned int GetModeDirection(unsigned int mode) = 0; + virtual unsigned int GetModeFlags(unsigned int mode) = 0; + virtual std::string GetModeName(unsigned int mode) = 0; + virtual unsigned int GetModeSpeed(unsigned int mode) = 0; + virtual unsigned int GetModeSpeedMax(unsigned int mode) = 0; + virtual unsigned int GetModeSpeedMin(unsigned int mode) = 0; + virtual int GetModeValue(unsigned int mode) = 0; - virtual unsigned char * GetZoneColorDescription(int zone) = 0; - virtual void SetZoneColorDescription(unsigned char* data_buf) = 0; + virtual void SetModeBrightness(unsigned int mode, unsigned int brightness) = 0; + virtual void SetModeColor(unsigned int mode, unsigned int color_index, RGBColor color) = 0; + virtual void SetModeColorMode(unsigned int mode, unsigned int color_mode) = 0; + virtual void SetModeColorsCount(unsigned int mode, std::size_t count) = 0; + virtual void SetModeDirection(unsigned int mode, unsigned int direction) = 0; + virtual void SetModeSpeed(unsigned int mode, unsigned int speed) = 0; - virtual unsigned char * GetSingleLEDColorDescription(int led) = 0; - virtual void SetSingleLEDColorDescription(unsigned char* data_buf) = 0; + virtual int GetActiveMode() = 0; + virtual void SetActiveMode(int mode) = 0; + virtual void SetCustomMode() = 0; - virtual void RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg) = 0; - virtual void UnregisterUpdateCallback(void * callback_arg) = 0; - virtual void ClearCallbacks() = 0; - virtual void SignalUpdate() = 0; + /*-----------------------------------------------------*\ + | LED Functions | + \*-----------------------------------------------------*/ + virtual std::size_t GetLEDCount() = 0; + virtual std::string GetLEDName(unsigned int led) = 0; + virtual unsigned int GetLEDValue(unsigned int led) = 0; - virtual void UpdateLEDs() = 0; - //virtual void UpdateZoneLEDs(int zone) = 0; - //virtual void UpdateSingleLED(int led) = 0; + virtual std::string GetLEDDisplayName(unsigned int led) = 0; - virtual void UpdateMode() = 0; - virtual void SaveMode() = 0; + /*-----------------------------------------------------*\ + | Color Functions | + \*-----------------------------------------------------*/ + virtual RGBColor GetColor(unsigned int led) = 0; + virtual RGBColor* GetColorsPointer() = 0; + virtual void SetColor(unsigned int led, RGBColor color) = 0; - virtual void DeviceCallThreadFunction() = 0; + virtual void SetAllColors(RGBColor color) = 0; + virtual void SetAllZoneColors(int zone, RGBColor color) = 0; - virtual void ClearSegments(int zone) = 0; - virtual void AddSegment(int zone, segment new_segment) = 0; + /*-----------------------------------------------------*\ + | Serialized Description Functions | + \*-----------------------------------------------------*/ + virtual unsigned char * GetDeviceDescription(unsigned int protocol_version) = 0; + virtual void ReadDeviceDescription(unsigned char* data_buf, unsigned int protocol_version) = 0; - /*---------------------------------------------------------*\ - | Functions to be implemented in device implementation | - \*---------------------------------------------------------*/ - virtual void SetupZones() = 0; + virtual unsigned char * GetModeDescription(int mode, unsigned int protocol_version) = 0; + virtual void SetModeDescription(unsigned char* data_buf, unsigned int protocol_version) = 0; - virtual void ResizeZone(int zone, int new_size) = 0; + virtual unsigned char * GetColorDescription() = 0; + virtual void SetColorDescription(unsigned char* data_buf) = 0; - virtual void DeviceUpdateLEDs() = 0; - virtual void UpdateZoneLEDs(int zone) = 0; - virtual void UpdateSingleLED(int led) = 0; + virtual unsigned char * GetZoneColorDescription(int zone) = 0; + virtual void SetZoneColorDescription(unsigned char* data_buf) = 0; - virtual void DeviceUpdateMode() = 0; - virtual void DeviceSaveMode() = 0; + virtual unsigned char * GetSingleLEDColorDescription(int led) = 0; + virtual void SetSingleLEDColorDescription(unsigned char* data_buf) = 0; - virtual void SetCustomMode() = 0; + virtual unsigned char * GetSegmentDescription(int zone, segment new_segment) = 0; + virtual void SetSegmentDescription(unsigned char* data_buf) = 0; + + /*-----------------------------------------------------*\ + | JSON Description Functions | + \*-----------------------------------------------------*/ + virtual nlohmann::json GetDeviceDescriptionJSON() = 0; + virtual nlohmann::json GetLEDDescriptionJSON(led led) = 0; + virtual nlohmann::json GetMatrixMapDescriptionJSON(matrix_map_type matrix_map) = 0; + virtual nlohmann::json GetModeDescriptionJSON(mode mode) = 0; + virtual nlohmann::json GetSegmentDescriptionJSON(segment segment) = 0; + virtual nlohmann::json GetZoneDescriptionJSON(zone zone) = 0; + + virtual void SetDeviceDescriptionJSON(nlohmann::json controller_json) = 0; + virtual led SetLEDDescriptionJSON(nlohmann::json led_json) = 0; + virtual matrix_map_type SetMatrixMapDescriptionJSON(nlohmann::json matrix_map_json) = 0; + virtual mode SetModeDescriptionJSON(nlohmann::json mode_json) = 0; + virtual segment SetSegmentDescriptionJSON(nlohmann::json segment_json) = 0; + virtual zone SetZoneDescriptionJSON(nlohmann::json zone_json) = 0; + + /*-----------------------------------------------------*\ + | Update Callback Functions | + \*-----------------------------------------------------*/ + virtual void RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg) = 0; + virtual void UnregisterUpdateCallback(void * callback_arg) = 0; + virtual void ClearCallbacks() = 0; + virtual void SignalUpdate(unsigned int update_reason) = 0; + + /*-----------------------------------------------------*\ + | Device Update Functions | + \*-----------------------------------------------------*/ + virtual void UpdateLEDs() = 0; + virtual void UpdateZoneLEDs(int zone) = 0; + virtual void UpdateSingleLED(int led) = 0; + + virtual void UpdateMode() = 0; + virtual void UpdateZoneMode(int zone) = 0; + virtual void SaveMode() = 0; + + virtual void ClearSegments(int zone) = 0; + virtual void AddSegment(int zone, segment new_segment) = 0; + + virtual void ResizeZone(int zone, int new_size) = 0; }; class RGBController : public RGBControllerInterface { public: - std::string name; /* controller name */ - std::string vendor; /* controller vendor */ - std::string description; /* controller description */ - std::string version; /* controller version */ - std::string serial; /* controller serial number */ - std::string location; /* controller location */ - std::vector leds; /* LEDs */ - std::vector zones; /* Zones */ - std::vector modes; /* Modes */ - std::vector colors; /* Color buffer */ - device_type type; /* device type */ - int active_mode = 0;/* active mode */ - std::vector - led_alt_names; /* alternate LED names */ - unsigned int flags; /* controller flags */ - - /*---------------------------------------------------------*\ - | RGBController base class constructor | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | RGBController base class constructor | + \*-----------------------------------------------------*/ RGBController(); virtual ~RGBController(); - /*---------------------------------------------------------*\ - | Generic functions implemented in RGBController.cpp | - \*---------------------------------------------------------*/ - void SetupColors(); - - unsigned int GetLEDsInZone(unsigned int zone); + /*-----------------------------------------------------*\ + | Controller Information | + \*-----------------------------------------------------*/ std::string GetName(); std::string GetVendor(); std::string GetDescription(); @@ -351,18 +494,121 @@ public: std::string GetSerial(); std::string GetLocation(); - std::string GetModeName(unsigned int mode); + device_type GetDeviceType(); + unsigned int GetFlags(); + + /*-----------------------------------------------------*\ + | Hidden Flag Functions | + \*-----------------------------------------------------*/ + bool GetHidden(); + void SetHidden(bool hidden); + + /*-----------------------------------------------------*\ + | Zone Functions | + \*-----------------------------------------------------*/ + int GetZoneActiveMode(unsigned int zone); + RGBColor GetZoneColor(unsigned int zone, unsigned int color_index); + RGBColor* GetZoneColorsPointer(unsigned int zone); + std::size_t GetZoneCount(); + unsigned int GetZoneFlags(unsigned int zone); + unsigned int GetZoneLEDsCount(unsigned int zone); + unsigned int GetZoneLEDsMax(unsigned int zone); + unsigned int GetZoneLEDsMin(unsigned int zone); + unsigned int GetZoneMatrixMapHeight(unsigned int zone); + const unsigned int* GetZoneMatrixMap(unsigned int zone); + unsigned int GetZoneMatrixMapWidth(unsigned int zone); + std::size_t GetZoneModeCount(unsigned int zone); + unsigned int GetZoneModeBrightness(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeBrightnessMax(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeBrightnessMin(unsigned int zone, unsigned int mode); + RGBColor GetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index); + unsigned int GetZoneModeColorMode(unsigned int zone, unsigned int mode); + std::size_t GetZoneModeColorsCount(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeColorsMax(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeColorsMin(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeDirection(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeFlags(unsigned int zone, unsigned int mode); + std::string GetZoneModeName(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeSpeed(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeSpeedMax(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeSpeedMin(unsigned int zone, unsigned int mode); + int GetZoneModeValue(unsigned int zone, unsigned int mode); std::string GetZoneName(unsigned int zone); + std::size_t GetZoneSegmentCount(unsigned int zone); + unsigned int GetZoneSegmentLEDsCount(unsigned int zone, unsigned int segment); + unsigned int GetZoneSegmentMatrixMapHeight(unsigned int zone, unsigned int segment); + const unsigned int * GetZoneSegmentMatrixMap(unsigned int zone, unsigned int segment); + unsigned int GetZoneSegmentMatrixMapWidth(unsigned int zone, unsigned int segment); + std::string GetZoneSegmentName(unsigned int zone, unsigned int segment); + unsigned int GetZoneSegmentStartIndex(unsigned int zone, unsigned int segment); + unsigned int GetZoneSegmentType(unsigned int zone, unsigned int segment); + unsigned int GetZoneStartIndex(unsigned int zone); + zone_type GetZoneType(unsigned int zone); + + unsigned int GetLEDsInZone(unsigned int zone); + + void SetZoneActiveMode(unsigned int zone, int mode); + void SetZoneModeBrightness(unsigned int zone, unsigned int mode, unsigned int brightness); + void SetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index, RGBColor color); + void SetZoneModeColorMode(unsigned int zone, unsigned int mode, unsigned int color_mode); + void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, std::size_t count); + void SetZoneModeDirection(unsigned int zone, unsigned int mode, unsigned int direction); + void SetZoneModeSpeed(unsigned int zone, unsigned int mode, unsigned int speed); + + bool SupportsPerZoneModes(); + + /*-----------------------------------------------------*\ + | Mode Functions | + \*-----------------------------------------------------*/ + std::size_t GetModeCount(); + unsigned int GetModeBrightness(unsigned int mode); + unsigned int GetModeBrightnessMax(unsigned int mode); + unsigned int GetModeBrightnessMin(unsigned int mode); + RGBColor GetModeColor(unsigned int mode, unsigned int color_index); + unsigned int GetModeColorMode(unsigned int mode); + std::size_t GetModeColorsCount(unsigned int mode); + unsigned int GetModeColorsMax(unsigned int mode); + unsigned int GetModeColorsMin(unsigned int mode); + unsigned int GetModeDirection(unsigned int mode); + unsigned int GetModeFlags(unsigned int mode); + std::string GetModeName(unsigned int mode); + unsigned int GetModeSpeed(unsigned int mode); + unsigned int GetModeSpeedMax(unsigned int mode); + unsigned int GetModeSpeedMin(unsigned int mode); + int GetModeValue(unsigned int mode); + + void SetModeBrightness(unsigned int mode, unsigned int brightness); + void SetModeColor(unsigned int mode, unsigned int color_index, RGBColor color); + void SetModeColorMode(unsigned int mode, unsigned int color_mode); + void SetModeColorsCount(unsigned int mode, std::size_t count); + void SetModeDirection(unsigned int mode, unsigned int direction); + void SetModeSpeed(unsigned int mode, unsigned int speed); + + int GetActiveMode(); + void SetActiveMode(int mode); + void SetCustomMode(); + + /*-----------------------------------------------------*\ + | LED Functions | + \*-----------------------------------------------------*/ + std::size_t GetLEDCount(); std::string GetLEDName(unsigned int led); + unsigned int GetLEDValue(unsigned int led); - RGBColor GetLED(unsigned int led); - void SetLED(unsigned int led, RGBColor color); - void SetAllLEDs(RGBColor color); - void SetAllZoneLEDs(int zone, RGBColor color); + std::string GetLEDDisplayName(unsigned int led); - int GetMode(); - void SetMode(int mode); + /*-----------------------------------------------------*\ + | Color Functions | + \*-----------------------------------------------------*/ + RGBColor GetColor(unsigned int led); + RGBColor* GetColorsPointer(); + void SetColor(unsigned int led, RGBColor color); + void SetAllColors(RGBColor color); + void SetAllZoneColors(int zone, RGBColor color); + /*-----------------------------------------------------*\ + | Serialized Description Functions | + \*-----------------------------------------------------*/ unsigned char * GetDeviceDescription(unsigned int protocol_version); void ReadDeviceDescription(unsigned char* data_buf, unsigned int protocol_version); @@ -381,16 +627,40 @@ public: unsigned char * GetSegmentDescription(int zone, segment new_segment); void SetSegmentDescription(unsigned char* data_buf); + /*-----------------------------------------------------*\ + | JSON Description Functions | + \*-----------------------------------------------------*/ + nlohmann::json GetDeviceDescriptionJSON(); + nlohmann::json GetLEDDescriptionJSON(led led); + nlohmann::json GetMatrixMapDescriptionJSON(matrix_map_type matrix_map); + nlohmann::json GetModeDescriptionJSON(mode mode); + nlohmann::json GetSegmentDescriptionJSON(segment segment); + nlohmann::json GetZoneDescriptionJSON(zone zone); + + void SetDeviceDescriptionJSON(nlohmann::json controller_json); + led SetLEDDescriptionJSON(nlohmann::json led_json); + matrix_map_type SetMatrixMapDescriptionJSON(nlohmann::json matrix_map_json); + mode SetModeDescriptionJSON(nlohmann::json mode_json); + segment SetSegmentDescriptionJSON(nlohmann::json segment_json); + zone SetZoneDescriptionJSON(nlohmann::json zone_json); + + /*-----------------------------------------------------*\ + | Update Callback Functions | + \*-----------------------------------------------------*/ void RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg); void UnregisterUpdateCallback(void * callback_arg); void ClearCallbacks(); - void SignalUpdate(); + void SignalUpdate(unsigned int update_reason); + /*-----------------------------------------------------*\ + | Device Update Functions | + \*-----------------------------------------------------*/ void UpdateLEDs(); - //void UpdateZoneLEDs(int zone); - //void UpdateSingleLED(int led); + void UpdateZoneLEDs(int zone); + void UpdateSingleLED(int led); void UpdateMode(); + void UpdateZoneMode(int zone); void SaveMode(); void DeviceCallThreadFunction(); @@ -398,32 +668,82 @@ public: void ClearSegments(int zone); void AddSegment(int zone, segment new_segment); - /*---------------------------------------------------------*\ - | Functions to be implemented in device implementation | - \*---------------------------------------------------------*/ - virtual void SetupZones() = 0; + void ResizeZone(int zone, int new_size); - virtual void ResizeZone(int zone, int new_size) = 0; + /*-----------------------------------------------------*\ + | Functions to be implemented in device implementation | + \*-----------------------------------------------------*/ + virtual void DeviceResizeZone(int zone, int new_size); - virtual void DeviceUpdateLEDs() = 0; - virtual void UpdateZoneLEDs(int zone) = 0; - virtual void UpdateSingleLED(int led) = 0; + virtual void DeviceUpdateLEDs(); + virtual void DeviceUpdateZoneLEDs(int zone); + virtual void DeviceUpdateSingleLED(int led); - virtual void DeviceUpdateMode() = 0; - void DeviceSaveMode(); + virtual void DeviceUpdateMode(); + virtual void DeviceUpdateZoneMode(int zone); + virtual void DeviceSaveMode(); - void SetCustomMode(); +protected: + /*-----------------------------------------------------*\ + | Controller information strings | + \*-----------------------------------------------------*/ + std::string description; /* controller description */ + std::string location; /* controller location */ + std::string name; /* controller name */ + std::string serial; /* controller serial number */ + std::string vendor; /* controller vendor */ + std::string version; /* controller version */ + + /*-----------------------------------------------------*\ + | Controller variables | + \*-----------------------------------------------------*/ + int active_mode = 0;/* active mode */ + unsigned int flags; /* controller flags */ + device_type type; /* device type */ + + /*-----------------------------------------------------*\ + | Controller member vectors | + \*-----------------------------------------------------*/ + std::vector colors; /* Color buffer */ + std::vector leds; /* LEDs */ + std::vector + led_alt_names; /* alternate LED names */ + std::vector modes; /* Modes */ + std::vector zones; /* Zones */ + + /*-----------------------------------------------------*\ + | Access mutex variables | + \*-----------------------------------------------------*/ + std::shared_mutex AccessMutex; + + /*-----------------------------------------------------*\ + | Functions not part of interface for internal use only | + \*-----------------------------------------------------*/ + unsigned int LEDsInZone(unsigned int zone); + void SetupColors(); + void UpdateLEDsInternal(); private: + /*-----------------------------------------------------*\ + | Device thread variables | + \*-----------------------------------------------------*/ std::thread* DeviceCallThread; std::atomic CallFlag_UpdateLEDs; std::atomic CallFlag_UpdateMode; std::atomic DeviceThreadRunning; - //bool CallFlag_UpdateZoneLEDs = false; - //bool CallFlag_UpdateSingleLED = false; - //bool CallFlag_UpdateMode = false; + /*-----------------------------------------------------*\ + | Update callback variables | + \*-----------------------------------------------------*/ std::mutex UpdateMutex; std::vector UpdateCallbacks; std::vector UpdateCallbackArgs; + + /*-----------------------------------------------------*\ + | Certain internal OpenRGB framework classes can modify | + | protected members | + \*-----------------------------------------------------*/ + friend class NetworkClient; + friend class ProfileManager; + friend class ResourceManager; }; diff --git a/RGBController/RGBController_Dummy.cpp b/RGBController/RGBController_Dummy.cpp index fe9b55973..8d33e67aa 100644 --- a/RGBController/RGBController_Dummy.cpp +++ b/RGBController/RGBController_Dummy.cpp @@ -42,27 +42,17 @@ void RGBController_Dummy::SetupZones() } -void RGBController_Dummy::ResizeZone(int /*zone*/, int /*new_size*/) -{ - -} - void RGBController_Dummy::DeviceUpdateLEDs() { } -void RGBController_Dummy::UpdateZoneLEDs(int /*zone*/) +void RGBController_Dummy::DeviceUpdateZoneLEDs(int /*zone*/) { } -void RGBController_Dummy::UpdateSingleLED(int /*led*/) -{ - -} - -void RGBController_Dummy::SetCustomMode() +void RGBController_Dummy::DeviceUpdateSingleLED(int /*led*/) { } diff --git a/RGBController/RGBController_Dummy.h b/RGBController/RGBController_Dummy.h index c629c6488..23becad6f 100644 --- a/RGBController/RGBController_Dummy.h +++ b/RGBController/RGBController_Dummy.h @@ -21,12 +21,9 @@ public: void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); - void SetCustomMode(); void DeviceUpdateMode(); }; diff --git a/RGBController/RGBController_Network.cpp b/RGBController/RGBController_Network.cpp index 9e3366ed3..de2207ba0 100644 --- a/RGBController/RGBController_Network.cpp +++ b/RGBController/RGBController_Network.cpp @@ -68,7 +68,7 @@ void RGBController_Network::DeviceUpdateLEDs() delete[] data; } -void RGBController_Network::UpdateZoneLEDs(int zone) +void RGBController_Network::DeviceUpdateZoneLEDs(int zone) { unsigned char * data = GetZoneColorDescription(zone); unsigned int size; @@ -80,7 +80,7 @@ void RGBController_Network::UpdateZoneLEDs(int zone) delete[] data; } -void RGBController_Network::UpdateSingleLED(int led) +void RGBController_Network::DeviceUpdateSingleLED(int led) { unsigned char * data = GetSingleLEDColorDescription(led); diff --git a/RGBController/RGBController_Network.h b/RGBController/RGBController_Network.h index 1f7e97018..703af601a 100644 --- a/RGBController/RGBController_Network.h +++ b/RGBController/RGBController_Network.h @@ -27,8 +27,8 @@ public: void ResizeZone(int zone, int new_size); void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); + void DeviceUpdateZoneLEDs(int zone); + void DeviceUpdateSingleLED(int led); void SetCustomMode(); void DeviceUpdateMode(); diff --git a/cli.cpp b/cli.cpp index b8aa393c2..d3d8682db 100644 --- a/cli.cpp +++ b/cli.cpp @@ -328,18 +328,18 @@ bool ParseColors(std::string colors_string, DeviceOptions *options) unsigned int ParseMode(DeviceOptions& options, std::vector &rgb_controllers) { // no need to check if --mode wasn't passed - if (options.mode.size() == 0) + if(options.mode.size() == 0) { - return rgb_controllers[options.device]->active_mode; + return rgb_controllers[options.device]->GetActiveMode(); } /*---------------------------------------------------------*\ | Search through all of the device modes and see if there is| | a match. If no match is found, print an error message. | \*---------------------------------------------------------*/ - for(unsigned int mode_idx = 0; mode_idx < rgb_controllers[options.device]->modes.size(); mode_idx++) + for(std::size_t mode_idx = 0; mode_idx < rgb_controllers[options.device]->GetModeCount(); mode_idx++) { - if (strcasecmp(rgb_controllers[options.device]->modes[mode_idx].name.c_str(), options.mode.c_str()) == 0) + if(strcasecmp(rgb_controllers[options.device]->GetModeName(mode_idx).c_str(), options.mode.c_str()) == 0) { return mode_idx; } @@ -472,7 +472,7 @@ void OptionListDevices(std::vector& rgb_controllers) /*---------------------------------------------------------*\ | Print device type | \*---------------------------------------------------------*/ - std::cout << " Type: " << device_type_to_str(controller->type) << std::endl; + std::cout << " Type: " << device_type_to_str(controller->GetDeviceType()) << std::endl; /*---------------------------------------------------------*\ | Print device description | @@ -509,14 +509,14 @@ void OptionListDevices(std::vector& rgb_controllers) /*---------------------------------------------------------*\ | Print device modes | \*---------------------------------------------------------*/ - if(!controller->modes.empty()) + if(controller->GetModeCount() > 0) { std::cout << " Modes:"; - int current_mode = controller->GetMode(); - for(std::size_t mode_idx = 0; mode_idx < controller->modes.size(); mode_idx++) + int current_mode = controller->GetActiveMode(); + for(std::size_t mode_idx = 0; mode_idx < controller->GetModeCount(); mode_idx++) { - std::string modeStr = QuoteIfNecessary(controller->modes[mode_idx].name); + std::string modeStr = QuoteIfNecessary(controller->GetModeName(mode_idx)); if(current_mode == (int)mode_idx) { @@ -530,13 +530,13 @@ void OptionListDevices(std::vector& rgb_controllers) /*---------------------------------------------------------*\ | Print device zones | \*---------------------------------------------------------*/ - if(!controller->zones.empty()) + if(controller->GetZoneCount() > 0) { std::cout << " Zones:"; - for(std::size_t zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { - std::cout << " " << QuoteIfNecessary(controller->zones[zone_idx].name); + std::cout << " " << QuoteIfNecessary(controller->GetZoneName(zone_idx)); } std::cout << std::endl; } @@ -544,13 +544,13 @@ void OptionListDevices(std::vector& rgb_controllers) /*---------------------------------------------------------*\ | Print device LEDs | \*---------------------------------------------------------*/ - if(!controller->leds.empty()) + if(controller->GetLEDCount() > 0) { std::cout << " LEDs:"; - for(std::size_t led_idx = 0; led_idx < controller->leds.size(); led_idx++) + for(std::size_t led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) { - std::cout << " " << QuoteIfNecessary(controller->leds[led_idx].name); + std::cout << " " << QuoteIfNecessary(controller->GetLEDName(led_idx)); } std::cout << std::endl; } @@ -650,7 +650,7 @@ bool OptionZone(std::vector* current_devices, std::string argumen { int current_device = current_devices->at(i).device; - if(current_zone >= static_cast(rgb_controllers[current_device]->zones.size()) || (current_zone < 0)) + if(current_zone >= static_cast(rgb_controllers[current_device]->GetZoneCount()) || (current_zone < 0)) { throw nullptr; } @@ -847,12 +847,12 @@ bool OptionSize(std::vector* current_devices, std::string argumen std::cout << "Error: Device is out of range" << std::endl; return false; } - else if((current_zone >= static_cast(rgb_controllers[current_device]->zones.size())) || (current_zone < 0)) + else if((current_zone >= static_cast(rgb_controllers[current_device]->GetZoneCount())) || (current_zone < 0)) { std::cout << "Error: Zone is out of range" << std::endl; return false; } - else if((new_size < rgb_controllers[current_device]->zones[current_zone].leds_min) || (new_size > rgb_controllers[current_device]->zones[current_zone].leds_max)) + else if((new_size < rgb_controllers[current_device]->GetZoneLEDsMin(current_zone)) || (new_size > rgb_controllers[current_device]->GetZoneLEDsMax(current_zone))) { std::cout << "Error: New size is out of range" << std::endl; } @@ -888,9 +888,9 @@ bool OptionProfile(std::string argument, std::vector& rgb_contr RGBController* device = rgb_controllers[controller_idx]; device->DeviceUpdateMode(); - LOG_DEBUG("[CLI] Updating mode for %s to %i", device->GetName().c_str(), device->active_mode); + LOG_DEBUG("[CLI] Updating mode for %s to %i", device->GetName().c_str(), device->GetActiveMode()); - if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED) + if(device->GetModeColorMode(device->GetActiveMode()) == MODE_COLORS_PER_LED) { device->DeviceUpdateLEDs(); LOG_DEBUG("[CLI] Mode uses per-LED color, also updating LEDs"); @@ -1161,7 +1161,7 @@ void ApplyOptions(DeviceOptions& options, std::vector& rgb_cont /*---------------------------------------------------------*\ | Set mode first, in case it's 'direct' (which affects | - | SetLED below) | + | SetColor below) | \*---------------------------------------------------------*/ unsigned int mode = ParseMode(options, rgb_controllers); @@ -1170,9 +1170,9 @@ void ApplyOptions(DeviceOptions& options, std::vector& rgb_cont | supports that colour mode then swich to it before | | evaluating if a colour needs to be set | \*---------------------------------------------------------*/ - if(options.random_colors && (device->modes[mode].flags & MODE_FLAG_HAS_RANDOM_COLOR)) + if(options.random_colors && (device->GetModeFlags(mode) & MODE_FLAG_HAS_RANDOM_COLOR)) { - device->modes[mode].color_mode = MODE_COLORS_RANDOM; + device->SetModeColorMode(mode, MODE_COLORS_RANDOM); } /*---------------------------------------------------------*\ @@ -1180,29 +1180,29 @@ void ApplyOptions(DeviceOptions& options, std::vector& rgb_cont | supports that colour mode then swich to it before | | evaluating if a colour needs to be set | \*---------------------------------------------------------*/ - if((device->modes[mode].flags & MODE_FLAG_HAS_BRIGHTNESS)) + if((device->GetModeFlags(mode) & MODE_FLAG_HAS_BRIGHTNESS)) { - unsigned int new_brightness = device->modes[mode].brightness_max - device->modes[mode].brightness_min; + unsigned int new_brightness = device->GetModeBrightnessMax(mode) - device->GetModeBrightnessMin(mode); new_brightness *= options.brightness; new_brightness /= brightness_percentage; - device->modes[mode].brightness = device->modes[mode].brightness_min + new_brightness; + device->SetModeBrightness(mode, device->GetModeBrightnessMin(mode) + new_brightness); } - if((device->modes[mode].flags & MODE_FLAG_HAS_SPEED)) + if((device->GetModeFlags(mode) & MODE_FLAG_HAS_SPEED)) { - unsigned int new_speed = device->modes[mode].speed_max - device->modes[mode].speed_min; + unsigned int new_speed = device->GetModeSpeedMax(mode) - device->GetModeSpeedMin(mode); new_speed *= options.speed; new_speed /= speed_percentage; - device->modes[mode].speed = device->modes[mode].speed_min + new_speed; + device->SetModeSpeed(mode, device->GetModeSpeedMin(mode) + new_speed); } /*---------------------------------------------------------*\ | Determine which color mode this mode uses and update | | colors accordingly | \*---------------------------------------------------------*/ - switch(device->modes[mode].color_mode) + switch(device->GetModeColorMode(mode)) { case MODE_COLORS_NONE: break; @@ -1213,51 +1213,50 @@ void ApplyOptions(DeviceOptions& options, std::vector& rgb_cont case MODE_COLORS_PER_LED: if(options.colors.size() != 0) { - std::size_t last_set_color = 0; + std::size_t start_from; + std::size_t led_count; - RGBColor* start_from; - unsigned int led_count; if(options.zone < 0) { - start_from = &device->colors[0]; - led_count = (unsigned int)device->leds.size(); + start_from = 0; + led_count = device->GetLEDCount(); } else { - start_from = device->zones[options.zone].colors; - led_count = device->zones[options.zone].leds_count; + start_from = (std::size_t)device->GetZoneStartIndex(options.zone); + led_count = (std::size_t)device->GetZoneLEDsCount(options.zone); } for(std::size_t led_idx = 0; led_idx < led_count; led_idx++) { - if(led_idx < options.colors.size()) + std::size_t color_idx = led_idx; + + if(color_idx >= options.colors.size()) { - last_set_color = led_idx; + color_idx = options.colors.size() - 1; } - start_from[led_idx] = ToRGBColor(std::get<0>(options.colors[last_set_color]), - std::get<1>(options.colors[last_set_color]), - std::get<2>(options.colors[last_set_color])); + device->SetColor((unsigned int)(start_from + led_idx), ToRGBColor(std::get<0>(options.colors[color_idx]), + std::get<1>(options.colors[color_idx]), + std::get<2>(options.colors[color_idx]))); } } break; case MODE_COLORS_MODE_SPECIFIC: - if(options.colors.size() >= device->modes[mode].colors_min && options.colors.size() <= device->modes[mode].colors_max) + if(options.colors.size() >= device->GetModeColorsMin(mode) && options.colors.size() <= device->GetModeColorsMax(mode)) { - device->modes[mode].colors.resize(options.colors.size()); + device->SetModeColorsCount(mode, options.colors.size()); for(std::size_t color_idx = 0; color_idx < options.colors.size(); color_idx++) { - device->modes[mode].colors[color_idx] = ToRGBColor(std::get<0>(options.colors[color_idx]), - std::get<1>(options.colors[color_idx]), - std::get<2>(options.colors[color_idx])); + device->SetModeColor(mode, color_idx, ToRGBColor(std::get<0>(options.colors[color_idx]), std::get<1>(options.colors[color_idx]), std::get<2>(options.colors[color_idx]))); } } else { - std::cout << "Wrong number of colors specified for mode " + device->modes[mode].name << std::endl; - std::cout << "Please provide between " + std::to_string(device->modes[mode].colors_min) + " and " + std::to_string(device->modes[mode].colors_min) + " colors" << std::endl; + std::cout << "Wrong number of colors specified for mode " + device->GetModeName(mode) << std::endl; + std::cout << "Please provide between " + std::to_string(device->GetModeColorsMin(mode)) + " and " + std::to_string(device->GetModeColorsMax(mode)) + " colors" << std::endl; exit(0); } break; @@ -1266,13 +1265,12 @@ void ApplyOptions(DeviceOptions& options, std::vector& rgb_cont /*---------------------------------------------------------*\ | Set device mode | \*---------------------------------------------------------*/ - device->active_mode = mode; - device->DeviceUpdateMode(); + device->SetActiveMode(mode); /*---------------------------------------------------------*\ | Set device per-LED colors if necessary | \*---------------------------------------------------------*/ - if(device->modes[mode].color_mode == MODE_COLORS_PER_LED) + if(device->GetModeColorMode(mode) == MODE_COLORS_PER_LED) { device->DeviceUpdateLEDs(); } diff --git a/qt/DeviceView.cpp b/qt/DeviceView.cpp index c5eaed5b8..9cd8c1950 100644 --- a/qt/DeviceView.cpp +++ b/qt/DeviceView.cpp @@ -244,14 +244,14 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Set the size of the selection flags vector | \*-----------------------------------------------------*/ - selectionFlags.resize((int)controller->leds.size()); + selectionFlags.resize((int)controller->GetLEDCount()); /*-----------------------------------------------------*\ | Set the size of the zone and LED position vectors | \*-----------------------------------------------------*/ - zone_pos.resize(controller->zones.size()); - led_pos.resize(controller->leds.size()); - led_labels.resize(controller->leds.size()); + zone_pos.resize(controller->GetZoneCount()); + led_pos.resize(controller->GetLEDCount()); + led_labels.resize(controller->GetLEDCount()); /*-----------------------------------------------------*\ | Process position and size for zones | @@ -279,25 +279,25 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Determine the total height (in LEDs) of all zones | \*-----------------------------------------------------*/ - for(std::size_t zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { /*-----------------------------------------------------*\ | For matrix zones, use matrix height from the map | \*-----------------------------------------------------*/ - if((controller->zones[zone_idx].type == ZONE_TYPE_MATRIX) && (controller->zones[zone_idx].matrix_map)) + if(controller->GetZoneType(zone_idx) == ZONE_TYPE_MATRIX) { - totalHeight += controller->zones[zone_idx].matrix_map->height; - zone_pos[zone_idx].matrix_w = controller->zones[zone_idx].matrix_map->width; + totalHeight += controller->GetZoneMatrixMapHeight(zone_idx); + zone_pos[zone_idx].matrix_w = controller->GetZoneMatrixMapWidth(zone_idx); } /*-----------------------------------------------------*\ | For all other zones, compute the height including | | wrap-around | \*-----------------------------------------------------*/ - else if(controller->zones[zone_idx].segments.size() > 0) + else if(controller->GetZoneSegmentCount(zone_idx) > 0) { - for(std::size_t segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++) + for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { - unsigned int count = controller->zones[zone_idx].segments[segment_idx].leds_count; + unsigned int count = controller->GetZoneSegmentLEDsCount(zone_idx, segment_idx); zone_pos[zone_idx].matrix_w = std::min(count, (unsigned int)MAX_COLS); totalHeight += (count / MAX_COLS) + ((count % MAX_COLS) > 0); @@ -325,14 +325,14 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Add some space for zone names and padding | \*-----------------------------------------------------*/ - totalHeight += controller->zones.size() * PAD_ZONE; + totalHeight += controller->GetZoneCount() * PAD_ZONE; totalHeight += segment_count * PAD_SEGMENT; float current_y = 0; // We will be descending, placing each zone one unit below the previous one matrix_h = totalHeight; segment_count = 0; - for(std::size_t zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { /*-----------------------------------------------------*\ | Calculate zone label position and size | @@ -345,18 +345,16 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Calculate LEDs position and size for zone | \*-----------------------------------------------------*/ - if((controller->zones[zone_idx].type == ZONE_TYPE_MATRIX) && (controller->zones[zone_idx].matrix_map)) + if(controller->GetZoneType(zone_idx) == ZONE_TYPE_MATRIX) { - matrix_map_type * map = controller->zones[zone_idx].matrix_map; - - for(unsigned int led_x = 0; led_x < map->width; led_x++) + for(unsigned int led_x = 0; led_x < controller->GetZoneMatrixMapWidth(zone_idx); led_x++) { - for(unsigned int led_y = 0; led_y < map->height; led_y++) + for(unsigned int led_y = 0; led_y < controller->GetZoneMatrixMapHeight(zone_idx); led_y++) { - unsigned int map_idx = led_y * map->width + led_x; - unsigned int color_idx = map->map[map_idx] + controller->zones[zone_idx].start_idx; + unsigned int map_idx = led_y * controller->GetZoneMatrixMapWidth(zone_idx) + led_x; + unsigned int color_idx = controller->GetZoneMatrixMap(zone_idx)[map_idx] + controller->GetZoneStartIndex(zone_idx); - if(map->map[map_idx] != 0xFFFFFFFF && color_idx < led_pos.size()) + if(controller->GetZoneMatrixMap(zone_idx)[map_idx] != 0xFFFFFFFF && color_idx < led_pos.size()) { led_pos[color_idx].matrix_x = (zone_pos[zone_idx].matrix_x + led_x + PAD_LED); led_pos[color_idx].matrix_y = current_y + (led_y + PAD_LED); @@ -387,40 +385,40 @@ void DeviceView::InitDeviceView() | Fill Wide: | | Space | \*-----------------------------------------------------*/ - if(led_x < map->width - 1 && map->map[map_idx + 1] == 0xFFFFFFFF) + if(led_x < controller->GetZoneMatrixMapWidth(zone_idx) - 1 && controller->GetZoneMatrixMap(zone_idx)[map_idx + 1] == 0xFFFFFFFF) { - if( ( controller->GetLEDName(color_idx) == KEY_EN_TAB ) - || ( controller->GetLEDName(color_idx) == KEY_EN_CAPS_LOCK ) - || ( controller->GetLEDName(color_idx) == KEY_EN_LEFT_SHIFT ) - || ( controller->GetLEDName(color_idx) == KEY_EN_RIGHT_SHIFT) - || ( controller->GetLEDName(color_idx) == KEY_EN_BACKSPACE ) - || ( controller->GetLEDName(color_idx) == KEY_EN_NUMPAD_0 ) ) + if( ( controller->GetLEDDisplayName(color_idx) == KEY_EN_TAB ) + || ( controller->GetLEDDisplayName(color_idx) == KEY_EN_CAPS_LOCK ) + || ( controller->GetLEDDisplayName(color_idx) == KEY_EN_LEFT_SHIFT ) + || ( controller->GetLEDDisplayName(color_idx) == KEY_EN_RIGHT_SHIFT) + || ( controller->GetLEDDisplayName(color_idx) == KEY_EN_BACKSPACE ) + || ( controller->GetLEDDisplayName(color_idx) == KEY_EN_NUMPAD_0 ) ) { led_pos[color_idx].matrix_w += 1.0f; } } - if( ( controller->GetLEDName(color_idx) == KEY_EN_NUMPAD_ENTER ) - || ( controller->GetLEDName(color_idx) == KEY_EN_NUMPAD_PLUS ) ) + if( ( controller->GetLEDDisplayName(color_idx) == KEY_EN_NUMPAD_ENTER ) + || ( controller->GetLEDDisplayName(color_idx) == KEY_EN_NUMPAD_PLUS ) ) { - if(led_y < map->height - 1 && map->map[map_idx + map->width] == 0xFFFFFFFF) + if(led_y < controller->GetZoneMatrixMapHeight(zone_idx) - 1 && controller->GetZoneMatrixMap(zone_idx)[map_idx + controller->GetZoneMatrixMapWidth(zone_idx)] == 0xFFFFFFFF) { led_pos[color_idx].matrix_h += 1.0f; } /* TODO: check if there isn't another widened key above */ - else if(led_y > 0 && map->map[map_idx - map->width] == 0xFFFFFFFF) + else if(led_y > 0 && controller->GetZoneMatrixMap(zone_idx)[map_idx - controller->GetZoneMatrixMapWidth(zone_idx)] == 0xFFFFFFFF) { led_pos[color_idx].matrix_y -= 1.0f; led_pos[color_idx].matrix_h += 1.0f; } } - else if(controller->GetLEDName(color_idx) == KEY_EN_SPACE) + else if(controller->GetLEDDisplayName(color_idx) == KEY_EN_SPACE) { - for(unsigned int map_idx2 = map_idx - 1; map_idx2 > led_y * map->width && map->map[map_idx2] == 0xFFFFFFFF; map_idx2--) + for(unsigned int map_idx2 = map_idx - 1; map_idx2 > led_y * controller->GetZoneMatrixMapWidth(zone_idx) && controller->GetZoneMatrixMap(zone_idx)[map_idx2] == 0xFFFFFFFF; map_idx2--) { led_pos[color_idx].matrix_x -= 1.0f; led_pos[color_idx].matrix_w += 1.0f; } - for(unsigned int map_idx2 = map_idx + 1; map_idx2 < (led_y + 1) * map->width && map->map[map_idx2] == 0xFFFFFFFF; map_idx2++) + for(unsigned int map_idx2 = map_idx + 1; map_idx2 < (led_y + 1) * controller->GetZoneMatrixMapWidth(zone_idx) && controller->GetZoneMatrixMap(zone_idx)[map_idx2] == 0xFFFFFFFF; map_idx2++) { led_pos[color_idx].matrix_w += 1.0f; } @@ -430,11 +428,11 @@ void DeviceView::InitDeviceView() } } - current_y += map->height; + current_y += controller->GetZoneMatrixMapHeight(zone_idx); } - else if(controller->zones[zone_idx].segments.size() > 0) + else if(controller->GetZoneSegmentCount(zone_idx) > 0) { - for(std::size_t segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++) + for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { /*-----------------------------------------------------*\ | Calculate segment label position and size | @@ -450,11 +448,11 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Calculate LED box positions for segmented zones | \*-----------------------------------------------------*/ - unsigned int leds_count = controller->zones[zone_idx].segments[segment_idx].leds_count; + unsigned int leds_count = controller->GetZoneSegmentLEDsCount(zone_idx, segment_idx); for(unsigned int led_idx = 0; led_idx < leds_count; led_idx++) { - unsigned int led_pos_idx = controller->zones[zone_idx].start_idx + controller->zones[zone_idx].segments[segment_idx].start_idx + led_idx; + unsigned int led_pos_idx = controller->GetZoneStartIndex(zone_idx) + controller->GetZoneSegmentStartIndex(zone_idx, segment_idx) + led_idx; led_pos[led_pos_idx].matrix_x = zone_pos[zone_idx].matrix_x + ((led_idx % MAX_COLS) + PAD_LED); led_pos[led_pos_idx].matrix_y = current_y + ((led_idx / MAX_COLS) + PAD_LED); @@ -478,7 +476,7 @@ void DeviceView::InitDeviceView() for(unsigned int led_idx = 0; led_idx < leds_count; led_idx++) { - unsigned int led_pos_idx = controller->zones[zone_idx].start_idx + led_idx; + unsigned int led_pos_idx = controller->GetZoneStartIndex(zone_idx) + led_idx; led_pos[led_pos_idx].matrix_x = zone_pos[zone_idx].matrix_x + ((led_idx % MAX_COLS) + PAD_LED); led_pos[led_pos_idx].matrix_y = current_y + ((led_idx / MAX_COLS) + PAD_LED); @@ -497,9 +495,9 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Update LED labels | \*-----------------------------------------------------*/ - for(std::size_t led_idx = 0; led_idx < controller->leds.size(); led_idx++) + for(std::size_t led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) { - std::map::const_iterator it = led_label_lookup.find(controller->GetLEDName((unsigned int)led_idx)); + std::map::const_iterator it = led_label_lookup.find(controller->GetLEDDisplayName((unsigned int)led_idx)); if(it != led_label_lookup.end()) { @@ -640,7 +638,7 @@ void DeviceView::mouseMoveEvent(QMouseEvent *event) { previousSelection.clear(); previousFlags.clear(); - previousFlags.resize((int)controller->leds.size()); + previousFlags.resize((int)controller->GetLEDCount()); } updateSelection(); } @@ -671,7 +669,7 @@ void DeviceView::mouseReleaseEvent(QMouseEvent* event) unsigned int segment_count = 0; - for(unsigned int zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { int posx = zone_pos[zone_idx].matrix_x * size + offset_x + 12; int posy = zone_pos[zone_idx].matrix_y * size; @@ -685,7 +683,7 @@ void DeviceView::mouseReleaseEvent(QMouseEvent* event) selectZone(zone_idx, ctrlDown); } - for(unsigned int segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { posx = segment_pos[segment_count].matrix_x * size + offset_x + 12; posy = segment_pos[segment_count].matrix_y * size; @@ -736,7 +734,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) /*-----------------------------------------------------*\ | If controller has resized, reinitialize local data | \*-----------------------------------------------------*/ - if(controller->leds.size() != led_pos.size()) + if(controller->GetLEDCount() != led_pos.size()) { InitDeviceView(); } @@ -746,9 +744,9 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) \*-----------------------------------------------------*/ unsigned int segments = 0; - for(std::size_t zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { - for(std::size_t segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++) + for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { segments++; } @@ -762,7 +760,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) /*-----------------------------------------------------*\ | LED rectangles | \*-----------------------------------------------------*/ - for(unsigned int led_idx = 0; led_idx < controller->leds.size(); led_idx++) + for(unsigned int led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) { int posx = led_pos[led_idx].matrix_x * size + offset_x; int posy = led_pos[led_idx].matrix_y * size; @@ -775,9 +773,9 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) | Fill color | \*-----------------------------------------------------*/ QColor currentColor = QColor::fromRgb( - RGBGetRValue(controller->colors[led_idx]), - RGBGetGValue(controller->colors[led_idx]), - RGBGetBValue(controller->colors[led_idx])); + RGBGetRValue(controller->GetColor(led_idx)), + RGBGetGValue(controller->GetColor(led_idx)), + RGBGetBValue(controller->GetColor(led_idx))); painter.setBrush(currentColor); /*-----------------------------------------------------*\ @@ -821,7 +819,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) \*-----------------------------------------------------*/ unsigned int segment_count = 0; - for(std::size_t zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { int posx = zone_pos[zone_idx].matrix_x * size + offset_x; int posy = zone_pos[zone_idx].matrix_y * size; @@ -840,7 +838,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) } painter.drawText(posx, posy + posh, QString(controller->GetZoneName((unsigned int)zone_idx).c_str())); - for(std::size_t segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++) + for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { posx = segment_pos[segment_count].matrix_x * size + offset_x; posy = segment_pos[segment_count].matrix_y * size; @@ -859,7 +857,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) { painter.setPen(palette().windowText().color()); } - painter.drawText(posx, posy + posh, QString(controller->zones[zone_idx].segments[segment_idx].name.c_str())); + painter.drawText(posx, posy + posh, QString(controller->GetZoneSegmentName(zone_idx, segment_idx).c_str())); } } @@ -882,12 +880,11 @@ void DeviceView::updateSelection() { selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize((int)controller->leds.size()); + selectionFlags.resize((int)controller->GetLEDCount()); - QRect sel = selectionRect.normalized(); - std::vector& leds = controller->leds; + QRect sel = selectionRect.normalized(); - for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++) + for(unsigned int led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) { /*-----------------------------------------------------*\ | Check intersection | @@ -926,7 +923,7 @@ void DeviceView::updateSelection() bool DeviceView::selectLed(int target) { - if(target < 0 || size_t(target) >= controller->leds.size()) + if(target < 0 || size_t(target) >= controller->GetLEDCount()) { return false; } @@ -934,7 +931,7 @@ bool DeviceView::selectLed(int target) selectedLeds.resize(1); selectedLeds[0] = target; selectionFlags.clear(); - selectionFlags.resize((int)controller->leds.size()); + selectionFlags.resize((int)controller->GetLEDCount()); selectionFlags[target] = 1; update(); @@ -951,14 +948,14 @@ bool DeviceView::selectLeds(QVector target) { for(int item: target) { - if(item < 0 || size_t(item) >= controller->leds.size()) + if(item < 0 || size_t(item) >= controller->GetLEDCount()) { return false; } } selectionFlags.clear(); - selectionFlags.resize((int)controller->leds.size()); + selectionFlags.resize((int)controller->GetLEDCount()); for(int item: target) { @@ -992,12 +989,12 @@ bool DeviceView::selectLeds(QVector target) bool DeviceView::selectSegment(int zone, int segment, bool add) { - if(zone < 0 || size_t(zone) >= controller->zones.size()) + if(zone < 0 || size_t(zone) >= controller->GetZoneCount()) { return false; } - if(segment < 0 || size_t(segment) >= controller->zones[zone].segments.size()) + if(segment < 0 || size_t(segment) >= controller->GetZoneSegmentCount(zone)) { return false; } @@ -1006,13 +1003,13 @@ bool DeviceView::selectSegment(int zone, int segment, bool add) { selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize((int)controller->leds.size()); + selectionFlags.resize((int)controller->GetLEDCount()); } - int zoneStart = controller->zones[zone].start_idx; - int segStart = controller->zones[zone].segments[segment].start_idx; + int zoneStart = controller->GetZoneStartIndex(zone); + int segStart = controller->GetZoneSegmentStartIndex(zone, segment); - for(int led_idx = 0; led_idx < (int)controller->zones[zone].segments[segment].leds_count; led_idx++) + for(int led_idx = 0; led_idx < (int)controller->GetZoneSegmentLEDsCount(zone, segment); led_idx++) { if(!selectionFlags[zoneStart + segStart + led_idx]) { @@ -1033,7 +1030,7 @@ bool DeviceView::selectSegment(int zone, int segment, bool add) bool DeviceView::selectZone(int zone, bool add) { - if(zone < 0 || size_t(zone) >= controller->zones.size()) + if(zone < 0 || size_t(zone) >= controller->GetZoneCount()) { return false; } @@ -1042,10 +1039,10 @@ bool DeviceView::selectZone(int zone, bool add) { selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize((int)controller->leds.size()); + selectionFlags.resize((int)controller->GetLEDCount()); } - int zoneStart = controller->zones[zone].start_idx; + int zoneStart = controller->GetZoneStartIndex(zone); for(std::size_t led_idx = 0; led_idx < controller->GetLEDsInZone(zone); led_idx++) { @@ -1073,20 +1070,20 @@ void DeviceView::clearSelection() \*-----------------------------------------------------*/ selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize((int)controller->leds.size()); + selectionFlags.resize((int)controller->GetLEDCount()); } void DeviceView::setSelectionColor(RGBColor color) { if(selectedLeds.isEmpty()) { - controller->SetAllLEDs(color); + controller->SetAllColors(color); } else { for(int led_idx: selectedLeds) { - controller->SetLED(led_idx, color); + controller->SetColor(led_idx, color); } } controller->UpdateLEDs(); diff --git a/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp b/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp index 9ca95f745..b582fa7c8 100644 --- a/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp +++ b/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp @@ -200,7 +200,7 @@ void OpenRGBClientInfoPage::UpdateInfo() /*-----------------------------------------------------*\ | Add child items for each zone in the device | \*-----------------------------------------------------*/ - for(std::size_t zone_idx = 0; zone_idx < ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->GetZoneCount(); zone_idx++) { /*-----------------------------------------------------*\ | Create child tree widget items and display the zone | @@ -208,11 +208,11 @@ void OpenRGBClientInfoPage::UpdateInfo() \*-----------------------------------------------------*/ QTreeWidgetItem* new_child = new QTreeWidgetItem(); - std::string zone_str = ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->zones[zone_idx].name + ", "; - zone_str.append(std::to_string(ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->zones[zone_idx].leds_count)); + std::string zone_str = ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->GetZoneName(zone_idx) + ", "; + zone_str.append(std::to_string(ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->GetZoneLEDsCount(zone_idx))); zone_str.append(" LEDs, "); // TODO : translate - switch(ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->zones[zone_idx].type) + switch(ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->GetZoneType(zone_idx)) { case ZONE_TYPE_SINGLE: zone_str.append("Single"); diff --git a/qt/OpenRGBDeviceInfoPage/OpenRGBDeviceInfoPage.cpp b/qt/OpenRGBDeviceInfoPage/OpenRGBDeviceInfoPage.cpp index f4980a75e..f74cd61d1 100644 --- a/qt/OpenRGBDeviceInfoPage/OpenRGBDeviceInfoPage.cpp +++ b/qt/OpenRGBDeviceInfoPage/OpenRGBDeviceInfoPage.cpp @@ -18,7 +18,7 @@ OpenRGBDeviceInfoPage::OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent ui->setupUi(this); - ui->TypeValue->setText(device_type_to_str(dev->type).c_str()); + ui->TypeValue->setText(device_type_to_str(dev->GetDeviceType()).c_str()); ui->NameValue->setText(QString::fromStdString(dev->GetName())); ui->VendorValue->setText(QString::fromStdString(dev->GetVendor())); @@ -27,15 +27,16 @@ OpenRGBDeviceInfoPage::OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent ui->LocationValue->setText(QString::fromStdString(dev->GetLocation())); ui->SerialValue->setText(QString::fromStdString(dev->GetSerial())); - std::string flags_string = ""; - bool need_separator = false; + unsigned int flags = dev->GetFlags(); + std::string flags_string = ""; + bool need_separator = false; - if(dev->flags & CONTROLLER_FLAG_LOCAL) + if(flags & CONTROLLER_FLAG_LOCAL) { flags_string += "Local"; need_separator = true; } - if(dev->flags & CONTROLLER_FLAG_REMOTE) + if(flags & CONTROLLER_FLAG_REMOTE) { if(need_separator) { @@ -44,7 +45,7 @@ OpenRGBDeviceInfoPage::OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent flags_string += "Remote"; need_separator = true; } - if(dev->flags & CONTROLLER_FLAG_VIRTUAL) + if(flags & CONTROLLER_FLAG_VIRTUAL) { if(need_separator) { @@ -53,7 +54,16 @@ OpenRGBDeviceInfoPage::OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent flags_string += "Virtual"; need_separator = true; } - if(dev->flags & CONTROLLER_FLAG_RESET_BEFORE_UPDATE) + if(flags & CONTROLLER_FLAG_HIDDEN) + { + if(need_separator) + { + flags_string += ", "; + } + flags_string += "Hidden"; + need_separator = true; + } + if(flags & CONTROLLER_FLAG_RESET_BEFORE_UPDATE) { if(need_separator) { diff --git a/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp index d8fc7906a..f4a1e6d7f 100644 --- a/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp @@ -13,43 +13,11 @@ #include "SettingsManager.h" #include "ui_OpenRGBDevicePage.h" -static void UpdateCallback(void * this_ptr) +static void UpdateCallback(void * this_ptr, unsigned int update_reason) { OpenRGBDevicePage * this_obj = (OpenRGBDevicePage *)this_ptr; - QMetaObject::invokeMethod(this_obj, "UpdateInterface", Qt::QueuedConnection); -} - -QString OpenRGBDevicePage::ModeDescription(const mode& m) -{ - /*-----------------------------------------------------------------*\ - | List of common mode names can be found on the OpenRGB Wiki: | - | https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/Common-Modes | - \*-----------------------------------------------------------------*/ - static const std::unordered_map descriptions = - { - {"Direct", tr("Set individual LEDs to static colors. Safe for use with software-driven effects.") }, - {"Custom", tr("Set individual LEDs to static colors. Not safe for use with software-driven effects.") }, - {"Static", tr("Sets the entire device or a zone to a single color.") }, - {"Breathing", tr("Gradually fades between fully off and fully on.") }, - {"Flashing", tr("Abruptly changes between fully off and fully on.") }, - {"Spectrum Cycle", tr("Gradually cycles through the entire color spectrum. All lights on the device are the same color.") }, - {"Rainbow Wave", tr("Gradually cycles through the entire color spectrum. Produces a rainbow pattern that moves.") }, - {"Reactive", tr("Flashes lights when keys or buttons are pressed.") }, - }; - - /*-----------------------------------------------------------------*\ - | Find the given mode name in the list and return the description | - | if it exists, otherwise return an empty string | - \*-----------------------------------------------------------------*/ - std::unordered_map::const_iterator it = descriptions.find(m.name); - - if(it != descriptions.end()) - { - return it->second; - } - - return ""; + QMetaObject::invokeMethod(this_obj, "UpdateInterface", Qt::QueuedConnection, Q_ARG(unsigned int, update_reason)); } OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) : @@ -102,23 +70,21 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) : } } + /*-----------------------------------------------------*\ + | Initialize Device View | + \*-----------------------------------------------------*/ ui->DeviceViewBox->setController(device); ui->DeviceViewBoxFrame->hide(); /*-----------------------------------------------------*\ - | Fill in the mode selection box | + | Update zone list | \*-----------------------------------------------------*/ - ui->ModeBox->blockSignals(true); - ui->ModeBox->clear(); + UpdateZoneList(); - for(std::size_t i = 0; i < device->modes.size(); i++) - { - ui->ModeBox->addItem(device->GetModeName((unsigned int)i).c_str()); - ui->ModeBox->setItemData((int)i, ModeDescription(device->modes[i]), Qt::ToolTipRole); - } - - ui->ModeBox->setCurrentIndex(device->GetMode()); - ui->ModeBox->blockSignals(false); + /*-----------------------------------------------------*\ + | Update mode list | + \*-----------------------------------------------------*/ + UpdateModeList(); /*-----------------------------------------------------*\ | Update mode user interface elements | @@ -126,13 +92,14 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) : UpdateModeUi(); /*-----------------------------------------------------*\ - | Set initial color to black and update UI | + | Update LED list | \*-----------------------------------------------------*/ - current_color.setRgb(0, 0, 0); - updateColorUi(); + UpdateLEDList(); - ui->ApplyColorsButton->setDisabled(autoUpdateEnabled()); - ui->SetAllButton->setDisabled(device->modes[0].name != "Direct" && device->modes[0].name != "Custom" && device->modes[0].name != "Static"); + /*-----------------------------------------------------*\ + | Update LED UI | + \*-----------------------------------------------------*/ + UpdateLEDUi(); } OpenRGBDevicePage::~OpenRGBDevicePage() @@ -153,1073 +120,46 @@ OpenRGBDevicePage::~OpenRGBDevicePage() delete ui; } -void OpenRGBDevicePage::changeEvent(QEvent *event) -{ - /*-----------------------------------------------------*\ - | Retranslate the UI when a language change event occurs| - \*-----------------------------------------------------*/ - if(event->type() == QEvent::LanguageChange) - { - ui->retranslateUi(this); - } -} - +/*---------------------------------------------------------*\ +| Device Functions | +\*---------------------------------------------------------*/ RGBController* OpenRGBDevicePage::GetController() { - return device; -} - -void OpenRGBDevicePage::on_ZoneBox_currentIndexChanged(int /*index*/) -{ - /*-----------------------------------------------------*\ - | Determine what is selected, either all zones, a zone, | - | or a segment | - \*-----------------------------------------------------*/ - bool selected_all_zones; - int selected_zone; - int selected_segment; - - getSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); - - /*-----------------------------------------------------*\ - | Update mode UI | - \*-----------------------------------------------------*/ - - /*-----------------------------------------------------*\ - | Read selected mode | - \*-----------------------------------------------------*/ - unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex(); - - /*-----------------------------------------------------*\ - | Process zone box change based on color mode | - \*-----------------------------------------------------*/ - switch(device->modes[selected_mode].color_mode) - { - case MODE_COLORS_PER_LED: - { - /*-----------------------------------------*\ - | Clear LED box | - \*-----------------------------------------*/ - ui->LEDBox->blockSignals(true); - ui->LEDBox->clear(); - - /*-----------------------------------------*\ - | Clear multiple selected flag | - \*-----------------------------------------*/ - MultipleSelected = false; - - /*-----------------------------------------*\ - | Handle "All Zones" selected condition or | - | multiple selection condition | - \*-----------------------------------------*/ - if(selected_all_zones) - { - /*-------------------------------------*\ - | If there are multiple LEDs, add the | - | "Entire Device" option to the LED box | - | and enable it, otherwise there is | - | only one LED so disable it | - \*-------------------------------------*/ - if(device->leds.size() > 1) - { - ui->LEDBox->addItem(tr("Entire Device")); - ui->LEDBox->setEnabled(1); - } - else - { - ui->LEDBox->setDisabled(1); - } - - /*-------------------------------------*\ - | Fill in the LED list with all LEDs in | - | the device | - \*-------------------------------------*/ - for(std::size_t i = 0; i < device->leds.size(); i++) - { - ui->LEDBox->addItem(device->GetLEDName((unsigned int)i).c_str()); - } - - /*-------------------------------------*\ - | Editing is not allowed when all | - | zones are selected at once | - \*-------------------------------------*/ - ui->EditZoneButton->setEnabled(false); - - if(!ui->ZoneBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->clearSelection(); - ui->DeviceViewBox->blockSignals(false); - } - } - - /*-----------------------------------------*\ - | Handle a zone selected condition | - \*-----------------------------------------*/ - else if(selected_zone != -1 && selected_segment == -1) - { - unsigned int leds_in_zone = device->GetLEDsInZone(selected_zone); - - /*-------------------------------------*\ - | If there are multiple LEDs, add the | - | "Entire Zone" option to the LED box | - | and enable it, otherwise there is | - | only one LED so disable it | - \*-------------------------------------*/ - if(leds_in_zone > 1) - { - ui->LEDBox->addItem(tr("Entire Zone")); - ui->LEDBox->setEnabled(1); - } - else - { - ui->LEDBox->setDisabled(1); - } - - /*-------------------------------------*\ - | Fill in the LED list with all LEDs in | - | the zone | - \*-------------------------------------*/ - for(std::size_t led_idx = 0; led_idx < leds_in_zone; led_idx++) - { - ui->LEDBox->addItem(device->zones[selected_zone].leds[led_idx].name.c_str()); - } - - /*-------------------------------------*\ - | Enable editing if: | - | Zone has variable size | - | OR | - | Zone is LINEAR and device type is | - | LEDSTRIP | - \*-------------------------------------*/ - bool zone_is_editable = false; - - if(device->zones[selected_zone].leds_min != device->zones[selected_zone].leds_max) - { - zone_is_editable = true; - } - - if((device->zones[selected_zone].type == ZONE_TYPE_LINEAR) && (device->type == DEVICE_TYPE_LEDSTRIP)) - { - zone_is_editable = true; - } - - ui->EditZoneButton->setEnabled(zone_is_editable); - - if(!ui->ZoneBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->selectZone(selected_zone); - ui->DeviceViewBox->blockSignals(false); - } - } - - /*-----------------------------------------*\ - | Handle a segment selected condition | - \*-----------------------------------------*/ - else if(selected_zone != -1 && selected_segment != -1) - { - /*-------------------------------------*\ - | If there are multiple LEDs, add the | - | "Entire Segment" option to the LED | - | box and enable it, otherwise there is | - | only one LED so disable it | - \*-------------------------------------*/ - if(device->zones[selected_zone].segments[selected_segment].leds_count > 1) - { - ui->LEDBox->addItem(tr("Entire Segment")); - ui->LEDBox->setEnabled(1); - } - else - { - ui->LEDBox->setDisabled(1); - } - - /*-------------------------------------*\ - | Fill in the LED list with all LEDs in | - | the segment | - \*-------------------------------------*/ - for(std::size_t led_idx = 0; led_idx < device->zones[selected_zone].segments[selected_segment].leds_count; led_idx++) - { - ui->LEDBox->addItem(device->zones[selected_zone].leds[led_idx + device->zones[selected_zone].segments[selected_segment].start_idx].name.c_str()); - } - - /*-------------------------------------*\ - | Editing is not allowed when a | - | segment is selected | - \*-------------------------------------*/ - ui->EditZoneButton->setEnabled(false); - - if(!ui->ZoneBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->selectSegment(selected_zone, selected_segment); - ui->DeviceViewBox->blockSignals(false); - } - } - - ui->LEDBox->setCurrentIndex(0); - on_LEDBox_currentIndexChanged(0); - ui->LEDBox->blockSignals(false); - } - break; - } -} - -void OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index) -{ - /*-----------------------------------------------------*\ - | Determine what is selected, either all zones, a zone, | - | or a segment | - \*-----------------------------------------------------*/ - bool selected_all_zones; - int selected_zone; - int selected_segment; - - getSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); - - /*-----------------------------------------------------*\ - | Read selected mode | - \*-----------------------------------------------------*/ - unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex(); - - /*-----------------------------------------------------*\ - | Process zone box change based on color mode | - \*-----------------------------------------------------*/ - switch(device->modes[selected_mode].color_mode) - { - case MODE_COLORS_PER_LED: - { - /*-----------------------------------------*\ - | Initialize both selected zone and segment | - | to -1 to indicate there is no selection | - \*-----------------------------------------*/ - bool selected_all_leds = false; - int selected_led = -1; - - /*-----------------------------------------*\ - | Handle selection of "Entire Device/Zone/ | - | Segment" index is selected | - | | - | There should always be an Entire index as | - | long as the LED box is enabled | - \*-----------------------------------------*/ - if(index == 0) - { - selected_all_leds = true; - } - /*-----------------------------------------*\ - | Determine selected LED if "Entire Device/ | - | Zone/Segment" is not selected | - \*-----------------------------------------*/ - else - { - selected_led = index - 1; - } - - /*-----------------------------------------*\ - | Initialize variables | - \*-----------------------------------------*/ - bool multiple = (std::size_t(selected_led) == (device->leds.size() + 1)); - RGBColor color = 0x00000000; - bool updateColor = false; - - /*-----------------------------------------*\ - | Remove multiple selection | - \*-----------------------------------------*/ - if(MultipleSelected) - { - ui->LEDBox->removeItem((int)(device->leds.size() + 1)); - } - - MultipleSelected = false; - - /*-----------------------------------------*\ - | Handle "All Zones" selected condition | - \*-----------------------------------------*/ - if(selected_all_zones) - { - /*-------------------------------------*\ - | Handle Entire Device selection | - \*-------------------------------------*/ - if(selected_all_leds) - { - if(!ui->LEDBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->clearSelection(); - ui->DeviceViewBox->blockSignals(false); - } - } - - /*-------------------------------------*\ - | Handle single selected LED | - \*-------------------------------------*/ - if((device->leds.size() == 1 || selected_led != -1) && !multiple) - { - /*---------------------------------*\ - | Get selected LED's current color | - \*---------------------------------*/ - color = device->GetLED(selected_led); - - /*---------------------------------*\ - | Set update color flag | - \*---------------------------------*/ - updateColor = true; - - /*---------------------------------*\ - | Select LED in device view | - \*---------------------------------*/ - if(!ui->LEDBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->selectLed(selected_led); - ui->DeviceViewBox->blockSignals(false); - } - } - } - /*-----------------------------------------*\ - | Handle a zone selected condition | - \*-----------------------------------------*/ - else if(selected_zone != -1 && selected_segment == -1) - { - /*-------------------------------------*\ - | Handle Entire Zone selection | - \*-------------------------------------*/ - if(selected_all_leds) - { - if(!ui->LEDBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->selectZone(selected_zone); - ui->DeviceViewBox->blockSignals(false); - } - } - - /*-------------------------------------*\ - | Handle single selected LED | - \*-------------------------------------*/ - if(device->GetLEDsInZone(selected_zone) == 1 || selected_led != -1) - { - if((unsigned int)selected_led < device->GetLEDsInZone(selected_zone)) - { - /*-----------------------------*\ - | Get selected LED's current | - | color | - \*-----------------------------*/ - color = device->zones[selected_zone].colors[selected_led]; - - /*-----------------------------*\ - | Set update color flag | - \*-----------------------------*/ - updateColor = 1; - - /*-----------------------------*\ - | Set global index | - \*-----------------------------*/ - int globalIndex = device->zones[selected_zone].leds - &(device->leds[0]) + selected_led; - - /*-----------------------------*\ - | Select LED in device view | - \*-----------------------------*/ - if(!ui->LEDBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->selectLed(globalIndex); - ui->DeviceViewBox->blockSignals(false); - } - } - } - } - /*-----------------------------------------*\ - | Handle a segment selected condition | - \*-----------------------------------------*/ - else if(selected_zone != -1 && selected_segment != -1) - { - /*-------------------------------------*\ - | Handle Entire Zone selection | - \*-------------------------------------*/ - if(selected_all_leds) - { - if(!ui->LEDBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->selectSegment(selected_zone, selected_segment); - ui->DeviceViewBox->blockSignals(false); - } - } - - /*-------------------------------------*\ - | Handle single selected LED | - \*-------------------------------------*/ - if(device->zones[selected_zone].segments[selected_segment].leds_count == 1 || selected_led != -1) - { - if((unsigned int)selected_led < device->zones[selected_zone].segments[selected_segment].leds_count) - { - /*-----------------------------*\ - | Get selected LED's current | - | color | - \*-----------------------------*/ - color = device->zones[selected_zone].colors[selected_led + device->zones[selected_zone].segments[selected_segment].start_idx]; - - /*-----------------------------*\ - | Set update color flag | - \*-----------------------------*/ - updateColor = 1; - - /*-----------------------------*\ - | Set global index | - \*-----------------------------*/ - int globalIndex = device->zones[selected_zone].leds - &(device->leds[0]) + selected_led + device->zones[selected_zone].segments[selected_segment].start_idx; - - /*-----------------------------*\ - | Select LED in device view | - \*-----------------------------*/ - if(!ui->LEDBox->signalsBlocked()) - { - ui->DeviceViewBox->blockSignals(true); - ui->DeviceViewBox->selectLed(globalIndex); - ui->DeviceViewBox->blockSignals(false); - } - } - } - } - - /*-----------------------------------------------------*\ - | Update color picker with color of selected LED | - \*-----------------------------------------------------*/ - if(updateColor) - { - current_color.setRgb(RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color)); - - updateColorUi(); - } - } - break; - - case MODE_COLORS_MODE_SPECIFIC: - { - /*-----------------------------------------------------*\ - | Update color picker with color of selected mode | - \*-----------------------------------------------------*/ - RGBColor color = device->modes[selected_mode].colors[index]; - - current_color.setRgb(RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color)); - - updateColorUi(); - } - break; - } - -} - -void OpenRGBDevicePage::on_ModeBox_currentIndexChanged(int index) -{ - /*-----------------------------------------------------*\ - | Update mode user interface elements | - \*-----------------------------------------------------*/ - UpdateModeUi(); - - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - UpdateMode(); - - /*-----------------------------------------------------*\ - | Disable the button if we can safely auto apply colors | - \*-----------------------------------------------------*/ - ui->ApplyColorsButton->setDisabled(autoUpdateEnabled()); - ui->SetAllButton->setDisabled(device->modes[index].name != "Direct" && device->modes[index].name != "Custom" && device->modes[index].name != "Static"); - -} - -void OpenRGBDevicePage::on_PerLEDCheck_clicked() -{ - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - UpdateMode(); - - /*-----------------------------------------------------*\ - | Update mode user interface elements | - \*-----------------------------------------------------*/ - UpdateModeUi(); -} - -void OpenRGBDevicePage::on_ModeSpecificCheck_clicked() -{ - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - UpdateMode(); - - /*-----------------------------------------------------*\ - | Update mode user interface elements | - \*-----------------------------------------------------*/ - UpdateModeUi(); -} - -void OpenRGBDevicePage::on_RandomCheck_clicked() -{ - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - UpdateMode(); - - /*-----------------------------------------------------*\ - | Update mode user interface elements | - \*-----------------------------------------------------*/ - UpdateModeUi(); -} - -void OpenRGBDevicePage::on_BrightnessSlider_valueChanged(int /*value*/) -{ - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - UpdateMode(); -} - -void OpenRGBDevicePage::on_SpeedSlider_valueChanged(int /*value*/) -{ - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - UpdateMode(); -} - -void OpenRGBDevicePage::on_DirectionBox_currentIndexChanged(int /*index*/) -{ - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - UpdateMode(); -} - -void OpenRGBDevicePage::UpdateInterface() -{ - //UpdateModeUi(); - ui->DeviceViewBox->repaint(); -} - -void OpenRGBDevicePage::UpdateModeUi() -{ - /*-----------------------------------------------------*\ - | Read selected mode | - \*-----------------------------------------------------*/ - unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex(); - - /*-----------------------------------------------------*\ - | Don't update the UI if the current mode is invalid | - \*-----------------------------------------------------*/ - if(selected_mode < device->modes.size()) - { - bool supports_per_led = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_PER_LED_COLOR ); - bool supports_mode_specific = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR ); - bool supports_random = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_RANDOM_COLOR ); - bool supports_speed = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_SPEED ); - bool supports_brightness = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_BRIGHTNESS); - bool supports_dir_lr = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_DIRECTION_LR ); - bool supports_dir_ud = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_DIRECTION_UD ); - bool supports_dir_hv = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_DIRECTION_HV ); - bool per_led = device->modes[selected_mode].color_mode == MODE_COLORS_PER_LED; - bool mode_specific = device->modes[selected_mode].color_mode == MODE_COLORS_MODE_SPECIFIC; - bool random = device->modes[selected_mode].color_mode == MODE_COLORS_RANDOM; - unsigned int dir = device->modes[selected_mode].direction; - bool manual_save = ( device->modes[selected_mode].flags & MODE_FLAG_MANUAL_SAVE ); - bool automatic_save = ( device->modes[selected_mode].flags & MODE_FLAG_AUTOMATIC_SAVE ); - - if(supports_speed) - { - ui->SpeedSlider->blockSignals(true); - int current_speed; - InvertedSpeed = device->modes[selected_mode].speed_min > device->modes[selected_mode].speed_max; - - if(InvertedSpeed) - { - /*-----------------------------------------------------*\ - | If Speed Slider is inverted, invert value | - \*-----------------------------------------------------*/ - ui->SpeedSlider->setMinimum(device->modes[selected_mode].speed_max); - ui->SpeedSlider->setMaximum(device->modes[selected_mode].speed_min); - current_speed = device->modes[selected_mode].speed_min - device->modes[selected_mode].speed + device->modes[selected_mode].speed_max; - } - else - { - ui->SpeedSlider->setMinimum(device->modes[selected_mode].speed_min); - ui->SpeedSlider->setMaximum(device->modes[selected_mode].speed_max); - current_speed = device->modes[selected_mode].speed; - } - - ui->SpeedSlider->setValue(current_speed); - ui->SpeedSlider->setEnabled(true); - ui->SpeedSlider->blockSignals(false); - } - else - { - ui->SpeedSlider->blockSignals(true); - ui->SpeedSlider->setEnabled(false); - ui->SpeedSlider->blockSignals(false); - } - - if(supports_brightness) - { - ui->BrightnessSlider->blockSignals(true); - int current_brightness; - InvertedBrightness = device->modes[selected_mode].brightness_min > device->modes[selected_mode].brightness_max; - - if(InvertedBrightness) - { - /*-----------------------------------------------------*\ - | If Brightness Slider is inverted, invert value | - \*-----------------------------------------------------*/ - ui->BrightnessSlider->setMinimum(device->modes[selected_mode].brightness_max); - ui->BrightnessSlider->setMaximum(device->modes[selected_mode].brightness_min); - current_brightness = device->modes[selected_mode].brightness_min - device->modes[selected_mode].brightness + device->modes[selected_mode].brightness_max; - } - else - { - ui->BrightnessSlider->setMinimum(device->modes[selected_mode].brightness_min); - ui->BrightnessSlider->setMaximum(device->modes[selected_mode].brightness_max); - current_brightness = device->modes[selected_mode].brightness; - } - - ui->BrightnessSlider->setValue(current_brightness); - ui->BrightnessSlider->setEnabled(true); - ui->BrightnessSlider->blockSignals(false); - } - else - { - ui->BrightnessSlider->blockSignals(true); - ui->BrightnessSlider->setEnabled(false); - ui->BrightnessSlider->blockSignals(false); - } - - ui->DirectionBox->blockSignals(true); - ui->DirectionBox->clear(); - - if(supports_dir_lr) - { - ui->DirectionBox->addItem(tr("Left")); - ui->DirectionBox->addItem(tr("Right")); - } - - if(supports_dir_ud) - { - ui->DirectionBox->addItem(tr("Up")); - ui->DirectionBox->addItem(tr("Down")); - } - - if(supports_dir_hv) - { - ui->DirectionBox->addItem(tr("Horizontal")); - ui->DirectionBox->addItem(tr("Vertical")); - } - - if(supports_dir_lr || supports_dir_ud || supports_dir_hv) - { - if((supports_dir_lr) - &&((dir == MODE_DIRECTION_LEFT) - ||(dir == MODE_DIRECTION_RIGHT))) - { - ui->DirectionBox->setCurrentIndex(dir); - } - - if((supports_dir_ud) - &&((dir == MODE_DIRECTION_UP) - ||(dir == MODE_DIRECTION_DOWN))) - { - if(supports_dir_lr) - { - ui->DirectionBox->setCurrentIndex(dir); - } - else - { - ui->DirectionBox->setCurrentIndex(dir - 2); - } - } - - if((supports_dir_hv) - &&((dir == MODE_DIRECTION_HORIZONTAL) - ||(dir == MODE_DIRECTION_VERTICAL))) - { - if(supports_dir_lr && supports_dir_ud) - { - ui->DirectionBox->setCurrentIndex(dir); - } - else if(supports_dir_lr || supports_dir_ud) - { - ui->DirectionBox->setCurrentIndex(dir - 2); - } - else - { - ui->DirectionBox->setCurrentIndex(dir - 4); - } - } - - ui->DirectionBox->setEnabled(true); - } - else - { - ui->DirectionBox->setEnabled(false); - } - - ui->DirectionBox->blockSignals(false); - - if(supports_per_led) - { - ui->PerLEDCheck->setEnabled(true); - ui->PerLEDCheck->setChecked(per_led); - - if(DeviceViewShowing) - { - ui->DeviceViewBoxFrame->show(); - } - } - else - { - ui->PerLEDCheck->setEnabled(false); - ui->PerLEDCheck->setAutoExclusive(false); - ui->PerLEDCheck->setChecked(false); - ui->PerLEDCheck->setAutoExclusive(true); - ui->DeviceViewBoxFrame->hide(); - } - - if(supports_mode_specific) - { - ui->ModeSpecificCheck->setEnabled(true); - ui->ModeSpecificCheck->setChecked(mode_specific); - } - else - { - ui->ModeSpecificCheck->setEnabled(false); - ui->ModeSpecificCheck->setAutoExclusive(false); - ui->ModeSpecificCheck->setChecked(false); - ui->ModeSpecificCheck->setAutoExclusive(true); - } - - if(supports_random) - { - ui->RandomCheck->setEnabled(true); - ui->RandomCheck->setChecked(random); - } - else - { - ui->RandomCheck->setEnabled(false); - ui->RandomCheck->setAutoExclusive(false); - ui->RandomCheck->setChecked(false); - ui->RandomCheck->setAutoExclusive(true); - } - - if(automatic_save) - { - ui->DeviceSaveButton->setText(tr("Saved To Device")); - ui->DeviceSaveButton->setEnabled(false); - } - else if(manual_save) - { - ui->DeviceSaveButton->setText(tr("Save To Device")); - ui->DeviceSaveButton->setEnabled(true); - } - else - { - ui->DeviceSaveButton->setText(tr("Saving Not Supported")); - ui->DeviceSaveButton->setEnabled(false); - } - - /*-----------------------------------------------------*\ - | Fill in the zone box based on color mode | - \*-----------------------------------------------------*/ - switch(device->modes[selected_mode].color_mode) - { - case MODE_COLORS_NONE: - case MODE_COLORS_RANDOM: - ui->ZoneBox->blockSignals(true); - ui->ZoneBox->clear(); - ui->ZoneBox->blockSignals(false); - - ui->LEDBox->blockSignals(true); - ui->LEDBox->clear(); - ui->LEDBox->blockSignals(false); - - ui->EditZoneButton->setEnabled(false); - ui->ApplyColorsButton->setEnabled(false); - break; - - case MODE_COLORS_PER_LED: - ui->ZoneBox->blockSignals(true); - ui->ZoneBox->clear(); - - if(device->zones.size() > 1) - { - ui->ZoneBox->setEnabled(1); - ui->ZoneBox->addItem(tr("All Zones")); - } - else if(device->zones.size() == 1 && device->zones[0].segments.size() > 1) - { - ui->ZoneBox->setEnabled(1); - } - else - { - ui->ZoneBox->setDisabled(1); - ui->EditZoneButton->setEnabled(false); - } - - for(std::size_t zone_idx = 0; zone_idx < device->zones.size(); zone_idx++) - { - ui->ZoneBox->addItem(device->GetZoneName((unsigned int)zone_idx).c_str()); - - for(std::size_t segment_idx = 0; segment_idx < device->zones[zone_idx].segments.size(); segment_idx++) - { - ui->ZoneBox->addItem((" " + device->zones[zone_idx].segments[segment_idx].name).c_str()); - } - } - - ui->ZoneBox->setCurrentIndex(0); - ui->ZoneBox->blockSignals(false); - ui->ApplyColorsButton->setEnabled(true); - - /*-----------------------------------------------------*\ - | Update LED box | - \*-----------------------------------------------------*/ - on_ZoneBox_currentIndexChanged(0); - - /*-----------------------------------------------------*\ - | Update color picker with color of first LED | - \*-----------------------------------------------------*/ - //on_LEDBox_currentIndexChanged(0); - break; - - case MODE_COLORS_MODE_SPECIFIC: - ui->ZoneBox->blockSignals(true); - ui->ZoneBox->clear(); - ui->ZoneBox->addItem(tr("Mode Specific")); - ui->ZoneBox->blockSignals(false); - - ui->LEDBox->blockSignals(true); - ui->LEDBox->clear(); - - if(device->modes[selected_mode].colors_min == device->modes[selected_mode].colors_max) - { - ui->EditZoneButton->setEnabled(false); - } - else - { - ui->EditZoneButton->setEnabled(true); - } - - for(unsigned int i = 0; i < device->modes[selected_mode].colors.size(); i++) - { - char id_buf[32]; - // TODO: translate - snprintf(id_buf, 32, "Mode Color %u", i); - ui->LEDBox->addItem(id_buf); - } - - ui->LEDBox->setCurrentIndex(0); - on_LEDBox_currentIndexChanged(0); - ui->LEDBox->setEnabled(true); - ui->LEDBox->blockSignals(false); - ui->ApplyColorsButton->setEnabled(true); - break; - } - } -} - -void OpenRGBDevicePage::UpdateMode() -{ - /*-----------------------------------------------------*\ - | Read selected mode | - \*-----------------------------------------------------*/ - int current_mode = ui->ModeBox->currentIndex(); - - if(current_mode >= 0) - { - int current_speed = 0; - int current_brightness = 0; - bool current_per_led = ui->PerLEDCheck->isChecked(); - bool current_mode_specific = ui->ModeSpecificCheck->isChecked(); - bool current_random = ui->RandomCheck->isChecked(); - int current_dir_idx = ui->DirectionBox->currentIndex(); - int current_direction = 0; - bool supports_dir_lr = ( device->modes[(unsigned int)current_mode].flags & MODE_FLAG_HAS_DIRECTION_LR ); - bool supports_dir_ud = ( device->modes[(unsigned int)current_mode].flags & MODE_FLAG_HAS_DIRECTION_UD ); - bool supports_dir_hv = ( device->modes[(unsigned int)current_mode].flags & MODE_FLAG_HAS_DIRECTION_HV ); - - /*-----------------------------------------------------*\ - | If DirectionBox is enabled, set the direction values | - \*-----------------------------------------------------*/ - if(ui->DirectionBox->isEnabled()) - { - if(supports_dir_hv) - { - if(supports_dir_lr && supports_dir_ud) - { - current_direction = current_dir_idx; - } - else if(supports_dir_lr || supports_dir_ud) - { - current_direction = current_dir_idx + 2; - } - else - { - current_direction = current_dir_idx + 4; - } - } - - if(supports_dir_ud) - { - if(supports_dir_lr) - { - current_direction = current_dir_idx; - } - else - { - current_direction = current_dir_idx + 2; - } - } - - if((supports_dir_lr) - &&(current_dir_idx < 2)) - { - current_direction = current_dir_idx; - } - - device->modes[(unsigned int)current_mode].direction = current_direction; - } - - /*-----------------------------------------------------*\ - | If Speed Slider is enabled, read the speed value | - \*-----------------------------------------------------*/ - if(ui->SpeedSlider->isEnabled()) - { - /*-----------------------------------------------------*\ - | If Speed Slider is inverted, invert value | - \*-----------------------------------------------------*/ - if(InvertedSpeed) - { - current_speed = device->modes[(unsigned int)current_mode].speed_min - ui->SpeedSlider->value() + device->modes[current_mode].speed_max; - } - else - { - current_speed = ui->SpeedSlider->value(); - } - } - - /*-----------------------------------------------------*\ - | If Brightness Slider is enabled, read the value | - \*-----------------------------------------------------*/ - if(ui->BrightnessSlider->isEnabled()) - { - /*-----------------------------------------------------*\ - | If Brightness Slider is inverted, invert value | - \*-----------------------------------------------------*/ - if(InvertedBrightness) - { - current_brightness = device->modes[(unsigned int)current_mode].brightness_min - ui->BrightnessSlider->value() + device->modes[current_mode].brightness_max; - } - else - { - current_brightness = ui->BrightnessSlider->value(); - } - } - - /*-----------------------------------------------------*\ - | Don't set the mode if the current mode is invalid | - \*-----------------------------------------------------*/ - if((unsigned int)current_mode < device->modes.size()) - { - /*-----------------------------------------------------*\ - | Update mode parameters | - \*-----------------------------------------------------*/ - device->modes[(unsigned int)current_mode].speed = current_speed; - device->modes[(unsigned int)current_mode].brightness = current_brightness; - - if(current_per_led) - { - device->modes[(unsigned int)current_mode].color_mode = MODE_COLORS_PER_LED; - } - else if(current_mode_specific) - { - device->modes[(unsigned int)current_mode].color_mode = MODE_COLORS_MODE_SPECIFIC; - } - else if(current_random) - { - device->modes[(unsigned int)current_mode].color_mode = MODE_COLORS_RANDOM; - } - else - { - device->modes[(unsigned int)current_mode].color_mode = MODE_COLORS_NONE; - } - - /*-----------------------------------------------------*\ - | Change device mode | - \*-----------------------------------------------------*/ - device->SetMode((unsigned int)current_mode); - - if(device->modes[(unsigned int)current_mode].color_mode == MODE_COLORS_PER_LED) - { - device->UpdateLEDs(); - } - } - } -} - -void OpenRGBDevicePage::SetDevice(unsigned char red, unsigned char green, unsigned char blue) -{ - current_color.setRgb(red, green, blue); - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::UpdateDevice() -{ - ui->ModeBox->blockSignals(true); - ui->ModeBox->setCurrentIndex(device->active_mode); - ui->ModeBox->blockSignals(false); - UpdateModeUi(); - UpdateMode(); + return(device); } void OpenRGBDevicePage::SetCustomMode(unsigned char red, unsigned char green, unsigned char blue) { - RGBColor color = ToRGBColor(red, green, blue); /*-----------------------------------------------------*\ | Set the selected mode to the custom mode and update UI| \*-----------------------------------------------------*/ device->SetCustomMode(); - ui->ModeBox->blockSignals(true); - ui->ModeBox->setCurrentIndex(device->active_mode); - ui->ModeBox->blockSignals(false); + UpdateModeList(); UpdateModeUi(); /*-----------------------------------------------------*\ | Set the color boxes | \*-----------------------------------------------------*/ + RGBColor color = ToRGBColor(red, green, blue); current_color.setRgb(red, green, blue); - updateColorUi(); + UpdateColorUi(); /*-----------------------------------------------------*\ - | Read selected mode | + | Set colors for the active mode | \*-----------------------------------------------------*/ - unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex(); - - switch(device->modes[selected_mode].color_mode) + switch(device->GetModeColorMode(device->GetActiveMode())) { case MODE_COLORS_PER_LED: { - device->SetAllLEDs(color); + device->SetAllColors(color); } break; case MODE_COLORS_MODE_SPECIFIC: { - for(std::size_t i = 0; i < device->modes[selected_mode].colors.size(); i++) + for(std::size_t i = 0; i < device->GetModeColorsCount(device->GetActiveMode()); i++) { - device->modes[selected_mode].colors[i] = color; + device->SetModeColor(device->GetActiveMode(), i, color); } break; } @@ -1231,336 +171,9 @@ void OpenRGBDevicePage::SetCustomMode(unsigned char red, unsigned char green, un UpdateMode(); } -void OpenRGBDevicePage::on_SwatchBox_swatchChanged(const QColor color) -{ - /*-----------------------------------------------------*\ - | Store the swatch color to the current color QColor | - \*-----------------------------------------------------*/ - current_color = color; - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::on_ColorWheelBox_colorChanged(const QColor color) -{ - /*-----------------------------------------------------*\ - | Store the wheel color to the current color QColor | - \*-----------------------------------------------------*/ - current_color = color; - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -bool OpenRGBDevicePage::autoUpdateEnabled() -{ - return !(device->modes[device->active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE); -} - -void OpenRGBDevicePage::on_RedSpinBox_valueChanged(int red) -{ - /*-----------------------------------------------------*\ - | Update the current color QColor red channel | - \*-----------------------------------------------------*/ - current_color.setRed(red); - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::on_HueSpinBox_valueChanged(int hue) -{ - /*-----------------------------------------------------*\ - | Read the saturation and value box values | - \*-----------------------------------------------------*/ - int sat = current_color.saturation(); - int val = current_color.value(); - - /*-----------------------------------------------------*\ - | Update the current color QColor using HSV | - \*-----------------------------------------------------*/ - current_color.setHsv(hue, sat, val); - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::on_GreenSpinBox_valueChanged(int green) -{ - /*-----------------------------------------------------*\ - | Update the current color QColor green channel | - \*-----------------------------------------------------*/ - current_color.setGreen(green); - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::on_SatSpinBox_valueChanged(int sat) -{ - /*-----------------------------------------------------*\ - | Read the hue and value box values | - \*-----------------------------------------------------*/ - int hue = current_color.hue(); - int val = current_color.value(); - - /*-----------------------------------------------------*\ - | Update the current color QColor using HSV | - \*-----------------------------------------------------*/ - current_color.setHsv(hue, sat, val); - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::on_BlueSpinBox_valueChanged(int blue) -{ - /*-----------------------------------------------------*\ - | Update the current color QColor blue channel | - \*-----------------------------------------------------*/ - current_color.setBlue(blue); - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::on_ValSpinBox_valueChanged(int val) -{ - /*-----------------------------------------------------*\ - | Read the hue and saturation box values | - \*-----------------------------------------------------*/ - int hue = current_color.hue(); - int sat = current_color.saturation(); - - /*-----------------------------------------------------*\ - | Update the current color QColor using HSV | - \*-----------------------------------------------------*/ - current_color.setHsv(hue, sat, val); - - /*-----------------------------------------------------*\ - | Update the color UI | - \*-----------------------------------------------------*/ - colorChanged(); -} - -void OpenRGBDevicePage::on_HexLineEdit_textChanged(const QString &arg1) -{ - /*-----------------------------------------------------*\ - | Make an editable copy of the string | - \*-----------------------------------------------------*/ - QString temp = arg1; - - /*-----------------------------------------------------*\ - | Remove # character so that #XXXXXX color codes are | - | acceptable. 0xXXXXXX codes are already accepted by | - | toInt(). Convert into an RGBColor. Mask off the | - | unused bits. | - \*-----------------------------------------------------*/ - RGBColor color = (RGBColor)(0x00FFFFFF & temp.replace("#", "").toInt(NULL, 16)); - - /*-----------------------------------------------------*\ - | Store new color into the current color QColor | - | Because RGBColor stores color in BGR format, we have | - | to reverse the R and B channels if the hex format is | - | RGB. | - \*-----------------------------------------------------*/ - if(HexFormatRGB) - { - current_color.setRed(RGBGetBValue(color)); - current_color.setGreen(RGBGetGValue(color)); - current_color.setBlue(RGBGetRValue(color)); - } - else - { - current_color.setRed(RGBGetRValue(color)); - current_color.setGreen(RGBGetGValue(color)); - current_color.setBlue(RGBGetBValue(color)); - } - - /*-----------------------------------------------------*\ - | Update the color UI, but set the UpdateHex flag to | - | false so the hex edit box isn't updated while the user| - | is in the middle of typing a value. | - \*-----------------------------------------------------*/ - UpdateHex = false; - colorChanged(); - UpdateHex = true; -} - -void OpenRGBDevicePage::on_DeviceViewBox_selectionChanged(QVector indices) -{ - if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED) - { - ui->ZoneBox->blockSignals(true); - ui->LEDBox->blockSignals(true); - ui->ZoneBox->setCurrentIndex(0); - on_ZoneBox_currentIndexChanged(0); - //updateLeds(); // We want to update the LED box, but we don't want any of the side effects of that action - ui->ZoneBox->blockSignals(false); - if(indices.size() != 0 && size_t(indices.size()) != device->leds.size()) - { - if(indices.size() == 1) - { - if(device->leds.size() == 1) - { - ui->LEDBox->setCurrentIndex(0); - } - else - { - ui->LEDBox->setCurrentIndex(indices[0] + 1); - // Set everything to it's color - } - MultipleSelected = 0; - } - else - { - if(MultipleSelected) - { - ui->LEDBox->removeItem((int)(device->leds.size() + 1)); - } - // TODO: translate - ui->LEDBox->addItem("Multiple (" + QVariant(indices.size()).toString() + ")"); - ui->LEDBox->setCurrentIndex((int)(device->leds.size() + 1)); - MultipleSelected = 1; - } - } - else - { - ui->LEDBox->setCurrentIndex(0); - } - ui->LEDBox->blockSignals(false); - } -} - -void OpenRGBDevicePage::on_SetAllButton_clicked() -{ - emit SetAllDevices(current_color.red(), current_color.green(), current_color.blue()); -} - -void OpenRGBDevicePage::on_EditZoneButton_clicked() -{ - /*-----------------------------------------------------*\ - | Determine what is selected, either all zones, a zone, | - | or a segment | - \*-----------------------------------------------------*/ - bool selected_all_zones; - int selected_zone; - int selected_segment; - - getSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); - - switch(device->modes[device->active_mode].color_mode) - { - case MODE_COLORS_PER_LED: - { - /*-----------------------------------------*\ - | If all zones or a segment are selected, | - | the edit button should not be clickable. | - | If somehow this did get clicked, ignore. | - \*-----------------------------------------*/ - if(selected_all_zones || selected_segment != -1) - { - return; - } - - /*-----------------------------------------*\ - | Only allow resizing linear zones or | - | effects-only resizable zones | - \*-----------------------------------------*/ - if((device->zones[selected_zone].type == ZONE_TYPE_LINEAR) || (device->zones[selected_zone].flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY)) - { - OpenRGBZoneResizeDialog dlg(device, selected_zone); - - int new_size = dlg.show(); - - if(new_size >= 0) - { - /*-----------------------------------------------------*\ - | Update mode UI to update Zone box | - \*-----------------------------------------------------*/ - UpdateModeUi(); - - /*-----------------------------------------------------*\ - | Update interface to update Device View | - \*-----------------------------------------------------*/ - UpdateInterface(); - - /*-----------------------------------------------------*\ - | Update LED box | - \*-----------------------------------------------------*/ - on_ZoneBox_currentIndexChanged(selected_zone); - - /*-----------------------------------------------------*\ - | Update color picker with color of first LED | - \*-----------------------------------------------------*/ - on_LEDBox_currentIndexChanged(0); - - /*-----------------------------------------------------*\ - | Save the size profile | - \*-----------------------------------------------------*/ - SaveSizeProfile(); - } - } - } - break; - - case MODE_COLORS_MODE_SPECIFIC: - { - OpenRGBZoneResizeDialog dlg(device->modes[device->active_mode].colors_min, - device->modes[device->active_mode].colors_max, - (int)device->modes[device->active_mode].colors.size()); - - int new_size = dlg.show(); - - if(new_size > 0) - { - device->modes[device->active_mode].colors.resize(new_size); - } - - UpdateModeUi(); - UpdateMode(); - } - break; - } -} - -void OpenRGBDevicePage::ShowDeviceView() -{ - /*-----------------------------------------------------*\ - | Read selected mode | - \*-----------------------------------------------------*/ - unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex(); - - /*-----------------------------------------------------*\ - | Set device view showing flag to True | - \*-----------------------------------------------------*/ - DeviceViewShowing = true; - - /*-----------------------------------------------------*\ - | Only show device view if active mode is Per-LED and | - | device contains at least one LED | - \*-----------------------------------------------------*/ - if(device->modes[selected_mode].flags & MODE_FLAG_HAS_PER_LED_COLOR && device->leds.size() >= 1) - { - ui->DeviceViewBoxFrame->show(); - } -} - +/*---------------------------------------------------------*\ +| Device View Functions | +\*---------------------------------------------------------*/ void OpenRGBDevicePage::HideDeviceView() { /*-----------------------------------------------------*\ @@ -1574,101 +187,139 @@ void OpenRGBDevicePage::HideDeviceView() ui->DeviceViewBoxFrame->hide(); } -void OpenRGBDevicePage::on_ApplyColorsButton_clicked() +void OpenRGBDevicePage::ShowDeviceView() { /*-----------------------------------------------------*\ - | Read selected mode | + | Determine the selected mode | \*-----------------------------------------------------*/ - unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex(); + bool selected_zone_mode; + int selected_mode; - switch(device->modes[selected_mode].color_mode) + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + /*-----------------------------------------------------*\ + | Set device view showing flag to True | + \*-----------------------------------------------------*/ + DeviceViewShowing = true; + + /*-----------------------------------------------------*\ + | Only show device view if active mode is Per-LED and | + | device contains at least one LED | + \*-----------------------------------------------------*/ + if(device->GetLEDCount() > 0) + { + if(selected_zone_mode && (selected_mode >= 0)) + { + if(device->GetZoneModeFlags(selected_zone, selected_mode) & MODE_FLAG_HAS_PER_LED_COLOR) + { + ui->DeviceViewBoxFrame->show(); + } + } + else if(selected_zone_mode) + { + if(device->GetModeFlags(device->GetActiveMode()) & MODE_FLAG_HAS_PER_LED_COLOR) + { + ui->DeviceViewBoxFrame->show(); + } + } + else + { + if(device->GetModeFlags(selected_mode) & MODE_FLAG_HAS_PER_LED_COLOR) + { + ui->DeviceViewBoxFrame->show(); + } + } + } +} + +/*---------------------------------------------------------*\ +| UI Update Functions | +\*---------------------------------------------------------*/ +void OpenRGBDevicePage::UpdateColor() +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + /*-----------------------------------------------------*\ + | Get color mode of selected mode | + \*-----------------------------------------------------*/ + unsigned int color_mode; + + if(selected_zone_mode && (selected_mode >= 0)) + { + color_mode = device->GetZoneModeColorMode(selected_zone, selected_mode); + } + else if(selected_zone_mode) + { + color_mode = device->GetModeColorMode(device->GetActiveMode()); + } + else + { + color_mode = device->GetModeColorMode(selected_mode); + } + + /*-----------------------------------------------------*\ + | OpenRGB's RGBColor is stored differently than Qt's | + | qrgb type, so casting between them doesn't work | + \*-----------------------------------------------------*/ + RGBColor rgb_color = ToRGBColor(current_color.red(), current_color.green(), current_color.blue()); + + switch(color_mode) { case MODE_COLORS_PER_LED: - { - RGBColor qrgb = ToRGBColor( - current_color.red(), - current_color.green(), - current_color.blue() - ); - - ui->DeviceViewBox->setSelectionColor(qrgb); - } + ui->DeviceViewBox->setSelectionColor(rgb_color); break; case MODE_COLORS_MODE_SPECIFIC: { unsigned int index = ui->LEDBox->currentIndex(); - /*-----------------------------------------------------*\ - | Set all device LEDs to the current color | - \*-----------------------------------------------------*/ - RGBColor color = ToRGBColor( - current_color.red(), - current_color.green(), - current_color.blue() - ); - - device->modes[selected_mode].colors[index] = color; - - device->UpdateMode(); + if(selected_zone_mode && (selected_mode >= 0)) + { + device->SetZoneModeColor(selected_zone, selected_mode, index, rgb_color); + device->UpdateZoneMode(selected_zone); + } + else if(selected_zone_mode) + { + device->SetModeColor(device->GetActiveMode(), index, rgb_color); + device->UpdateMode(); + } + else + { + device->SetModeColor(selected_mode, index, rgb_color); + device->UpdateMode(); + } } break; } } -void OpenRGBDevicePage::on_SelectAllLEDsButton_clicked() -{ - if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED) - { - ui->LEDBox->setCurrentIndex(0); - on_LEDBox_currentIndexChanged(0); - ui->DeviceViewBox->repaint(); - } -} - -void OpenRGBDevicePage::on_DeviceSaveButton_clicked() -{ - if(device->modes[device->active_mode].flags & MODE_FLAG_MANUAL_SAVE) - { - device->SaveMode(); - } -} - -void OpenRGBDevicePage::colorChanged() -{ - updateColorUi(); - - if(autoUpdateEnabled()) - { - unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex(); - - /*-----------------------------------------------------------------*\ - | OpenRGB's RGBColor is stored differently than Qt's qrgb type, | - | so casting between them doesn't work | - \*-----------------------------------------------------------------*/ - RGBColor rgb_color = ToRGBColor(current_color.red(), current_color.green(), current_color.blue()); - - switch(device->modes[selected_mode].color_mode) - { - case MODE_COLORS_PER_LED: - { - ui->DeviceViewBox->setSelectionColor(rgb_color); - break; - } - - case MODE_COLORS_MODE_SPECIFIC: - { - unsigned int index = ui->LEDBox->currentIndex(); - - device->modes[selected_mode].colors[index] = rgb_color; - device->UpdateMode(); - break; - } - } - } -} - -void OpenRGBDevicePage::updateColorUi() +void OpenRGBDevicePage::UpdateColorUi() { /*-----------------------------------------------------*\ | Update colorwheel | @@ -1721,8 +372,8 @@ void OpenRGBDevicePage::updateColorUi() if(!HexFormatRGB) { color = RGBGetRValue(color) << 16 - | RGBGetGValue(color) << 8 - | RGBGetBValue(color); + | RGBGetGValue(color) << 8 + | RGBGetBValue(color); } ui->HexLineEdit->blockSignals(true); @@ -1731,7 +382,1480 @@ void OpenRGBDevicePage::updateColorUi() } } -void OpenRGBDevicePage::getSelectedZone(bool * selected_all_zones, int * selected_zone, int * selected_segment) +void OpenRGBDevicePage::UpdateDevice() +{ + ui->ModeBox->blockSignals(true); + ui->ModeBox->setCurrentIndex(device->GetActiveMode()); + ui->ModeBox->blockSignals(false); + UpdateModeUi(); + UpdateMode(); +} + +void OpenRGBDevicePage::UpdateLEDList() +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + /*-----------------------------------------------------*\ + | Update LED list based on active mode's color mode | + \*-----------------------------------------------------*/ + unsigned int color_mode; + + if(selected_zone_mode) + { + if(selected_mode >= 0) + { + color_mode = device->GetZoneModeColorMode(selected_zone, selected_mode); + } + else + { + color_mode = device->GetModeColorMode(device->GetActiveMode()); + } + } + else + { + color_mode = device->GetModeColorMode(selected_mode); + } + + switch(color_mode) + { + case MODE_COLORS_NONE: + case MODE_COLORS_RANDOM: + default: + /*---------------------------------------------*\ + | Update label | + \*---------------------------------------------*/ + ui->LEDLabel->setText("LED:"); + + /*---------------------------------------------*\ + | Disable Select All button | + \*---------------------------------------------*/ + ui->SpinBoxModeColors->setHidden(true); + ui->SpinBoxModeColors->setEnabled(false); + ui->SelectAllLEDsButton->setHidden(false); + ui->SelectAllLEDsButton->setEnabled(false); + + /*---------------------------------------------*\ + | Clear LED box | + \*---------------------------------------------*/ + ui->LEDBox->blockSignals(true); + ui->LEDBox->clear(); + + /*---------------------------------------------*\ + | Disable LED box | + \*---------------------------------------------*/ + ui->LEDBox->setEnabled(false); + ui->LEDBox->blockSignals(false); + break; + + case MODE_COLORS_PER_LED: + /*---------------------------------------------*\ + | Update label | + \*---------------------------------------------*/ + ui->LEDLabel->setText("LED:"); + + /*---------------------------------------------*\ + | Enable Select All button | + \*---------------------------------------------*/ + ui->SpinBoxModeColors->setHidden(true); + ui->SpinBoxModeColors->setEnabled(false); + ui->SelectAllLEDsButton->setHidden(false); + ui->SelectAllLEDsButton->setEnabled(true); + + /*---------------------------------------------*\ + | Clear LED box | + \*---------------------------------------------*/ + ui->LEDBox->blockSignals(true); + ui->LEDBox->clear(); + + /*---------------------------------------------*\ + | Clear multiple selected flag | + \*---------------------------------------------*/ + MultipleSelected = false; + + /*---------------------------------------------*\ + | Handle "All Zones" selected condition or | + | multiple selection condition | + \*---------------------------------------------*/ + if(selected_all_zones) + { + /*-----------------------------------------*\ + | If there are multiple LEDs, add the | + | "Entire Device" option to the LED box and | + | enable it, otherwise there is only one | + | LED so disable it | + \*-----------------------------------------*/ + if(device->GetLEDCount() > 1) + { + ui->LEDBox->addItem(tr("Entire Device")); + ui->LEDBox->setEnabled(1); + } + else + { + ui->LEDBox->setDisabled(1); + } + + /*-----------------------------------------*\ + | Fill in the LED list with all LEDs in the | + | device | + \*-----------------------------------------*/ + for(std::size_t i = 0; i < device->GetLEDCount(); i++) + { + ui->LEDBox->addItem(device->GetLEDDisplayName((unsigned int)i).c_str()); + } + + /*-----------------------------------------*\ + | Editing is not allowed when all zones are | + | selected at once | + \*-----------------------------------------*/ + ui->EditZoneButton->setEnabled(false); + + if(!ui->ZoneBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->clearSelection(); + ui->DeviceViewBox->blockSignals(false); + } + } + + /*---------------------------------------------*\ + | Handle a zone selected condition | + \*---------------------------------------------*/ + else if(selected_zone != -1 && selected_segment == -1) + { + unsigned int leds_in_zone = device->GetLEDsInZone(selected_zone); + + /*-----------------------------------------*\ + | If there are multiple LEDs, add the | + | "Entire Zone" option to the LED box and | + | enable it, otherwise there is only one | + | LED so disable it | + \*-----------------------------------------*/ + if(leds_in_zone > 1) + { + ui->LEDBox->addItem(tr("Entire Zone")); + ui->LEDBox->setEnabled(1); + } + else + { + ui->LEDBox->setDisabled(1); + } + + /*-----------------------------------------*\ + | Fill in the LED list with all LEDs in the | + | zone | + \*-----------------------------------------*/ + for(std::size_t led_idx = 0; led_idx < leds_in_zone; led_idx++) + { + ui->LEDBox->addItem(device->GetLEDName(device->GetZoneStartIndex(selected_zone) + led_idx).c_str()); + } + + /*-----------------------------------------*\ + | Enable editing if: | + | Zone has variable size | + | OR | + | Zone is LINEAR and device type is | + | LEDSTRIP | + \*-----------------------------------------*/ + bool zone_is_editable = false; + + if(device->GetZoneLEDsMin(selected_zone) != device->GetZoneLEDsMax(selected_zone)) + { + zone_is_editable = true; + } + + if((device->GetZoneType(selected_zone) == ZONE_TYPE_LINEAR) && (device->GetDeviceType() == DEVICE_TYPE_LEDSTRIP)) + { + zone_is_editable = true; + } + + ui->EditZoneButton->setEnabled(zone_is_editable); + + if(!ui->ZoneBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->selectZone(selected_zone); + ui->DeviceViewBox->blockSignals(false); + } + } + + /*---------------------------------------------*\ + | Handle a segment selected condition | + \*---------------------------------------------*/ + else if(selected_zone != -1 && selected_segment != -1) + { + /*-----------------------------------------*\ + | If there are multiple LEDs, add the | + | "Entire Segment" option to the LED box | + | and enable it, otherwise there is only | + | one LED so disable it | + \*-----------------------------------------*/ + if(device->GetZoneSegmentLEDsCount(selected_zone, selected_segment) > 1) + { + ui->LEDBox->addItem(tr("Entire Segment")); + ui->LEDBox->setEnabled(1); + } + else + { + ui->LEDBox->setDisabled(1); + } + + /*-----------------------------------------*\ + | Fill in the LED list with all LEDs in the | + | segment | + \*-----------------------------------------*/ + for(std::size_t led_idx = 0; led_idx < device->GetZoneSegmentLEDsCount(selected_zone, selected_segment); led_idx++) + { + ui->LEDBox->addItem(device->GetLEDName(device->GetZoneStartIndex(selected_zone) + device->GetZoneSegmentStartIndex(selected_zone, selected_segment) + led_idx).c_str()); + } + + /*-----------------------------------------*\ + | Editing is not allowed when a segment is | + | selected | + \*-----------------------------------------*/ + ui->EditZoneButton->setEnabled(false); + + if(!ui->ZoneBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->selectSegment(selected_zone, selected_segment); + ui->DeviceViewBox->blockSignals(false); + } + } + + /*---------------------------------------------*\ + | Enable LED box | + \*---------------------------------------------*/ + ui->LEDBox->setCurrentIndex(0); + ui->LEDBox->blockSignals(false); + break; + + case MODE_COLORS_MODE_SPECIFIC: + { + /*-----------------------------------------*\ + | Update label | + \*-----------------------------------------*/ + ui->LEDLabel->setText("Color:"); + + /*-----------------------------------------*\ + | Get mode colors information | + \*-----------------------------------------*/ + unsigned int mode_colors_min; + unsigned int mode_colors_max; + unsigned int mode_colors; + + if(selected_zone_mode && (selected_mode >= 0)) + { + mode_colors_min = device->GetZoneModeColorsMin(selected_zone, selected_mode); + mode_colors_max = device->GetZoneModeColorsMax(selected_zone, selected_mode); + mode_colors = device->GetZoneModeColorsCount(selected_zone, selected_mode); + } + else if(selected_zone_mode) + { + mode_colors_min = device->GetModeColorsMin(device->GetActiveMode()); + mode_colors_max = device->GetModeColorsMax(device->GetActiveMode()); + mode_colors = device->GetModeColorsCount(device->GetActiveMode()); + } + else + { + mode_colors_min = device->GetModeColorsMin(selected_mode); + mode_colors_max = device->GetModeColorsMax(selected_mode); + mode_colors = device->GetModeColorsCount(selected_mode); + } + + ui->SpinBoxModeColors->setMinimum(mode_colors_min); + ui->SpinBoxModeColors->setMaximum(mode_colors_max); + ui->SpinBoxModeColors->setValue(mode_colors); + + /*-----------------------------------------*\ + | Swap Select ALl button for Mode Colors | + \*-----------------------------------------*/ + ui->SelectAllLEDsButton->setHidden(true); + ui->SelectAllLEDsButton->setEnabled(false); + ui->SpinBoxModeColors->setHidden(false); + ui->SpinBoxModeColors->setEnabled(true); + + /*-----------------------------------------*\ + | Clear LED box | + \*-----------------------------------------*/ + ui->LEDBox->blockSignals(true); + ui->LEDBox->clear(); + + /*-----------------------------------------*\ + | Add entries for each mode-specific color | + \*-----------------------------------------*/ + for(unsigned int i = 0; i < mode_colors; i++) + { + char id_buf[64]; + + snprintf(id_buf, 32, "Mode-Specific Color %u", i); + ui->LEDBox->addItem(id_buf); + } + + /*-----------------------------------------*\ + | Enable LED box | + \*-----------------------------------------*/ + ui->LEDBox->setCurrentIndex(0); + ui->LEDBox->setEnabled(true); + ui->LEDBox->blockSignals(false); + } + break; + } +} + +void OpenRGBDevicePage::UpdateLEDUi() +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + /*-----------------------------------------------------*\ + | Read selected LED | + \*-----------------------------------------------------*/ + int index = ui->LEDBox->currentIndex(); + + /*-----------------------------------------------------*\ + | Process LED UI based on color mode | + \*-----------------------------------------------------*/ + unsigned int color_mode; + + if(selected_zone_mode) + { + if(selected_mode >= 0) + { + color_mode = device->GetZoneModeColorMode(selected_zone, selected_mode); + } + else + { + color_mode = device->GetModeColorMode(device->GetActiveMode()); + } + } + else + { + color_mode = device->GetModeColorMode(selected_mode); + } + + switch(color_mode) + { + case MODE_COLORS_PER_LED: + { + /*-----------------------------------------*\ + | Initialize both selected zone and segment | + | to -1 to indicate there is no selection | + \*-----------------------------------------*/ + bool selected_all_leds = false; + int selected_led = -1; + + /*-----------------------------------------*\ + | Handle selection of "Entire Device/Zone/ | + | Segment" index is selected | + | | + | There should always be an Entire index as | + | long as the LED box is enabled | + \*-----------------------------------------*/ + if(index == 0) + { + selected_all_leds = true; + } + /*-----------------------------------------*\ + | Determine selected LED if "Entire Device/ | + | Zone/Segment" is not selected | + \*-----------------------------------------*/ + else + { + selected_led = index - 1; + } + + /*-----------------------------------------*\ + | Initialize variables | + \*-----------------------------------------*/ + bool multiple = (std::size_t(selected_led) == (device->GetLEDCount() + 1)); + RGBColor color = 0x00000000; + bool updateColor = false; + + /*-----------------------------------------*\ + | Remove multiple selection | + \*-----------------------------------------*/ + if(MultipleSelected) + { + ui->LEDBox->removeItem((int)(device->GetLEDCount() + 1)); + } + + MultipleSelected = false; + + /*-----------------------------------------*\ + | Handle "All Zones" selected condition | + \*-----------------------------------------*/ + if(selected_all_zones) + { + /*-------------------------------------*\ + | Handle Entire Device selection | + \*-------------------------------------*/ + if(selected_all_leds) + { + if(!ui->LEDBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->clearSelection(); + ui->DeviceViewBox->blockSignals(false); + } + } + + /*-------------------------------------*\ + | Handle single selected LED | + \*-------------------------------------*/ + if((device->GetLEDCount() == 1 || selected_led != -1) && !multiple) + { + /*---------------------------------*\ + | Get selected LED's current color | + \*---------------------------------*/ + color = device->GetColor(selected_led); + + /*---------------------------------*\ + | Set update color flag | + \*---------------------------------*/ + updateColor = true; + + /*---------------------------------*\ + | Select LED in device view | + \*---------------------------------*/ + if(!ui->LEDBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->selectLed(selected_led); + ui->DeviceViewBox->blockSignals(false); + } + } + } + /*-----------------------------------------*\ + | Handle a zone selected condition | + \*-----------------------------------------*/ + else if(selected_zone != -1 && selected_segment == -1) + { + /*-------------------------------------*\ + | Handle Entire Zone selection | + \*-------------------------------------*/ + if(selected_all_leds) + { + if(!ui->LEDBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->selectZone(selected_zone); + ui->DeviceViewBox->blockSignals(false); + } + } + + /*-------------------------------------*\ + | Handle single selected LED | + \*-------------------------------------*/ + if(device->GetLEDsInZone(selected_zone) == 1 || selected_led != -1) + { + if((unsigned int)selected_led < device->GetLEDsInZone(selected_zone)) + { + /*-----------------------------*\ + | Get selected LED's current | + | color | + \*-----------------------------*/ + color = device->GetZoneColor(selected_zone, selected_led); + + /*-----------------------------*\ + | Set update color flag | + \*-----------------------------*/ + updateColor = true; + + /*-----------------------------*\ + | Set global index | + \*-----------------------------*/ + int globalIndex = device->GetZoneStartIndex(selected_zone) + selected_led; + + /*-----------------------------*\ + | Select LED in device view | + \*-----------------------------*/ + if(!ui->LEDBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->selectLed(globalIndex); + ui->DeviceViewBox->blockSignals(false); + } + } + } + } + /*-----------------------------------------*\ + | Handle a segment selected condition | + \*-----------------------------------------*/ + else if(selected_zone != -1 && selected_segment != -1) + { + /*-------------------------------------*\ + | Handle Entire Zone selection | + \*-------------------------------------*/ + if(selected_all_leds) + { + if(!ui->LEDBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->selectSegment(selected_zone, selected_segment); + ui->DeviceViewBox->blockSignals(false); + } + } + + /*-------------------------------------*\ + | Handle single selected LED | + \*-------------------------------------*/ + if(device->GetZoneSegmentLEDsCount(selected_zone, selected_segment) == 1 || selected_led != -1) + { + if((unsigned int)selected_led < device->GetZoneSegmentLEDsCount(selected_zone, selected_segment)) + { + /*-----------------------------*\ + | Get selected LED's current | + | color | + \*-----------------------------*/ + color = device->GetZoneColor(selected_zone, (selected_led + device->GetZoneSegmentStartIndex(selected_zone, selected_segment))); + + /*-----------------------------*\ + | Set update color flag | + \*-----------------------------*/ + updateColor = true; + + /*-----------------------------*\ + | Set global index | + \*-----------------------------*/ + int globalIndex = device->GetZoneStartIndex(selected_zone) + selected_led + device->GetZoneSegmentStartIndex(selected_zone, selected_segment); + + /*-----------------------------*\ + | Select LED in device view | + \*-----------------------------*/ + if(!ui->LEDBox->signalsBlocked()) + { + ui->DeviceViewBox->blockSignals(true); + ui->DeviceViewBox->selectLed(globalIndex); + ui->DeviceViewBox->blockSignals(false); + } + } + } + } + + /*-----------------------------------------*\ + | Update color picker with color of | + | selected LED | + \*-----------------------------------------*/ + if(updateColor) + { + current_color.setRgb(RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color)); + + UpdateColorUi(); + } + + /*-----------------------------------------*\ + | Update Device View | + \*-----------------------------------------*/ + ui->DeviceViewBox->repaint(); + } + break; + + case MODE_COLORS_MODE_SPECIFIC: + { + /*-----------------------------------------*\ + | Update color picker with color of | + | selected | + \*-----------------------------------------*/ + RGBColor color; + + if(selected_zone_mode && (selected_mode >= 0)) + { + color = device->GetZoneModeColor(selected_zone, selected_mode, index); + } + else if(selected_zone_mode) + { + color = device->GetModeColor(device->GetActiveMode(), index); + } + else + { + color = device->GetModeColor(selected_mode, index); + } + + current_color.setRgb(RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color)); + + UpdateColorUi(); + } + break; + default: + current_color.setRgb(0, 0, 0); + UpdateColorUi(); + break; + + } +} + +void OpenRGBDevicePage::UpdateMode() +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + if(selected_zone_mode && selected_mode < 0) + { + device->SetZoneActiveMode(selected_zone, -1); + } + else if(selected_mode >= 0) + { + int current_speed = 0; + int current_brightness = 0; + bool current_per_led = ui->PerLEDCheck->isChecked(); + bool current_mode_specific = ui->ModeSpecificCheck->isChecked(); + bool current_random = ui->RandomCheck->isChecked(); + int current_dir_idx = ui->DirectionBox->currentIndex(); + int current_direction = 0; + bool supports_dir_lr = 0; + bool supports_dir_ud = 0; + bool supports_dir_hv = 0; + + if(selected_zone_mode) + { + supports_dir_lr = ( device->GetZoneModeFlags(selected_zone, (unsigned int)selected_mode) & MODE_FLAG_HAS_DIRECTION_LR ); + supports_dir_ud = ( device->GetZoneModeFlags(selected_zone, (unsigned int)selected_mode) & MODE_FLAG_HAS_DIRECTION_UD ); + supports_dir_hv = ( device->GetZoneModeFlags(selected_zone, (unsigned int)selected_mode) & MODE_FLAG_HAS_DIRECTION_HV ); + } + else + { + supports_dir_lr = ( device->GetModeFlags((unsigned int)selected_mode) & MODE_FLAG_HAS_DIRECTION_LR ); + supports_dir_ud = ( device->GetModeFlags((unsigned int)selected_mode) & MODE_FLAG_HAS_DIRECTION_UD ); + supports_dir_hv = ( device->GetModeFlags((unsigned int)selected_mode) & MODE_FLAG_HAS_DIRECTION_HV ); + } + + /*-----------------------------------------------------*\ + | If DirectionBox is enabled, set the direction values | + \*-----------------------------------------------------*/ + if(ui->DirectionBox->isEnabled()) + { + if(supports_dir_hv) + { + if(supports_dir_lr && supports_dir_ud) + { + current_direction = current_dir_idx; + } + else if(supports_dir_lr || supports_dir_ud) + { + current_direction = current_dir_idx + 2; + } + else + { + current_direction = current_dir_idx + 4; + } + } + + if(supports_dir_ud) + { + if(supports_dir_lr) + { + current_direction = current_dir_idx; + } + else + { + current_direction = current_dir_idx + 2; + } + } + + if((supports_dir_lr) + &&(current_dir_idx < 2)) + { + current_direction = current_dir_idx; + } + + if(selected_zone_mode) + { + device->SetZoneModeDirection(selected_zone, (unsigned int)selected_mode, current_direction); + } + else + { + device->SetModeDirection((unsigned int)selected_mode, current_direction); + } + } + + /*-----------------------------------------------------*\ + | If Speed Slider is enabled, read the speed value | + \*-----------------------------------------------------*/ + if(ui->SpeedSlider->isEnabled()) + { + /*-----------------------------------------------------*\ + | If Speed Slider is inverted, invert value | + \*-----------------------------------------------------*/ + if(InvertedSpeed) + { + if(selected_zone_mode) + { + current_speed = device->GetZoneModeSpeedMin(selected_zone, (unsigned int)selected_mode) - ui->SpeedSlider->value() + device->GetZoneModeSpeedMax(selected_zone, (unsigned int)selected_mode); + } + else + { + current_speed = device->GetModeSpeedMin((unsigned int)selected_mode) - ui->SpeedSlider->value() + device->GetModeSpeedMax((unsigned int)selected_mode); + } + } + else + { + current_speed = ui->SpeedSlider->value(); + } + } + + /*-----------------------------------------------------*\ + | If Brightness Slider is enabled, read the value | + \*-----------------------------------------------------*/ + if(ui->BrightnessSlider->isEnabled()) + { + /*-----------------------------------------------------*\ + | If Brightness Slider is inverted, invert value | + \*-----------------------------------------------------*/ + if(InvertedBrightness) + { + if(selected_zone_mode) + { + current_brightness = device->GetZoneModeBrightnessMin(selected_zone, (unsigned int)selected_mode) - ui->BrightnessSlider->value() + device->GetZoneModeBrightnessMax(selected_zone, (unsigned int)selected_mode); + } + else + { + current_brightness = device->GetModeBrightnessMin((unsigned int)selected_mode) - ui->BrightnessSlider->value() + device->GetModeBrightnessMax((unsigned int)selected_mode); + } + } + else + { + current_brightness = ui->BrightnessSlider->value(); + } + } + + /*-----------------------------------------------------*\ + | Don't set the mode if the current mode is invalid | + \*-----------------------------------------------------*/ + std::size_t mode_count = 0; + + if(selected_zone_mode) + { + mode_count = device->GetZoneModeCount(selected_zone); + } + else + { + mode_count = device->GetModeCount(); + } + + if((std::size_t)selected_mode < mode_count) + { + /*-----------------------------------------------------*\ + | Update mode parameters | + \*-----------------------------------------------------*/ + if(selected_zone_mode) + { + device->SetZoneModeSpeed(selected_zone, (unsigned int)selected_mode, current_speed); + device->SetZoneModeBrightness(selected_zone, (unsigned int)selected_mode, current_brightness); + + if(current_per_led) + { + device->SetZoneModeColorMode(selected_zone, (unsigned int)selected_mode, MODE_COLORS_PER_LED); + } + else if(current_mode_specific) + { + device->SetZoneModeColorMode(selected_zone, (unsigned int)selected_mode, MODE_COLORS_MODE_SPECIFIC); + } + else if(current_random) + { + device->SetZoneModeColorMode(selected_zone, (unsigned int)selected_mode, MODE_COLORS_RANDOM); + } + else + { + device->SetZoneModeColorMode(selected_zone, (unsigned int)selected_mode, MODE_COLORS_NONE); + } + + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + device->SetZoneActiveMode(selected_zone, (unsigned int)selected_mode); + + if(device->GetZoneModeColorMode(selected_zone, (unsigned int)selected_mode) == MODE_COLORS_PER_LED) + { + device->UpdateZoneLEDs(selected_zone); + } + } + else + { + device->SetModeSpeed((unsigned int)selected_mode, current_speed); + device->SetModeBrightness((unsigned int)selected_mode, current_brightness); + + if(current_per_led) + { + device->SetModeColorMode((unsigned int)selected_mode, MODE_COLORS_PER_LED); + } + else if(current_mode_specific) + { + device->SetModeColorMode((unsigned int)selected_mode, MODE_COLORS_MODE_SPECIFIC); + } + else if(current_random) + { + device->SetModeColorMode((unsigned int)selected_mode, MODE_COLORS_RANDOM); + } + else + { + device->SetModeColorMode((unsigned int)selected_mode, MODE_COLORS_NONE); + } + + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + device->SetActiveMode((unsigned int)selected_mode); + + if(device->GetModeColorMode((unsigned int)selected_mode) == MODE_COLORS_PER_LED) + { + device->UpdateLEDs(); + } + } + } + } +} + +void OpenRGBDevicePage::UpdateModeList() +{ + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + /*-----------------------------------------------------*\ + | Fill in the mode list | + | If the device supports per-zone modes and a zone is | + | selected, add a default option | + \*-----------------------------------------------------*/ + ui->ModeBox->blockSignals(true); + ui->ModeBox->clear(); + + std::size_t entry_count = 0; + + if(!selected_all_zones && !(device->GetModeFlags(device->GetActiveMode()) & MODE_FLAG_REQUIRES_ENTIRE_DEVICE) && (selected_zone >= 0) && device->SupportsPerZoneModes()) + { + ui->ModeBox->addItem("Follow Device Mode"); + ui->ModeBox->setItemData((int)entry_count, "Follow the device's global mode", Qt::ToolTipRole); + + entry_count++; + + for(std::size_t i = 0; i < device->GetZoneModeCount(selected_zone); i++) + { + ui->ModeBox->addItem(device->GetZoneModeName(selected_zone, (unsigned int)i).c_str()); + ui->ModeBox->setItemData((int)entry_count, ModeDescription(device->GetZoneModeName(selected_zone, i)), Qt::ToolTipRole); + + entry_count++; + } + + ui->ModeBox->setCurrentIndex(device->GetZoneActiveMode(selected_zone) + 1); + ui->ModeBox->setEnabled(true); + } + else + { + for(std::size_t i = 0; i < device->GetModeCount(); i++) + { + ui->ModeBox->addItem(device->GetModeName((unsigned int)i).c_str()); + ui->ModeBox->setItemData((int)entry_count, ModeDescription(device->GetModeName(i)), Qt::ToolTipRole); + + entry_count++; + } + + ui->ModeBox->setCurrentIndex(device->GetActiveMode()); + ui->ModeBox->setEnabled(selected_all_zones); + } + + ui->ModeBox->blockSignals(false); +} + +void OpenRGBDevicePage::UpdateModeUi() +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + /*-----------------------------------------------------*\ + | Read mode variables | + \*-----------------------------------------------------*/ + bool enable_controls; + unsigned int brightness; + unsigned int brightness_min; + unsigned int brightness_max; + unsigned int color_mode; + unsigned int direction; + unsigned int flags; + unsigned int speed; + unsigned int speed_min; + unsigned int speed_max; + + if(selected_zone_mode) + { + if((selected_mode >= 0) && (selected_mode < (int)device->GetZoneModeCount(selected_zone))) + { + enable_controls = true; + brightness = device->GetZoneModeBrightness(selected_zone, selected_mode); + brightness_min = device->GetZoneModeBrightnessMin(selected_zone, selected_mode); + brightness_max = device->GetZoneModeBrightnessMax(selected_zone, selected_mode); + color_mode = device->GetZoneModeColorMode(selected_zone, selected_mode); + direction = device->GetZoneModeDirection(selected_zone, selected_mode); + flags = device->GetZoneModeFlags(selected_zone, selected_mode); + speed = device->GetZoneModeSpeed(selected_zone, selected_mode); + speed_min = device->GetZoneModeSpeedMin(selected_zone, selected_mode); + speed_max = device->GetZoneModeSpeedMax(selected_zone, selected_mode); + } + else + { + enable_controls = false; + brightness = 0; + brightness_min = 0; + brightness_max = 0; + color_mode = 0; + direction = 0; + flags = 0; + speed = 0; + speed_min = 0; + speed_max = 0; + } + } + else if(selected_mode < (int)device->GetModeCount()) + { + enable_controls = selected_all_zones; + brightness = device->GetModeBrightness(selected_mode); + brightness_min = device->GetModeBrightnessMin(selected_mode); + brightness_max = device->GetModeBrightnessMax(selected_mode); + color_mode = device->GetModeColorMode(selected_mode); + direction = device->GetModeDirection(selected_mode); + flags = device->GetModeFlags(selected_mode); + speed = device->GetModeSpeed(selected_mode); + speed_min = device->GetModeSpeedMin(selected_mode); + speed_max = device->GetModeSpeedMax(selected_mode); + } + else + { + /*-------------------------------------------------*\ + | Don't update the UI if the current mode is invalid| + \*-------------------------------------------------*/ + return; + } + + /*-----------------------------------------------------*\ + | Read mode flags | + \*-----------------------------------------------------*/ + bool supports_per_led = flags & MODE_FLAG_HAS_PER_LED_COLOR; + bool supports_mode_specific = flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR; + bool supports_random = flags & MODE_FLAG_HAS_RANDOM_COLOR; + bool supports_speed = flags & MODE_FLAG_HAS_SPEED; + bool supports_brightness = flags & MODE_FLAG_HAS_BRIGHTNESS; + bool supports_dir_lr = flags & MODE_FLAG_HAS_DIRECTION_LR; + bool supports_dir_ud = flags & MODE_FLAG_HAS_DIRECTION_UD; + bool supports_dir_hv = flags & MODE_FLAG_HAS_DIRECTION_HV; + bool per_led = color_mode == MODE_COLORS_PER_LED; + bool mode_specific = color_mode == MODE_COLORS_MODE_SPECIFIC; + bool random = color_mode == MODE_COLORS_RANDOM; + bool manual_save = flags & MODE_FLAG_MANUAL_SAVE; + bool automatic_save = flags & MODE_FLAG_AUTOMATIC_SAVE; + + if(supports_speed) + { + ui->SpeedSlider->blockSignals(true); + int current_speed; + InvertedSpeed = speed_min > speed_max; + + if(InvertedSpeed) + { + /*-----------------------------------------------------*\ + | If Speed Slider is inverted, invert value | + \*-----------------------------------------------------*/ + ui->SpeedSlider->setMinimum(speed_max); + ui->SpeedSlider->setMaximum(speed_min); + current_speed = speed_min - speed + speed_max; + } + else + { + ui->SpeedSlider->setMinimum(speed_min); + ui->SpeedSlider->setMaximum(speed_max); + current_speed = speed; + } + + ui->SpeedSlider->setValue(current_speed); + ui->SpeedSlider->setEnabled(enable_controls); + ui->SpeedSlider->blockSignals(false); + } + else + { + ui->SpeedSlider->blockSignals(true); + ui->SpeedSlider->setEnabled(false); + ui->SpeedSlider->blockSignals(false); + } + + if(supports_brightness) + { + ui->BrightnessSlider->blockSignals(true); + int current_brightness; + InvertedBrightness = brightness_min > brightness_max; + + if(InvertedBrightness) + { + /*-----------------------------------------------------*\ + | If Brightness Slider is inverted, invert value | + \*-----------------------------------------------------*/ + ui->BrightnessSlider->setMinimum(brightness_max); + ui->BrightnessSlider->setMaximum(brightness_min); + current_brightness = brightness_min - brightness + brightness_max; + } + else + { + ui->BrightnessSlider->setMinimum(brightness_min); + ui->BrightnessSlider->setMaximum(brightness_max); + current_brightness = brightness; + } + + ui->BrightnessSlider->setValue(current_brightness); + ui->BrightnessSlider->setEnabled(enable_controls); + ui->BrightnessSlider->blockSignals(false); + } + else + { + ui->BrightnessSlider->blockSignals(true); + ui->BrightnessSlider->setEnabled(false); + ui->BrightnessSlider->blockSignals(false); + } + + ui->DirectionBox->blockSignals(true); + ui->DirectionBox->clear(); + + if(supports_dir_lr) + { + ui->DirectionBox->addItem(tr("Left")); + ui->DirectionBox->addItem(tr("Right")); + } + + if(supports_dir_ud) + { + ui->DirectionBox->addItem(tr("Up")); + ui->DirectionBox->addItem(tr("Down")); + } + + if(supports_dir_hv) + { + ui->DirectionBox->addItem(tr("Horizontal")); + ui->DirectionBox->addItem(tr("Vertical")); + } + + if(supports_dir_lr || supports_dir_ud || supports_dir_hv) + { + if((supports_dir_lr) + &&((direction == MODE_DIRECTION_LEFT) + ||(direction == MODE_DIRECTION_RIGHT))) + { + ui->DirectionBox->setCurrentIndex(direction); + } + + if((supports_dir_ud) + &&((direction == MODE_DIRECTION_UP) + ||(direction == MODE_DIRECTION_DOWN))) + { + if(supports_dir_lr) + { + ui->DirectionBox->setCurrentIndex(direction); + } + else + { + ui->DirectionBox->setCurrentIndex(direction - 2); + } + } + + if((supports_dir_hv) + &&((direction == MODE_DIRECTION_HORIZONTAL) + ||(direction == MODE_DIRECTION_VERTICAL))) + { + if(supports_dir_lr && supports_dir_ud) + { + ui->DirectionBox->setCurrentIndex(direction); + } + else if(supports_dir_lr || supports_dir_ud) + { + ui->DirectionBox->setCurrentIndex(direction - 2); + } + else + { + ui->DirectionBox->setCurrentIndex(direction - 4); + } + } + + ui->DirectionBox->setEnabled(enable_controls); + } + else + { + ui->DirectionBox->setEnabled(false); + } + + ui->DirectionBox->blockSignals(false); + + if(supports_per_led) + { + ui->PerLEDCheck->setEnabled(enable_controls); + ui->PerLEDCheck->setChecked(per_led); + + if(DeviceViewShowing) + { + ui->DeviceViewBoxFrame->show(); + } + } + else + { + ui->PerLEDCheck->setEnabled(false); + ui->PerLEDCheck->setAutoExclusive(false); + ui->PerLEDCheck->setChecked(false); + ui->PerLEDCheck->setAutoExclusive(true); + ui->DeviceViewBoxFrame->hide(); + } + + if(supports_mode_specific) + { + ui->ModeSpecificCheck->setEnabled(enable_controls); + ui->ModeSpecificCheck->setChecked(mode_specific); + } + else + { + ui->ModeSpecificCheck->setEnabled(false); + ui->ModeSpecificCheck->setAutoExclusive(false); + ui->ModeSpecificCheck->setChecked(false); + ui->ModeSpecificCheck->setAutoExclusive(true); + } + + if(supports_random) + { + ui->RandomCheck->setEnabled(enable_controls); + ui->RandomCheck->setChecked(random); + } + else + { + ui->RandomCheck->setEnabled(false); + ui->RandomCheck->setAutoExclusive(false); + ui->RandomCheck->setChecked(false); + ui->RandomCheck->setAutoExclusive(true); + } + + if(automatic_save) + { + ui->DeviceSaveButton->setText(tr("Saved To Device")); + ui->DeviceSaveButton->setEnabled(false); + } + else if(manual_save) + { + ui->DeviceSaveButton->setText(tr("Save To Device")); + ui->DeviceSaveButton->setEnabled(enable_controls); + } + else + { + ui->DeviceSaveButton->setText(tr("Saving Not Supported")); + ui->DeviceSaveButton->setEnabled(false); + } + + /*-----------------------------------------------------*\ + | Enable the Apply Colors button if a mode with colors | + | is selected and automatic updates are not enabled | + \*-----------------------------------------------------*/ + if(supports_mode_specific || supports_per_led) + { + ui->ApplyColorsButton->setEnabled(enable_controls && (!AutoUpdateEnabled())); + } + else + { + ui->ApplyColorsButton->setEnabled(false); + } + + /*-----------------------------------------------------*\ + | Enable the Set All Colors button if the selected mode | + | is "Direct", "Custom", or "Static" | + \*-----------------------------------------------------*/ + std::string selected_mode_string; + + if(!selected_zone_mode) + { + selected_mode_string = device->GetModeName(selected_mode); + } + else if(selected_zone_mode && (selected_mode >= 0)) + { + selected_mode_string = device->GetZoneModeName(selected_zone, selected_mode); + } + + ui->SetAllButton->setDisabled((selected_mode_string != "Direct") && (selected_mode_string != "Custom") && (selected_mode_string != "Static")); + +#if 0 + /*-----------------------------------------------------*\ + | Fill in the zone box based on color mode | + \*-----------------------------------------------------*/ + switch(color_mode) + { + case MODE_COLORS_NONE: + case MODE_COLORS_RANDOM: + ui->ZoneBox->blockSignals(true); + ui->ZoneBox->clear(); + ui->ZoneBox->blockSignals(false); + + ui->LEDBox->blockSignals(true); + ui->LEDBox->clear(); + ui->LEDBox->blockSignals(false); + + ui->EditZoneButton->setEnabled(false); + ui->ApplyColorsButton->setEnabled(false); + break; + + case MODE_COLORS_PER_LED: + ui->ZoneBox->blockSignals(true); + ui->ZoneBox->clear(); + + if(device->GetZoneCount() > 1) + { + ui->ZoneBox->setEnabled(1); + ui->ZoneBox->addItem(tr("All Zones")); + } + else if(device->GetZoneCount() == 1 && device->GetZoneSegmentCount(0) > 1) + { + ui->ZoneBox->setEnabled(1); + } + else + { + ui->ZoneBox->setDisabled(1); + ui->EditZoneButton->setEnabled(false); + } + + for(std::size_t zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) + { + ui->ZoneBox->addItem(device->GetZoneName((unsigned int)zone_idx).c_str()); + + for(std::size_t segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) + { + ui->ZoneBox->addItem((" " + device->GetZoneSegmentName(zone_idx, segment_idx)).c_str()); + } + } + + ui->ZoneBox->setCurrentIndex(0); + ui->ZoneBox->blockSignals(false); + ui->ApplyColorsButton->setEnabled(true); + + /*-----------------------------------------------------*\ + | Update LED box | + \*-----------------------------------------------------*/ + on_ZoneBox_currentIndexChanged(0); + + /*-----------------------------------------------------*\ + | Update color picker with color of first LED | + \*-----------------------------------------------------*/ + //on_LEDBox_currentIndexChanged(0); + break; + + case MODE_COLORS_MODE_SPECIFIC: + ui->ZoneBox->blockSignals(true); + ui->ZoneBox->clear(); + ui->ZoneBox->addItem(tr("Mode Specific")); + ui->ZoneBox->blockSignals(false); + + int led_index = ui->LEDBox->currentIndex(); + + ui->LEDBox->blockSignals(true); + ui->LEDBox->clear(); + + if(device->GetModeColorsMin(selected_mode) == device->GetModeColorsMax(selected_mode)) + { + ui->EditZoneButton->setEnabled(false); + } + else + { + ui->EditZoneButton->setEnabled(true); + } + + for(unsigned int i = 0; i < device->GetModeColorsCount(selected_mode); i++) + { + char id_buf[32]; + // TODO: translate + snprintf(id_buf, 32, "Mode Color %u", i); + ui->LEDBox->addItem(id_buf); + } + + if(led_index >= ui->LEDBox->count()) + { + led_index = 0; + } + + ui->LEDBox->setCurrentIndex(led_index); + on_LEDBox_currentIndexChanged(led_index); + ui->LEDBox->setEnabled(true); + ui->LEDBox->blockSignals(false); + ui->ApplyColorsButton->setEnabled(true); + break; + } +#endif +} + +void OpenRGBDevicePage::UpdateZoneList() +{ + ui->ZoneBox->blockSignals(true); + ui->ZoneBox->clear(); + + if(device->GetZoneCount() > 1) + { + ui->ZoneBox->setEnabled(1); + ui->ZoneBox->addItem(tr("Entire Device")); + } + else if(device->GetZoneCount() == 1 && device->GetZoneSegmentCount(0) > 1) + { + ui->ZoneBox->setEnabled(1); + } + else + { + ui->ZoneBox->setDisabled(1); + ui->EditZoneButton->setEnabled(false); + } + + for(std::size_t zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) + { + ui->ZoneBox->addItem(device->GetZoneName((unsigned int)zone_idx).c_str()); + + for(std::size_t segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) + { + ui->ZoneBox->addItem((" " + device->GetZoneSegmentName(zone_idx, segment_idx)).c_str()); + } + } + + ui->ZoneBox->setCurrentIndex(0); + ui->ZoneBox->blockSignals(false); + ui->ApplyColorsButton->setEnabled(true); + + /*-----------------------------------------------------*\ + | Update color picker with color of first LED | + \*-----------------------------------------------------*/ + //on_LEDBox_currentIndexChanged(0); +} + +/*---------------------------------------------------------*\ +| Helper functions | +\*---------------------------------------------------------*/ +bool OpenRGBDevicePage::AutoUpdateEnabled() +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + if(selected_zone_mode && (selected_mode >= 0)) + { + return(!(device->GetZoneModeFlags(selected_zone, selected_mode) & MODE_FLAG_AUTOMATIC_SAVE)); + } + else if(selected_zone_mode) + { + return(!(device->GetModeFlags(device->GetActiveMode()) & MODE_FLAG_AUTOMATIC_SAVE)); + } + else + { + return(!(device->GetModeFlags(selected_mode) & MODE_FLAG_AUTOMATIC_SAVE)); + } +} + +void OpenRGBDevicePage::ColorChanged() +{ + UpdateColorUi(); + + if(AutoUpdateEnabled()) + { + UpdateColor(); + } +} + +void OpenRGBDevicePage::GetSelectedMode(bool * selected_zone_mode, int * selected_mode) +{ + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + if(selected_all_zones || !device->SupportsPerZoneModes() || (device->GetModeFlags(device->GetActiveMode()) & MODE_FLAG_REQUIRES_ENTIRE_DEVICE)) + { + *selected_zone_mode = false; + *selected_mode = ui->ModeBox->currentIndex(); + } + else + { + *selected_zone_mode = true; + *selected_mode = ui->ModeBox->currentIndex() - 1; + } +} + +void OpenRGBDevicePage::GetSelectedZone(bool * selected_all_zones, int * selected_zone, int * selected_segment) { /*-----------------------------------------------------*\ | Get the current index of the zone box | @@ -1752,7 +1876,7 @@ void OpenRGBDevicePage::getSelectedZone(bool * selected_all_zones, int * selecte | which adds an "All Zones" entry to the Zone menu in | | the first index | \*-----------------------------------------------------*/ - if(device->zones.size() > 1) + if(device->GetZoneCount() > 1) { if(index == current_index) { @@ -1764,7 +1888,7 @@ void OpenRGBDevicePage::getSelectedZone(bool * selected_all_zones, int * selecte if(!(*selected_all_zones)) { - for(std::size_t zone_idx = 0; zone_idx < device->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) { if(index == (int)current_index) { @@ -1774,7 +1898,7 @@ void OpenRGBDevicePage::getSelectedZone(bool * selected_all_zones, int * selecte current_index++; - for(std::size_t segment_idx = 0; segment_idx < device->zones[zone_idx].segments.size(); segment_idx++) + for(std::size_t segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) { if(index == (int)current_index) { @@ -1791,5 +1915,678 @@ void OpenRGBDevicePage::getSelectedZone(bool * selected_all_zones, int * selecte break; } } + + if((*selected_segment == -1) && (device->GetZoneCount() <= 1)) + { + *selected_all_zones = true; + } } } + +QString OpenRGBDevicePage::ModeDescription(const std::string mode_name) +{ + /*-----------------------------------------------------------------*\ + | List of common mode names can be found on the OpenRGB Wiki: | + | https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/Common-Modes | + \*-----------------------------------------------------------------*/ + static const std::unordered_map descriptions = + { + {"Direct", tr("Set individual LEDs to static colors. Safe for use with software-driven effects.") }, + {"Custom", tr("Set individual LEDs to static colors. Not safe for use with software-driven effects.") }, + {"Static", tr("Sets the entire device or a zone to a single color.") }, + {"Breathing", tr("Gradually fades between fully off and fully on.") }, + {"Flashing", tr("Abruptly changes between fully off and fully on.") }, + {"Spectrum Cycle", tr("Gradually cycles through the entire color spectrum. All lights on the device are the same color.") }, + {"Rainbow Wave", tr("Gradually cycles through the entire color spectrum. Produces a rainbow pattern that moves.") }, + {"Reactive", tr("Flashes lights when keys or buttons are pressed.") }, + }; + + /*-----------------------------------------------------------------*\ + | Find the given mode name in the list and return the description | + | if it exists, otherwise return an empty string | + \*-----------------------------------------------------------------*/ + std::unordered_map::const_iterator it = descriptions.find(mode_name); + + if(it != descriptions.end()) + { + return it->second; + } + + return ""; +} + +/*---------------------------------------------------------*\ +| Callback handler | +\*---------------------------------------------------------*/ +void OpenRGBDevicePage::UpdateInterface(unsigned int update_reason) +{ + switch(update_reason) + { + case RGBCONTROLLER_UPDATE_REASON_HIDDEN: + case RGBCONTROLLER_UPDATE_REASON_UNHIDDEN: + emit RefreshList(); + break; + + case RGBCONTROLLER_UPDATE_REASON_UPDATELEDS: + /*-------------------------------------------------*\ + | Update LED UI | + \*-------------------------------------------------*/ + UpdateLEDUi(); + break; + + case RGBCONTROLLER_UPDATE_REASON_UPDATEMODE: + case RGBCONTROLLER_UPDATE_REASON_SAVEMODE: + /*-------------------------------------------------*\ + | Update mode list to update selected mode | + \*-------------------------------------------------*/ + UpdateModeList(); + + /*-------------------------------------------------*\ + | Update mode user interface elements | + \*-------------------------------------------------*/ + UpdateModeUi(); + + /*-------------------------------------------------*\ + | Update LED list | + \*-------------------------------------------------*/ + UpdateLEDList(); + + /*-------------------------------------------------*\ + | Update LED UI | + \*-------------------------------------------------*/ + UpdateLEDUi(); + break; + + case RGBCONTROLLER_UPDATE_REASON_ADDSEGMENT: + case RGBCONTROLLER_UPDATE_REASON_CLEARSEGMENTS: + case RGBCONTROLLER_UPDATE_REASON_RESIZEZONE: + UpdateModeUi(); + ui->DeviceViewBox->repaint(); + break; + } +} + +/*---------------------------------------------------------*\ +| Retranslate Event Slot | +\*---------------------------------------------------------*/ +void OpenRGBDevicePage::changeEvent(QEvent *event) +{ + /*-----------------------------------------------------*\ + | Retranslate the UI when a language change event occurs| + \*-----------------------------------------------------*/ + if(event->type() == QEvent::LanguageChange) + { + ui->retranslateUi(this); + } +} + +/*---------------------------------------------------------*\ +| UI Control Slots | +\*---------------------------------------------------------*/ +void OpenRGBDevicePage::on_ApplyColorsButton_clicked() +{ + UpdateColor(); +} + +void OpenRGBDevicePage::on_BlueSpinBox_valueChanged(int blue) +{ + /*-----------------------------------------------------*\ + | Update the current color QColor blue channel | + \*-----------------------------------------------------*/ + current_color.setBlue(blue); + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_BrightnessSlider_valueChanged(int /*value*/) +{ + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + UpdateMode(); +} + +void OpenRGBDevicePage::on_ColorWheelBox_colorChanged(const QColor color) +{ + /*-----------------------------------------------------*\ + | Store the wheel color to the current color QColor | + \*-----------------------------------------------------*/ + current_color = color; + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_DeviceSaveButton_clicked() +{ + if(device->GetModeFlags(device->GetActiveMode()) & MODE_FLAG_MANUAL_SAVE) + { + device->SaveMode(); + } +} + +void OpenRGBDevicePage::on_DeviceViewBox_selectionChanged(QVector indices) +{ + if(device->GetModeColorMode(device->GetActiveMode()) == MODE_COLORS_PER_LED) + { + ui->ZoneBox->blockSignals(true); + ui->LEDBox->blockSignals(true); + ui->ZoneBox->setCurrentIndex(0); + on_ZoneBox_currentIndexChanged(0); + //updateLeds(); // We want to update the LED box, but we don't want any of the side effects of that action + ui->ZoneBox->blockSignals(false); + if(indices.size() != 0 && size_t(indices.size()) != device->GetLEDCount()) + { + if(indices.size() == 1) + { + if(device->GetLEDCount() == 1) + { + ui->LEDBox->setCurrentIndex(0); + } + else + { + ui->LEDBox->setCurrentIndex(indices[0] + 1); + // Set everything to it's color + } + MultipleSelected = 0; + } + else + { + if(MultipleSelected) + { + ui->LEDBox->removeItem((int)(device->GetLEDCount() + 1)); + } + // TODO: translate + ui->LEDBox->addItem("Multiple (" + QVariant(indices.size()).toString() + ")"); + ui->LEDBox->setCurrentIndex((int)(device->GetLEDCount() + 1)); + MultipleSelected = 1; + } + } + else + { + ui->LEDBox->setCurrentIndex(0); + } + ui->LEDBox->blockSignals(false); + } +} + +void OpenRGBDevicePage::on_DirectionBox_currentIndexChanged(int /*index*/) +{ + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + UpdateMode(); +} + +void OpenRGBDevicePage::on_EditZoneButton_clicked() +{ + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + switch(device->GetModeColorMode(device->GetActiveMode())) + { + case MODE_COLORS_PER_LED: + { + /*-----------------------------------------*\ + | If all zones or a segment are selected, | + | the edit button should not be clickable. | + | If somehow this did get clicked, ignore. | + \*-----------------------------------------*/ + if(selected_all_zones || selected_segment != -1) + { + return; + } + + /*-----------------------------------------*\ + | Only allow resizing linear zones or | + | effects-only resizable zones | + \*-----------------------------------------*/ + if((device->GetZoneType(selected_zone) == ZONE_TYPE_LINEAR) || (device->GetZoneFlags(selected_zone) & ZONE_FLAG_RESIZE_EFFECTS_ONLY)) + { + OpenRGBZoneResizeDialog dlg(device, selected_zone); + + int new_size = dlg.show(); + + if(new_size >= 0) + { + /*---------------------------------*\ + | Update Zone box | + \*---------------------------------*/ + on_ZoneBox_currentIndexChanged(selected_zone); + + /*---------------------------------*\ + | Update color picker with color of | + | first LED | + \*---------------------------------*/ + on_LEDBox_currentIndexChanged(0); + + /*---------------------------------*\ + | Save the size profile | + \*---------------------------------*/ + SaveSizeProfile(); + } + } + } + break; + } +} + +void OpenRGBDevicePage::on_GreenSpinBox_valueChanged(int green) +{ + /*-----------------------------------------------------*\ + | Update the current color QColor green channel | + \*-----------------------------------------------------*/ + current_color.setGreen(green); + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_HexLineEdit_textChanged(const QString &arg1) +{ + /*-----------------------------------------------------*\ + | Make an editable copy of the string | + \*-----------------------------------------------------*/ + QString temp = arg1; + + /*-----------------------------------------------------*\ + | Remove # character so that #XXXXXX color codes are | + | acceptable. 0xXXXXXX codes are already accepted by | + | toInt(). Convert into an RGBColor. Mask off the | + | unused bits. | + \*-----------------------------------------------------*/ + RGBColor color = (RGBColor)(0x00FFFFFF & temp.replace("#", "").toInt(NULL, 16)); + + /*-----------------------------------------------------*\ + | Store new color into the current color QColor | + | Because RGBColor stores color in BGR format, we have | + | to reverse the R and B channels if the hex format is | + | RGB. | + \*-----------------------------------------------------*/ + if(HexFormatRGB) + { + current_color.setRed(RGBGetBValue(color)); + current_color.setGreen(RGBGetGValue(color)); + current_color.setBlue(RGBGetRValue(color)); + } + else + { + current_color.setRed(RGBGetRValue(color)); + current_color.setGreen(RGBGetGValue(color)); + current_color.setBlue(RGBGetBValue(color)); + } + + /*-----------------------------------------------------*\ + | Update the color UI, but set the UpdateHex flag to | + | false so the hex edit box isn't updated while the user| + | is in the middle of typing a value. | + \*-----------------------------------------------------*/ + UpdateHex = false; + ColorChanged(); + UpdateHex = true; +} + +void OpenRGBDevicePage::on_HueSpinBox_valueChanged(int hue) +{ + /*-----------------------------------------------------*\ + | Read the saturation and value box values | + \*-----------------------------------------------------*/ + int sat = current_color.saturation(); + int val = current_color.value(); + + /*-----------------------------------------------------*\ + | Update the current color QColor using HSV | + \*-----------------------------------------------------*/ + current_color.setHsv(hue, sat, val); + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int /*index*/) +{ + /*-----------------------------------------------------*\ + | Update LED UI | + \*-----------------------------------------------------*/ + UpdateLEDUi(); +} + +void OpenRGBDevicePage::on_ModeBox_currentIndexChanged(int /*index*/) +{ + /*-----------------------------------------------------*\ + | Update mode user interface elements | + \*-----------------------------------------------------*/ + UpdateModeUi(); + + /*-----------------------------------------------------*\ + | Update LED list | + \*-----------------------------------------------------*/ + UpdateLEDList(); + + /*-----------------------------------------------------*\ + | Update LED UI | + \*-----------------------------------------------------*/ + UpdateLEDUi(); + + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + UpdateMode(); +} + +void OpenRGBDevicePage::on_ModeSpecificCheck_clicked() +{ + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + UpdateMode(); + + /*-----------------------------------------------------*\ + | Update mode user interface elements | + \*-----------------------------------------------------*/ + UpdateModeUi(); + + /*-----------------------------------------------------*\ + | Update LED list | + \*-----------------------------------------------------*/ + UpdateLEDList(); + + /*-----------------------------------------------------*\ + | Update LED UI | + \*-----------------------------------------------------*/ + UpdateLEDUi(); +} + +void OpenRGBDevicePage::on_PerLEDCheck_clicked() +{ + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + UpdateMode(); + + /*-----------------------------------------------------*\ + | Update mode user interface elements | + \*-----------------------------------------------------*/ + UpdateModeUi(); + + /*-----------------------------------------------------*\ + | Update LED list | + \*-----------------------------------------------------*/ + UpdateLEDList(); + + /*-----------------------------------------------------*\ + | Update LED UI | + \*-----------------------------------------------------*/ + UpdateLEDUi(); +} + +void OpenRGBDevicePage::on_RandomCheck_clicked() +{ + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + UpdateMode(); + + /*-----------------------------------------------------*\ + | Update mode user interface elements | + \*-----------------------------------------------------*/ + UpdateModeUi(); + + /*-----------------------------------------------------*\ + | Update LED list | + \*-----------------------------------------------------*/ + UpdateLEDList(); + + /*-----------------------------------------------------*\ + | Update LED UI | + \*-----------------------------------------------------*/ + UpdateLEDUi(); +} + +void OpenRGBDevicePage::on_RedSpinBox_valueChanged(int red) +{ + /*-----------------------------------------------------*\ + | Update the current color QColor red channel | + \*-----------------------------------------------------*/ + current_color.setRed(red); + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_SatSpinBox_valueChanged(int sat) +{ + /*-----------------------------------------------------*\ + | Read the hue and value box values | + \*-----------------------------------------------------*/ + int hue = current_color.hue(); + int val = current_color.value(); + + /*-----------------------------------------------------*\ + | Update the current color QColor using HSV | + \*-----------------------------------------------------*/ + current_color.setHsv(hue, sat, val); + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_SelectAllLEDsButton_clicked() +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + unsigned int color_mode; + + if(selected_zone_mode && (selected_mode >= 0)) + { + color_mode = device->GetZoneModeColorMode(selected_zone, selected_mode); + } + else if(selected_zone_mode) + { + color_mode = device->GetModeColorMode(device->GetActiveMode()); + } + else + { + color_mode = device->GetModeColorMode(selected_mode); + } + + switch(color_mode) + { + case MODE_COLORS_PER_LED: + ui->LEDBox->setCurrentIndex(0); + on_LEDBox_currentIndexChanged(0); + ui->DeviceViewBox->repaint(); + break; + } +} + +void OpenRGBDevicePage::on_SetAllButton_clicked() +{ + emit SetAllDevices(current_color.red(), current_color.green(), current_color.blue()); +} + +void OpenRGBDevicePage::on_SpeedSlider_valueChanged(int /*value*/) +{ + /*-----------------------------------------------------*\ + | Change device mode | + \*-----------------------------------------------------*/ + UpdateMode(); +} + +void OpenRGBDevicePage::on_SpinBoxModeColors_valueChanged(int count) +{ + /*-----------------------------------------------------*\ + | Determine the selected mode | + \*-----------------------------------------------------*/ + bool selected_zone_mode; + int selected_mode; + + GetSelectedMode(&selected_zone_mode, &selected_mode); + + /*-----------------------------------------------------*\ + | Determine what is selected, either all zones, a zone, | + | or a segment | + \*-----------------------------------------------------*/ + bool selected_all_zones; + int selected_zone; + int selected_segment; + + GetSelectedZone(&selected_all_zones, &selected_zone, &selected_segment); + + unsigned int color_mode; + + if(selected_zone_mode && (selected_mode >= 0)) + { + color_mode = device->GetZoneModeColorMode(selected_zone, selected_mode); + } + else if(selected_zone_mode) + { + color_mode = device->GetModeColorMode(device->GetActiveMode()); + } + else + { + color_mode = device->GetModeColorMode(selected_mode); + } + + switch(color_mode) + { + case MODE_COLORS_MODE_SPECIFIC: + { + /*-----------------------------------------*\ + | Get mode colors information | + \*-----------------------------------------*/ + unsigned int mode_colors_min; + unsigned int mode_colors_max; + unsigned int mode_colors; + + if(selected_zone_mode && (selected_mode >= 0)) + { + mode_colors_min = device->GetZoneModeColorsMin(selected_zone, selected_mode); + mode_colors_max = device->GetZoneModeColorsMax(selected_zone, selected_mode); + mode_colors = device->GetZoneModeColorsCount(selected_zone, selected_mode); + } + else if(selected_zone_mode) + { + mode_colors_min = device->GetModeColorsMin(device->GetActiveMode()); + mode_colors_max = device->GetModeColorsMax(device->GetActiveMode()); + mode_colors = device->GetModeColorsCount(device->GetActiveMode()); + } + else + { + mode_colors_min = device->GetModeColorsMin(selected_mode); + mode_colors_max = device->GetModeColorsMax(selected_mode); + mode_colors = device->GetModeColorsCount(selected_mode); + } + + if((count >= mode_colors_min) && (count <= mode_colors_max)) + { + if(selected_zone_mode && (selected_mode >= 0)) + { + device->SetZoneModeColorsCount(selected_zone, device->GetZoneActiveMode(selected_zone), count); + } + else + { + device->SetModeColorsCount(device->GetActiveMode(), count); + } + } + + UpdateModeUi(); + UpdateLEDList(); + UpdateLEDUi(); + UpdateMode(); + } + break; + } +} + +void OpenRGBDevicePage::on_SwatchBox_swatchChanged(const QColor color) +{ + /*-----------------------------------------------------*\ + | Store the swatch color to the current color QColor | + \*-----------------------------------------------------*/ + current_color = color; + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_ValSpinBox_valueChanged(int val) +{ + /*-----------------------------------------------------*\ + | Read the hue and saturation box values | + \*-----------------------------------------------------*/ + int hue = current_color.hue(); + int sat = current_color.saturation(); + + /*-----------------------------------------------------*\ + | Update the current color QColor using HSV | + \*-----------------------------------------------------*/ + current_color.setHsv(hue, sat, val); + + /*-----------------------------------------------------*\ + | Update the color UI | + \*-----------------------------------------------------*/ + ColorChanged(); +} + +void OpenRGBDevicePage::on_ZoneBox_currentIndexChanged(int /*index*/) +{ + /*-----------------------------------------------------*\ + | Update mode list | + \*-----------------------------------------------------*/ + UpdateModeList(); + + /*-----------------------------------------------------*\ + | Update mode user interface elements | + \*-----------------------------------------------------*/ + UpdateModeUi(); + + /*-----------------------------------------------------*\ + | Update LED list | + \*-----------------------------------------------------*/ + UpdateLEDList(); + + /*-----------------------------------------------------*\ + | Update LED UI | + \*-----------------------------------------------------*/ + UpdateLEDUi(); +} + diff --git a/qt/OpenRGBDevicePage/OpenRGBDevicePage.h b/qt/OpenRGBDevicePage/OpenRGBDevicePage.h index f958badba..6f7b230cc 100644 --- a/qt/OpenRGBDevicePage/OpenRGBDevicePage.h +++ b/qt/OpenRGBDevicePage/OpenRGBDevicePage.h @@ -25,69 +25,109 @@ public: explicit OpenRGBDevicePage(RGBController *dev, QWidget *parent = nullptr); ~OpenRGBDevicePage(); + /*-----------------------------------------------------*\ + | Device Functions | + \*-----------------------------------------------------*/ RGBController* GetController(); - - void SetDevice(unsigned char red, unsigned char green, unsigned char blue); // Could be moved to private void SetCustomMode(unsigned char red, unsigned char green, unsigned char blue); - void UpdateDevice(); - void UpdateMode(); - void UpdateModeUi(); - void ShowDeviceView(); + + /*-----------------------------------------------------*\ + | Device View Functions | + \*-----------------------------------------------------*/ void HideDeviceView(); + void ShowDeviceView(); -private slots: - void changeEvent(QEvent *event); - void UpdateInterface(); - - void on_ColorWheelBox_colorChanged(const QColor color); - void on_SwatchBox_swatchChanged(const QColor color); - void on_DirectionBox_currentIndexChanged(int index); - void on_ZoneBox_currentIndexChanged(int index); - void on_LEDBox_currentIndexChanged(int index); - void on_BrightnessSlider_valueChanged(int value); - void on_ModeBox_currentIndexChanged(int index); - void on_SpeedSlider_valueChanged(int value); - void on_RedSpinBox_valueChanged(int red); - void on_HueSpinBox_valueChanged(int hue); - void on_GreenSpinBox_valueChanged(int green); - void on_SatSpinBox_valueChanged(int sat); - void on_BlueSpinBox_valueChanged(int blue); - void on_ValSpinBox_valueChanged(int val); - void on_HexLineEdit_textChanged(const QString &arg1); - void on_DeviceViewBox_selectionChanged(QVector); - - void on_SetAllButton_clicked(); - void on_RandomCheck_clicked(); - void on_PerLEDCheck_clicked(); - void on_ModeSpecificCheck_clicked(); - void on_EditZoneButton_clicked(); - - void on_ApplyColorsButton_clicked(); - - void on_SelectAllLEDsButton_clicked(); - - void on_DeviceSaveButton_clicked(); + void UpdateDevice(); private: + /*-----------------------------------------------------*\ + | UI Pointer | + \*-----------------------------------------------------*/ Ui::OpenRGBDevicePage *ui; + + /*-----------------------------------------------------*\ + | Device pointer | + \*-----------------------------------------------------*/ RGBController *device; - bool InvertedSpeed = false; - bool InvertedBrightness = false; - bool MultipleSelected = false; - bool DeviceViewShowing = false; - bool UpdateHex = true; - bool HexFormatRGB = true; - + /*-----------------------------------------------------*\ + | Current color | + \*-----------------------------------------------------*/ QColor current_color; - bool autoUpdateEnabled(); - void colorChanged(); - void getSelectedZone(bool * selected_all_zones, int * selected_zone, int * selected_segment); - void updateColorUi(); - QString ModeDescription(const mode& m); + /*-----------------------------------------------------*\ + | Flags | + \*-----------------------------------------------------*/ + bool DeviceViewShowing = false; + bool HexFormatRGB = true; + bool InvertedBrightness = false; + bool InvertedSpeed = false; + bool MultipleSelected = false; + bool UpdateHex = true; + + /*-----------------------------------------------------*\ + | UI Update Functions | + \*-----------------------------------------------------*/ + void UpdateColor(); + void UpdateColorUi(); + void UpdateLEDList(); + void UpdateLEDUi(); + void UpdateMode(); + void UpdateModeList(); + void UpdateModeUi(); + void UpdateZoneList(); + + /*-----------------------------------------------------*\ + | Helper functions | + \*-----------------------------------------------------*/ + bool AutoUpdateEnabled(); + void ColorChanged(); + void GetSelectedMode(bool * selected_zone_mode, int * selected_mode); + void GetSelectedZone(bool * selected_all_zones, int * selected_zone, int * selected_segment); + QString ModeDescription(const std::string mode_name); + +private slots: + /*-----------------------------------------------------*\ + | Callback handler | + \*-----------------------------------------------------*/ + void UpdateInterface(unsigned int update_reason); + + /*-----------------------------------------------------*\ + | Retranslate Event Slot | + \*-----------------------------------------------------*/ + void changeEvent(QEvent *event); + + /*-----------------------------------------------------*\ + | UI Control Slots | + \*-----------------------------------------------------*/ + void on_ApplyColorsButton_clicked(); + void on_BlueSpinBox_valueChanged(int blue); + void on_BrightnessSlider_valueChanged(int value); + void on_ColorWheelBox_colorChanged(const QColor color); + void on_DeviceSaveButton_clicked(); + void on_DeviceViewBox_selectionChanged(QVector); + void on_DirectionBox_currentIndexChanged(int index); + void on_EditZoneButton_clicked(); + void on_GreenSpinBox_valueChanged(int green); + void on_HexLineEdit_textChanged(const QString &arg1); + void on_HueSpinBox_valueChanged(int hue); + void on_LEDBox_currentIndexChanged(int index); + void on_ModeBox_currentIndexChanged(int index); + void on_ModeSpecificCheck_clicked(); + void on_PerLEDCheck_clicked(); + void on_RandomCheck_clicked(); + void on_RedSpinBox_valueChanged(int red); + void on_SatSpinBox_valueChanged(int sat); + void on_SelectAllLEDsButton_clicked(); + void on_SetAllButton_clicked(); + void on_SpeedSlider_valueChanged(int value); + void on_SpinBoxModeColors_valueChanged(int arg1); + void on_SwatchBox_swatchChanged(const QColor color); + void on_ValSpinBox_valueChanged(int val); + void on_ZoneBox_currentIndexChanged(int index); signals: + void RefreshList(); void SetAllDevices(unsigned char red, unsigned char green, unsigned char blue); void SaveSizeProfile(); }; diff --git a/qt/OpenRGBDevicePage/OpenRGBDevicePage.ui b/qt/OpenRGBDevicePage/OpenRGBDevicePage.ui index 1df6987ae..840b5a611 100644 --- a/qt/OpenRGBDevicePage/OpenRGBDevicePage.ui +++ b/qt/OpenRGBDevicePage/OpenRGBDevicePage.ui @@ -205,78 +205,66 @@ QFrame::Shadow::Sunken - - - - Speed: - - - - - - - - - - - - - Random - - - - - - - Mode: - - - - - - Dir: - - - - - - - Qt::Orientation::Horizontal - - - - Colors: - - + + - Per-LED + Mode-Specific - - - - Zone: + + + + Qt::Orientation::Horizontal - - - - - - - <html><head/><body><p align="justify">Sets all devices to<br/><b>Static</b> mode and<br/>applies the selected color.</p></body></html> - + + - Apply All Devices + Edit Zone + + + + + + + Qt::Orientation::Horizontal + + + + + + + Dir: + + + + + + + Apply Colors To Selection + + + + + + + Mode: + + + + + + + Brightness: @@ -287,50 +275,69 @@ - - + + - Edit + Zone: - - + + - Mode-Specific + Speed: - - + + - Apply Colors To Selection + Random + + + + + + + + + + <html><head/><body><p align="justify">Sets all devices to<br/><b>Static</b> mode and<br/>applies the selected color.</p></body></html> + + + Apply All Devices + + + + + + + + + + + + + + + + Per-LED - - - Select All - - - - - - - Qt::Orientation::Horizontal - - - - - - - - - - Brightness: - - + + + + + Select All + + + + + + + @@ -416,7 +423,6 @@ ZoneBox EditZoneButton LEDBox - SelectAllLEDsButton ApplyColorsButton SetAllButton ModeBox diff --git a/qt/OpenRGBDialog/OpenRGBDialog.cpp b/qt/OpenRGBDialog/OpenRGBDialog.cpp index 635956f8a..0e01ced9f 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.cpp +++ b/qt/OpenRGBDialog/OpenRGBDialog.cpp @@ -1002,45 +1002,161 @@ void OpenRGBDialog::UpdateDevicesList() { std::vector controllers = ResourceManager::get()->GetRGBControllers(); + /*-----------------------------------------------------*\ + | Keep track of the number of controllers added/kept in | + | the tab list | + \*-----------------------------------------------------*/ + unsigned int controller_tab_count = 0; + /*-----------------------------------------------------*\ | Loop through each controller in the list. | \*-----------------------------------------------------*/ for(unsigned int controller_idx = 0; controller_idx < controllers.size(); controller_idx++) { /*-------------------------------------------------*\ - | Loop through each tab in the devices tab bar | + | Search for this controller in existing pages | \*-------------------------------------------------*/ bool found = false; + /*-------------------------------------------------*\ + | First, search for the controller page in the tab | + | bar | + \*-------------------------------------------------*/ for(int tab_idx = 0; tab_idx < ui->DevicesTabBar->count(); tab_idx++) { + /*---------------------------------------------*\ + | Get a pointer to the page at this index in | + | the tab bar | + \*---------------------------------------------*/ QWidget* page = ui->DevicesTabBar->widget(tab_idx); + /*---------------------------------------------*\ + | Verify this page is an OpenRGBDevicePage | + \*---------------------------------------------*/ if(dynamic_cast(page) != nullptr) { /*-----------------------------------------*\ | If the current tab matches the current | - | controller, move the tab to the correct | - | position | + | controller, check if it is hidden | \*-----------------------------------------*/ if(controllers[controller_idx] == ((OpenRGBDevicePage*)page)->GetController()) { + /*-------------------------------------*\ + | Set the found flag indicating that a | + | page for this controller has been | + | found in the tab bar | + \*-------------------------------------*/ found = true; - ui->DevicesTabBar->tabBar()->moveTab(tab_idx, controller_idx); + + /*-------------------------------------*\ + | If the controller for this page is | + | hidden, remove the page from the tab | + | bar and store it in the hidden pages | + | vector | + \*-------------------------------------*/ + if(controllers[controller_idx]->GetHidden()) + { + hidden_pages.push_back((OpenRGBDevicePage*)page); + ui->DevicesTabBar->removeTab(tab_idx); + + /*---------------------------------*\ + | Decrement tab index to account | + | for removing tab | + \*---------------------------------*/ + tab_idx--; + } + /*-------------------------------------*\ + | Otherwise, move the tab to the | + | current index | + \*-------------------------------------*/ + else + { + controller_tab_count++; + ui->DevicesTabBar->tabBar()->moveTab(tab_idx, controller_idx); + } break; } } } + /*-------------------------------------------------*\ + | Next, if it wasn't found in the tab bar, search | + | for the controller page in hidden pages vector | + \*-------------------------------------------------*/ + if(!found) + { + for(std::size_t page_idx = 0; page_idx < hidden_pages.size(); page_idx++) + { + /*-----------------------------------------*\ + | Get a pointer to the page at this index | + | in the hidden pages vector | + \*-----------------------------------------*/ + QWidget* page = hidden_pages[page_idx]; + + /*-----------------------------------------*\ + | If the current tab matches the current | + | controller, check if it is hidden | + \*-----------------------------------------*/ + if(controllers[controller_idx] == ((OpenRGBDevicePage*)page)->GetController()) + { + /*-------------------------------------*\ + | Set the found flag indicating that a | + | page for this controller has been | + | found in the hidden pages vector | + \*-------------------------------------*/ + found = true; + + /*-------------------------------------*\ + | If the controller for this page is | + | not hidden, remove the page from the | + | hidden pages vector and add it to the | + | tab bar | + \*-------------------------------------*/ + if(!(controllers[controller_idx]->GetHidden())) + { + ui->DevicesTabBar->addTab(page, ""); + + /*---------------------------------*\ + | Create the tab label | + \*---------------------------------*/ + TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->GetDeviceType()), QString::fromStdString(controllers[controller_idx]->GetName()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context); + + ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); + ui->DevicesTabBar->tabBar()->setTabToolTip(ui->DevicesTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->GetName())); + + /*---------------------------------*\ + | Now move the new tab to the | + | correct position | + \*---------------------------------*/ + ui->DevicesTabBar->tabBar()->moveTab(ui->DevicesTabBar->count() - 1, controller_tab_count); + + /*---------------------------------*\ + | Increment tab counter | + \*---------------------------------*/ + controller_tab_count++; + + hidden_pages.erase(hidden_pages.begin() + page_idx); + + /*---------------------------------*\ + | Decrement page index to account | + | for removing page | + \*---------------------------------*/ + page_idx--; + } + } + } + } + + /*-------------------------------------------------*\ + | If the controller still has not been found, | + | create a new page for it | + \*-------------------------------------------------*/ if(!found) { /*---------------------------------------------*\ - | The controller does not have a tab already | - | created. Create a new tab and move it to the | - | correct position | + | Create a new OpenRGBDevicePage | \*---------------------------------------------*/ OpenRGBDevicePage *NewPage = new OpenRGBDevicePage(controllers[controller_idx]); - ui->DevicesTabBar->addTab(NewPage, ""); /*---------------------------------------------*\ | Connect the page's Set All button to the Set | @@ -1061,17 +1177,41 @@ void OpenRGBDialog::UpdateDevicesList() SLOT(on_SaveSizeProfile())); /*---------------------------------------------*\ - | Create the tab label | + | Connect the page's Refresh List signal to the | + | Refresh List slot | \*---------------------------------------------*/ - TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->GetName()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context); + connect(NewPage, + SIGNAL(RefreshList()), + this, + SLOT(onDeviceListUpdated())); - ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); - ui->DevicesTabBar->tabBar()->setTabToolTip(ui->DevicesTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->GetName())); + if(controllers[controller_idx]->GetHidden()) + { + hidden_pages.push_back(NewPage); + } + else + { + ui->DevicesTabBar->addTab(NewPage, ""); - /*---------------------------------------------*\ - | Now move the new tab to the correct position | - \*---------------------------------------------*/ - ui->DevicesTabBar->tabBar()->moveTab(ui->DevicesTabBar->count() - 1, controller_idx); + /*-----------------------------------------*\ + | Create the tab label | + \*-----------------------------------------*/ + TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->GetDeviceType()), QString::fromStdString(controllers[controller_idx]->GetName()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context); + + ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); + ui->DevicesTabBar->tabBar()->setTabToolTip(ui->DevicesTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->GetName())); + + /*-----------------------------------------*\ + | Now move the new tab to the correct | + | position | + \*-----------------------------------------*/ + ui->DevicesTabBar->tabBar()->moveTab(ui->DevicesTabBar->count() - 1, controller_tab_count); + + /*-----------------------------------------*\ + | Increment tab counter | + \*-----------------------------------------*/ + controller_tab_count++; + } } /*-------------------------------------------------*\ @@ -1116,7 +1256,7 @@ void OpenRGBDialog::UpdateDevicesList() /*---------------------------------------------*\ | Create the tab label | \*---------------------------------------------*/ - TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->GetName()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context); + TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->GetDeviceType()), QString::fromStdString(controllers[controller_idx]->GetName()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context); ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); ui->InformationTabBar->tabBar()->setTabToolTip(ui->InformationTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->GetName())); @@ -1131,10 +1271,10 @@ void OpenRGBDialog::UpdateDevicesList() /*-----------------------------------------------------*\ | Remove all remaining device tabs | \*-----------------------------------------------------*/ - unsigned int tab_count = ui->DevicesTabBar->count(); - unsigned int base_tab = (unsigned int)controllers.size(); + unsigned int tab_count = ui->DevicesTabBar->count(); + unsigned int base_tab = controller_tab_count; - for(std::size_t tab_idx = controllers.size(); tab_idx < tab_count; tab_idx++) + for(std::size_t tab_idx = base_tab; tab_idx < tab_count; tab_idx++) { QWidget* tab_widget = ui->DevicesTabBar->widget(base_tab); diff --git a/qt/OpenRGBDialog/OpenRGBDialog.h b/qt/OpenRGBDialog/OpenRGBDialog.h index 7788d56ef..04844354e 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.h +++ b/qt/OpenRGBDialog/OpenRGBDialog.h @@ -17,6 +17,7 @@ #include #include "OpenRGBClientInfoPage.h" +#include "OpenRGBDevicePage.h" #include "OpenRGBPluginsPage/OpenRGBPluginsPage.h" #include "OpenRGBSoftwareInfoPage.h" #include "OpenRGBSystemInfoPage.h" @@ -97,6 +98,12 @@ private: bool ShowI2CTools = false; bool plugins_loaded = false; + /*-----------------------------------------------------*\ + | Hidden pages | + \*-----------------------------------------------------*/ + std::vector + hidden_pages; + /*-----------------------------------------------------*\ | System tray icon and menu | \*-----------------------------------------------------*/ diff --git a/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.cpp b/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.cpp index 0f5b68e04..4c90d747d 100644 --- a/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.cpp +++ b/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.cpp @@ -19,9 +19,9 @@ OpenRGBZoneResizeDialog::OpenRGBZoneResizeDialog(RGBController* edit_dev_ptr, un edit_dev = edit_dev_ptr; edit_zone_idx = edit_zone_idx_val; - unsigned int size_min = edit_dev->zones[edit_zone_idx].leds_min; - unsigned int size_max = edit_dev->zones[edit_zone_idx].leds_max; - unsigned int size_current = edit_dev->zones[edit_zone_idx].leds_count; + unsigned int size_min = edit_dev->GetZoneLEDsMin(edit_zone_idx); + unsigned int size_max = edit_dev->GetZoneLEDsMax(edit_zone_idx); + unsigned int size_current = edit_dev->GetZoneLEDsCount(edit_zone_idx); ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -36,40 +36,12 @@ OpenRGBZoneResizeDialog::OpenRGBZoneResizeDialog(RGBController* edit_dev_ptr, un ui->ResizeSlider->setValue(size_current); ui->ResizeBox->setValue(size_current); - for(unsigned int segment_idx = 0; segment_idx < edit_dev->zones[edit_zone_idx].segments.size(); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < edit_dev->GetZoneSegmentCount(edit_zone_idx); segment_idx++) { - AddSegmentRow(QString::fromStdString(edit_dev->zones[edit_zone_idx].segments[segment_idx].name), edit_dev->zones[edit_zone_idx].segments[segment_idx].leds_count, edit_dev->zones[edit_zone_idx].segments[segment_idx].type); + AddSegmentRow(QString::fromStdString(edit_dev->GetZoneSegmentName(edit_zone_idx, segment_idx)), edit_dev->GetZoneSegmentLEDsCount(edit_zone_idx, segment_idx), edit_dev->GetZoneSegmentType(edit_zone_idx, segment_idx)); } } -OpenRGBZoneResizeDialog::OpenRGBZoneResizeDialog(unsigned int edit_zone_min_val, unsigned int edit_zone_max_val, unsigned int edit_zone_current_val, QWidget *parent) : - QDialog(parent), - ui(new Ui::OpenRGBZoneResizeDialog) -{ - /*-----------------------------------------------------*\ - | This constructor does not use a device pointer. | - \*-----------------------------------------------------*/ - edit_dev = NULL; - - ui->setupUi(this); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - - /*-----------------------------------------------------*\ - | This constructor is used for resizing mode-specific | - | colors. Segments are not used in this mode, so hide | - | the Segments tree view and buttons. | - \*-----------------------------------------------------*/ - ui->SegmentsTreeWidget->hide(); - ui->AddSegmentButton->hide(); - ui->RemoveSegmentButton->hide(); - - ui->ResizeSlider->setRange(edit_zone_min_val, edit_zone_max_val); - ui->ResizeBox->setRange(edit_zone_min_val, edit_zone_max_val); - - ui->ResizeSlider->setValue(edit_zone_current_val); - ui->ResizeBox->setValue(edit_zone_current_val); -} - OpenRGBZoneResizeDialog::~OpenRGBZoneResizeDialog() { delete ui; @@ -226,7 +198,7 @@ void OpenRGBZoneResizeDialog::AddSegmentRow(QString name, unsigned int length, z /*---------------------------------------------------------*\ | Fill in slider length and maximum | \*---------------------------------------------------------*/ - slider_length->setMaximum(edit_dev->zones[edit_zone_idx].leds_count); + slider_length->setMaximum(edit_dev->GetZoneLEDsCount(edit_zone_idx)); slider_length->setValue(length); /*---------------------------------------------------------*\ diff --git a/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.h b/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.h index ff5cb3fe1..6661e5047 100644 --- a/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.h +++ b/qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.h @@ -24,7 +24,6 @@ class OpenRGBZoneResizeDialog : public QDialog public: explicit OpenRGBZoneResizeDialog(RGBController* edit_dev_ptr, unsigned int edit_zone_idx_val, QWidget *parent = nullptr); - explicit OpenRGBZoneResizeDialog(unsigned int edit_zone_min_val, unsigned int edit_zone_max_val, unsigned int edit_zone_current_val, QWidget *parent = nullptr); ~OpenRGBZoneResizeDialog(); int show(); diff --git a/qt/OpenRGBZonesBulkResizer/OpenRGBZonesBulkResizer.cpp b/qt/OpenRGBZonesBulkResizer/OpenRGBZonesBulkResizer.cpp index d4bd34aae..2433ebe8c 100644 --- a/qt/OpenRGBZonesBulkResizer/OpenRGBZonesBulkResizer.cpp +++ b/qt/OpenRGBZonesBulkResizer/OpenRGBZonesBulkResizer.cpp @@ -45,33 +45,38 @@ void OpenRGBZonesBulkResizer::RunChecks(QWidget *parent) LOG_DEBUG("[ZonesBulkResizer] Running zones sizes checks..."); - /*---------------------------------------------------------*\ - | Collect the unconfigured zones | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Collect the unconfigured zones | + \*-----------------------------------------------------*/ std::vector& controllers = ResourceManager::get()->GetRGBControllers(); - std::vector> zones; + std::vector> unconfigured_zones; for(RGBController* controller: controllers) { - for(unsigned int zone_index = 0; zone_index < controller->zones.size(); zone_index++) + for(unsigned int zone_index = 0; zone_index < controller->GetZoneCount(); zone_index++) { - // Consider unconfigured if 0 leds AND led_count < leds_max - if(controller->zones[zone_index].leds_count == 0 - && controller->zones[zone_index].leds_count < controller->zones[zone_index].leds_max) + /*---------------------------------------------*\ + | Consider unconfigured if zone is size 0, zone | + | size is less than max size, and not manually | + | configured | + \*---------------------------------------------*/ + if((controller->GetZoneLEDsCount(zone_index) == 0) && + (controller->GetZoneLEDsCount(zone_index) < controller->GetZoneLEDsMax(zone_index)) && + (controller->GetZoneFlags(zone_index) & ZONE_FLAG_MANUALLY_CONFIGURED) == 0) { - zones.push_back({controller, zone_index}); + unconfigured_zones.push_back({controller, zone_index}); } } } - LOG_DEBUG("[ZonesBulkResizer] Zones checks finished: %d unconfigured zone(s).", zones.size()); + LOG_DEBUG("[ZonesBulkResizer] Zones checks finished: %d unconfigured zone(s).", unconfigured_zones.size()); - /*---------------------------------------------------------*\ - | Show the configuration tool GUI if we have some | - | unconfigured zones | - \*---------------------------------------------------------*/ - if(!zones.empty()) + /*-----------------------------------------------------*\ + | Show the configuration tool GUI if we have some | + | unconfigured zones | + \*-----------------------------------------------------*/ + if(!unconfigured_zones.empty()) { QDialog* dialog = new QDialog(parent); dialog->setWindowTitle(tr("Resize the zones")); @@ -81,7 +86,7 @@ void OpenRGBZonesBulkResizer::RunChecks(QWidget *parent) QVBoxLayout* dialog_layout = new QVBoxLayout(dialog); - OpenRGBZonesBulkResizer* widget = new OpenRGBZonesBulkResizer(dialog, zones); + OpenRGBZonesBulkResizer* widget = new OpenRGBZonesBulkResizer(dialog, unconfigured_zones); dialog_layout->addWidget(widget); @@ -145,15 +150,15 @@ void OpenRGBZonesBulkResizer::CreateZoneWidget(RGBController* controller, unsign controller_label->setText(QString::fromStdString(controller->GetName())); QLabel* zone_label = new QLabel(this); - zone_label->setText(QString::fromStdString(controller->zones[zone_index].name)); + zone_label->setText(QString::fromStdString(controller->GetZoneName(zone_index))); /*---------------------------------------------------------*\ | Spin box: controls the zone size | \*---------------------------------------------------------*/ QSpinBox* spin_box = new QSpinBox(this); spin_box->setValue(0); - spin_box->setMinimum(controller->zones[zone_index].leds_min); - spin_box->setMaximum(controller->zones[zone_index].leds_max); + spin_box->setMinimum(controller->GetZoneLEDsMin(zone_index)); + spin_box->setMaximum(controller->GetZoneLEDsMax(zone_index)); /*---------------------------------------------------------*\ | Insert labels + spinbox | @@ -168,8 +173,6 @@ void OpenRGBZonesBulkResizer::CreateZoneWidget(RGBController* controller, unsign void OpenRGBZonesBulkResizer::on_save_button_clicked() { - bool has_changes = false; - /*---------------------------------------------------------*\ | Resize what needs to be resized | \*---------------------------------------------------------*/ @@ -177,31 +180,23 @@ void OpenRGBZonesBulkResizer::on_save_button_clicked() { unsigned int new_size = ((QSpinBox*)ui->zones_table->cellWidget(i,2))->value(); - if(new_size > 0) - { - RGBController* controller = std::get<0>(unconfigured_zones[i]); - unsigned int zone_index = std::get<1>(unconfigured_zones[i]); + RGBController* controller = std::get<0>(unconfigured_zones[i]); + unsigned int zone_index = std::get<1>(unconfigured_zones[i]); - controller->ResizeZone(zone_index, new_size); - - has_changes = true; - } + controller->ResizeZone(zone_index, new_size); } /*---------------------------------------------------------*\ - | Save the sizes if the user did any changes | + | Save the sizes | \*---------------------------------------------------------*/ - if(has_changes) - { - ProfileManager* profile_manager = ResourceManager::get()->GetProfileManager(); + ProfileManager* profile_manager = ResourceManager::get()->GetProfileManager(); - if(profile_manager != NULL) - { - /*---------------------------------------------------------*\ - | Save the profile | - \*---------------------------------------------------------*/ - profile_manager->SaveProfile("sizes", true); - } + if(profile_manager != NULL) + { + /*-----------------------------------------------------*\ + | Save the profile | + \*-----------------------------------------------------*/ + profile_manager->SaveProfile("sizes", true); } /*---------------------------------------------------------*\