@@ -202,6 +202,7 @@ def wait_for_new_color(self):
202
202
203
203
@property
204
204
def ir_channel (self ):
205
+ """Get the IR channel for message transmission"""
205
206
return self ._ir_channel
206
207
207
208
@ir_channel .setter
@@ -217,20 +218,15 @@ def ir_channel(self, channel=1):
217
218
elif check_chan < 1 :
218
219
check_chan = 1
219
220
# Internally: 0-3
220
- self ._ir_channel = int (check_chan )- 1
221
+ self ._ir_channel = int (check_chan ) - 1
221
222
222
223
@property
223
224
def ir_address (self ):
224
- """
225
- IR Address space of 0x0 for default PoweredUp or 0x1 for extra space
226
- """
225
+ """IR Address space of 0x0 for default PoweredUp or 0x1 for extra space"""
227
226
return self ._ir_address
228
227
229
228
def toggle_ir_toggle (self ):
230
- """
231
- Toggle the IR toggle bit
232
-
233
- """
229
+ """Toggle the IR toggle bit"""
234
230
# IYKYK, because the RC documents are not clear
235
231
if self ._ir_toggle :
236
232
self ._ir_toggle = 0x0
@@ -241,7 +237,8 @@ def toggle_ir_toggle(self):
241
237
def send_ir_sop (self , port , mode ):
242
238
"""
243
239
Send an IR message via Power Functions RC Protocol in Single Output PWM mode
244
- https://www.philohome.com/pf/pf.htm
240
+
241
+ PF IR RC Protocol documented at https://www.philohome.com/pf/pf.htm
245
242
246
243
Port B is blue
247
244
@@ -297,7 +294,8 @@ def send_ir_sop(self, port, mode):
297
294
def send_ir_socstid (self , port , mode ):
298
295
"""
299
296
Send an IR message via Power Functions RC Protocol in Single Output Clear/Set/Toggle/Increment/Decrement mode
300
- https://www.philohome.com/pf/pf.htm
297
+
298
+ PF IR RC Protocol documented at https://www.philohome.com/pf/pf.htm
301
299
302
300
Valid values for mode are:
303
301
0x0: Toggle full Clockwise/Forward (Stop to Clockwise, Clockwise to Stop, Counterclockwise to Clockwise)
@@ -320,7 +318,6 @@ def send_ir_socstid(self, port, mode):
320
318
:param port: 'A' or 'B'
321
319
:param mode: 0-15 indicating the port's mode to set
322
320
"""
323
-
324
321
escape_modeselect = 0x0
325
322
escape = escape_modeselect
326
323
@@ -352,7 +349,8 @@ def send_ir_socstid(self, port, mode):
352
349
def send_ir_combo_pwm (self , port_b_mode , port_a_mode ):
353
350
"""
354
351
Send an IR message via Power Functions RC Protocol in Combo PWM mode
355
- https://www.philohome.com/pf/pf.htm
352
+
353
+ PF IR RC Protocol documented at https://www.philohome.com/pf/pf.htm
356
354
357
355
Valid values for the modes are:
358
356
0x0 Float
@@ -375,7 +373,6 @@ def send_ir_combo_pwm(self, port_b_mode, port_a_mode):
375
373
:param port_b_mode: 0-15 indicating the command to send to port B
376
374
:param port_a_mode: 0-15 indicating the command to send to port A
377
375
"""
378
-
379
376
escape_combo_pwm = 0x1
380
377
escape = escape_combo_pwm
381
378
@@ -387,7 +384,8 @@ def send_ir_combo_pwm(self, port_b_mode, port_a_mode):
387
384
def send_ir_combo_direct (self , port_b_output , port_a_output ):
388
385
"""
389
386
Send an IR message via Power Functions RC Protocol in Combo Direct mode
390
- https://www.philohome.com/pf/pf.htm
387
+
388
+ PF IR RC Protocol documented at https://www.philohome.com/pf/pf.htm
391
389
392
390
Valid values for the output variables are:
393
391
0x0: Float output
@@ -419,7 +417,8 @@ def send_ir_combo_direct(self, port_b_output, port_a_output):
419
417
def send_ir_extended (self , mode ):
420
418
"""
421
419
Send an IR message via Power Functions RC Protocol in Extended mode
422
- https://www.philohome.com/pf/pf.htm
420
+
421
+ PF IR RC Protocol documented at https://www.philohome.com/pf/pf.htm
423
422
424
423
Valid values for the mode are:
425
424
0x0: Brake Port A (timeout)
@@ -450,7 +449,8 @@ def send_ir_extended(self, mode):
450
449
def send_ir_single_pin (self , port , pin , mode , timeout ):
451
450
"""
452
451
Send an IR message via Power Functions RC Protocol in Single Pin mode
453
- https://www.philohome.com/pf/pf.htm
452
+
453
+ PF IR RC Protocol documented at https://www.philohome.com/pf/pf.htm
454
454
455
455
Valid values for the mode are:
456
456
0x0: No-op
@@ -490,7 +490,7 @@ def send_ir_single_pin(self, port, pin, mode, timeout):
490
490
491
491
if pin != 1 and pin != 2 :
492
492
return False
493
- pin_value = pin - 1
493
+ pin_value = pin - 1
494
494
495
495
if mode > 0x3 or mode < 0x0 :
496
496
return False
@@ -499,7 +499,7 @@ def send_ir_single_pin(self, port, pin, mode, timeout):
499
499
nibble2 = (self ._ir_address << 3 ) | ir_mode
500
500
nibble3 = (output_port << 3 ) | (pin_value << 3 ) | mode
501
501
502
- return self ._send_ir_nibbles (nibble1 , nibble2 , mode )
502
+ return self ._send_ir_nibbles (nibble1 , nibble2 , nibble3 )
503
503
504
504
def _send_ir_nibbles (self , nibble1 , nibble2 , nibble3 ):
505
505
@@ -516,7 +516,7 @@ def _send_ir_nibbles(self, nibble1, nibble2, nibble3):
516
516
if nibble1 < 0x0 or nibble2 < 0x0 or nibble3 < 0x0 :
517
517
return False
518
518
519
- byte_two = (nibble2 << 4 ) | nibble3
519
+ byte_two = (nibble2 << 4 ) | nibble3
520
520
521
521
data = bytearray (3 )
522
522
data [0 ] = (0xc << 4 ) | mode
0 commit comments