Merge branch 'master' of github.com:meshtastic/meshtastic

This commit is contained in:
Sacha Weatherstone 2021-12-23 01:43:03 +11:00
commit 17befd9a7d

View file

@ -16,6 +16,7 @@ Another example using Python 3 code to send a message to the mesh when WiFi is e
```python ```python
import time import time
import meshtastic import meshtastic
import meshtastic.tcp_interface
from pubsub import pub from pubsub import pub
def onReceive(packet, interface): # called when a packet arrives def onReceive(packet, interface): # called when a packet arrives
@ -27,7 +28,7 @@ def onConnection(interface, topic=pub.AUTO_TOPIC): # called when we (re)connect
pub.subscribe(onReceive, "meshtastic.receive") pub.subscribe(onReceive, "meshtastic.receive")
pub.subscribe(onConnection, "meshtastic.connection.established") pub.subscribe(onConnection, "meshtastic.connection.established")
interface = meshtastic.TCPInterface(hostname='192.168.68.74') interface = meshtastic.tcp_interface.TCPInterface(hostname='192.168.68.74')
while True: while True:
time.sleep(1000) time.sleep(1000)
interface.close() interface.close()
@ -39,7 +40,8 @@ Note: Be sure to change the ip address in the code above to a valid ip address f
You can get and update settings like this: You can get and update settings like this:
```python ```python
import meshtastic import meshtastic
interface = meshtastic.SerialInterface() import meshtastic.serial_interface
interface = meshtastic.serial_interface.SerialInterface()
ourNode = interface.getNode('^local') ourNode = interface.getNode('^local')
print(ourNode.radioConfig.preferences) print(ourNode.radioConfig.preferences)