+
     vi  c            
       s   R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHtH	t	H
t
Ht ]P                  ! ]4      tR^ R^R^R^R	^/t^ t^dt ! R
 R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t]t]t]tR# )ak  liquidctl drivers for NZXT Smart Device V1/V2, Grid+ V3, HUE 2/2 Ambient, H1 V2 and RGB & Fan
Controller.

Smart Device (V1)
-----------------

The NZXT Smart Device is a fan and LED controller that ships with the H200i,
H400i, H500i and H700i cases.

It provides three independent fan channels with standard 4-pin connectors.
Both PWM and DC control is supported, and the device automatically chooses the
appropriate mode for each channel.

Additionally, up to four chained HUE+ LED strips, or five Aer RGB fans, can be
driven from only RGB channel available.  The firmware installed on the device
exposes several color presets, most of them common to other NZXT products.

The device recognizes the type of accessory connected by measuring the
resistance between the FD and GND lines.[1][2]  In normal usage accessories
should not be mixed.

A microphone is also present onboard, for noise level optimization through CAM
and AI.  NZXT calls this feature Adaptive Noise Reduction (ANR).

[1] https://forum.level1techs.com/t/nzxt-hue-a-look-inside/104836
[2] In parallel: 10 kOhm per HUE+ strip, 16 kOhm per Aer RGB fan.

Grid+ V3
--------

The NZXT Grid+ V3 is a fan controller very similar to the Smart Device (V1).
Comparing the two, the Grid+ has more fan channels (six in total), and no
support for LEDs.

Smart Device V2
---------------

The NZXT Smart Device V2 is a newer model of the original fan and LED controller. It
ships with NZXT's cases released in mid-2019 including the H510 Elite, H510i,
H710i, and H210i.

It provides three independent fan channels with standard 4-pin connectors. Both
PWM and DC control is supported, and the device automatically chooses the appropriate
mode for each channel.

Additionally, it features two independent lighting (Addressable RGB) channels,
unlike the single channel in the original. NZXT Aer RGB 2 fans and HUE 2 lighting
accessories (HUE 2 LED strip, HUE 2 Unerglow, HUE 2 Cable Comb) can be
connected. The firmware installed on the device exposes several color presets, most
of them common to other NZXT products.

HUE 2 and HUE+ devices (including Aer RGB and Aer RGB 2 fans) are supported, but
HUE 2 components cannot be mixed with HUE+ components in the same channel. Each
lighting channel supports up to 6 accessories and a total of 40 LEDs.

A microphone is still present onboard for noise level optimization through CAM
and AI.

NZXT H1 V2
----------

The second revision of the NZXT H1 case, labeled H1 V2, ships with a variant of the
NZXT Smart Device V2 that handles both the internal fans and the AIO pump. Two fan and
one pump channels are available, where the formers can be controlled via PWM or DC.

The pump speed is not user controllable. The device reports the state, speed and duty
of each fan channel, as well as the pump speed.

There are no lighting channels available nor an onboard microphone.

RGB & Fan Controller
--------------------

The NZXT RGB & Fan Controller is a retail version of the NZXT Smart Device V2.

HUE 2
-----

The NZXT HUE 2 is an LED controller from the same generation of the Smart
Device V2.

The presets and limitations of the four LED channels are the same as in the
Smart Device V2.

HUE 2 Ambient
-------------

HUE 2 Ambient is a variant of HUE 2 featuring 2 LED control channels.

Driver
------

This driver implements all features available at the hardware level:

 - initialization
 - detection of connected fans and LED strips
 - control of fan speeds per channel
 - monitoring of fan presence, control mode, speed, voltage and current
 - control of lighting modes and colors
 - reporting of LED accessory count and type
 - monitoring of noise level (from the onboard microphone)
 - reporting of firmware version

Software based features offered by CAM, like ANR, have not been implemented.

After powering on from Mechanical Off, or if there have been hardware changes,
the devices must be manually initialized by calling `initialize()`.  This will
cause all connected fans and LED accessories to be detected, and enable status
updates.  It is recommended to initialize the devices at every boot.

Copyright Jonas Malaco, CaseySJ and contributors
SPDX-License-Identifier: GPL-3.0-or-later
N)UsbHidDriverNotSupportedByDevice)clampmap_directionHue2AccessoryHUE2_MAX_ACCESSORIES_IN_CHANNELZslowestZslowernormalZfasterZfastestc                   sd   a a ] tR t^t oRtV 3R ltRR ltR tR tR t	R t
R tR	 tR
tVtV ;t# )_BaseSmartDevicez2Common functions of Smart Device and Grid drivers.c                s>   < \         SV `  W4       W0n        W@n        R # N)super__init___speed_channels_color_channels)selfdevicedescriptionspeed_channelscolor_channelskwargs	__class__s   &&&&&,B/usr/lib/python3.14/site-packages/liquidctl/driver/smart_device.pyr   Z_BaseSmartDevice.__init__   s    ---    c                sd   V P                   '       g   \        4       hRV9   d*   \        P                  R4       VP	                  RR4      pRpV P                   V,          pV P
                  V,          w    rp
V UUUu. uF	  w  rqW.NK  	  pppp\        V4      V	8  d   \        RV RV	 R24      hV
^ 8X  d%   V'       d   \        P                  R	V4       . RO.pM+\        V4      V
8  d   \        P                  R
W*4       VRV
 p\        V,          pV P                  WrW>V4       R# u upppi )zhSet the color mode for a specific channel.

Only supported by Smart Device V1/V2 and HUE 2 controllers.
Z	backwardsz2deprecated mode, move to direction=backward optionz
backwards- backwardznot enough colors for mode=z, at least z	 requiredz(too many colors for mode=%s, none neededz+too many colors for mode=%s, dropping to %dN    r   r   )
r   r   _LOGGERwarningZreplace_COLOR_MODESlenZ
ValueError_ANIMATION_SPEEDS_write_colors)r   channelmodecolorsspeed	directionr   cid_	mincolors	maxcolorsrgbsvals   &&&&&&,        r   	set_colorZ_BaseSmartDevice.set_color   s    ###&(($OOPQ<<b1D"I""7+(,(9(9$(?%1aI-34V	qa)V4v;":4&I;V_`aa!^ JDQ[F[9$OOI -JY'F '3fI> 5s   >D+c                s    VR8X  d   V P                   pMWP                   V,          /pVP                  4        F<  w  pw  rgp\        W'V4      p\        P	                  RWR4       V P                  Wb4       K>  	  R# )z"Set channel to a fixed speed duty.synczsetting %s duty to %d%%N)r   Zitemsr   r   info_write_fixed_duty)	r   r!   dutyr   Zselected_channelsZcnamer&   ZdminZdmaxs	   &&&,     r   set_fixed_speedZ _BaseSmartDevice.set_fixed_speed   ss     f $ 4 4!(*>*>w*G H(9(?(?(A$E$CtT*DLL2E@""3- )Br   c                    \        4       hr	   r   )r   r!   Zprofiler      &&&,r   set_speed_profileZ"_BaseSmartDevice.set_speed_profile       "$$r   c                s    ^ .V P                   \        V4      ,
          ,          pV P                  P                  W,           4       R# )r   N)_WRITE_LENGTHr   r   Zwrite)r   ZdataZpaddings   && r   _writeZ_BaseSmartDevice._write   s1    %++c$i78$.)r   c                r4   r	   ZNotImplementedError)r   r&   r"   r#   r-   r%   s   &&&&&&r   r    Z_BaseSmartDevice._write_colors       !##r   c                r4   r	   r:   r   r&   r2      &&&r   r1   Z"_BaseSmartDevice._write_fixed_duty   r;   r   c                r4   )zNot supported by this device.r   )r   r!   r"   Zvaluer   s   &&&&,r   
set_screenZ_BaseSmartDevice.set_screen   s    "$$r   )r   r   )r   forward)__name__
__module____qualname____firstlineno____doc__r   r.   r3   r6   r9   r    r1   r>   __static_attributes____classdictcell____classcell__r   __classdict__   @@r   r   r      s5     <.
?>
.%*$$% %r   r   c                   s(  a a ] tR t^t oRtRRRR^R^/3RRRR^R^ /3.t^t^At/ R	R+bR
R,bRR-bRR.bRR/bRR0bRR1bRR2bRR3bRR4bRR5bRR6bRR7bRR8bRR9bRR:bRR;bRR<RR/RR0RR1RR2RR3R R4R!R6R"R</	CtV 3R# lt	R=R$ lt
R% tR& tR=R' ltR>R( ltR) tR*tVtV ;t# )?SmartDevicez#NZXT Smart Device (V1) or Grid+ V3.q  i  zNZXT Smart Device (V1)speed_channel_countcolor_channel_counti  zNZXT Grid+ V3offfixedsuper-fixedfadingspectrum-wave	marquee-3	marquee-4	marquee-5	marquee-6covering-marqueealternatingzmoving-alternatingpulse	breathingsuper-breathingcandlewingsz
super-wavebackwards-spectrum-wavebackwards-marquee-3backwards-marquee-4backwards-marquee-5backwards-marquee-6covering-backwards-marqueezbackwards-moving-alternatingzbackwards-super-wavec                s   < \        V4       Uu/ uF  pRV^,            2V\        \        3bK  	  pp\        V4       Uu/ uF  pRVbK  	  pp\        S	V `  ! WWx3/ VB  R# u upi u upi )*Instantiate a driver with a device handle.fanledNrange	_MIN_DUTY	_MAX_DUTYr
   r   
r   r   r   rM   rN   r   ir   r   r   
   &&&&&,   r   r   ZSmartDevice.__init__  s     $))<#=?#=a  Aw-!Y	)BB#= 	 ? $))<#=?#=a  !)#= 	 ?nWPVW	??s
   !A!A&c                sV   V P                   '       d4   V'       g,   \        P                  RV P                   P                  4       M|V P                   '       d+   \        P	                  RV P                   P                  4       V P                  ^^\.4       V P                  ^^].4       V P                  P                  4        V P                  P                  V P                  4      p\        VR,          4      p\        P                  RV4       V^ ,           RV^,           2pRVR3.pV P                  '       dn   V^,          pVP                  RVR34       V^ 8  dJ   RR.V^,          ^,	          ,          w  rVP                  R	VR34       VP                  R
Wy,          R34       V# )  Initialize the device and the driver.

Connected fans and LED accessories are detected.

This method should be called every time the systems boots, resumes from
a suspended state, or if the device has just been (re)connected.  In
those scenarios, no other method, except `connect()` or `disconnect()`,
should be called until the device and driver has been (re-)initialized.

Returns None or a list of `(property, value, unit)` tuples, similarly
to `get_status()`.
=bound to %s kernel driver, assuming it is already initialized2forcing re-initialization despite %s kernel driver:   i   Nzraw firmware version: %r.Firmware versionr   zLED accessorieszLED accessory typezLED count (total))z
HUE+ Stripi
   )zAer RGB   )_hwmonr   r0   driverr   r9   r   clear_enqueued_reportsread_READ_LENGTHZtupleZdebugr   append)
r   direct_accessr   msgfwZfw_humanretZlcountZltypeZlsizes
   &&,       r   
initializeZSmartDevice.initialize
  s[    ;;;}LLX++- {{{ T $ 2 24KKd$KKd$KK..0kkt0013w< 0"5 eWAbeW%"Hb12YFJJ)6267z 2NCCIQRNS

0%<=

/rBC
r   c           	     sn   R .\        V P                  4      ,          p. pV P                  P                  4        \	        V4       F  w  r4V P                  P                  V P                  4      pV^,          ^,	          ^,           pV^,          ^,          pRV R2V^,          ^,          V^,          ,          R3RV R2V^,          V^,          ^d,          ,           R3RV R2V^	,          V^
,          ^d,          ,           R3RV R2. ROV,          R	3.W^,
          &   VP                  V^,          4       K  	  . p\	        V4       F4  w  r9V	'       d   W,           pK  \        P                  R
V^,           4       K6  	  VP                  R\        \        V4      \        V4      ,          4      R34       V# )NFan  speedrpm voltageV currentA control moder   zmissing data fan for %dNoise leveldBNDCPWM)r   r   r   rx   	enumeratery   rz   r{   r   r   roundZsum)
r   ZfansZnoiserm   r'   r}   ZnumZstater   rf   s
   &         r   _get_status_directlyZ SmartDevice._get_status_directly6  s}   vD0011**,dODA++""4#4#45Cr7a<1$CGcME uF#SVq[3q6%95AuH%s1vAs
':C@uH%s1vB';SAuM*,?,FK	DqM LLQ  $ oFAi 91q5A	 & 	

M5UCJ)>#?FG
r   c           
     sF   . pR R.p\        \        V P                  4      4       F  pV^,           pVP                  RV R2V P                  P                  RV R24      R34      3 VP                  RV R2V P                  P                  RV R24      R	,          R
34      3 VP                  RV R2V P                  P                  RV R24      R	,          R34      3 VP                  RV R2W P                  P                  RV R24      ,          R34      3 K  	  V# )r   r   r   r   rf   _inputr   r   ZingMbP?r   r   Zcurrr   r   pwm_moder   )ri   r   r   r{   rv   read_int)r   r   r"   rm   ns   &    r   _get_status_from_hwmonZ"SmartDevice._get_status_from_hwmonT  s)   e}s4//01AAAJJ$qc($++*>*>QCv*OQVWXYJJ$qc*DKK,@,@2aS,PSW,WY\]^_JJ$qc*DKK,@,@4s&AQ,RUY,Y[^_`aJJ$qc/kk6J6JSQRPSSX>6Z1[]_`ab 2 
r   c                sB   V P                   '       dC   V'       g;   \        P                  RV P                   P                  4       V P	                  4       # V P                   '       d+   \        P                  RV P                   P                  4       V P                  4       # JGet a status report.

Returns a list of `(property, value, unit)` tuples.
z4bound to %s kernel driver, reading status from hwmonz4directly reading the status despite %s kernel driver)rv   r   r0   rw   r   r   r   r   r|   r      &&,r   
get_statusZSmartDevice.get_statusc  sp     ;;;}LLOQUQ\Q\QcQcd..00;;;OOR KK..0 ((**r   c                s   V P                   V,          w  rgp p	V\        V^ ^4      ,          pRV9   d    \        \        P                  ! V!  4      .p
MV Uu. uF  q^(,          NK  	  p
p\        V
4       F`  w  rV^,          pWN,          V,          pV P                  ^^KWgV.VR,          ,           4       V P                  ^.VR,          ,           4       Kb  	  R# u upi )r   r
   :r   9   N:r   NNN)r   r   list	itertoolschainr   r9   )r   r&   r"   r#   r-   r%   mvalmod3mod4r'   ZstepsZcolorrm   ledsZseqZbyte4s   &&&&&&          r   r    ZSmartDevice._write_colorss  s    !%!2!24!8D!Q
 	iD11d?)//6234E+126%2XX6E2 'GAq&CJ%EKKdD6dCDKKS	)*	 ( 3s   Cc                s2    V P                  ^^MV^ V.4       R# )   Nr9   r<   r=   r   r1   ZSmartDevice._write_fixed_duty  s    S$Q-.r    r   r   r   r   r   r   r   r      r   r   r   r   r   (   r   r   r   r   ru   r   r   r   r   r      r   r   r   r   )r   r   ru   r   r   )r   r      r   r   )r   r   i   r   r   i   r   r   r   ru      r   r   r   r   )r   ru   r   r   r      r   r   r   ru      r   r   r   ru   )r   r   r   r   r   i	   r   r   r   r   )   r   r   r   r   )   r   r   r   r   Fr?   )r@   rA   rB   rC   rD   _MATCHESrz   r8   r   r   r   r   r   r   r    r1   rE   rF   rG   rH   rJ   r   rK   rK      s    - 
1!1!14
 	 
!1!1+
 		H LM)A 	)A 	)B	
 	)A 	)A 	)A 	)A 	)A 	)A 	)A 	)A 	)A 	)A 	)A  	)B!" 	)A#$ 	)A%& 	)B 	")A)A)A)A)A$)A&)A)B;L@X*X<+ +$/ /r   rK   c                   sD  a a ] tR tRt oRtRRRR^R^/3RRRR^R^/3RR	RR^R^/3RR
RR^ R^/3RRRR^ R^/3RRRR^R^/3RRRR^R^/3RRRR^R^/3RRRR^R^ /3RRRR^R^ /3RRRR^R^ /3RRRR^R^/3.t^t^@t^@t/ RRHbRRIbRRJbRRKbRRLbRRMbRRNbRRObRRPbR RQbR!RRbR"RSbR#RTbR$RUbR%RVbR&RWbR'RXb/ R(RYbR)RZbR*R[bR+R\bR,R]bR-R^bR.R_bR/R`bR0RabR1RbbR2RLbR3RMbR4RNbR5RObR6RPbR7RQbR8RcbCR9RdR:ReR;RfR<R_R=R`R>Ra/Ct	V 3R? lt
RgR@ ltRA tRB tRgRC ltRD tRhRE ltRF tRGtVtV ;t# )iSmartDevice2i  z4NZXT HUE 2 lighting and, optionally, fan controller.rL   i   zNZXT Smart Device V2rM   rN   i   i   i   z
NZXT HUE 2i   zNZXT HUE 2 Ambienti	   zNZXT RGB & Fan Controlleri   i   i   z(NZXT RGB & Fan Controller (3+6 channels)i   i   i    rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   zalternating-3zalternating-4zalternating-5zalternating-6zmoving-alternating-3zmoving-alternating-4zmoving-alternating-5zmoving-alternating-6rZ   r[   r\   r]   starry-nightrainbow-flowsuper-rainbowrainbow-pulser^   r_   r`   ra   rb   rc   rd   zbackwards-moving-alternating-3zbackwards-moving-alternating-4zbackwards-moving-alternating-5zbackwards-moving-alternating-6zbackwards-rainbow-flowzbackwards-super-rainbowzbackwards-rainbow-pulsec                s.  < \        V4       Uu/ uF  pRV^,            2V\        \        3bK  	  pp\        V4       Uu/ uF  pRV^,            2^V,          bK  	  ppV'       d   ^V,          ^,
          VR&   \        S	V `  ! WWx3/ VB  R# u upi u upi )re   rf   rg   r/   Nrh   rl   rn   r   r   ZSmartDevice2.__init__  s     $))<#=?#=a  Aw-!Y	)BB#= 	 ? $))<#=?#=a  Aw-!q&0#= 	 ?&'+>&>!%CN6"nWPVW??s
   !BBc           
     s  a V P                   P                  4        V P                  '       d   V P                  '       d4   V'       g,   \        P                  RV P                  P                  4       MqV P                  '       d+   \        P                  RV P                  P                  4       R ! R4      pV P                  ^`^^^V^^V.4       V P                  ^`^.4       V P                  ^^.4       V P                  ^ ^.4       . oV3R lpV3R lpRV/pV P                  '       d   WVR&   V P                  V4       \        S4      # )	ro   rp   rq   c                 sB    ^\        V R,
          R,          4      ,           # )r         ?g      ?)r   )Zsecss   &r   Z<lambda>Z)SmartDevice2.initialize.<locals>.<lambda>  s    E4"9:K4L0Lr   r   c                 n   < V ^,           RV ^,           RV ^,           2pSP                  RVR34       R# i   rs   rt   r   Nr{   r}   r~   r      & r   parse_firm_infoZ0SmartDevice2.initialize.<locals>.parse_firm_info  9    I;aD	{!CI;7BJJ*B34r   c           	      s&  < V ^,          p^p\        V4       Fu  p\        \        4       F_  pWV\        ,          ,           V,           ,          pV^ 8X  d    K@  SP                  RV^,            RV^,            2\        V4      R34       Ka  	  Kw  	  R# )   LED z accessory r   Nri   r   r{   r   r}   Zchannel_countZoffsetZcZaZaccessory_idr      &     r   parse_led_infoZ/SmartDevice2.initialize.<locals>.parse_led_info#  s    GMF=)>?A#&4S0S'SVW'W#XL#q(JJ$q1ug[Q @#0#> D E	 @ *r         !)r   rx   r   rv   r   r0   rw   r   r9   r   _read_untilsorted)r   r|   r   Zupdate_intervalr   r   parsersr   s   &&,    @r   r   ZSmartDevice2.initialize  s    	**, {{{=\![[//1 ;;;OO$X$(KK$6$68#Lb"QT4t_dDRabcT4L) 	T4L!T4L!	5		E 0#1K !c{r   c                s   a a . oVV 3R  lpS P                   P                  4        S P                  RV/4       \        S4      # )c                 s  < ^p^p^(p^8p. ROp\        S
P                  4       F  w  rgWPW,           ,          ,          pS	P                  RV^,            R2W^,           ,          ^,          W,          ,          R34       S	P                  RV^,            R2WV,           ,          R34       S	P                  RV^,            R2VR34       V^,          pK  	  S	P                  R	W,          R
34       R# )r   Nr   r   r    duty%r   r   r   r   r   r   r   r{   )r}   mode_offset
rpm_offsetduty_offsetZnoise_offset	raw_modesrm   r'   r"   r   r      &        r   parse_fan_infoZ9SmartDevice2._get_status_directly.<locals>.parse_fan_info7  s    KJKL+I!$"6"67 [_!56

d1q5'0#1n2E2JS_2\^cde

d1q5'/1_1EsKL

d1q5'7rBCa
 8 JJs'8$?@r   s   gr   rx   r   r   )r   r   r   s   f @r   r   Z!SmartDevice2._get_status_directly4  s=    	A 	**,+~67c{r   c           
     s   . pR R.p\        ^\        V P                  4      ^,           4       F  pVP                  RV R2V P                  P                  RV R24      R34      3 VP                  RV R2V P                  P                  RV 24      R	,          ^,          R
34      3 VP                  RV R2W P                  P                  RV R24      ,          R34      3 K  	  \        V4      # )r   r   r   r   rf   r   r   r   r   g      Y@r   r   r   r   )ri   r   r   r{   rv   r   r   )r   r   Zmodesr   s   &   r   r   Z#SmartDevice2._get_status_from_hwmonJ  s    uq#d223a78AJJ$qc($++*>*>QCv*OQVWXYJJ$qc)=)=A3i)H4)ORU)UWZ[\]JJ$qc/{{7K7KcRSQTTYN7[1\^`abc 9 c{r   c                sj   V P                   '       g   . # V P                  '       dC   V'       g;   \        P                  RV P                  P                  4       V P                  4       # V P                  '       d+   \        P                  RV P                  P                  4       V P                  4       # r   )r   rv   r   r0   rw   r   r   r   r   r   r   r   ZSmartDevice2.get_statusW  s     ###I;;;}LLOQUQ\Q\QcQcd..00;;;OOR KK..0 ((**r   c                D   \        V P                  4       Fg  pV P                  P                  V P                  4      p\        VR ,          4      pVP                  VR4      pV'       d	   V! V4       V'       d   Kf   R# 	  Q RV P                   R\        V4       R24       h:r   r   NNzmissing messages (attempts=z
, missing=Z)ri   _MAX_READ_ATTEMPTSr   ry   rz   ZbytesZpopr   r   r   r'   r}   ZprefixZfunc   &&    r   r   ZSmartDevice2._read_untilj      t../A++""4#4#45C3s8_F;;vt,DS	7 0 	g3D4K4K3LJWZ[bWcVddeffur   c                s   V P                   V,          w  rgrp
V P                  '       g   Q R 4       h\        V4      pV
^(8X  d   . ROW,
          ,          p\        \        P
                  ! V!  4      V,           pV P                  ^"^V^ .VR,          ,           4       V P                  ^"^V^ .VR,          ,           4       V P                  ^"^V^ Wg^ ^ ^ ^ ^d^ ^2^ ^ ^.4       R# VR8X  Ed   V EF  w  rpV P                  ^"^V.4       V P                  ^"^V.4       . .^,          pWV.^,          V^ &   V^ ,           Uu. uF  p\        VR,          4      NK  	  upV^&   V^,           Uu. uF  p\        V^,          4      NK  	  upV^&   \        ^4       FR  pVR9   d   ^M^p^"^ VV^^9^ V^ ^ ^ ^ ^ ^ ^ ^^^^^^^^ ^ ^ ^ ^ ^ .pV P                  VVV^,          ,          ,           4       KT  	  V P                  ^"^V^.4       EK  	  R# V^,          ^,	          p\        V^ ^4      pV^8X  d   TMTpV^8X  d   TM^ p^(^V^ WdVVVV.
pV P                  V\        \        P
                  ! V!  4      ,           4       R# u upi u upi )z.color channels should be available and enabledr   <   Nr   NNr^   g      @Nr   )r   r   )
r   r   r   r   r   r   r9   Zintri   r   )r   r&   r"   r#   r-   r%   r   r   r   r(   r)   color_countled_paddingr   r+   r*   r,   Zcolor_listsZxrm   Zmodr}   Zbyte7Zbyte8Zbyte9Zbyte10headers   &&&&&&                     r   r    ZSmartDevice2._write_colorsu  s|   151B1B41H.DY###U%UU#&k?,i.EFK	01K?DKKtS$/$t*<=KKtS$/$s);<KKtS$D$tT4tTC DW_#	qT4-.T4-.!dQh"#QA9DQ!HA#a3h-!HA7B1~!F~!#a1f+~!FAqA"#v+$4C $QdD# $dD$d $dD$d $d4C KKk!a%&8 89 " T4d34 $  D[Q&E!)Q2E DLDkE!T\TtFD#tTufUFKKioov&>!??@! "I!Fs   <I9(I>c                s\    ^b^^V,          ^ ^ ^ .pW#V^,           &   V P                  V4       R# )ib   Nr   )r   r&   r2   r}   s   &&& r   r1   ZSmartDevice2._write_fixed_duty  s/    T43;dD9C!GCr   r   r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   r   r   )r   i   r   r   r   )ru   r   r   r   r   r   )rr   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )Nr   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   r   r   )r@   rA   rB   rC   rD   r   r   rz   r8   r   r   r   r   r   r   r   r    r1   rE   rF   rG   rH   rJ   r   r   r     s    >
 
/!1!12
 	 
/!1!12
 	 
/!1!12
 	 
!1!1(
 	 
-!1!10
 	 
4!1!17
 	 
4!1!17
 	 
4!1!17
 	 
C!1!1F
 	 
C!1!1F
 	 
C!1!1F
 	 
C!1!1F
 	[1Hf LM,,D, 	,D, 	,E	,
 	,D, 	,D, 	,D, 	,D, 	,D, 	,D, 	,D, 	,D, 	,D, 	,D, 	,D,  	,D!," 	,D#,$ 	,D%,& 	,D',( 	,D),* 	,D+,, 	,E-,. 	,D/,0 	,D1,2 	,D3,4 	,D5,6 	,D7,8 	,D9,> 	",D?,@ 	,DA,B 	,DC,D 	,DE,F 	,DG,H 	%,DI,J 	),DK,L 	),D(,D(,D ,D!,D!,DW,L\X5n,+&	g#AJ r   r   c                   s@   a  ] tR tRt o RRRR^R^ /3.tR
R ltRtV tR	# )H1V2i  rL   i   z
NZXT H1 V2rM   rN   c                s   a a . oVV 3R  lpS P                   P                  4        S P                  RV/4       \        S4      # )c                 s  < ^p^p^p^p. R
Op\        S
P                  4       F  w  rgWPW,           ,          ,          pS	P                  RV^,            R2W,          ^,          W^,
          ,          ,          R34       S	P                  RV^,            R2W,          R34       S	P                  RV^,            R2VR34       V^,          pV^,          pK  	  S	P                  R	W,          ^,          W^,
          ,          ,          R34       R# )i   Nr   r   r   r   r   r   r   z
Pump speedr   r   )r}   r   r   r   Zpump_offsetr   rm   r'   r"   r   r   r   r   r   Z'H1V2.get_status.<locals>.parse_fan_info  s    KJKK+I!$"6"67 [_!56

d1q5'0#/Q2FZ[^I\2\^cde

d1q5'/1A3GH

d1q5'7rBCa
q  8 JJc&6!&;cPQ/>R&RTYZ[r   s   ur   )r   r|   r   r   r   s   f&, @r   r   ZH1V2.get_status  s=    	\" 	**,+~67c{r   r   Nr   )r@   rA   rB   rC   r   r   rE   rF   )rI   s   @r   r   r     s1     	!1!1(
 	H r   r   c                   s  a a ] tR tRt oRRRR^ R^/3RRRR^ R^/3.t^t^@t^@tRR!R	R"R
R#RR$RR%RR&RR'RR(RR)RR*RR+RR,RR-RR./tR^(^ .^^ .^^ .^
^ .^^ ..R^P^ .^<^ .^(^ .^^ .^
^ ..R^^ .^^ .^^ .^^ .^^ ..R^ ^ .^^ .^^ .^^ .^,^ ..R^^ .^^ .^^ .^^ .^^ ..R^^^.^,^.^^ .^^ .^P^ ..R^^^.^,^.^^ .^^ .^P^ ..R^^^.^,^.^^ .^^ .^P^ ..R^^^.^,^.^^ .^^ .^P^ ..R^^^.^,^.^^ .^^ .^P^ ..R^@^.^^.^^.^ ^.^X^..R	^2^ ..^,          R
^2^ ..^,          R^2^ ..^,          R^ ^ ..^,          /t	V 3R lt
R/R ltR/R ltR tR tR0R ltR tR tR tVtV ;t# )1Nzxt2023RgbControlleri  rL   i   zNZXT 2023 RGB ControllerrM   rN   i!   rO   rP   rQ   r[   rR   rX   rZ   rS   rY   r   r   r   r   r]   zalternating-movingzcover-marqueec                s   < / p\        V4       Uu/ uF  pRV^,            2^V,          bK  	  ppV'       d   ^V,          ^,
          VR&   \        S	V `  ! WWh3/ VB  R# u upi )re   rg   r/   N)ri   r
   r   )
r   r   r   rM   rN   r   r   rm   r   r   rn   r   r   ZNzxt2023RgbController.__init__  ss    #()<#=?#=a  Aw-!q&0#= 	 ?&'+>&>!%CN6"nWPVW	?s   Ac                s  a V P                   P                  4        V P                  ^^.4       V P                  ^ ^.4       . oV3R lpV3R lpRV/pV P                  '       d   WER&   V P	                  V4       \        S4      # )ro   c                 r   r   r   r   r   r   r   Z9Nzxt2023RgbController.initialize.<locals>.parse_firm_info  r   r   c                 s  < V ^,          p^p\        V4       Fk  p\        \        4       FU  pWV\        ,          ,           V,           ,          pV^ 8X  d    K@  SP                  RV^,            2\        V4      R34       KW  	  Km  	  R# )r   r   r   Nr   r   r   r   r   Z8Nzxt2023RgbController.initialize.<locals>.parse_led_info  sw    GMF=)>?A#&4S0S'SVW'W#XL#q(JJ$q1ugl0KRPQ	 @ *r   r   r   )r   rx   r9   r   r   r   )r   r|   r   r   r   r   r   s   &&,   @r   r   Z Nzxt2023RgbController.initialize  s     	**, 	T4L!T4L!	5	R 0#1K !c{r   c                s~    . pVP                  R\        V P                  4      ^,
           2RR34       \        V4      # )r   zARGB Channels: r   )r{   r   r   r   )r   r|   r   r   s   &&, r   r   Z Nzxt2023RgbController.get_status&  s>     

oc$*>*>&?&A%BCRLMc{r   c                r   r   r   r   r   r   r   Z!Nzxt2023RgbController._read_until0  r   r   c                sV   \        V4      p. RO^(V,
          ,          p\        \        P                  ! V!  4      V,           pV P	                  ^"^V^ .VR,          ,           4       V P	                  ^"^V^ .VR,          ,           4       V P	                  ^"^V^ ^^ ^ ^^ ^ ^^ ^2^ ^ ^.4       R# )r   r   r   Nr   )r   r   r   r   r9   )r   r&   r#   r   r   r   s   &&&   r   _write_individual_colorZ-Nzxt2023RgbController._write_individual_color;  s    &k("{*:;IOOV,-;T4d+d4j89T4d+d3i78T4dD$dD4tT4? 	@r   c                sd   V P                   V,          w  rgrp
\        V4      pV
^(8X  d   V P                  W4       R# ^*^W.pV P                  V,          V,          pWm^ ,          V^,          .\	        \
        P                  ! V!  4      ,           pVR8X  d   ^M^ pWV^^.^ .^,          ,           p\        V4      \        V4      ,           \        V4      ,           p\        V P                  V,
          4       Uu. uF  p^ NK  	  ppV P                  W,           V,           V,           4       R# u upi )r   r   N)
r   r   r   _SPEED_VALUESr   r   r   ri   r8   r9   )r   r&   r"   r#   r-   r%   Zcmode0Zmod1Zmod2r(   r)   r   r   r$   Z
color_moder   ZfooterZ
msg_lengthr'   Zspaces   &&&&&&              r   r    Z#Nzxt2023RgbController._write_colorsD  s   373D3DT3J0dy&k?((5 D#+F &&t,T2E (E!H5Y__f=U8VVJ %z14tDtT:dVAXEF Vs:6VDJ#(););j)H#IJ#IaT#IEJKK+e3f<= Ks   9D-c                r4   r	   r   )r   r!   r2   r   r5   r   r3   Z%Nzxt2023RgbController.set_fixed_speed]  r7   r   c                r4   r	   r   r<   r=   r   r1   Z'Nzxt2023RgbController._write_fixed_duty`  r7   r   r   r   r   r   )r   r   ru   r   ru   )r   r   ru   r   ru   r   )r   r   ru   r   r   r   r   r   )r   r   r   r   r   )rr   r   r   r   r   )r   r   r   r   r   )ru   r   r   r   r   r   r   )r@   rA   rB   rC   r   r   rz   r8   r   r   r   r   r   r   r   r    r3   r1   rE   rF   rG   rH   rJ   r   r   r     s    	3!1!16
 	 
3!1!16
 		H LM 	44544444444444L$ 	d|dD\D;tW[\`Vabd|dD\D;tW[\`Vabd|dD\D;tW[\`Vabd|dD\D;tW[\`Vabd|dD\D;tW[\`Vabd|dD\D;dVZ\`Uabd|dD\D;dVZ\`Uabd|dD\D;dVZ\`Uabd|dD\D;dVZ\`Uabd|dD\D;dVZ\`Uabd|dD\D$<$PTX\^bWcdd|nQ.d|nQ.d|nQ.d|nQ.M$X'R	g@>2%% %r   r   )rD   r   ZloggingZliquidctl.driver.usbr    Zliquidctl.errorr   Zliquidctl.utilr   r   r   r   Z	getLoggerr@   r   r   rj   rk   r   rK   r   r   r   ZNzxtSmartDeviceDriverZSmartDeviceDriverZSmartDeviceV2Driverr   r   r   <module>r      s   pd   - 0; ; 

H
%   		B%| B%Jx/" x/vT# Tn< B`%, `%H $  " r   