Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set --ch-index to a newly added channel when --ch-add is set, to allow further modification #508

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

ianmcorvidae
Copy link
Contributor

This isn't quite the fix as described in the issue, but I believe fixes #507 a bit more nicely even than that.

Currently, if you were to pass all of --ch-add, --ch-index, and --ch-set, the CLI would first add a channel at the first available index, but then the --ch-set would apply to whatever channel was at --ch-index, which needn't necessarily match the channel that was just added. That is, a command like:

meshtastic --ch-add test --ch-index 0 --ch-set psk default --ch-set uplink_enabled true

would first add "test" as one of channels 1-7 (assuming one was available), and then set the primary channel to the default PSK and turn uplink on.

With this change, --ch-add won't allow --ch-index to be set along with it, and after adding the channel, will instead set the channel index to that value. That way, the above command would error, but the following:

meshtastic --ch-add test --ch-set psk default --ch-set uplink_enabled true

would, instead, add a channel called "test" with the default PSK and uplink enabled.

I think this is a lot more intuitive and more in line with the usual philosophy of this command line where a single command is intended, generally, to modify only one thing. Hopefully y'all agree!

@thebentern thebentern merged commit bd788ae into meshtastic:master Mar 17, 2024
1 of 10 checks passed
@ianmcorvidae ianmcorvidae deleted the set-ch-index-on-add branch March 19, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify warning message when setting channel PSK during meshtastic --ch-add
2 participants