python icon indicating copy to clipboard operation
python copied to clipboard

Accept node.id in decimal and hex

Open jp-bennett opened this issue 2 years ago • 6 comments

To specify a node, we currently use an exclamation mark, which has other effects in bash. It would be ideal to also allow nodes to be specified by their numeric value, as well as by 0xdeadbeef as well as !deadbeef.

jp-bennett avatar Nov 16 '23 01:11 jp-bennett

Would this need to be changed in the firmware or just in the pattern matching from the command line?

dl33t-me avatar Jan 21 '25 02:01 dl33t-me

this should only need updating within the CLI/library -- everything is converted to an integer to send to the radio

ianmcorvidae avatar Jan 21 '25 02:01 ianmcorvidae

Made a PR to potentially address this issue. https://github.com/meshtastic/python/pull/731

I'm open to comments on improving this though.

migillett avatar Jan 26 '25 17:01 migillett

PR just merged to main. You can now use ! or 0x prefixes when setting node destinations. ie: --dest "0x12345678" or --dest "!12345678"

migillett avatar Feb 19 '25 16:02 migillett

I'll keep this open for the time being, because I think we'd still like to add some handling for passing node IDs in pure decimal at the command line. I think we can add some handling that treats a value as decimal if it has no prefix at all and all digits could be decimal. I'm not sure entirely what we should do with an unprefixed 8-digit all-decimal-digits value, though.

ianmcorvidae avatar Feb 19 '25 16:02 ianmcorvidae

[...] I'm not sure entirely what we should do with an unprefixed 8-digit all-decimal-digits value, though.

There will be no choice: the prefix will initiate the interpretation of the following string as defined by the prefix. No prefix then is just a shortcut to interpret as a decimal number, otherwise there is an ambiguity which cannot be resolved. Having a clear rule will also keep the code clean and understandable.

juergenRe avatar Oct 26 '25 09:10 juergenRe