diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index be16a47..fff5805 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -949,18 +949,6 @@ offset_bottom = 827.0 theme = SubResource("Theme_yblys") text = "Сохранить все настройки" -[node name="can_macro" type="Label" parent="."] -offset_left = 226.0 -offset_top = 876.0 -offset_right = 1055.0 -offset_bottom = 916.0 - -[node name="can" type="Label" parent="."] -offset_left = 224.0 -offset_top = 844.0 -offset_right = 959.0 -offset_bottom = 889.0 - [connection signal="pressed" from="Background/side_panel/select_prd" to="." method="_on_prd_select"] [connection signal="pressed" from="Background/side_panel/select_control" to="." method="_on_control_button"] [connection signal="pressed" from="Background/side_panel/select_ems_g" to="." method="_on_emsg_select"] diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 8e3f1a1..b8929bf 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -139,7 +139,17 @@ func _ready() -> void: for key in Constants.ATT_DICT: node_select_yau_07b.get_node2(1, 4).add_item(key) node_select_yau_07b_2.get_node2(1, 4).add_item(key) - + + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 48) + Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8]) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 49) + Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8]) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 51) + Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8]) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 52) + Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8]) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 56) + Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8]) Network.connect('yau_status_line', Callable(self, '_on_yau_status')) Network.connect('yau_receive', Callable(self, '_on_data_received')) @@ -207,25 +217,43 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: $ISA.text = 'ISA: ' + str(len(Constants.EMS_G_PORT_DATA_HOLDER)) if isa_data.has(Constants.BASE_PORTS.UG+6): - $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+6] & 0x7) - $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+6] & 0x38)>> 3) + if (isa_data[Constants.BASE_PORTS.UG+6] & 0x7) < 7: + $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+6] & 0x7) + $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+6] & 0x38)>> 3) $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[Constants.BASE_PORTS.UG+6] & 0x7)) $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[Constants.BASE_PORTS.UG+6] & 0x38)) if isa_data.has(Constants.BASE_PORTS.UG+8): - $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+8] & 0x7) - $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+8] & 0x38)>>3) + if (isa_data[Constants.BASE_PORTS.UG+8] & 0x7) < 7: + $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+8] & 0x7) + $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+8] & 0x38)>>3) $TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[Constants.BASE_PORTS.UG+8] & 0x7)) $TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[Constants.BASE_PORTS.UG+8] & 0x38)) - if isa_data.has(Constants.BASE_PORTS.EMS_G+2): - print(isa_data[Constants.BASE_PORTS.EMS_G+2]) - if (isa_data[Constants.BASE_PORTS.EMS_G+2]== 48): - if (isa_data[Constants.BASE_PORTS.EMS_G+8]>>14): - print(isa_data) - $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).button_pressed = true - else: - $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).button_pressed = false - + for index in Constants.EMS_G_PORT_DATA_HOLDER.size(): + var tmp_device_mode = Constants.EMS_G_PORT_DATA_HOLDER[index][0] + if tmp_device_mode == 48: + var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] + if Constants.BASE_PORTS.EMS_G+8 in data_dict: + $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14 + if tmp_device_mode == 49: + var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] + if Constants.BASE_PORTS.EMS_G+8 in data_dict: + $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14 + if tmp_device_mode == 51: + var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] + if Constants.BASE_PORTS.EMS_G+8 in data_dict: + var select = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 if data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 < 3 else 3 + $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,2).select(select) + if tmp_device_mode == 52: + var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] + if Constants.BASE_PORTS.EMS_G+8 in data_dict: + var select = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 if data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 < 3 else 3 + $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,2).select(select) + if tmp_device_mode == 56: + var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] + if Constants.BASE_PORTS.EMS_G+8 in data_dict: + $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,5).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 + func _on_data_fs_1(fs_1_data): var node_select_fs_1 = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control @@ -252,8 +280,6 @@ func _on_data_fs_1(fs_1_data): Constants.CMD.BASE_CAN_MACRO_READ: if GRP == Constants.GROUP.BASE: node_select_fs_1.set_node_text(2, 7, str(fs_1_data.decode_u16(0x20)) + ' МГц') - $can.text = str(fs_1_data) - $can_macro.text = str(fs_1_data.decode_u32(0x04)) func _on_data_fs_2(fs_2_data): diff --git a/scripts/constants.gd b/scripts/constants.gd index 9913ca5..7665ba8 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -1,6 +1,6 @@ extends Node -const UNICAST_PORT: int = 50014 -const UNICAST_ADDRESS: String = '10.1.1.14' +const UNICAST_PORT: int = 50003 +const UNICAST_ADDRESS: String = '10.1.1.3' const BROADCAST_PORT: int = 50000 const DEFAULT_ADDRESS: String = '10.1.1.11' const DEFAULT_PORT: String = '50011' diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index 8bb9327..fd5ea87 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -67,7 +67,7 @@ func _status_cell(status): node_cell_ind[i].state = Constants.STATE_VAL.NONE func _status_prd(): - var status: int + var status: int = 0 for i in range(count_cell-3): status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0 status += 1 if (node_cell_ind[count_cell-1].state == Constants.STATE_VAL.GOOD) else 0 diff --git a/scripts/network.gd b/scripts/network.gd index 2d53b7d..8f078ac 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -109,7 +109,7 @@ func _ready() -> void: soc_unicast = Socket.new() rc = soc_unicast.bind(Constants.UNICAST_PORT, Constants.UNICAST_ADDRESS) if rc != OK: - print_debug('Ошибка: неудачная привязка адреса: ', ip_address_yau) + print_debug('Ошибка: неудачная привязка адреса: ', Constants.UNICAST_ADDRESS) unit.connect('line_changed', Callable(self, 'on_line_changed')) unit.connect('command_fail', Callable(self, 'on_command_fail'))