Skip to content

Commit

Permalink
BUGFIX: fixes issue #9
Browse files Browse the repository at this point in the history
fixes #9
  • Loading branch information
amilcarlucas committed May 11, 2024
1 parent 05c2224 commit 00b5de4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions MethodicConfigurator/frontend_tkinter_component_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def add_entry_or_combobox(self, value, entry_frame, path): # pylint: disable=to
'Synthetic Current and Analog Voltage', 'INA239_SPI', 'EFI', 'AD7091R5', 'Scripting'],
},
('ESC', 'FC Connection', 'Type'): {
"values": ['Main Out'] + serial_ports + can_ports,
"values": ['Main Out', 'AIO'] + serial_ports + can_ports,
},
('ESC', 'FC Connection', 'Protocol'): {
# TODO get this list from MOT_PWM_TYPE pdef metadata pylint: disable=fixme
Expand Down Expand Up @@ -297,7 +297,7 @@ def save_data(self):
def validate_data(self): # pylint: disable=too-many-branches
invalid_values = False
duplicated_connections = False
fc_connection_types = set()
fc_serial_connection = {}

for path, entry in self.entry_widgets.items():
value = entry.get()
Expand All @@ -310,12 +310,16 @@ def validate_data(self): # pylint: disable=too-many-branches
invalid_values = True
continue
if 'FC Connection' in path and 'Type' in path:
if value in fc_connection_types and value not in ["CAN1", "CAN2", "I2C1", "I2C2", "I2C3", "I2C4"]:
if value in fc_serial_connection and value not in ["CAN1", "CAN2", "I2C1", "I2C2", "I2C3", "I2C4"]:
if path[0] in ['Telemetry', 'RC Receiver'] and \
fc_serial_connection[value] in ['Telemetry', 'RC Receiver']:
entry.configure(style="comb_input_valid.TCombobox")
continue # Allow telemetry and RC Receiver connections using the same SERIAL port
show_error_message("Error", f"Duplicate FC connection type '{value}' for {'>'.join(list(path))}")
entry.configure(style="comb_input_invalid.TCombobox")
duplicated_connections = True
continue
fc_connection_types.add(value)
fc_serial_connection[value] = path[0]
entry.configure(style="comb_input_valid.TCombobox")

if path in [('Battery', 'Specifications', 'Volt per cell max'), ('Battery', 'Specifications', 'Volt per cell low'),
Expand Down

0 comments on commit 00b5de4

Please sign in to comment.