diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abdf3f2..e8a3ee9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: which meshtastic meshtastic --version - name: Run pylint - run: pylint meshtastic + run: pylint meshtastic examples/ - name: Run tests with pytest run: pytest --cov=meshtastic - name: Generate coverage report diff --git a/Makefile b/Makefile index 2688ea1..14ad4d6 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ docs: # lint the codebase lint: - pylint meshtastic + pylint meshtastic examples # show the slowest unit tests slow: diff --git a/examples/info_example.py b/examples/info_example.py new file mode 100644 index 0000000..4b0a2af --- /dev/null +++ b/examples/info_example.py @@ -0,0 +1,23 @@ +"""Simple program to demo how to use meshtastic library. + To run: python examples/info.py +""" + +import meshtastic +import meshtastic.serial_interface + +iface = meshtastic.serial_interface.SerialInterface() + +# call showInfo() just to ensure values are populated +#info = iface.showInfo() + +if iface.myInfo: + #print(f'myInfo:{iface.myInfo}') + print(f'firmware_version:{iface.myInfo.firmware_version}') + +if iface.nodes: + for n in iface.nodes.values(): + if n['num'] == iface.myInfo.my_node_num: + print(n['user']['hwModel']) + break + +iface.close() diff --git a/examples/pub_sub_example.py b/examples/pub_sub_example.py index a58d83a..79d49cf 100644 --- a/examples/pub_sub_example.py +++ b/examples/pub_sub_example.py @@ -13,7 +13,7 @@ if len(sys.argv) < 2: print(f"usage: {sys.argv[0]} host") sys.exit(1) -def onConnection(interface, topic=pub.AUTO_TOPIC): +def onConnection(interface, topic=pub.AUTO_TOPIC): # pylint: disable=unused-argument """This is called when we (re)connect to the radio.""" print(interface.myInfo) interface.close() diff --git a/examples/pub_sub_example2.py b/examples/pub_sub_example2.py index b8ee60b..03edacd 100644 --- a/examples/pub_sub_example2.py +++ b/examples/pub_sub_example2.py @@ -14,11 +14,11 @@ if len(sys.argv) < 2: print(f"usage: {sys.argv[0]} host") sys.exit(1) -def onReceive(packet, interface): +def onReceive(packet, interface): # pylint: disable=unused-argument """called when a packet arrives""" print(f"Received: {packet}") -def onConnection(interface, topic=pub.AUTO_TOPIC): +def onConnection(interface, topic=pub.AUTO_TOPIC): # pylint: disable=unused-argument """called when we (re)connect to the radio""" # defaults to broadcast, specify a destination ID if you wish interface.sendText("hello mesh") diff --git a/examples/scan_for_devices.py b/examples/scan_for_devices.py index 6dc28c3..9971a93 100644 --- a/examples/scan_for_devices.py +++ b/examples/scan_for_devices.py @@ -3,7 +3,6 @@ """ import sys -import meshtastic from meshtastic.supported_device import get_unique_vendor_ids, active_ports_on_supported_devices from meshtastic.util import detect_supported_devices diff --git a/info/mac/techo.txt b/info/mac/techo.txt index ab2b12a..833bbda 100644 --- a/info/mac/techo.txt +++ b/info/mac/techo.txt @@ -30,3 +30,11 @@ drwxrwxrwx 1 bob staff 512 Feb 1 16:47 .fseventsd % diff /tmp/a /tmp/c > | +-o T-Echo v1@14300000 + +contents of: INFO_UF2.TXT + +UF2 Bootloader 0.6.1-2-g1224915 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-293-gaf8e5a90) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7) +Model: LilyGo T-Echo +Board-ID: nRF52840-TEcho-v1 +SoftDevice: S140 version 6.1.1 +Date: Oct 13 2021