@@ -135,7 +135,7 @@ def splitCompoundName(comp_name):
135135 return name
136136
137137
138- def setPref (config , comp_name , valStr ):
138+ def setPref (config , comp_name , valStr ) -> bool :
139139 """Set a channel or preferences value"""
140140
141141 name = splitCompoundName (comp_name )
@@ -690,9 +690,29 @@ def setSimpleConfig(modem_preset):
690690 # Handle the channel settings
691691 for pref in args .ch_set or []:
692692 if pref [0 ] == "psk" :
693+ found = True
693694 ch .settings .psk = meshtastic .util .fromPSK (pref [1 ])
694695 else :
695- setPref (ch .settings , pref [0 ], pref [1 ])
696+ found = setPref (ch .settings , pref [0 ], pref [1 ])
697+ if not found :
698+ category_settings = ['module_settings' ]
699+ print (
700+ f"{ ch .settings .__class__ .__name__ } does not have an attribute { pref [0 ]} ."
701+ )
702+ print ("Choices are..." )
703+ for field in ch .settings .DESCRIPTOR .fields :
704+ if field .name not in category_settings :
705+ print (f"{ field .name } " )
706+ else :
707+ print (f"{ field .name } :" )
708+ config = ch .settings .DESCRIPTOR .fields_by_name .get (field .name )
709+ names = []
710+ for sub_field in config .message_type .fields :
711+ tmp_name = f"{ field .name } .{ sub_field .name } "
712+ names .append (tmp_name )
713+ for temp_name in sorted (names ):
714+ print (f" { temp_name } " )
715+
696716 enable = True # If we set any pref, assume the user wants to enable the channel
697717
698718 if enable :
0 commit comments