meshtastic / python

The Python CLI and API for talking to Meshtastic devices
https://meshtastic.org
401 stars 170 forks source link

CLI Reports ModemPreset Has No Value for ch-mid command-line options #367

Closed ghostop14 closed 2 years ago

ghostop14 commented 2 years ago

meshtastic --ch-midfast and meshtastic --ch-midslow both error with similar errors:

Connected to radio Aborting due to: Enum ModemPreset has no value defined for name 'MidFast'

Connected to radio Aborting due to: Enum ModemPreset has no value defined for name 'MidSlow'

All other channel presets seem to work okay.
Using meshtastic installed via pip. Package info: meshtastic-1.3a26-py3.8.egg

garthvh commented 2 years ago

/// Long Range - Fast case longFast // = 0 /// Long Range - Slow case longSlow // = 1 /// Very Long Range - Slow case vlongSlow // = 2 /// Medium Range - Slow case medSlow // = 3 /// Medium Range - Fast case medFast // = 4 /// Short Range - Slow case shortSlow // = 5 /// Short Range - Fast case shortFast // = 6

Are the modem preset values from 1.3, the mid is an old typo.

ghostop14 commented 2 years ago

It may be from the command-line parsing:

meshtastic --ch-midfast Connected to radio Aborting due to: Enum ModemPreset has no value defined for name 'MidFast'

meshtastic --ch-medfast usage: meshtastic [-h] [--configure CONFIGURE] [--export-config] [--port PORT] [--host HOST] [--seriallog SERIALLOG] [--info] [--get-canned-message] [--nodes] [--qr] [--get GET] [--set SET SET] [--seturl SETURL] [--ch-index CH_INDEX] [--ch-add CH_ADD] [--ch-del] [--ch-enable] [--ch-disable] [--ch-set CH_SET CH_SET] [--ch-vlongslow] [--ch-longslow] [--ch-longfast] [--ch-midslow] [--ch-midfast] [--ch-shortslow] [--ch-shortfast] [--set-owner SET_OWNER] [--set-canned-message SET_CANNED_MESSAGE] [--set-owner-short SET_OWNER_SHORT] [--set-ham SET_HAM] [--dest DEST] [--sendtext SENDTEXT] [--sendping] [--reboot] [--shutdown] [--device-metadata] [--reply] [--gpio-wrb GPIO_WRB GPIO_WRB] [--gpio-rd GPIO_RD] [--gpio-watch GPIO_WATCH] [--no-time] [--setalt SETALT] [--setlat SETLAT] [--setlon SETLON] [--pos-fields [POS_FIELDS [POS_FIELDS ...]]] [--debug] [--test] [--ble BLE] [--noproto] [--tunnel] [--subnet TUNNEL_NET] [--version] [--support] meshtastic: error: unrecognized arguments: --ch-medfast

ghostop14 commented 2 years ago

Looks like the mismatch is in main.py:

    if args.ch_midslow:
        setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.MidSlow)

    if args.ch_midfast:
        setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.MidFast)
ghostop14 commented 2 years ago

Cloned meshtastic-python and fixed and built locally. Changing those lines in mainpy to Med rather than Mid fixes the command-line issue.

garthvh commented 2 years ago

Please submit a pull request

ghostop14 commented 2 years ago

Just submitted.