Новый клиент от ФС
This commit is contained in:
@@ -178,7 +178,7 @@ class ClientFs extends Node:
|
|||||||
|
|
||||||
func send_fs_data() -> bool:
|
func send_fs_data() -> bool:
|
||||||
if _status != _stream.STATUS_CONNECTED:
|
if _status != _stream.STATUS_CONNECTED:
|
||||||
print("Error: Stream is not currently connected.")
|
print("Send_fs_data Error: Stream is not currently connected.")
|
||||||
return false
|
return false
|
||||||
|
|
||||||
var error: int = _stream.put_data(command_stack.pop_front())
|
var error: int = _stream.put_data(command_stack.pop_front())
|
||||||
@@ -208,7 +208,7 @@ class ClientFs extends Node:
|
|||||||
send_packet_to(packet)
|
send_packet_to(packet)
|
||||||
|
|
||||||
## Constant модуляция
|
## Constant модуляция
|
||||||
func set_configure_state_msk_const_1():
|
func set_configure_state_msk_const():
|
||||||
var index_size = 0x20
|
var index_size = 0x20
|
||||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
|
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
|
||||||
packet.encode_u8(0x3, 0x09)
|
packet.encode_u8(0x3, 0x09)
|
||||||
@@ -244,7 +244,7 @@ class ClientFs extends Node:
|
|||||||
packet.encode_float(0x18, attenuation)
|
packet.encode_float(0x18, attenuation)
|
||||||
send_packet_to(packet)
|
send_packet_to(packet)
|
||||||
|
|
||||||
func set_base_can_macro(installation_can_frequency: int, ):
|
func set_base_can_macro(installation_can_frequency: int):
|
||||||
var index_size = 0x34
|
var index_size = 0x34
|
||||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_WRITE, index_size, counter)
|
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_WRITE, index_size, counter)
|
||||||
packet.encode_u16(0x08, 0x28)
|
packet.encode_u16(0x08, 0x28)
|
||||||
|
|||||||
195
scripts/PRD.gd
195
scripts/PRD.gd
@@ -199,19 +199,19 @@ func _ready() -> void:
|
|||||||
node_select_yau_07b_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_3'))
|
node_select_yau_07b_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_3'))
|
||||||
|
|
||||||
## FS 1
|
## FS 1
|
||||||
node_select_fs_1.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_1'))
|
node_select_fs_1.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq').bind(Network.unit_fs_1))
|
||||||
node_select_fs_1.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_1'))
|
node_select_fs_1.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att').bind(Network.unit_fs_1))
|
||||||
node_select_fs_1.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs_1'))
|
node_select_fs_1.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs').bind(Network.unit_fs_1))
|
||||||
node_select_fs_1.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_1))
|
node_select_fs_1.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_1))
|
||||||
node_select_fs_1.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro'))
|
node_select_fs_1.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro').bind(Network.unit_fs_1))
|
||||||
node_select_fs_1.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_1'))
|
node_select_fs_1.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro').bind(Network.unit_fs_1))
|
||||||
## FS 2
|
## FS 2
|
||||||
node_select_fs_2.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_2'))
|
node_select_fs_2.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq').bind(Network.unit_fs_2))
|
||||||
node_select_fs_2.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_2'))
|
node_select_fs_2.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att').bind(Network.unit_fs_2))
|
||||||
node_select_fs_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs_2'))
|
node_select_fs_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs').bind(Network.unit_fs_2))
|
||||||
node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_2))
|
node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_2))
|
||||||
node_select_fs_2.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro_2'))
|
node_select_fs_2.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro').bind(Network.unit_fs_2))
|
||||||
node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_2'))
|
node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro').bind(Network.unit_fs_2))
|
||||||
## FS 3
|
## FS 3
|
||||||
node_select_fs_3.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_3'))
|
node_select_fs_3.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_3'))
|
||||||
node_select_fs_3.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_3'))
|
node_select_fs_3.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_3'))
|
||||||
@@ -230,14 +230,14 @@ func _ready() -> void:
|
|||||||
#Network.connect('data_from_fs_3', _on_data_fs_3)
|
#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, true))
|
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, false))
|
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, false))
|
Network.unit_fs_1.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.ERROR))
|
||||||
Network.unit_fs_1.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_1))
|
Network.unit_fs_1.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_1))
|
||||||
|
|
||||||
Network.unit_fs_2.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, true))
|
Network.unit_fs_2.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.GOOD))
|
||||||
Network.unit_fs_2.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, false))
|
Network.unit_fs_2.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.NONE))
|
||||||
Network.unit_fs_2.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, false))
|
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))
|
Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_2))
|
||||||
|
|
||||||
|
|
||||||
@@ -340,8 +340,6 @@ func _on_yau_status(addr: String):
|
|||||||
var status_yau_list = $TabContainer/PRD/status_yau_list.get_children()
|
var status_yau_list = $TabContainer/PRD/status_yau_list.get_children()
|
||||||
var status_label = $TabContainer/PRD/status_yau
|
var status_label = $TabContainer/PRD/status_yau
|
||||||
if addr.is_empty():
|
if addr.is_empty():
|
||||||
if Network.unit.online:
|
|
||||||
return
|
|
||||||
# Сброс состояния, если адрес пуст (нет связи)
|
# Сброс состояния, если адрес пуст (нет связи)
|
||||||
for label in status_yau_list:
|
for label in status_yau_list:
|
||||||
label.text = ''
|
label.text = ''
|
||||||
@@ -906,25 +904,30 @@ func set_bits(v, a, m):
|
|||||||
|
|
||||||
|
|
||||||
## ФС Connect close
|
## ФС Connect close
|
||||||
func _on_port_changed(client_addr: String, unit_fs_client: Node, status_online:bool) -> void:
|
func _on_port_changed(client_addr: String, unit_fs_client: Node, status) -> void:
|
||||||
|
var loging = 'Соединение ...' if status == Constants.STATE_VAL.NONE else 'Подключено!' if status == Constants.STATE_VAL.GOOD else 'Ошибка'
|
||||||
|
var color = Color.AQUAMARINE if status == Constants.STATE_VAL.GOOD else Color.DARK_GRAY if status == Constants.STATE_VAL.NONE else Color.CRIMSON
|
||||||
|
|
||||||
if unit_fs_client == Network.unit_fs_1:
|
if unit_fs_client == Network.unit_fs_1:
|
||||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, client_addr)
|
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, client_addr)
|
||||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
|
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(2, 1, loging)
|
||||||
|
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = color
|
||||||
elif unit_fs_client == Network.unit_fs_2:
|
elif unit_fs_client == Network.unit_fs_2:
|
||||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, client_addr)
|
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, client_addr)
|
||||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
|
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(2, 1, loging)
|
||||||
|
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = color
|
||||||
elif unit_fs_client == Network.unit_fs_3:
|
elif unit_fs_client == Network.unit_fs_3:
|
||||||
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(1, 1, client_addr)
|
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(1, 1, client_addr)
|
||||||
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
|
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(2, 1, loging)
|
||||||
|
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = color
|
||||||
|
|
||||||
|
|
||||||
# Установка формы сигнала (модуляция константа или msk)
|
# Установка формы сигнала (модуляция константа или msk)
|
||||||
func _on_modul_fs_1(modulation_select_1) -> void:
|
func _on_modul_fs(modulation_select_1: int, unit_fs_client: Node) -> void:
|
||||||
if modulation_select_1 == 0:
|
if modulation_select_1 == 0:
|
||||||
Network.set_configure_gen_const_1()
|
unit_fs_client.set_configure_state_msk_const()
|
||||||
elif modulation_select_1 == 1:
|
elif modulation_select_1 == 1:
|
||||||
Network.set_configure_gen_msk_1()
|
unit_fs_client.set_configure_state_msk_modul_1()
|
||||||
|
|
||||||
|
|
||||||
# Установка и получение статуса генератора фс
|
# Установка и получение статуса генератора фс
|
||||||
@@ -933,6 +936,7 @@ func _on_get_status(toggled_btn: bool, unit_fs_client: Node):
|
|||||||
var inverted_state = not toggled_btn
|
var inverted_state = not toggled_btn
|
||||||
unit_fs_client.set_gen_state(inverted_state)
|
unit_fs_client.set_gen_state(inverted_state)
|
||||||
unit_fs_client.get_gen_state()
|
unit_fs_client.get_gen_state()
|
||||||
|
unit_fs_client.get_base_current_temp()
|
||||||
|
|
||||||
|
|
||||||
func _on_set_ferq(freq: String, unit_fs_client: Node):
|
func _on_set_ferq(freq: String, unit_fs_client: Node):
|
||||||
@@ -954,18 +958,19 @@ func _on_set_ferq(freq: String, unit_fs_client: Node):
|
|||||||
unit_fs_client.get_carrier()
|
unit_fs_client.get_carrier()
|
||||||
|
|
||||||
|
|
||||||
func _on_set_att_1(att: String):
|
func _on_set_att(att: String, unit_fs_client: Node):
|
||||||
Network.unit_fs_1.set_att_batch(float(att))
|
unit_fs_client.set_att_batch(float(att))
|
||||||
save_settings(float(att), 0)
|
save_settings(float(att), 0)
|
||||||
Network.unit_fs_1.get_att_batch()
|
unit_fs_client.get_att_batch()
|
||||||
|
|
||||||
|
|
||||||
func _on_set_base_can_macro(can_freq: String):
|
func _on_set_base_can_macro(can_freq: String, unit_fs_client: Node):
|
||||||
Network.set_can_macro(int(can_freq))
|
unit_fs_client.set_base_can_macro(int(can_freq))
|
||||||
|
unit_fs_client.get_base_can_macro()
|
||||||
|
|
||||||
|
|
||||||
func _on_status_can_macro_1(toggled_btn: bool):
|
func _on_status_can_macro(toggled_btn: bool, unit_fs_client: Node):
|
||||||
Network.status_can_macro_1(toggled_btn)
|
unit_fs_client.status_can_macro_exec(toggled_btn)
|
||||||
|
|
||||||
|
|
||||||
### 2 ФС
|
### 2 ФС
|
||||||
@@ -991,71 +996,71 @@ func _on_status_can_macro_1(toggled_btn: bool):
|
|||||||
#print_debug('Некорректная частота')
|
#print_debug('Некорректная частота')
|
||||||
#return
|
#return
|
||||||
#Network.set_fs_ferq_carrier_2(freq_int)
|
#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()
|
||||||
|
|
||||||
|
|
||||||
func _on_set_att_2(att: String):
|
### ФС 3
|
||||||
Network.set_fs_attenuation_2(float(att))
|
#func _on_get_status_3(toggled_btn):
|
||||||
save_settings(float(att), 1)
|
#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)
|
||||||
func _on_set_base_can_macro_2(can_freq: String):
|
#Network.get_gen_state_3()
|
||||||
Network.set_can_macro_2(int(can_freq))
|
#
|
||||||
|
#
|
||||||
|
#func _on_set_ferq_3(freq: String):
|
||||||
func _on_status_can_macro_2(toggled_btn: bool):
|
## Проверка на наличие символов в строке freq
|
||||||
Network.status_can_macro_2(toggled_btn)
|
#var regex = RegEx.new()
|
||||||
|
#regex.compile("^[0-9]+$")
|
||||||
|
#if not regex.search(freq):
|
||||||
func _on_modul_fs_2(modulation_select_2) -> void:
|
#print_debug('Ошибка: частота должна быть числом без букв')
|
||||||
if modulation_select_2 == 0:
|
#return
|
||||||
Network.set_configure_gen_const_2()
|
## Преобразование строки в число
|
||||||
elif modulation_select_2 == 1:
|
#var freq_int = int(freq) * 1_000_000
|
||||||
Network.set_configure_gen_msk_2()
|
#
|
||||||
|
## Проверка на диапазон
|
||||||
|
#if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
|
||||||
## ФС 3
|
#print_debug('Некорректная частота')
|
||||||
func _on_get_status_3(toggled_btn):
|
#return
|
||||||
if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
|
#Network.set_fs_ferq_carrier_3(freq_int)
|
||||||
var inverted_state = not toggled_btn
|
#
|
||||||
Network.set_fs_gen_status_3(inverted_state)
|
#
|
||||||
Network.get_gen_state_3()
|
#func _on_set_att_3(att: String):
|
||||||
|
#Network.set_fs_attenuation_3(float(att))
|
||||||
|
#save_settings(float(att), 2)
|
||||||
func _on_set_ferq_3(freq: String):
|
#
|
||||||
# Проверка на наличие символов в строке freq
|
#
|
||||||
var regex = RegEx.new()
|
#func _on_set_base_can_macro_3(can_freq: String):
|
||||||
regex.compile("^[0-9]+$")
|
#Network.set_can_macro_3(int(can_freq))
|
||||||
if not regex.search(freq):
|
#
|
||||||
print_debug('Ошибка: частота должна быть числом без букв')
|
#
|
||||||
return
|
#func _on_status_can_macro_3(toggled_btn: bool):
|
||||||
# Преобразование строки в число
|
#Network.status_can_macro_3(toggled_btn)
|
||||||
var freq_int = int(freq) * 1_000_000
|
#
|
||||||
|
#
|
||||||
# Проверка на диапазон
|
#func _on_modul_fs_3(modulation_select_3) -> void:
|
||||||
if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
|
#if modulation_select_3 == 0:
|
||||||
print_debug('Некорректная частота')
|
#Network.set_configure_gen_const_3()
|
||||||
return
|
#elif modulation_select_3 == 1:
|
||||||
Network.set_fs_ferq_carrier_3(freq_int)
|
#Network.set_configure_gen_msk_3()
|
||||||
|
|
||||||
|
|
||||||
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
|
## Switch panel
|
||||||
|
|||||||
Reference in New Issue
Block a user