@@ -102,27 +102,6 @@ class FanSpeedLUT:
102
102
_fan_lut_t8 = UnaryStruct (0x5E , "<B" )
103
103
_fan_lut_s8 = UnaryStruct (0x5F , "<B" )
104
104
105
- _lut_speed_setters = [
106
- _fan_lut_s1 ,
107
- _fan_lut_s2 ,
108
- _fan_lut_s3 ,
109
- _fan_lut_s4 ,
110
- _fan_lut_s5 ,
111
- _fan_lut_s6 ,
112
- _fan_lut_s7 ,
113
- _fan_lut_s8 ,
114
- ]
115
- _lut_temp_setters = [
116
- _fan_lut_t1 ,
117
- _fan_lut_t2 ,
118
- _fan_lut_t3 ,
119
- _fan_lut_t4 ,
120
- _fan_lut_t5 ,
121
- _fan_lut_t6 ,
122
- _fan_lut_t7 ,
123
- _fan_lut_t8 ,
124
- ]
125
-
126
105
def __init__ (self , fan_obj ):
127
106
self .emc_fan = fan_obj
128
107
self .lut_values = {}
@@ -187,19 +166,15 @@ def _set_lut(self, lut_dict):
187
166
# get and sort the new lut keys so that we can assign them in order
188
167
lut_keys = list (self .lut_values .keys ())
189
168
lut_keys .sort ()
190
- for idx in range (lut_size ):
191
- current_temp = lut_keys [idx ]
169
+ for idx , current_temp in enumerate (sorted (self .lut_values .keys ())):
192
170
current_speed = _speed_to_lsb (self .lut_values [current_temp ])
193
- getattr (self , "_fan_lut_t%d" % (idx + 1 )).__set__ (self , current_temp )
194
- getattr (self , "_fan_lut_s%d" % (idx + 1 )).__set__ (self , current_speed )
195
-
196
- # self.emc_fan._lut_temp_setters[idx].__set__(self.emc_fan, current_temp)
197
- # self.emc_fan._lut_speed_setters[idx].__set__(self.emc_fan, current_speed)
171
+ setattr (self , "_fan_lut_t%d" % (idx + 1 ), current_temp )
172
+ setattr (self , "_fan_lut_s%d" % (idx + 1 ), current_speed )
198
173
199
174
# Set the remaining LUT entries to the default (Temp/Speed = max value)
200
- for idx in range (8 )[lut_size :]:
201
- getattr (self , "_fan_lut_t%d" % (idx + 1 )). __set__ ( self , MAX_LUT_TEMP )
202
- getattr (self , "_fan_lut_s%d" % (idx + 1 )). __set__ ( self , MAX_LUT_SPEED )
175
+ for idx in range (8 )[len ( self . lut_values ) :]:
176
+ setattr (self , "_fan_lut_t%d" % (idx + 1 ), MAX_LUT_TEMP )
177
+ setattr (self , "_fan_lut_s%d" % (idx + 1 ), MAX_LUT_SPEED )
203
178
self .emc_fan .lut_enabled = current_mode
204
179
205
180
0 commit comments