File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -597,6 +597,12 @@ def onConnected(interface):
597597 # handle changing channels
598598
599599 if args .ch_add :
600+ channelIndex = our_globals .get_channel_index ()
601+ if channelIndex is not None :
602+ # Since we set the channel index after adding a channel, don't allow --ch-index
603+ meshtastic .util .our_exit (
604+ "Warning: '--ch-add' and '--ch-index' are incompatible. Channel not added."
605+ )
600606 closeNow = True
601607 if len (args .ch_add ) > 10 :
602608 meshtastic .util .our_exit (
@@ -620,6 +626,9 @@ def onConnected(interface):
620626 ch .role = channel_pb2 .Channel .Role .SECONDARY
621627 print (f"Writing modified channels to device" )
622628 n .writeChannel (ch .index )
629+ if channelIndex is None :
630+ print (f"Setting newly-added channel's { ch .index } as '--ch-index' for further modifications" )
631+ our_globals .set_channel_index (ch .index )
623632
624633 if args .ch_del :
625634 closeNow = True
You can’t perform that action at this time.
0 commit comments