mirror of
https://github.com/meshtastic/python.git
synced 2025-12-26 17:37:51 -05:00
Compare commits
7 Commits
patch-1
...
1.3alpha.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92c7b2db69 | ||
|
|
ff94ad968c | ||
|
|
c6071c57ec | ||
|
|
e3e3562c2c | ||
|
|
06b5b8fa83 | ||
|
|
4b95b0ff30 | ||
|
|
42f2ed571d |
48
.vscode/launch.json
vendored
48
.vscode/launch.json
vendored
@@ -52,6 +52,30 @@
|
|||||||
"justMyCode": true,
|
"justMyCode": true,
|
||||||
"args": ["--debug", "--get", "power.is_power_saving"]
|
"args": ["--debug", "--get", "power.is_power_saving"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "meshtastic debug getPref telemetry",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "meshtastic",
|
||||||
|
"justMyCode": true,
|
||||||
|
"args": ["--debug", "--get", "telemetry.environment_update_interval"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "meshtastic debug info",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "meshtastic",
|
||||||
|
"justMyCode": true,
|
||||||
|
"args": ["--debug", "--info"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "meshtastic debug set region",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "meshtastic",
|
||||||
|
"justMyCode": true,
|
||||||
|
"args": ["--debug", "--set", "lora.region", "1"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "meshtastic debug setPref",
|
"name": "meshtastic debug setPref",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
@@ -60,6 +84,30 @@
|
|||||||
"justMyCode": true,
|
"justMyCode": true,
|
||||||
"args": ["--debug", "--set", "power.is_power_saving", "1"]
|
"args": ["--debug", "--set", "power.is_power_saving", "1"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "meshtastic debug setPref telemetry.environment_measurement_enabled",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "meshtastic",
|
||||||
|
"justMyCode": true,
|
||||||
|
"args": ["--debug", "--set", "telemetry.environment_measurement_enabled", "1"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "meshtastic debug setPref telemetry.environment_screen_enabled",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "meshtastic",
|
||||||
|
"justMyCode": true,
|
||||||
|
"args": ["--debug", "--set", "telemetry.environment_screen_enabled", "1"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "meshtastic debug setPref telemetry",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "meshtastic",
|
||||||
|
"justMyCode": true,
|
||||||
|
"args": ["--debug", "--set", "telemetry.environment_measurement_enabled", "1"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "meshtastic setpref",
|
"name": "meshtastic setpref",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
|
|||||||
@@ -52,13 +52,10 @@ def onConnection(interface, topic=pub.AUTO_TOPIC): # pylint: disable=W0613
|
|||||||
print(f"Connection changed: {topic.getName()}")
|
print(f"Connection changed: {topic.getName()}")
|
||||||
|
|
||||||
|
|
||||||
def getPref(attributes, comp_name):
|
def getPref(config, comp_name):
|
||||||
"""Get a channel or preferences value"""
|
"""Get a channel or preferences value"""
|
||||||
|
|
||||||
name = comp_name.split(".",1)
|
name = splitCompoundName(comp_name)
|
||||||
if len(name) != 2:
|
|
||||||
name[0]=comp_name
|
|
||||||
name.append(comp_name)
|
|
||||||
|
|
||||||
camel_name = meshtastic.util.snake_to_camel(name[1])
|
camel_name = meshtastic.util.snake_to_camel(name[1])
|
||||||
# Note: protobufs has the keys in snake_case, so snake internally
|
# Note: protobufs has the keys in snake_case, so snake internally
|
||||||
@@ -66,33 +63,17 @@ def getPref(attributes, comp_name):
|
|||||||
logging.debug(f'snake_name:{snake_name} camel_name:{camel_name}')
|
logging.debug(f'snake_name:{snake_name} camel_name:{camel_name}')
|
||||||
logging.debug(f'use camel:{Globals.getInstance().get_camel_case()}')
|
logging.debug(f'use camel:{Globals.getInstance().get_camel_case()}')
|
||||||
|
|
||||||
objDesc = attributes.DESCRIPTOR
|
objDesc = config.DESCRIPTOR
|
||||||
config_type = objDesc.fields_by_name.get(name[0])
|
config_type = objDesc.fields_by_name.get(name[0])
|
||||||
pref = False
|
pref = False
|
||||||
if config_type:
|
if config_type:
|
||||||
pref = config_type.message_type.fields_by_name.get(snake_name)
|
pref = config_type.message_type.fields_by_name.get(snake_name)
|
||||||
|
|
||||||
if (not pref) or (not config_type):
|
if (not pref) or (not config_type):
|
||||||
if Globals.getInstance().get_camel_case():
|
return False
|
||||||
print(f"{attributes.__class__.__name__} does not have an attribute called {name[0]}.{camel_name}, so you can not get it.")
|
|
||||||
else:
|
|
||||||
print(f"{attributes.__class__.__name__} does not have an attribute called {name[0]}.{snake_name}, so you can not get it.")
|
|
||||||
print(f"Choices in sorted order are:")
|
|
||||||
names = []
|
|
||||||
for f in objDesc.fields:
|
|
||||||
tmp_path = f'{f.name}'
|
|
||||||
if(f.message_type):
|
|
||||||
for ff in f.message_type.fields:
|
|
||||||
tmp_name = f'{ff.name}'
|
|
||||||
if Globals.getInstance().get_camel_case():
|
|
||||||
tmp_name = meshtastic.util.snake_to_camel(tmp_name)
|
|
||||||
names.append(tmp_path + "." +tmp_name)
|
|
||||||
for temp_name in sorted(names):
|
|
||||||
print(f" {temp_name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
# read the value
|
# read the value
|
||||||
config_values = getattr(attributes, config_type.name)
|
config_values = getattr(config, config_type.name)
|
||||||
pref_value = getattr(config_values, pref.name)
|
pref_value = getattr(config_values, pref.name)
|
||||||
|
|
||||||
if Globals.getInstance().get_camel_case():
|
if Globals.getInstance().get_camel_case():
|
||||||
@@ -101,52 +82,40 @@ def getPref(attributes, comp_name):
|
|||||||
else:
|
else:
|
||||||
print(f"{str(config_type.name)}.{snake_name}: {str(pref_value)}")
|
print(f"{str(config_type.name)}.{snake_name}: {str(pref_value)}")
|
||||||
logging.debug(f"{str(config_type.name)}.{snake_name}: {str(pref_value)}")
|
logging.debug(f"{str(config_type.name)}.{snake_name}: {str(pref_value)}")
|
||||||
|
return True
|
||||||
|
|
||||||
|
def splitCompoundName(comp_name):
|
||||||
def setPref(attributes, comp_name, valStr):
|
|
||||||
"""Set a channel or preferences value"""
|
|
||||||
|
|
||||||
name = comp_name.split(".",1)
|
name = comp_name.split(".",1)
|
||||||
if len(name) != 2:
|
if len(name) != 2:
|
||||||
name[0]=comp_name
|
name[0]=comp_name
|
||||||
name.append(comp_name)
|
name.append(comp_name)
|
||||||
|
return name
|
||||||
|
|
||||||
|
def setPref(config, comp_name, valStr):
|
||||||
|
"""Set a channel or preferences value"""
|
||||||
|
|
||||||
|
name = splitCompoundName(comp_name)
|
||||||
|
|
||||||
snake_name = meshtastic.util.camel_to_snake(name[1])
|
snake_name = meshtastic.util.camel_to_snake(name[1])
|
||||||
camel_name = meshtastic.util.snake_to_camel(name[1])
|
camel_name = meshtastic.util.snake_to_camel(name[1])
|
||||||
logging.debug(f'snake_name:{snake_name}')
|
logging.debug(f'snake_name:{snake_name}')
|
||||||
logging.debug(f'camel_name:{camel_name}')
|
logging.debug(f'camel_name:{camel_name}')
|
||||||
|
|
||||||
objDesc = attributes.DESCRIPTOR
|
objDesc = config.DESCRIPTOR
|
||||||
config_type = objDesc.fields_by_name.get(name[0])
|
config_type = objDesc.fields_by_name.get(name[0])
|
||||||
pref = False
|
pref = False
|
||||||
if config_type:
|
if config_type:
|
||||||
pref = config_type.message_type.fields_by_name.get(snake_name)
|
pref = config_type.message_type.fields_by_name.get(snake_name)
|
||||||
|
|
||||||
if (not pref) or (not config_type):
|
if (not pref) or (not config_type):
|
||||||
if Globals.getInstance().get_camel_case():
|
return False
|
||||||
print(f"{attributes.__class__.__name__} does not have an attribute called {name[0]}.{camel_name}, so you can not set it.")
|
|
||||||
else:
|
|
||||||
print(f"{attributes.__class__.__name__} does not have an attribute called {name[0]}.{snake_name}, so you can not set it.")
|
|
||||||
print(f"Choices in sorted order are:")
|
|
||||||
names = []
|
|
||||||
for f in objDesc.fields:
|
|
||||||
tmp_path = f'{f.name}'
|
|
||||||
if(f.message_type):
|
|
||||||
for ff in f.message_type.fields:
|
|
||||||
tmp_name = f'{ff.name}'
|
|
||||||
if Globals.getInstance().get_camel_case():
|
|
||||||
tmp_name = meshtastic.util.snake_to_camel(tmp_name)
|
|
||||||
names.append(tmp_path + "." + tmp_name)
|
|
||||||
for temp_name in sorted(names):
|
|
||||||
print(f" {temp_name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
val = meshtastic.util.fromStr(valStr)
|
val = meshtastic.util.fromStr(valStr)
|
||||||
logging.debug(f'valStr:{valStr} val:{val}')
|
logging.debug(f'valStr:{valStr} val:{val}')
|
||||||
|
|
||||||
if snake_name == 'psk' and len(valStr) < 8:
|
if snake_name == 'psk' and len(valStr) < 8:
|
||||||
print(f"Warning: wifi.psk must be 8 or more characters.")
|
print(f"Warning: wifi.psk must be 8 or more characters.")
|
||||||
return
|
return
|
||||||
|
|
||||||
enumType = pref.enum_type
|
enumType = pref.enum_type
|
||||||
# pylint: disable=C0123
|
# pylint: disable=C0123
|
||||||
@@ -172,11 +141,11 @@ def setPref(attributes, comp_name, valStr):
|
|||||||
# note: 'ignore_incoming' is a repeating field
|
# note: 'ignore_incoming' is a repeating field
|
||||||
if snake_name != 'ignore_incoming':
|
if snake_name != 'ignore_incoming':
|
||||||
try:
|
try:
|
||||||
config_values = getattr(attributes, config_type.name)
|
config_values = getattr(config, config_type.name)
|
||||||
setattr(config_values, pref.name, val)
|
setattr(config_values, pref.name, val)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# The setter didn't like our arg type guess try again as a string
|
# The setter didn't like our arg type guess try again as a string
|
||||||
config_values = getattr(attributes, config_type.name)
|
config_values = getattr(config, config_type.name)
|
||||||
setattr(config_values, pref.name, valStr)
|
setattr(config_values, pref.name, valStr)
|
||||||
else:
|
else:
|
||||||
if val == 0:
|
if val == 0:
|
||||||
@@ -191,6 +160,8 @@ def setPref(attributes, comp_name, valStr):
|
|||||||
print(f"Set {name[0]}.{camel_name} to {valStr}")
|
print(f"Set {name[0]}.{camel_name} to {valStr}")
|
||||||
else:
|
else:
|
||||||
print(f"Set {name[0]}.{snake_name} to {valStr}")
|
print(f"Set {name[0]}.{snake_name} to {valStr}")
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def onConnected(interface):
|
def onConnected(interface):
|
||||||
@@ -210,18 +181,18 @@ def onConnected(interface):
|
|||||||
alt = 0
|
alt = 0
|
||||||
lat = 0.0
|
lat = 0.0
|
||||||
lon = 0.0
|
lon = 0.0
|
||||||
prefs = interface.localNode.localConfig
|
localConfig = interface.localNode.localConfig
|
||||||
if args.setalt:
|
if args.setalt:
|
||||||
alt = int(args.setalt)
|
alt = int(args.setalt)
|
||||||
prefs.fixed_position = True
|
localConfig.fixed_position = True
|
||||||
print(f"Fixing altitude at {alt} meters")
|
print(f"Fixing altitude at {alt} meters")
|
||||||
if args.setlat:
|
if args.setlat:
|
||||||
lat = float(args.setlat)
|
lat = float(args.setlat)
|
||||||
prefs.fixed_position = True
|
localConfig.fixed_position = True
|
||||||
print(f"Fixing latitude at {lat} degrees")
|
print(f"Fixing latitude at {lat} degrees")
|
||||||
if args.setlon:
|
if args.setlon:
|
||||||
lon = float(args.setlon)
|
lon = float(args.setlon)
|
||||||
prefs.fixed_position = True
|
localConfig.fixed_position = True
|
||||||
print(f"Fixing longitude at {lon} degrees")
|
print(f"Fixing longitude at {lon} degrees")
|
||||||
|
|
||||||
print("Setting device position")
|
print("Setting device position")
|
||||||
@@ -251,7 +222,7 @@ def onConnected(interface):
|
|||||||
if args.pos_fields:
|
if args.pos_fields:
|
||||||
# If --pos-fields invoked with args, set position fields
|
# If --pos-fields invoked with args, set position fields
|
||||||
closeNow = True
|
closeNow = True
|
||||||
prefs = interface.getNode(args.dest).localConfig
|
localConfig = interface.getNode(args.dest).localConfig
|
||||||
allFields = 0
|
allFields = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -266,18 +237,18 @@ def onConnected(interface):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
print(f"Setting position fields to {allFields}")
|
print(f"Setting position fields to {allFields}")
|
||||||
setPref(prefs, 'position_flags', f'{allFields:d}')
|
setPref(localConfig, 'position_flags', f'{allFields:d}')
|
||||||
print("Writing modified preferences to device")
|
print("Writing modified preferences to device")
|
||||||
interface.getNode(args.dest).writeConfig()
|
interface.getNode(args.dest).writeConfig()
|
||||||
|
|
||||||
elif args.pos_fields is not None:
|
elif args.pos_fields is not None:
|
||||||
# If --pos-fields invoked without args, read and display current value
|
# If --pos-fields invoked without args, read and display current value
|
||||||
closeNow = True
|
closeNow = True
|
||||||
prefs = interface.getNode(args.dest).localConfig
|
localConfig = interface.getNode(args.dest).localConfig
|
||||||
|
|
||||||
fieldNames = []
|
fieldNames = []
|
||||||
for bit in config_pb2.PositionFlags.values():
|
for bit in config_pb2.PositionFlags.values():
|
||||||
if prefs.position_flags & bit:
|
if localConfig.position_flags & bit:
|
||||||
fieldNames.append(config_pb2.PositionFlags.Name(bit))
|
fieldNames.append(config_pb2.PositionFlags.Name(bit))
|
||||||
print(' '.join(fieldNames))
|
print(' '.join(fieldNames))
|
||||||
|
|
||||||
@@ -353,14 +324,22 @@ def onConnected(interface):
|
|||||||
# handle settings
|
# handle settings
|
||||||
if args.set:
|
if args.set:
|
||||||
closeNow = True
|
closeNow = True
|
||||||
prefs = interface.getNode(args.dest).localConfig
|
node = interface.getNode(args.dest)
|
||||||
|
|
||||||
# Handle the int/float/bool arguments
|
# Handle the int/float/bool arguments
|
||||||
for pref in args.set:
|
for pref in args.set:
|
||||||
setPref(prefs, pref[0], pref[1])
|
found = setPref(node.localConfig, pref[0], pref[1])
|
||||||
|
if not found:
|
||||||
|
found = setPref(node.moduleConfig, pref[0], pref[1])
|
||||||
|
|
||||||
print("Writing modified preferences to device")
|
if found:
|
||||||
interface.getNode(args.dest).writeConfig()
|
print("Writing modified preferences to device")
|
||||||
|
interface.getNode(args.dest).writeConfig()
|
||||||
|
else:
|
||||||
|
if Globals.getInstance().get_camel_case():
|
||||||
|
print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have an attribute {pref[0]}.")
|
||||||
|
else:
|
||||||
|
print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have attribute {pref[0]}.")
|
||||||
|
|
||||||
if args.configure:
|
if args.configure:
|
||||||
with open(args.configure[0], encoding='utf8') as file:
|
with open(args.configure[0], encoding='utf8') as file:
|
||||||
@@ -391,35 +370,35 @@ def onConnected(interface):
|
|||||||
alt = 0
|
alt = 0
|
||||||
lat = 0.0
|
lat = 0.0
|
||||||
lon = 0.0
|
lon = 0.0
|
||||||
prefs = interface.localNode.localConfig
|
localConfig = interface.localNode.localConfig
|
||||||
|
|
||||||
if 'alt' in configuration['location']:
|
if 'alt' in configuration['location']:
|
||||||
alt = int(configuration['location']['alt'])
|
alt = int(configuration['location']['alt'])
|
||||||
prefs.fixed_position = True
|
localConfig.fixed_position = True
|
||||||
print(f"Fixing altitude at {alt} meters")
|
print(f"Fixing altitude at {alt} meters")
|
||||||
if 'lat' in configuration['location']:
|
if 'lat' in configuration['location']:
|
||||||
lat = float(configuration['location']['lat'])
|
lat = float(configuration['location']['lat'])
|
||||||
prefs.fixed_position = True
|
localConfig.fixed_position = True
|
||||||
print(f"Fixing latitude at {lat} degrees")
|
print(f"Fixing latitude at {lat} degrees")
|
||||||
if 'lon' in configuration['location']:
|
if 'lon' in configuration['location']:
|
||||||
lon = float(configuration['location']['lon'])
|
lon = float(configuration['location']['lon'])
|
||||||
prefs.fixed_position = True
|
localConfig.fixed_position = True
|
||||||
print(f"Fixing longitude at {lon} degrees")
|
print(f"Fixing longitude at {lon} degrees")
|
||||||
print("Setting device position")
|
print("Setting device position")
|
||||||
interface.sendPosition(lat, lon, alt)
|
interface.sendPosition(lat, lon, alt)
|
||||||
interface.localNode.writeConfig()
|
interface.localNode.writeConfig()
|
||||||
|
|
||||||
if 'user_prefs' in configuration:
|
if 'user_prefs' in configuration:
|
||||||
prefs = interface.getNode(args.dest).localConfig
|
localConfig = interface.getNode(args.dest).localConfig
|
||||||
for pref in configuration['user_prefs']:
|
for pref in configuration['user_prefs']:
|
||||||
setPref(prefs, pref, str(configuration['user_prefs'][pref]))
|
setPref(localConfig, pref, str(configuration['user_prefs'][pref]))
|
||||||
print("Writing modified preferences to device")
|
print("Writing modified preferences to device")
|
||||||
interface.getNode(args.dest).writeConfig()
|
interface.getNode(args.dest).writeConfig()
|
||||||
|
|
||||||
if 'userPrefs' in configuration:
|
if 'userPrefs' in configuration:
|
||||||
prefs = interface.getNode(args.dest).localConfig
|
localConfig = interface.getNode(args.dest).localConfig
|
||||||
for pref in configuration['userPrefs']:
|
for pref in configuration['userPrefs']:
|
||||||
setPref(prefs, pref, str(configuration['userPrefs'][pref]))
|
setPref(localConfig, pref, str(configuration['userPrefs'][pref]))
|
||||||
print("Writing modified preferences to device")
|
print("Writing modified preferences to device")
|
||||||
interface.getNode(args.dest).writeConfig()
|
interface.getNode(args.dest).writeConfig()
|
||||||
|
|
||||||
@@ -553,12 +532,21 @@ def onConnected(interface):
|
|||||||
|
|
||||||
if args.get:
|
if args.get:
|
||||||
closeNow = True
|
closeNow = True
|
||||||
prefs = interface.getNode(args.dest).localConfig
|
localConfig = interface.getNode(args.dest).localConfig
|
||||||
|
moduleConfig = interface.getNode(args.dest).moduleConfig
|
||||||
|
|
||||||
# Handle the int/float/bool arguments
|
# Handle the int/float/bool arguments
|
||||||
for pref in args.get:
|
for pref in args.get:
|
||||||
getPref(prefs, pref[0])
|
found = getPref(localConfig, pref[0])
|
||||||
|
if not found:
|
||||||
|
found = getPref(moduleConfig, pref[0])
|
||||||
|
|
||||||
|
if not found:
|
||||||
|
if Globals.getInstance().get_camel_case():
|
||||||
|
print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have an attribute {pref[0]}.")
|
||||||
|
else:
|
||||||
|
print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have attribute {pref[0]}.")
|
||||||
|
|
||||||
print("Completed getting preferences")
|
print("Completed getting preferences")
|
||||||
|
|
||||||
if args.nodes:
|
if args.nodes:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0c\x63onfig.proto\"\xd6\x11\n\x06\x43onfig\x12&\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfigH\x00\x12*\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfigH\x00\x12$\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfigH\x00\x12\"\n\x04wifi\x18\x04 \x01(\x0b\x32\x12.Config.WiFiConfigH\x00\x12(\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfigH\x00\x12\"\n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfigH\x00\x1a\xd8\x01\n\x0c\x44\x65viceConfig\x12\'\n\x04role\x18\x01 \x01(\x0e\x32\x19.Config.DeviceConfig.Role\x12\x17\n\x0fserial_disabled\x18\x02 \x01(\x08\x12\x15\n\rfactory_reset\x18\x03 \x01(\x08\x12\x19\n\x11\x64\x65\x62ug_log_enabled\x18\x04 \x01(\x08\x12\x12\n\nntp_server\x18\x05 \x01(\t\"@\n\x04Role\x12\n\n\x06\x43lient\x10\x00\x12\x0e\n\nClientMute\x10\x01\x12\n\n\x06Router\x10\x02\x12\x10\n\x0cRouterClient\x10\x03\x1a\x86\x03\n\x0ePositionConfig\x12\x1f\n\x17position_broadcast_secs\x18\x01 \x01(\r\x12)\n!position_broadcast_smart_disabled\x18\x02 \x01(\x08\x12\x16\n\x0e\x66ixed_position\x18\x03 \x01(\x08\x12\x14\n\x0cgps_disabled\x18\x05 \x01(\x08\x12\x1b\n\x13gps_update_interval\x18\x06 \x01(\r\x12\x18\n\x10gps_attempt_time\x18\x07 \x01(\r\x12\x16\n\x0eposition_flags\x18\n \x01(\r\"\xaa\x01\n\rPositionFlags\x12\x11\n\rPOS_UNDEFINED\x10\x00\x12\x10\n\x0cPOS_ALTITUDE\x10\x01\x12\x0f\n\x0bPOS_ALT_MSL\x10\x02\x12\x0f\n\x0bPOS_GEO_SEP\x10\x04\x12\x0b\n\x07POS_DOP\x10\x08\x12\r\n\tPOS_HVDOP\x10\x10\x12\x11\n\rPOS_SATINVIEW\x10 \x12\x0f\n\x0bPOS_SEQ_NOS\x10@\x12\x12\n\rPOS_TIMESTAMP\x10\x80\x01\x1a\xf4\x03\n\x0bPowerConfig\x12\x39\n\x0e\x63harge_current\x18\x01 \x01(\x0e\x32!.Config.PowerConfig.ChargeCurrent\x12\x17\n\x0fis_power_saving\x18\x02 \x01(\x08\x12&\n\x1eon_battery_shutdown_after_secs\x18\x04 \x01(\r\x12\x1f\n\x17\x61\x64\x63_multiplier_override\x18\x06 \x01(\x02\x12\x1b\n\x13wait_bluetooth_secs\x18\x07 \x01(\r\x12\x1d\n\x15mesh_sds_timeout_secs\x18\t \x01(\r\x12\x10\n\x08sds_secs\x18\n \x01(\r\x12\x0f\n\x07ls_secs\x18\x0b \x01(\r\x12\x15\n\rmin_wake_secs\x18\x0c \x01(\r\"\xd1\x01\n\rChargeCurrent\x12\x0b\n\x07MAUnset\x10\x00\x12\t\n\x05MA100\x10\x01\x12\t\n\x05MA190\x10\x02\x12\t\n\x05MA280\x10\x03\x12\t\n\x05MA360\x10\x04\x12\t\n\x05MA450\x10\x05\x12\t\n\x05MA550\x10\x06\x12\t\n\x05MA630\x10\x07\x12\t\n\x05MA700\x10\x08\x12\t\n\x05MA780\x10\t\x12\t\n\x05MA880\x10\n\x12\t\n\x05MA960\x10\x0b\x12\n\n\x06MA1000\x10\x0c\x12\n\n\x06MA1080\x10\r\x12\n\n\x06MA1160\x10\x0e\x12\n\n\x06MA1240\x10\x0f\x12\n\n\x06MA1320\x10\x10\x1aK\n\nWiFiConfig\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\x0b\n\x03psk\x18\x02 \x01(\t\x12\x0f\n\x07\x61p_mode\x18\x03 \x01(\x08\x12\x11\n\tap_hidden\x18\x04 \x01(\x08\x1a\x8f\x02\n\rDisplayConfig\x12\x16\n\x0escreen_on_secs\x18\x01 \x01(\r\x12=\n\ngps_format\x18\x02 \x01(\x0e\x32).Config.DisplayConfig.GpsCoordinateFormat\x12!\n\x19\x61uto_screen_carousel_secs\x18\x03 \x01(\r\"\x83\x01\n\x13GpsCoordinateFormat\x12\x10\n\x0cGpsFormatDec\x10\x00\x12\x10\n\x0cGpsFormatDMS\x10\x01\x12\x10\n\x0cGpsFormatUTM\x10\x02\x12\x11\n\rGpsFormatMGRS\x10\x03\x12\x10\n\x0cGpsFormatOLC\x10\x04\x12\x11\n\rGpsFormatOSGR\x10\x05\x1a\x93\x04\n\nLoRaConfig\x12\x10\n\x08tx_power\x18\x01 \x01(\x05\x12\x34\n\x0cmodem_preset\x18\x02 \x01(\x0e\x32\x1e.Config.LoRaConfig.ModemPreset\x12\x11\n\tbandwidth\x18\x03 \x01(\r\x12\x15\n\rspread_factor\x18\x04 \x01(\r\x12\x13\n\x0b\x63oding_rate\x18\x05 \x01(\r\x12\x18\n\x10\x66requency_offset\x18\x06 \x01(\x02\x12-\n\x06region\x18\x07 \x01(\x0e\x32\x1d.Config.LoRaConfig.RegionCode\x12\x11\n\thop_limit\x18\x08 \x01(\r\x12\x13\n\x0btx_disabled\x18\t \x01(\x08\x12\x17\n\x0fignore_incoming\x18g \x03(\r\"\x81\x01\n\nRegionCode\x12\t\n\x05Unset\x10\x00\x12\x06\n\x02US\x10\x01\x12\t\n\x05\x45U433\x10\x02\x12\t\n\x05\x45U868\x10\x03\x12\x06\n\x02\x43N\x10\x04\x12\x06\n\x02JP\x10\x05\x12\x07\n\x03\x41NZ\x10\x06\x12\x06\n\x02KR\x10\x07\x12\x06\n\x02TW\x10\x08\x12\x06\n\x02RU\x10\t\x12\x06\n\x02IN\x10\n\x12\t\n\x05NZ865\x10\x0b\x12\x06\n\x02TH\x10\x0c\"p\n\x0bModemPreset\x12\x0c\n\x08LongFast\x10\x00\x12\x0c\n\x08LongSlow\x10\x01\x12\r\n\tVLongSlow\x10\x02\x12\x0b\n\x07MidSlow\x10\x03\x12\x0b\n\x07MidFast\x10\x04\x12\r\n\tShortSlow\x10\x05\x12\r\n\tShortFast\x10\x06\x42\x10\n\x0epayloadVariantBH\n\x13\x63om.geeksville.meshB\x0c\x43onfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0c\x63onfig.proto\"\xf8\x11\n\x06\x43onfig\x12&\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfigH\x00\x12*\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfigH\x00\x12$\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfigH\x00\x12\"\n\x04wifi\x18\x04 \x01(\x0b\x32\x12.Config.WiFiConfigH\x00\x12(\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfigH\x00\x12\"\n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfigH\x00\x1a\xd8\x01\n\x0c\x44\x65viceConfig\x12\'\n\x04role\x18\x01 \x01(\x0e\x32\x19.Config.DeviceConfig.Role\x12\x17\n\x0fserial_disabled\x18\x02 \x01(\x08\x12\x15\n\rfactory_reset\x18\x03 \x01(\x08\x12\x19\n\x11\x64\x65\x62ug_log_enabled\x18\x04 \x01(\x08\x12\x12\n\nntp_server\x18\x05 \x01(\t\"@\n\x04Role\x12\n\n\x06\x43lient\x10\x00\x12\x0e\n\nClientMute\x10\x01\x12\n\n\x06Router\x10\x02\x12\x10\n\x0cRouterClient\x10\x03\x1a\xa8\x03\n\x0ePositionConfig\x12\x1f\n\x17position_broadcast_secs\x18\x01 \x01(\r\x12)\n!position_broadcast_smart_disabled\x18\x02 \x01(\x08\x12\x16\n\x0e\x66ixed_position\x18\x03 \x01(\x08\x12\x14\n\x0cgps_disabled\x18\x05 \x01(\x08\x12\x1b\n\x13gps_update_interval\x18\x06 \x01(\r\x12\x18\n\x10gps_attempt_time\x18\x07 \x01(\r\x12\x16\n\x0eposition_flags\x18\n \x01(\r\"\xcc\x01\n\rPositionFlags\x12\x11\n\rPOS_UNDEFINED\x10\x00\x12\x10\n\x0cPOS_ALTITUDE\x10\x01\x12\x0f\n\x0bPOS_ALT_MSL\x10\x02\x12\x0f\n\x0bPOS_GEO_SEP\x10\x04\x12\x0b\n\x07POS_DOP\x10\x08\x12\r\n\tPOS_HVDOP\x10\x10\x12\x11\n\rPOS_SATINVIEW\x10 \x12\x0f\n\x0bPOS_SEQ_NOS\x10@\x12\x12\n\rPOS_TIMESTAMP\x10\x80\x01\x12\x10\n\x0bPOS_HEADING\x10\x80\x02\x12\x0e\n\tPOS_SPEED\x10\x80\x04\x1a\xf4\x03\n\x0bPowerConfig\x12\x39\n\x0e\x63harge_current\x18\x01 \x01(\x0e\x32!.Config.PowerConfig.ChargeCurrent\x12\x17\n\x0fis_power_saving\x18\x02 \x01(\x08\x12&\n\x1eon_battery_shutdown_after_secs\x18\x04 \x01(\r\x12\x1f\n\x17\x61\x64\x63_multiplier_override\x18\x06 \x01(\x02\x12\x1b\n\x13wait_bluetooth_secs\x18\x07 \x01(\r\x12\x1d\n\x15mesh_sds_timeout_secs\x18\t \x01(\r\x12\x10\n\x08sds_secs\x18\n \x01(\r\x12\x0f\n\x07ls_secs\x18\x0b \x01(\r\x12\x15\n\rmin_wake_secs\x18\x0c \x01(\r\"\xd1\x01\n\rChargeCurrent\x12\x0b\n\x07MAUnset\x10\x00\x12\t\n\x05MA100\x10\x01\x12\t\n\x05MA190\x10\x02\x12\t\n\x05MA280\x10\x03\x12\t\n\x05MA360\x10\x04\x12\t\n\x05MA450\x10\x05\x12\t\n\x05MA550\x10\x06\x12\t\n\x05MA630\x10\x07\x12\t\n\x05MA700\x10\x08\x12\t\n\x05MA780\x10\t\x12\t\n\x05MA880\x10\n\x12\t\n\x05MA960\x10\x0b\x12\n\n\x06MA1000\x10\x0c\x12\n\n\x06MA1080\x10\r\x12\n\n\x06MA1160\x10\x0e\x12\n\n\x06MA1240\x10\x0f\x12\n\n\x06MA1320\x10\x10\x1aK\n\nWiFiConfig\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\x0b\n\x03psk\x18\x02 \x01(\t\x12\x0f\n\x07\x61p_mode\x18\x03 \x01(\x08\x12\x11\n\tap_hidden\x18\x04 \x01(\x08\x1a\x8f\x02\n\rDisplayConfig\x12\x16\n\x0escreen_on_secs\x18\x01 \x01(\r\x12=\n\ngps_format\x18\x02 \x01(\x0e\x32).Config.DisplayConfig.GpsCoordinateFormat\x12!\n\x19\x61uto_screen_carousel_secs\x18\x03 \x01(\r\"\x83\x01\n\x13GpsCoordinateFormat\x12\x10\n\x0cGpsFormatDec\x10\x00\x12\x10\n\x0cGpsFormatDMS\x10\x01\x12\x10\n\x0cGpsFormatUTM\x10\x02\x12\x11\n\rGpsFormatMGRS\x10\x03\x12\x10\n\x0cGpsFormatOLC\x10\x04\x12\x11\n\rGpsFormatOSGR\x10\x05\x1a\x93\x04\n\nLoRaConfig\x12\x10\n\x08tx_power\x18\x01 \x01(\x05\x12\x34\n\x0cmodem_preset\x18\x02 \x01(\x0e\x32\x1e.Config.LoRaConfig.ModemPreset\x12\x11\n\tbandwidth\x18\x03 \x01(\r\x12\x15\n\rspread_factor\x18\x04 \x01(\r\x12\x13\n\x0b\x63oding_rate\x18\x05 \x01(\r\x12\x18\n\x10\x66requency_offset\x18\x06 \x01(\x02\x12-\n\x06region\x18\x07 \x01(\x0e\x32\x1d.Config.LoRaConfig.RegionCode\x12\x11\n\thop_limit\x18\x08 \x01(\r\x12\x13\n\x0btx_disabled\x18\t \x01(\x08\x12\x17\n\x0fignore_incoming\x18g \x03(\r\"\x81\x01\n\nRegionCode\x12\t\n\x05Unset\x10\x00\x12\x06\n\x02US\x10\x01\x12\t\n\x05\x45U433\x10\x02\x12\t\n\x05\x45U868\x10\x03\x12\x06\n\x02\x43N\x10\x04\x12\x06\n\x02JP\x10\x05\x12\x07\n\x03\x41NZ\x10\x06\x12\x06\n\x02KR\x10\x07\x12\x06\n\x02TW\x10\x08\x12\x06\n\x02RU\x10\t\x12\x06\n\x02IN\x10\n\x12\t\n\x05NZ865\x10\x0b\x12\x06\n\x02TH\x10\x0c\"p\n\x0bModemPreset\x12\x0c\n\x08LongFast\x10\x00\x12\x0c\n\x08LongSlow\x10\x01\x12\r\n\tVLongSlow\x10\x02\x12\x0b\n\x07MedSlow\x10\x03\x12\x0b\n\x07MedFast\x10\x04\x12\r\n\tShortSlow\x10\x05\x12\r\n\tShortFast\x10\x06\x42\x10\n\x0epayloadVariantBH\n\x13\x63om.geeksville.meshB\x0c\x43onfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -91,29 +91,29 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
|||||||
DESCRIPTOR._options = None
|
DESCRIPTOR._options = None
|
||||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\014ConfigProtosH\003Z!github.com/meshtastic/gomeshproto'
|
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\014ConfigProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||||
_CONFIG._serialized_start=17
|
_CONFIG._serialized_start=17
|
||||||
_CONFIG._serialized_end=2279
|
_CONFIG._serialized_end=2313
|
||||||
_CONFIG_DEVICECONFIG._serialized_start=264
|
_CONFIG_DEVICECONFIG._serialized_start=264
|
||||||
_CONFIG_DEVICECONFIG._serialized_end=480
|
_CONFIG_DEVICECONFIG._serialized_end=480
|
||||||
_CONFIG_DEVICECONFIG_ROLE._serialized_start=416
|
_CONFIG_DEVICECONFIG_ROLE._serialized_start=416
|
||||||
_CONFIG_DEVICECONFIG_ROLE._serialized_end=480
|
_CONFIG_DEVICECONFIG_ROLE._serialized_end=480
|
||||||
_CONFIG_POSITIONCONFIG._serialized_start=483
|
_CONFIG_POSITIONCONFIG._serialized_start=483
|
||||||
_CONFIG_POSITIONCONFIG._serialized_end=873
|
_CONFIG_POSITIONCONFIG._serialized_end=907
|
||||||
_CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_start=703
|
_CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_start=703
|
||||||
_CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_end=873
|
_CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_end=907
|
||||||
_CONFIG_POWERCONFIG._serialized_start=876
|
_CONFIG_POWERCONFIG._serialized_start=910
|
||||||
_CONFIG_POWERCONFIG._serialized_end=1376
|
_CONFIG_POWERCONFIG._serialized_end=1410
|
||||||
_CONFIG_POWERCONFIG_CHARGECURRENT._serialized_start=1167
|
_CONFIG_POWERCONFIG_CHARGECURRENT._serialized_start=1201
|
||||||
_CONFIG_POWERCONFIG_CHARGECURRENT._serialized_end=1376
|
_CONFIG_POWERCONFIG_CHARGECURRENT._serialized_end=1410
|
||||||
_CONFIG_WIFICONFIG._serialized_start=1378
|
_CONFIG_WIFICONFIG._serialized_start=1412
|
||||||
_CONFIG_WIFICONFIG._serialized_end=1453
|
_CONFIG_WIFICONFIG._serialized_end=1487
|
||||||
_CONFIG_DISPLAYCONFIG._serialized_start=1456
|
_CONFIG_DISPLAYCONFIG._serialized_start=1490
|
||||||
_CONFIG_DISPLAYCONFIG._serialized_end=1727
|
_CONFIG_DISPLAYCONFIG._serialized_end=1761
|
||||||
_CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_start=1596
|
_CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_start=1630
|
||||||
_CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_end=1727
|
_CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_end=1761
|
||||||
_CONFIG_LORACONFIG._serialized_start=1730
|
_CONFIG_LORACONFIG._serialized_start=1764
|
||||||
_CONFIG_LORACONFIG._serialized_end=2261
|
_CONFIG_LORACONFIG._serialized_end=2295
|
||||||
_CONFIG_LORACONFIG_REGIONCODE._serialized_start=2018
|
_CONFIG_LORACONFIG_REGIONCODE._serialized_start=2052
|
||||||
_CONFIG_LORACONFIG_REGIONCODE._serialized_end=2147
|
_CONFIG_LORACONFIG_REGIONCODE._serialized_end=2181
|
||||||
_CONFIG_LORACONFIG_MODEMPRESET._serialized_start=2149
|
_CONFIG_LORACONFIG_MODEMPRESET._serialized_start=2183
|
||||||
_CONFIG_LORACONFIG_MODEMPRESET._serialized_end=2261
|
_CONFIG_LORACONFIG_MODEMPRESET._serialized_end=2295
|
||||||
# @@protoc_insertion_point(module_scope)
|
# @@protoc_insertion_point(module_scope)
|
||||||
|
|||||||
@@ -532,15 +532,18 @@ class MeshInterface:
|
|||||||
# stream API fromRadio.config_complete_id
|
# stream API fromRadio.config_complete_id
|
||||||
logging.debug(f"Config complete ID {self.configId}")
|
logging.debug(f"Config complete ID {self.configId}")
|
||||||
self._handleConfigComplete()
|
self._handleConfigComplete()
|
||||||
|
|
||||||
elif fromRadio.HasField("packet"):
|
elif fromRadio.HasField("packet"):
|
||||||
self._handlePacketFromRadio(fromRadio.packet)
|
self._handlePacketFromRadio(fromRadio.packet)
|
||||||
|
|
||||||
elif fromRadio.rebooted:
|
elif fromRadio.rebooted:
|
||||||
# Tell clients the device went away. Careful not to call the overridden
|
# Tell clients the device went away. Careful not to call the overridden
|
||||||
# subclass version that closes the serial port
|
# subclass version that closes the serial port
|
||||||
MeshInterface._disconnected(self)
|
MeshInterface._disconnected(self)
|
||||||
|
|
||||||
self._startConfig() # redownload the node db etc...
|
self._startConfig() # redownload the node db etc...
|
||||||
elif fromRadio.config:
|
|
||||||
|
elif fromRadio.config or fromRadio.moduleConfig:
|
||||||
if fromRadio.config.HasField("device"):
|
if fromRadio.config.HasField("device"):
|
||||||
self.localNode.localConfig.device.CopyFrom(fromRadio.config.device)
|
self.localNode.localConfig.device.CopyFrom(fromRadio.config.device)
|
||||||
elif fromRadio.config.HasField("position"):
|
elif fromRadio.config.HasField("position"):
|
||||||
@@ -553,6 +556,20 @@ class MeshInterface:
|
|||||||
self.localNode.localConfig.display.CopyFrom(fromRadio.config.display)
|
self.localNode.localConfig.display.CopyFrom(fromRadio.config.display)
|
||||||
elif fromRadio.config.HasField("lora"):
|
elif fromRadio.config.HasField("lora"):
|
||||||
self.localNode.localConfig.lora.CopyFrom(fromRadio.config.lora)
|
self.localNode.localConfig.lora.CopyFrom(fromRadio.config.lora)
|
||||||
|
|
||||||
|
elif fromRadio.moduleConfig.HasField("mqtt"):
|
||||||
|
self.localNode.moduleConfig.mqtt.CopyFrom(fromRadio.moduleConfig.mqtt)
|
||||||
|
elif fromRadio.moduleConfig.HasField("serial"):
|
||||||
|
self.localNode.moduleConfig.serial.CopyFrom(fromRadio.moduleConfig.serial)
|
||||||
|
elif fromRadio.moduleConfig.HasField("external_notification"):
|
||||||
|
self.localNode.moduleConfig.external_notification.CopyFrom(fromRadio.moduleConfig.external_notification)
|
||||||
|
elif fromRadio.moduleConfig.HasField("range_test"):
|
||||||
|
self.localNode.moduleConfig.range_test.CopyFrom(fromRadio.moduleConfig.range_test)
|
||||||
|
elif fromRadio.moduleConfig.HasField("telemetry"):
|
||||||
|
self.localNode.moduleConfig.telemetry.CopyFrom(fromRadio.moduleConfig.telemetry)
|
||||||
|
elif fromRadio.moduleConfig.HasField("canned_message"):
|
||||||
|
self.localNode.moduleConfig.canned_message.CopyFrom(fromRadio.moduleConfig.canned_message)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.debug("Unexpected FromRadio payload")
|
logging.debug("Unexpected FromRadio payload")
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@ from meshtastic.util import pskToString, stripnl, Timeout, our_exit, fromPSK
|
|||||||
class Node:
|
class Node:
|
||||||
"""A model of a (local or remote) node in the mesh
|
"""A model of a (local or remote) node in the mesh
|
||||||
|
|
||||||
Includes methods for localConfig and channels
|
Includes methods for localConfig, moduleConfig and channels
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, iface, nodeNum, noProto=False):
|
def __init__(self, iface, nodeNum, noProto=False):
|
||||||
@@ -20,6 +20,7 @@ class Node:
|
|||||||
self.iface = iface
|
self.iface = iface
|
||||||
self.nodeNum = nodeNum
|
self.nodeNum = nodeNum
|
||||||
self.localConfig = localonly_pb2.LocalConfig()
|
self.localConfig = localonly_pb2.LocalConfig()
|
||||||
|
self.moduleConfig = localonly_pb2.LocalModuleConfig()
|
||||||
self.channels = None
|
self.channels = None
|
||||||
self._timeout = Timeout(maxSecs=300)
|
self._timeout = Timeout(maxSecs=300)
|
||||||
self.partialChannels = None
|
self.partialChannels = None
|
||||||
@@ -57,6 +58,10 @@ class Node:
|
|||||||
if self.localConfig:
|
if self.localConfig:
|
||||||
prefs = stripnl(MessageToJson(self.localConfig))
|
prefs = stripnl(MessageToJson(self.localConfig))
|
||||||
print(f"Preferences: {prefs}\n")
|
print(f"Preferences: {prefs}\n")
|
||||||
|
prefs = ""
|
||||||
|
if self.moduleConfig:
|
||||||
|
prefs = stripnl(MessageToJson(self.moduleConfig))
|
||||||
|
print(f"Module preferences: {prefs}\n")
|
||||||
self.showChannels()
|
self.showChannels()
|
||||||
|
|
||||||
def requestConfig(self):
|
def requestConfig(self):
|
||||||
@@ -87,43 +92,97 @@ class Node:
|
|||||||
p.set_config.device.CopyFrom(self.localConfig.device)
|
p.set_config.device.CopyFrom(self.localConfig.device)
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
logging.debug("Wrote device")
|
logging.debug("Wrote device")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
if self.localConfig.position:
|
if self.localConfig.position:
|
||||||
p = admin_pb2.AdminMessage()
|
p = admin_pb2.AdminMessage()
|
||||||
p.set_config.position.CopyFrom(self.localConfig.position)
|
p.set_config.position.CopyFrom(self.localConfig.position)
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
logging.debug("Wrote position")
|
logging.debug("Wrote position")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
if self.localConfig.power:
|
if self.localConfig.power:
|
||||||
p = admin_pb2.AdminMessage()
|
p = admin_pb2.AdminMessage()
|
||||||
p.set_config.power.CopyFrom(self.localConfig.power)
|
p.set_config.power.CopyFrom(self.localConfig.power)
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
logging.debug("Wrote power")
|
logging.debug("Wrote power")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
if self.localConfig.wifi:
|
if self.localConfig.wifi:
|
||||||
p = admin_pb2.AdminMessage()
|
p = admin_pb2.AdminMessage()
|
||||||
p.set_config.wifi.CopyFrom(self.localConfig.wifi)
|
p.set_config.wifi.CopyFrom(self.localConfig.wifi)
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
logging.debug("Wrote wifi")
|
logging.debug("Wrote wifi")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
if self.localConfig.display:
|
if self.localConfig.display:
|
||||||
p = admin_pb2.AdminMessage()
|
p = admin_pb2.AdminMessage()
|
||||||
p.set_config.display.CopyFrom(self.localConfig.display)
|
p.set_config.display.CopyFrom(self.localConfig.display)
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
logging.debug("Wrote display")
|
logging.debug("Wrote display")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
if self.localConfig.lora:
|
if self.localConfig.lora:
|
||||||
p = admin_pb2.AdminMessage()
|
p = admin_pb2.AdminMessage()
|
||||||
p.set_config.lora.CopyFrom(self.localConfig.lora)
|
p.set_config.lora.CopyFrom(self.localConfig.lora)
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
logging.debug("Wrote lora")
|
logging.debug("Wrote lora")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if self.moduleConfig.mqtt:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.mqtt.CopyFrom(self.moduleConfig.mqtt)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: mqtt")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if self.moduleConfig.serial:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.serial.CopyFrom(self.moduleConfig.serial)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: serial")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if self.moduleConfig.external_notification:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.external_notification.CopyFrom(self.moduleConfig.external_notification)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: external_notification")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if self.moduleConfig.store_forward:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.store_forward.CopyFrom(self.moduleConfig.store_forward)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: store_forward")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if self.moduleConfig.range_test:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.range_test.CopyFrom(self.moduleConfig.range_test)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: range_test")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if self.moduleConfig.telemetry:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.telemetry.CopyFrom(self.moduleConfig.telemetry)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: telemetry")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if self.moduleConfig.canned_message:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.canned_message.CopyFrom(self.moduleConfig.canned_message)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: canned_message")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
def writeChannel(self, channelIndex, adminIndex=0):
|
def writeChannel(self, channelIndex, adminIndex=0):
|
||||||
"""Write the current (edited) channel to the device"""
|
"""Write the current (edited) channel to the device"""
|
||||||
|
|
||||||
p = admin_pb2.AdminMessage()
|
p = admin_pb2.AdminMessage()
|
||||||
p.set_channel.CopyFrom(self.channels[channelIndex])
|
p.set_channel.CopyFrom(self.channels[channelIndex])
|
||||||
|
|
||||||
self._sendAdmin(p, adminIndex=adminIndex)
|
self._sendAdmin(p, adminIndex=adminIndex)
|
||||||
logging.debug(f"Wrote channel {channelIndex}")
|
logging.debug(f"Wrote channel {channelIndex}")
|
||||||
|
|
||||||
|
|||||||
2
proto
2
proto
Submodule proto updated: 274aa01a38...c63a16c32f
2
setup.py
2
setup.py
@@ -12,7 +12,7 @@ with open("README.md", "r") as fh:
|
|||||||
# This call to setup() does all the work
|
# This call to setup() does all the work
|
||||||
setup(
|
setup(
|
||||||
name="meshtastic",
|
name="meshtastic",
|
||||||
version="1.3alpha.18",
|
version="1.3alpha.19",
|
||||||
description="Python API & client shell for talking to Meshtastic devices",
|
description="Python API & client shell for talking to Meshtastic devices",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user