From 05143f6f45abc5504c8555a9c7dcf20545fc8c7e Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 7 Mar 2025 09:05:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BA=D0=BC=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PRD_MP550.tscn | 5 +- saves/fs_setting | 0 saves/fs_setting.txt | Bin 0 -> 80 bytes scripts/PRD.gd | 57 +++++++++++++++- scripts/constants.gd | 5 +- scripts/control_panel.gd | 143 ++++++++++++++++++++++++++------------- scripts/ems_g.gd | 57 ++++++++-------- 7 files changed, 182 insertions(+), 85 deletions(-) create mode 100644 saves/fs_setting create mode 100644 saves/fs_setting.txt diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 03c57c5..7d5b8fc 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -760,6 +760,7 @@ offset_bottom = 765.0 fname = "УМ 6" [node name="blok_ym_litera_1" parent="TabContainer/ControlPanel/socket_ym_lb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 309.0 offset_top = 830.0 offset_right = 490.0 @@ -1336,8 +1337,8 @@ text = "Сохранить все настройки" [connection signal="pressed" from="Background/switch_panel/select_control" to="." method="_on_control_button"] [connection signal="pressed" from="Background/switch_panel/select_ems_g" to="." method="_on_emsg_select"] [connection signal="pressed" from="Background/switch_panel/select_fs" to="." method="_on_mfs_select"] -[connection signal="pressed" from="Background/switch_panel/save_config" to="." method="_on_save_config"] -[connection signal="pressed" from="Background/switch_panel/load_config" to="." method="_on_load_config"] +[connection signal="pressed" from="Background/switch_panel/save_config" to="." method="save_settings"] +[connection signal="pressed" from="Background/switch_panel/load_config" to="." method="read_file"] [connection signal="toggled" from="Background/switch_panel/burgerButton" to="." method="_on_burger_button"] [connection signal="pressed" from="Background/switch_panel/texture_prd" to="." method="_on_prd_select"] [connection signal="pressed" from="Background/switch_panel/texture_control" to="." method="_on_control_button"] diff --git a/saves/fs_setting b/saves/fs_setting new file mode 100644 index 0000000..e69de29 diff --git a/saves/fs_setting.txt b/saves/fs_setting.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef95562227a3ff652729d2c87911e90d5e7a59c0 GIT binary patch literal 80 wcmeZaU|^62VrC#_f#Q void: for key in Constants.ATT_DICT_correct: node_select_yau_07b_3.get_node2(1, 4).add_item(key) + ## EMS статус сокета + $TabContainer/EMS_G.CI_1_UF = $TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_2_UF = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_3_UF = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CZI_2_FS = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 7).get_child(1) + $TabContainer/EMS_G.CZI_3_FS = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 7).get_child(1) + $TabContainer/EMS_G.CZI_4_FS = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 7).get_child(1) + $TabContainer/EMS_G.CZI_5_FS = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 7).get_child(1) + $TabContainer/EMS_G.CI_2_FS = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_3_FS = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_4_FS = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_5_FS = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_1_FS = $TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_6_FS = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1, 6).get_child(1) + $TabContainer/EMS_G.CI_7_FS = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1, 6).get_child(1) + get_select_device.connect('item_selected', Callable(self, 'on_mode_select')) ## Yau-07b 1 @@ -345,6 +361,10 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: 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 == Constants.META.CI_1_B_UF: + 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_1/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14 if tmp_device_mode == Constants.META.CI_2_B_UF: var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] if Constants.BASE_PORTS.EMS_G+8 in data_dict: @@ -353,6 +373,10 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: 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 == Constants.META.CI_3_B_UF: + 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] >> 13 if tmp_device_mode == Constants.META.MODUL_UM_1: var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] if Constants.BASE_PORTS.EMS_G+8 in data_dict: @@ -647,6 +671,8 @@ func on_mode_select(intem_from_sector: int) -> void: Network.start_work_fs_2() if meta[2] == Constants.MODE.PRD_K: Network.start_work_fs_3() + emit_signal('read_ems_g_start') + #_on_read_isa(Network.unit.isa_ports) func _on_zapret_1(toggled_on: bool) -> void: @@ -693,7 +719,7 @@ func _on_modul_um(item_from_ray_1: int, node: Node): else: return - if modul_um.has(0x8000): + if modul_um.has(0x2000): timer_modul_um.wait_time = 2.3 timer_modul_um.start() @@ -701,9 +727,9 @@ func _on_modul_um(item_from_ray_1: int, node: Node): ## Таймер для модуляции УМ func _on_timer_modul_um(): print('Модуляция вызывается') - if modul_um.has(0x8000): + if modul_um.has(0x2000): for i in range(3): - if modul_um[i] == 0x8000: + if modul_um[i] == 0x2000: print('Модуляция есть ', modul_um) Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, current_meta[i]) Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[i]) @@ -1005,3 +1031,28 @@ func set_tab_and_buttons(tab_index: int, button_name: String, txt_button_name: S func _on_connect_prd_pressed() -> void: on_mode_select($TabContainer/PRD/select_dev.get_node2(1, 0).get_selected_id()) + + +func save_settings(): + var settings = { + "test": 1, + "test2": 2, + "test3": 303, + } + var file = FileAccess.open("res://saves/fs_setting.txt", FileAccess.WRITE) + if file: + file.store_var(settings) + file.close() + + +func read_file(): + var file = FileAccess.open("res://saves/fs_setting.txt", FileAccess.READ) + if file: + var settings = file.get_var() + file.close() + + if 'test3' in settings: + var read_test = settings['test3'] + print(read_test) + else: + print('var not found in file') diff --git a/scripts/constants.gd b/scripts/constants.gd index 094cb7a..810cabb 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -1,4 +1,5 @@ extends Node +var file = FileAccess.open("user://constants.txt", FileAccess.READ) const UNICAST_PORT: int = 50003 const UNICAST_ADDRESS: String = '10.1.1.3' const BROADCAST_PORT: int = 50000 @@ -301,8 +302,6 @@ const SIGNS: Dictionary = { 'СИ 1 от ФС', 'Фильтр CAN', 'Статус CAN', - - ], } @@ -427,7 +426,7 @@ enum FS_ATT { att_2_prd_B4 = 16, att_1_prd_K1 = 15, att_2_prd_K1 = 10, - att_3_prd_K1 = 5, + att_3_prd_K1 = 0, att_1_prd_K2 = 17, att_2_prd_K2 = 16, att_3_prd_K2 = 19, diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index 1b0718b..a06e422 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -292,13 +292,16 @@ func fs_3_setup(freq: int, att: float): func yau_07b_setup(angle_and_att: int): Network.write_port_isa(Constants.BASE_PORTS.UG+0x6, angle_and_att) Network.write_port_isa(Constants.BASE_PORTS.UG+0x8, angle_and_att) - Network.write_port_isa(Constants.BASE_PORTS.UG+0xA, (angle_and_att & 0x38)>>3) - Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1) - Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 2<<13) ## Отключить модуляцию (литера 1) Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_2) - Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 2<<13) ## Отключить модуляцию (литера 2) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000) ## Отключить модуляцию (литера 2) Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3) - Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 2<<13) ## Отключить модуляцию (литера 3) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000) ## Отключить модуляцию (литера 3) + if Constants.CURRENT_MODE == Constants.MODE.PRD_K: + Network.write_port_isa(Constants.BASE_PORTS.UG+0xA, (angle_and_att & 0x38)>>3) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x2000) ## Включить (Контроль) модуляцию (литера 1) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_28) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x2000) func _on_data_fs(fs_data:PackedByteArray, fs_name: String): @@ -341,8 +344,10 @@ func _on_yau_received(status_yau): if flag_control_add: # Сбор урожая с УКП-1 var arr_power_ukp_1: Array = [] - var numbre_scrape: int = 7 if Constants.CURRENT_MODE == Constants.MODE.PRD_K else 6 + var numbre_scrape = 7 if Constants.CURRENT_MODE == Constants.MODE.PRD_K else 6 for i in range(numbre_scrape): ## Мощность от УКП_1 + if i == 6: + i +=1 var power_ukp_1 = status_yau.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i) arr_power_ukp_1.append(power_ukp_1) @@ -354,7 +359,8 @@ func _on_yau_received(status_yau): array_pow_1[i] = arr_power_ukp_1[i] # Сбор урожая с УКП-2 var arr_power_ukp_2: Array = [] - for i in range(6): ## Мощность от УКП_2 + numbre_scrape = 6 + for i in range(numbre_scrape): ## Мощность от УКП_2 var power_ukp_2 = status_yau.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i) arr_power_ukp_2.append(power_ukp_2) @@ -372,7 +378,11 @@ func _on_yau_feedback_receive(_status_yau): ## Флаг для проверки настройки угла и аттенюации на двух литерах if Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+6) and Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+8): if Network.unit.isa_ports[Constants.BASE_PORTS.UG+6] == prep_set_ug and Network.unit.isa_ports[Constants.BASE_PORTS.UG+8] == prep_set_ug: - flag_ug = true + if Constants.CURRENT_MODE == Constants.MODE.PRD_K: + if Network.unit.isa_ports[Constants.BASE_PORTS.UG+0xA] == (prep_set_ug & 0x38)>>3: + flag_ug = true + else: + flag_ug = true else: flag_ug = false ## Флаг для проверки модуяции на высоком @@ -391,6 +401,13 @@ func _on_yau_feedback_receive(_status_yau): elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and (flag_modul_on_2): flag_modul_on_2 = false logger.info('🛈 Модуляция УМ (3, 5, 7) отключена!') + if Constants.CURRENT_MODE == Constants.MODE.PRD_K: + if Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+8) and Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+2): + if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_1: + if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x2000: + print('Yes ') + elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000: + print('NO') func _on_start_super_control(): @@ -418,18 +435,15 @@ func _on_start_super_control(): var TMP_2 = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP + 3 if TMP_1 > 70: um_cell_ind[i_temperature].value0 = TMP_1 - _status_prd() - $log_array/await.visible = false + um_cell_ind[i_temperature].state = 2 + _on_contol_err() #timer.start(5) - return else: um_cell_ind[i_temperature].value0 = TMP_1 if TMP_2 > 70: um_cell_ind[i_temperature+6].value0 = TMP_2 - _status_prd() - $log_array/await.visible = false - #timer.start(5) - return + um_cell_ind[i_temperature+6].state = 2 + _on_contol_err() else: um_cell_ind[i_temperature+6].value0 = TMP_2 if Constants.CURRENT_MODE == Constants.MODE.PRD_K: @@ -438,9 +452,7 @@ func _on_start_super_control(): var TEMPERATURE = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_litera_1) * Constants.TEMP + 3 if TEMPERATURE > 70: um_cell_ind[12].value0 = TEMPERATURE - _status_prd() - $log_array/await.visible = false - #timer.start(5) + _on_contol_err() return else: um_cell_ind[12].value0 = TEMPERATURE @@ -456,8 +468,7 @@ func _on_start_super_control(): $soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR logger.error("❌ ЯУ-07Б: Нет связи") - _status_prd() - $log_array/await.visible = false + _on_contol_err() if Network.unit_fs.online: var fs_freq: Array @@ -554,28 +565,40 @@ func _on_fs_status(META:int): if logger: if META == Constants.META.CI_2_OT_FS or META == Constants.META.CI_4_OT_FS or META == Constants.META.CI_6_OT_FS: flag_fs_1_ready = true + logger.info('ФС - 1 READY') elif META == Constants.META.CI_3_OT_FS or META == Constants.META.CI_5_OT_FS or META == Constants.META.CI_7_OT_FS: flag_fs_2_ready = true + logger.info('ФС - 2 READY') elif META == Constants.META.CI_1_OT_FS: flag_fs_3_ready = true + logger.info('ФС - 3 READY') + if flag_fs_1_ready and flag_fs_2_ready: + if Constants.CURRENT_MODE == Constants.MODE.PRD_K: + if not flag_fs_3_ready: + return + #dkm var dkm: int = Network.unit.status.decode_u8(Constants.DataIndices.DKM) if Constants.CURRENT_MODE == Constants.MODE.PRD_H: - $soc_DKM/DKM_2.state = (dkm >> 1) & 0x1 - $soc_DKM/DKM_3.state = (dkm >> 2) & 0x1 - $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state - $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state if (dkm >> 1) & 0x1 == 1: logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Включено']) + $soc_DKM/DKM_2.state = Constants.STATE_VAL.GOOD + $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state else: logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Нет связи']) + $soc_DKM/DKM_2.state = Constants.STATE_VAL.ERROR + $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state if (dkm >> 2) & 0x1 == 1: logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Включено']) + $soc_DKM/DKM_3.state = Constants.STATE_VAL.GOOD + $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state else: logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Нет связи']) + $soc_DKM/DKM_3.state = Constants.STATE_VAL.ERROR + $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state if (dkm >> 1) & 0x1 == 1 and (dkm >> 2) & 0x1 == 1: # Следующий шаг -> flag_dkm = true @@ -584,23 +607,26 @@ func _on_fs_status(META:int): Network.get_gen_state_1() Network.set_fs_gen_status_2(true) ## отключен = true Network.get_gen_state_2() - _status_prd() - $log_array/await.visible = false + _on_contol_err() elif Constants.CURRENT_MODE == Constants.MODE.PRD_B: - $soc_DKM/DKM_2.state = (dkm >> 3) & 0x1 - $soc_DKM/DKM_3.state = (dkm >> 4) & 0x1 - $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state - $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state if (dkm >> 3) & 0x1 == 1: logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Включено']) + $soc_DKM/DKM_2.state = Constants.STATE_VAL.GOOD + $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state else: logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Нет связи']) + $soc_DKM/DKM_2.state = Constants.STATE_VAL.ERROR + $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state if (dkm >> 4) & 0x1 == 1: logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Включено']) + $soc_DKM/DKM_3.state = Constants.STATE_VAL.GOOD + $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state else: logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Нет связи']) - + $soc_DKM/DKM_3.state = Constants.STATE_VAL.ERROR + $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state + if (dkm >> 3) & 0x1 == 1 and (dkm >> 4) & 0x1 == 1: # Следующий шаг -> flag_dkm = true else: @@ -608,30 +634,35 @@ func _on_fs_status(META:int): Network.get_gen_state_1() Network.set_fs_gen_status_2(true) ## отключен = true Network.get_gen_state_2() - _status_prd() - $log_array/await.visible = false + _on_contol_err() elif Constants.CURRENT_MODE == Constants.MODE.PRD_K: - $soc_DKM/DKM_1.state = (dkm >> 0) & 0x1 - $soc_DKM/DKM_2.state = (dkm >> 5) & 0x1 - $soc_DKM/DKM_3.state = (dkm >> 6) & 0x1 - $Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state - $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state - $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state if (dkm >> 0) & 0x1 == 1: - print('OK') + logger.info('✅ %s: %s ' % [$Kasseta_FS/Block_FS_PRD_K.fname, 'Включено']) + $soc_DKM/DKM_1.state = Constants.STATE_VAL.GOOD + $Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state else: - print('FAIL: ', dkm) + logger.info('❌ %s: %s ' % [$Kasseta_FS/Block_FS_PRD_K.fname, 'Нет связи']) + $soc_DKM/DKM_1.state = Constants.STATE_VAL.ERROR + $Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state if (dkm >> 5) & 0x1 == 1: logger.info('✅ %s: %s ' % [$Kasseta_FS/ref_A3.fname, 'Включено']) + $soc_DKM/DKM_2.state = Constants.STATE_VAL.GOOD + $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state else: logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Нет связи']) + $soc_DKM/DKM_2.state = Constants.STATE_VAL.ERROR + $Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state if (dkm >> 6) & 0x1 == 1: logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Включено']) + $soc_DKM/DKM_3.state = Constants.STATE_VAL.GOOD + $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state else: logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Нет связи']) + $soc_DKM/DKM_3.state = Constants.STATE_VAL.ERROR + $Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state - if (dkm >> 5) & 0x1 == 1 and (dkm >> 6) & 0x1 == 1: # Следующий шаг -> + if (dkm >> 5) & 0x1 and (dkm >> 6) & 0x1 and (dkm >> 0) & 0x1: # Следующий шаг -> flag_dkm = true else: Network.set_fs_gen_status(true) ## отключен = true @@ -640,8 +671,8 @@ func _on_fs_status(META:int): Network.get_gen_state_2() Network.set_fs_gen_status_3(true) ## отключен = true Network.get_gen_state_3() - _status_prd() - $log_array/await.visible = false + _on_contol_err() + logger.info('🛈 ДКМ: %s ' % dkm) func _on_modul_um(): @@ -649,6 +680,11 @@ func _on_modul_um(): Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x8000) Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3) Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x8000) + if Constants.CURRENT_MODE == Constants.MODE.PRD_K: + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x2000) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_28) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x2000) flag_ug = false flag_dkm = false flag_start = true @@ -658,8 +694,6 @@ func _on_start_timer_03(): flag_start = false timer_03.wait_time = 0.3 timer_03.one_shot = true - array_pow_1 = [] - array_pow_2 = [] count_packet = 0 flag_control_add = true timer_03.start() @@ -675,6 +709,10 @@ func _on_timer_03(): Network.set_fs_gen_status_2(true) ## отключен = true Network.get_gen_state_2() if Constants.CURRENT_MODE == Constants.MODE.PRD_K: + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_28) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000) Network.set_fs_gen_status_3(true) ## отключен = true Network.get_gen_state_3() @@ -683,11 +721,17 @@ func _on_timer_03(): logger.info('Количество принятых пакетов от ЯУ-07Б: %s пкт.' % count_packet) logger.info('Максимальные значения мощностей от УКП-1: %s ' % str(array_pow_1)) logger.info('Максимальные значения мощности от УКП-2: %s ' % str(array_pow_2)) - _status_prd() - $log_array/await.visible = false + _on_contol_err() Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CZI_1) +func _on_contol_err(): + logger.warning('❌❌❌') + $log_array/await.visible = false + _status_prd() + #timer.start(5) + + func _status_prd(): var status: int = 0 for i in range(10): @@ -738,6 +782,9 @@ func _status_prd(): um_cell_ind[count_um].state = Constants.STATE_VAL.GOOD count_um += 1 + array_pow_1 = [] + array_pow_2 = [] + if pribor_ispraven: $lbl_control.text = 'Прибор %s исправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0] $lbl_control.modulate = Color.AQUAMARINE diff --git a/scripts/ems_g.gd b/scripts/ems_g.gd index 620ae57..4d2640e 100644 --- a/scripts/ems_g.gd +++ b/scripts/ems_g.gd @@ -7,6 +7,20 @@ var button_link_meta: Dictionary = {} var status_fs_1 var status_fs_2 var status_fs_3 +var CI_1_UF: Node +var CI_2_UF: Node +var CI_3_UF: Node +var CZI_2_FS: Node +var CZI_3_FS: Node +var CZI_4_FS: Node +var CZI_5_FS: Node +var CI_2_FS: Node +var CI_3_FS: Node +var CI_4_FS: Node +var CI_5_FS: Node +var CI_1_FS: Node +var CI_6_FS: Node +var CI_7_FS: Node func _on_read_ems_g(): @@ -86,6 +100,7 @@ func _ready() -> void: var parrent_NODE2 = get_parent().get_parent() parrent_NODE2.connect('read_ems_g_start', Callable(self, '_on_read_ems_g')) parrent_NODE2.connect('read_ems_g_finish', Callable(self, '_on_sync')) + Network.connect('yau_receive', Callable(self, '_on_data_received')) create_link_button(node_select1, shift+1, 16+shift+1, shift, 16+shift) @@ -100,13 +115,11 @@ func _on_data_received(data_from_yau_07): var in_imp: int = data_from_yau_07.decode_u16(Constants.DataIndices.IN_IMPULS_PRD) var out_blank: int = data_from_yau_07.decode_u16(Constants.DataIndices.OUT_BLANK_PRD) var out_imp: int = data_from_yau_07.decode_u16(Constants.DataIndices.OUT_IMPULS_PRD) - var parent_node2 = get_parent().get_parent() - - process_sockets_vert(in_blank, in_imp, 16, 1, parent_node2) - process_sockets_horizon(out_blank, out_imp, 16, 2, parent_node2) + process_sockets_vert(in_blank, in_imp, 16, 1) + process_sockets_horizon(out_blank, out_imp, 16, 2) -func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_node2: Node): +func process_sockets_horizon(blank: int, imp: int, count: int, col: int): for i in count: var socket_status = node_select1.get_node2(col+i, shift).get_child(1, false) var frame_type = Constants.Frame.WORK @@ -117,22 +130,21 @@ func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_ frame_type = Constants.Frame.VARIABLE set_frame(socket_status, frame_type) - - if i == 1: # СИ_2_в_УФ - var CI_2_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 6).get_child(1) + if i == 0: # СИ_2_в_УФ + set_frame(CI_1_UF, frame_type) + elif i == 1: # СИ_2_в_УФ set_frame(CI_2_UF, frame_type) - if i == 2: # СИ_3_в_УФ - var CI_3_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 6).get_child(1) + if i == 2: # СИ_3_в_УФ set_frame(CI_3_UF, frame_type) - if i == 4: # Модуляция_УМ_2 + if i == 4: # Модуляция_УМ_2 pass - if i == 5: # Модуляция_УМ_3 + if i == 5: # Модуляция_УМ_3 pass - if i == 9: # ФГОЗ_3 + if i == 9: # ФГОЗ_3 pass -func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_node2: Node): +func process_sockets_vert(blank: int, imp: int, count: int, col: int): for i in count: var socket_status = node_select1.get_node2(col, i + shift+1).get_child(1, false) var frame_type = Constants.Frame.WORK @@ -146,62 +158,49 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod if Constants.CURRENT_MODE == Constants.MODE.PRD_H: if i == 1: # СЗИ_2_от_УФ - # $TabContainer /PRD /body_grid/litera_2_4_6/yau07b_control - var CZI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 7).get_child(1) set_frame(CZI_2_FS, frame_type) if i == 2: # СЗИ_3_от_УФ - var CZI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 7).get_child(1) set_frame(CZI_3_FS, frame_type) elif Constants.CURRENT_MODE == Constants.MODE.PRD_B: if i == 3: # СЗИ_4_от_УФ - # $TabContainer /PRD /body_grid/litera_2_4_6/yau07b_control - var CZI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 7).get_child(1) - set_frame(CZI_2_FS, frame_type) + set_frame(CZI_4_FS, frame_type) if i == 4: # СЗИ_5_от_УФ - var CZI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 7).get_child(1) - set_frame(CZI_3_FS, frame_type) + set_frame(CZI_5_FS, frame_type) if Constants.CURRENT_MODE == Constants.MODE.PRD_H: if i == 9: # СИ_2_от_ФС - var CI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_2_FS, frame_type) if frame_type == Constants.Frame.CONSTANT and status_fs_1 != Constants.Frame.CONSTANT: emit_signal('signal_FS_is_ready', Constants.META.CI_2_OT_FS) status_fs_1 = frame_type if i == 10: # СИ_3_от_ФС - var CI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_3_FS, frame_type) if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT: emit_signal('signal_FS_is_ready', Constants.META.CI_3_OT_FS) status_fs_2 = frame_type elif Constants.CURRENT_MODE == Constants.MODE.PRD_B: if i == 11: # СИ_4_от_ФС - var CI_4_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_4_FS, frame_type) if frame_type == Constants.Frame.CONSTANT and status_fs_1 != Constants.Frame.CONSTANT: emit_signal('signal_FS_is_ready', Constants.META.CI_4_OT_FS) status_fs_1 = frame_type if i == 12: # СИ_5_от_ФС - var CI_5_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_5_FS, frame_type) if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT: emit_signal('signal_FS_is_ready', Constants.META.CI_5_OT_FS) status_fs_2 = frame_type elif Constants.CURRENT_MODE == Constants.MODE.PRD_K: if i == 8: # СИ_1_от_ФС - var CI_1_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(2).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_1_FS, frame_type) if frame_type == Constants.Frame.CONSTANT and status_fs_1 != Constants.Frame.CONSTANT: emit_signal('signal_FS_is_ready', Constants.META.CI_1_OT_FS) status_fs_1 = frame_type if i == 13: # СИ_6_от_ФС - var CI_6_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_6_FS, frame_type) if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT: emit_signal('signal_FS_is_ready', Constants.META.CI_6_OT_FS) status_fs_2 = frame_type if i == 14: # СИ_7_от_ФС - var CI_7_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_7_FS, frame_type) if frame_type == Constants.Frame.CONSTANT and status_fs_3 != Constants.Frame.CONSTANT: emit_signal('signal_FS_is_ready', Constants.META.CI_7_OT_FS)