New fs class for prd

This commit is contained in:
Maxim
2025-07-09 11:37:32 +03:00
parent 1982125fc7
commit 3242b70078
3 changed files with 95 additions and 307 deletions

View File

@@ -228,8 +228,6 @@ func _ready() -> void:
#Network.connect('data_from_fs_1', _on_data_fs_1)
#Network.connect('data_from_fs_2', _on_data_fs_2)
#Network.connect('data_from_fs_3', _on_data_fs_3)
Network.unit_fs_1.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.GOOD))
Network.unit_fs_1.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.NONE))
Network.unit_fs_1.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.ERROR))
@@ -240,7 +238,6 @@ func _ready() -> void:
Network.unit_fs_2.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.ERROR))
Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_2))
self.add_child(timer_modul_um)
timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um'))
self.connect('write_ems_g_start', _on_write_ems_g)
@@ -518,70 +515,6 @@ func _on_data_fs(fs_data: PackedByteArray, unit_fs_client: Node):
node_select.set_node_text(2, 7, str(fs_data.decode_u16(0x20)) + ' МГц')
#func _on_data_fs_2(fs_2_data):
#var GRP = fs_2_data.decode_u8(0x0)
#var CMD = fs_2_data.decode_u8(0x1)
#match CMD:
#Constants.CMD.READ_CARRIER:
#if GRP == Constants.GROUP.BASE:
#freq_fs_2 = fs_2_data.decode_u64(0xC) / 1_000_000.0
#node_select_fs_2.set_node_text(2, 2, str(freq_fs_2) + ' МГц')
#Constants.CMD.READ_ATT:
#if GRP == Constants.GROUP.RF:
#att_fs_2 = fs_2_data.decode_float(0x18)
#node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB')
#Constants.CMD.READ_GEN_STATUS:
#if GRP == Constants.GROUP.GENERATOR:
#if fs_2_data.decode_u32(0xC) == 0:
#node_select_fs_2.set_node_text(2, 5, 'Включен')
#node_select_fs_2.get_node2(2, 5).modulate = Color.AQUAMARINE
#node_select_fs_2.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 2.5)
#else:
#node_select_fs_2.set_node_text(2, 5, 'Отключен')
#node_select_fs_2.get_node2(2, 5).modulate = Color.CRIMSON
#node_select_fs_2.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 0.0)
#Constants.CMD.BASE_GET_CURRENT_TEMP:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
#Constants.CMD.BASE_CAN_MACRO_READ:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц')
#
#
#func _on_data_fs_3(fs_3_data):
#var GRP = fs_3_data.decode_u8(0x0)
#var CMD = fs_3_data.decode_u8(0x1)
#match CMD:
#Constants.CMD.READ_CARRIER:
#if GRP == Constants.GROUP.BASE:
#freq_fs_3 = fs_3_data.decode_u64(0xC) / 1_000_000
#node_select_fs_3.set_node_text(2, 2, str(freq_fs_3) + ' МГц')
#Constants.CMD.READ_ATT:
#if GRP == Constants.GROUP.RF:
#att_fs_3 = fs_3_data.decode_float(0x18)
#node_select_fs_3.set_node_text(2, 3, str(att_fs_3) + ' dB')
#Constants.CMD.READ_GEN_STATUS:
#if GRP == Constants.GROUP.GENERATOR:
#if fs_3_data.decode_u32(0xC) == 0:
#node_select_fs_3.set_node_text(2, 5, 'Включен')
#node_select_fs_3.get_node2(2, 5).modulate = Color.AQUAMARINE
#node_select_fs_3.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
#$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 2.5)
#else:
#node_select_fs_3.set_node_text(2, 5, 'Отключен')
#node_select_fs_3.get_node2(2, 5).modulate = Color.CRIMSON
#node_select_fs_3.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
#$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 0.0)
#Constants.CMD.BASE_GET_CURRENT_TEMP:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C')
#Constants.CMD.BASE_CAN_MACRO_READ:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_3.set_node_text(2, 7, str(fs_3_data.decode_u16(0x20)) + ' МГц')
func _process(_delta: float) -> void:
# FS 1
var node_freq_fs_1 = node_select_fs_1.get_node2(1, 2).get_text()
@@ -750,10 +683,6 @@ func on_mode_select(intem_from_sector: int) -> void:
add_signs_scene()
Network.on_command_change_device(meta)
Network.read_port_isa([Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+0xA])
#Network.start_work_fs_1(pribor_selec)
#Network.start_work_fs_2(pribor_selec)
#if meta[2] == Constants.MODE.PRD_K:
#Network.start_work_fs_3(pribor_selec)
$load_status_yau.value = 0
emit_signal('read_ems_g_start')
$load_status_yau.visible = true
@@ -960,7 +889,12 @@ func _on_set_ferq(freq: String, unit_fs_client: Node):
func _on_set_att(att: String, unit_fs_client: Node):
unit_fs_client.set_att_batch(float(att))
save_settings(float(att), 0)
if unit_fs_client == Network.unit_fs_1:
save_settings(float(att), 0)
elif unit_fs_client == Network.unit_fs_2:
save_settings(float(att), 1)
elif unit_fs_client == Network.unit_fs_3:
save_settings(float(att), 2)
unit_fs_client.get_att_batch()
@@ -973,96 +907,6 @@ func _on_status_can_macro(toggled_btn: bool, unit_fs_client: Node):
unit_fs_client.status_can_macro_exec(toggled_btn)
### 2 ФС
#func _on_get_status_2(toggled_btn):
#if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
#var inverted_state = not toggled_btn
#Network.unit_fs_2.set_gen_state(inverted_state)
#Network.unit_fs_2.get_gen_state()
#func _on_set_ferq_2(freq: String):
## Проверка на наличие символов в строке freq
#var regex = RegEx.new()
#regex.compile("^[0-9]+$")
#if not regex.search(freq):
#print_debug('Ошибка: частота должна быть числом без букв')
#return
## Преобразование строки в число
#var freq_int = int(freq) * 1_000_000
#
## Проверка на диапазон
#if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
#print_debug('Некорректная частота')
#return
#Network.set_fs_ferq_carrier_2(freq_int)
#
#
#func _on_set_att_2(att: String):
#Network.set_fs_attenuation_2(float(att))
#save_settings(float(att), 1)
#
#
#func _on_set_base_can_macro_2(can_freq: String):
#Network.set_can_macro_2(int(can_freq))
#
#
#func _on_status_can_macro_2(toggled_btn: bool):
#Network.status_can_macro_2(toggled_btn)
#
#
#func _on_modul_fs_2(modulation_select_2) -> void:
#if modulation_select_2 == 0:
#Network.set_configure_gen_const_2()
#elif modulation_select_2 == 1:
#Network.set_configure_gen_msk_2()
### ФС 3
#func _on_get_status_3(toggled_btn):
#if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
#var inverted_state = not toggled_btn
#Network.set_fs_gen_status_3(inverted_state)
#Network.get_gen_state_3()
#
#
#func _on_set_ferq_3(freq: String):
## Проверка на наличие символов в строке freq
#var regex = RegEx.new()
#regex.compile("^[0-9]+$")
#if not regex.search(freq):
#print_debug('Ошибка: частота должна быть числом без букв')
#return
## Преобразование строки в число
#var freq_int = int(freq) * 1_000_000
#
## Проверка на диапазон
#if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
#print_debug('Некорректная частота')
#return
#Network.set_fs_ferq_carrier_3(freq_int)
#
#
#func _on_set_att_3(att: String):
#Network.set_fs_attenuation_3(float(att))
#save_settings(float(att), 2)
#
#
#func _on_set_base_can_macro_3(can_freq: String):
#Network.set_can_macro_3(int(can_freq))
#
#
#func _on_status_can_macro_3(toggled_btn: bool):
#Network.status_can_macro_3(toggled_btn)
#
#
#func _on_modul_fs_3(modulation_select_3) -> void:
#if modulation_select_3 == 0:
#Network.set_configure_gen_const_3()
#elif modulation_select_3 == 1:
#Network.set_configure_gen_msk_3()
## Switch panel
func _on_prd_select() -> void:
$load_status_yau.value = 0