@@ -230,6 +230,7 @@ def __init__(self, version: str, local_filesystem: LocalFilesystem) -> None:
230230 _vehicle_components_strings = _ ("Version" )
231231 _vehicle_components_strings = _ ("Firmware" )
232232 _vehicle_components_strings = _ ("Type" )
233+ _vehicle_components_strings = _ ("MCU Series" )
233234 _vehicle_components_strings = _ ("Notes" )
234235 _vehicle_components_strings = _ ("Frame" )
235236 _vehicle_components_strings = _ ("Specifications" )
@@ -250,6 +251,7 @@ def __init__(self, version: str, local_filesystem: LocalFilesystem) -> None:
250251 _vehicle_components_strings = _ ("Number of cells" )
251252 _vehicle_components_strings = _ ("Capacity mAh" )
252253 _vehicle_components_strings = _ ("ESC" )
254+ _vehicle_components_strings = _ ("RPM Telemetry" )
253255 _vehicle_components_strings = _ ("Motors" )
254256 _vehicle_components_strings = _ ("Poles" )
255257 _vehicle_components_strings = _ ("Propellers" )
@@ -270,7 +272,7 @@ def update_json_data(self) -> None:
270272 if "Capacity mAh" not in self .data ["Components" ]["Battery" ]["Specifications" ]:
271273 self .data ["Components" ]["Battery" ]["Specifications" ]["Capacity mAh" ] = 0
272274
273- # To update old JSON files that do not have these new fields
275+ # To update old JSON files that do not have these new "Frame.Specifications.TOW * Kg" fields
274276 if "Frame" not in self .data ["Components" ]:
275277 self .data ["Components" ]["Frame" ] = {}
276278 if "Specifications" not in self .data ["Components" ]["Frame" ]:
@@ -286,6 +288,30 @@ def update_json_data(self) -> None:
286288
287289 self .data ["Program version" ] = __version__
288290
291+ # To update old JSON files that do not have this new "Flight Controller.Specifications.MCU Series" field
292+ if "Flight Controller" not in self .data ["Components" ]:
293+ self .data ["Components" ]["Flight Controller" ] = {}
294+ if "Specifications" not in self .data ["Components" ]["Flight Controller" ]:
295+ self .data ["Components" ]["Flight Controller" ]["Specifications" ] = {}
296+ if "MCU Series" not in self .data ["Components" ]["Flight Controller" ]["Specifications" ]:
297+ self .data ["Components" ]["Flight Controller" ]["Specifications" ]["MCU Series" ] = "Unknown"
298+
299+ # To update old JSON files that do not have these new
300+ # "ESC.RPM Telemetry.Connection" and "ESC.RPM Telemetry.Protocol" fields
301+ if "ESC" not in self .data ["Components" ]:
302+ self .data ["Components" ]["ESC" ] = {}
303+ if "RPM Telemetry" not in self .data ["Components" ]["ESC" ]:
304+ self .data ["Components" ]["ESC" ] = {
305+ "Product" : self .data ["Components" ]["ESC" ]["Product" ],
306+ "Firmware" : self .data ["Components" ]["ESC" ]["Firmware" ],
307+ "FC Connection" : self .data ["Components" ]["ESC" ]["FC Connection" ],
308+ "RPM Telemetry" : {
309+ "Connection" : "None" ,
310+ "Protocol" : "None"
311+ },
312+ "Notes" : self .data ["Components" ]["ESC" ]["Notes" ],
313+ }
314+
289315 def set_vehicle_type_and_version (self , vehicle_type : str , version : str ) -> None :
290316 self ._set_component_value_and_update_ui (("Flight Controller" , "Firmware" , "Type" ), vehicle_type )
291317 if version :
@@ -299,6 +325,10 @@ def set_fc_model(self, model: str) -> None:
299325 if model and model not in (_ ("Unknown" ), "MAVLink" ):
300326 self ._set_component_value_and_update_ui (("Flight Controller" , "Product" , "Model" ), model )
301327
328+ def set_mcu_series (self , mcu : str ) -> None :
329+ if mcu :
330+ self ._set_component_value_and_update_ui (("Flight Controller" , "Specifications" , "MCU Series" ), mcu )
331+
302332 def set_vehicle_configuration_template (self , configuration_template : str ) -> None :
303333 self .data ["Configuration template" ] = configuration_template
304334
@@ -468,22 +498,59 @@ def update_esc_protocol_combobox_entries(self, esc_connection_type: str) -> None
468498 """Updates the ESC Protocol combobox entries based on the selected ESC Type."""
469499 if len (esc_connection_type ) > 3 and esc_connection_type [:3 ] == "CAN" :
470500 protocols = ["DroneCAN" ]
501+ rpm_connections = [esc_connection_type ]
471502 elif len (esc_connection_type ) > 6 and esc_connection_type [:6 ] == "SERIAL" :
472503 protocols = [value ["protocol" ] for value in serial_protocols_dict .values () if value ["component" ] == "ESC" ]
504+ rpm_connections = [esc_connection_type ]
473505 elif "MOT_PWM_TYPE" in self .local_filesystem .doc_dict :
474506 protocols = list (self .local_filesystem .doc_dict ["MOT_PWM_TYPE" ]["values" ].values ())
507+ rpm_connections = ["None" , "I/O Only" , * serial_ports , * can_ports ]
475508 elif "Q_M_PWM_TYPE" in self .local_filesystem .doc_dict :
476509 protocols = list (self .local_filesystem .doc_dict ["Q_M_PWM_TYPE" ]["values" ].values ())
510+ rpm_connections = ["None" , "I/O Only" , * serial_ports , * can_ports ]
477511 else :
478512 protocols = []
513+ rpm_connections = []
479514
515+ protocol = ""
480516 protocol_path = ("ESC" , "FC Connection" , "Protocol" )
481517 if protocol_path in self .entry_widgets :
482518 protocol_combobox = self .entry_widgets [protocol_path ]
483519 protocol_combobox ["values" ] = protocols # Update the combobox entries
484520 if protocol_combobox .get () not in protocols and isinstance (protocol_combobox , ttk .Combobox ):
485521 protocol_combobox .set (protocols [0 ] if protocols else "" )
486522 protocol_combobox .update_idletasks () # re-draw the combobox ASAP
523+ protocol = protocol_combobox .get ()
524+ if protocol in ["Normal" , "OneShot" , "OneShot125" , "Brushed" , "PWMRange" ]:
525+ rpm_connections = ["None" ]
526+ elif "DShot" in protocol :
527+ rpm_connections = ["None" , "Main Out/AIO" , * serial_ports ]
528+
529+ rpm_connection_path = ("ESC" , "RPM Telemetry" , "Connection" )
530+ if rpm_connection_path in self .entry_widgets :
531+ rpm_connection_combobox = self .entry_widgets [rpm_connection_path ]
532+ rpm_connection_combobox ["values" ] = rpm_connections # Update the combobox entries
533+ if rpm_connection_combobox .get () not in rpm_connections and isinstance (rpm_connection_combobox , ttk .Combobox ):
534+ rpm_connection_combobox .set (rpm_connections [0 ] if rpm_connections else "" )
535+ rpm_connection_combobox .update_idletasks () # re-draw the combobox ASAP
536+
537+ if len (esc_connection_type ) > 3 and esc_connection_type [:3 ] == "CAN" :
538+ rpm_protocols = ["None" , "DroneCAN" ]
539+ elif len (esc_connection_type ) > 6 and esc_connection_type [:6 ] == "SERIAL" :
540+ rpm_protocols = ["None" , protocol ]
541+ elif "MOT_PWM_TYPE" in self .local_filesystem .doc_dict :
542+ rpm_protocols = ["None" , "Dshot" , "BDshot" ]
543+ elif "Q_M_PWM_TYPE" in self .local_filesystem .doc_dict :
544+ rpm_protocols = ["None" , "Dshot" , "BDshot" ]
545+ else :
546+ rpm_protocols = []
547+ rpm_protocol_path = ("ESC" , "RPM Telemetry" , "Protocol" )
548+ if rpm_protocol_path in self .entry_widgets :
549+ rpm_protocol_combobox = self .entry_widgets [rpm_protocol_path ]
550+ rpm_protocol_combobox ["values" ] = rpm_protocols # Update the combobox entries
551+ if rpm_protocol_combobox .get () not in rpm_protocols and isinstance (rpm_protocol_combobox , ttk .Combobox ):
552+ rpm_protocol_combobox .set (rpm_protocols [0 ] if rpm_protocols else "" )
553+ rpm_protocol_combobox .update_idletasks () # re-draw the combobox ASAP
487554
488555 def add_entry_or_combobox (
489556 self , value : float , entry_frame : ttk .Frame , path : tuple [str , str , str ]
@@ -538,6 +605,12 @@ def get_combobox_values(param_name: str) -> list:
538605 ("GNSS Receiver" , "FC Connection" , "Type" ): {
539606 "values" : ["None" , * self .serial_ports , * self .can_ports ],
540607 },
608+ ("ESC" , "RPM Telemetry" , "Connection" ): {
609+ "values" : ["None" , "" , * self .serial_ports , * self .can_ports ],
610+ },
611+ ("ESC" , "RPM Telemetry" , "Protocol" ): {
612+ "values" : ["None" , "DSHot" , "BDSHot" ],
613+ },
541614 ("GNSS Receiver" , "FC Connection" , "Protocol" ): {
542615 "values" : get_combobox_values ("GPS_TYPE" ),
543616 },
0 commit comments