]> vault307.fbx.one Git - micorpython_ir.git/commitdiff
Prior to portable tx branch
authorPeter Hinch <peter@hinch.me.uk>
Mon, 9 Mar 2020 08:20:05 +0000 (08:20 +0000)
committerPeter Hinch <peter@hinch.me.uk>
Mon, 9 Mar 2020 08:20:05 +0000 (08:20 +0000)
README.md
ir_rx/test.py [moved from ir_rx_test.py with 79% similarity]

index 1e1fa25b39e2374ea9718214a92945c219b009fc..b264e185277dee74159e652658b344f8cbe9bafc 100644 (file)
--- a/README.md
+++ b/README.md
@@ -73,11 +73,18 @@ This is a Python package. This minimises RAM usage: applications only import
 the device driver for the protocol in use.
 
 Copy the following to the target filesystem:
- 1. `ir_rx` Directory and contents. Contains the device drivers.
- 2. `ir_rx_test.py` Demo of a receiver.
+ 1. `ir_rx` Directory and contents. Contains device drivers and test script.
 
 There are no dependencies.
 
+The test script may be used to characterise remote controls. To run it issue:
+```python
+from ir_rx import test
+```
+The script will display instructions for running against the various protocols.
+If you are unsure which protocol your remote uses, try each one in turn. If
+none of the options work it may be that an unsupported protocol is in use.
+
 The demo can be used to characterise IR remotes. It displays the codes returned
 by each button. This can aid in the design of receiver applications. The demo
 prints "running" every 5 seconds and reports any data received from the remote.
similarity index 79%
rename from ir_rx_test.py
rename to ir_rx/test.py
index badd2b559b76117a49f9bee3f2b9b3a87728af00..354a6564a614c2f4940a80e02522eb599fd59141 100644 (file)
@@ -1,5 +1,5 @@
-# ir_rx_test.py Test program for IR remote control decoder arem.py
-# Supports Pyboard and ESP8266
+# test.py Test program for IR remote control decoder
+# Supports Pyboard ESP32 and ESP8266
 
 # Author: Peter Hinch
 # Copyright Peter Hinch 2020 Released under the MIT license
@@ -32,7 +32,7 @@ def cb(data, addr, ctrl):
     else:
         print('Data {:02x} Addr {:04x} Ctrl {:02x}'.format(data, addr, ctrl))
 
-def test(proto=0):
+def run(proto=0):
     classes = (NEC_8, NEC_16, SONY_12, SONY_15, SONY_20, RC5_IR, RC6_M0)
     ir = classes[proto](p, cb)  # Instantiate receiver
     ir.error_function(print_error)  # Show debug information
@@ -45,14 +45,14 @@ def test(proto=0):
 
 # **** DISPLAY GREETING ****
 s = '''Test for IR receiver. Run:
-from ir_rx_test import test
-test() for NEC 8 bit protocol,
-test(1) for NEC 16 bit,
-test(2) for Sony SIRC 12 bit,
-test(3) for Sony SIRC 15 bit,
-test(4) for Sony SIRC 20 bit,
-test(5) for Philips RC-5 protocol,
-test(6) for RC6 mode 0.
+from ir_rx import test
+test.run() for NEC 8 bit protocol,
+test.run(1) for NEC 16 bit,
+test.run(2) for Sony SIRC 12 bit,
+test.run(3) for Sony SIRC 15 bit,
+test.run(4) for Sony SIRC 20 bit,
+test.run(5) for Philips RC-5 protocol,
+test.run(6) for RC6 mode 0.
 
 Hit ctrl-c to stop, then ctrl-d to soft reset.'''