adafruit / Adafruit_Learning_System_Guides

Programs and scripts to display "inline" in Adafruit Learning System guides
MIT License
1.01k stars 770 forks source link

the number of arguments in decode_bits is too damn high! #1021

Open critchards opened 4 years ago

critchards commented 4 years ago

Adafruit_Learning_System_Guides/Circuit_Playground_Express_and_IR/CPX_IR_Remote_Recieve.py /

Great example, almost perfect. Got me from knowing close to nothing about the circuit playground express to making cool lights and sounds remotely. Love it!

But, first I had to find this bug. Line 15 received_code = decoder.decode_bits(pulses, debug=False) throws an error. Problem is decode_bits(pulses) doesnt like the debug argument. Could be this is some expert level code magic I dont understand but it works when I delete debug=false... so thats my issue.

For reference, the adafruit_irremote library doesnt have a debug argument either. https://github.com/adafruit/Adafruit_CircuitPython_IRRemote/blob/master/adafruit_irremote.py

kevinjwalters commented 4 years ago

The guide code was broken when it wasn't updated in line with an interface change in the library where debug was removed: https://github.com/adafruit/Adafruit_CircuitPython_IRRemote/commit/ed2adf7f66eaac026306074daf898d114f30d8e4#diff-0fe75fc9012f8da2c58900053dfb98cb

There's actually quite a few from my crude search (won't necessarily find them all, like black formatted ones).

$ grep 'decode_bits(.*debug' $(find . -name '*.py' -print)
./Adafruit_pIRKey/NEC_print_example.py:        code = decoder.decode_bits(pulses, debug=False)
./Adafruit_pIRKey/NEC_keyboard_example.py:        code = decoder.decode_bits(pulses, debug=False)
./Circuit_Playground_Express_and_IR/CPX_IR_Remote_Recieve.py:        received_code = decoder.decode_bits(pulses, debug=False)
./Circuit_Playground_Express_and_IR/CPX_IR_as_Input.py:        received_code = decoder.decode_bits(pulses, debug=False)
./Crickits/yayayay_flier/code.py:        code = decoder.decode_bits(pulses, debug=False)
./Make_It_Sense/cpx-ir-decode-list.py:        code = decoder.decode_bits(pulses, debug=False)
./Make_It_Sense/cpx-ir-decode.py:        code = decoder.decode_bits(pulses, debug=False)
./Remote_Tree_Ornament/main.py:        code = decoder.decode_bits(pulses, debug=False)

Those are just files so they may or may not be actively used in each respective guide.