Merge remote-tracking branch 'origin/MAD_CAT' into prd-control
This commit is contained in:
@@ -160,7 +160,7 @@ func init_fs_failed():
|
||||
var sectors_count = $canvas.fs_default_colors.size()
|
||||
fs_failed.resize(sectors_count)
|
||||
for i in fs_failed.size():
|
||||
fs_failed[i] = AntBandState.ANT_BAND_READY
|
||||
fs_failed[i] = AntBandState.ANT_BAND_FAILED
|
||||
|
||||
|
||||
## Производит инициализацию.
|
||||
@@ -593,7 +593,7 @@ func on_interfer_prinuditelno(prenuditelno_sectors, btns):
|
||||
## Вызывается при получении информации о состоянии модулей ФС от КАПС РПБ.
|
||||
func on_fs_update_state(fs_dict: Dictionary):
|
||||
for key in fs_dict.keys():
|
||||
fs_failed[key] = fs_dict[key].isg
|
||||
fs_failed[key] = fs_dict[key].ready
|
||||
|
||||
|
||||
func on_btn_center_toggled(toggled_on: bool) -> void:
|
||||
|
||||
@@ -383,8 +383,8 @@ texture_normal = ExtResource("14_ggrwd")
|
||||
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"]
|
||||
[connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"]
|
||||
[connection signal="button_down" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_down"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_up"]
|
||||
[connection signal="button_down" from="zoom_minus" to="tilemap" method="_on_zoom_minus_button_down"]
|
||||
[connection signal="button_up" from="zoom_minus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="pressed" from="btn_all_work" to="." method="_on_btn_all_work_pressed"]
|
||||
|
||||
@@ -277,10 +277,10 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v
|
||||
var ecm_active = true
|
||||
if not gos_flag:
|
||||
if ecm.nmfs in gos_nmfs:
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
ecm_active = false
|
||||
if ecm_active and (prd.fs_caps_id[ecm.nmfs] in fs_closed):
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
var th_id = thr.id
|
||||
for ecm_i in thrs.keys():
|
||||
@@ -290,9 +290,9 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v
|
||||
ecm.kni = fposmod(thr.aoa - course, 360)
|
||||
call_ecm_proc(ecm)
|
||||
if ecm.nmfs in gos_nmfs:
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
elif prd.fs_caps_id[ecm.nmfs] in fs_closed:
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
else:
|
||||
send_ecm(ecm, unit_instance)
|
||||
signaller.emit_signal('fs_update_color', ecms)
|
||||
@@ -382,7 +382,7 @@ func on_interfer_create(interfer_name, sel_threats, fs_arr, power, u, ecms) -> v
|
||||
for ecm in ecms.values():
|
||||
if ecm.nmfs == item.nmfs:
|
||||
if item.priority > ecm.priority:
|
||||
interfer_off(ecm, u)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
elif item.priority < ecm.priority:
|
||||
need_continue = true
|
||||
break
|
||||
@@ -504,17 +504,17 @@ func send_ecm(ecm, unit0) -> void:
|
||||
unit0.tx_stack.append(json_data)
|
||||
|
||||
|
||||
func on_interfer_off_all(unit0, ecms: Dictionary) -> void:
|
||||
func on_interfer_off_all(_unit0, ecms: Dictionary) -> void:
|
||||
for ecm in ecms.values():
|
||||
interfer_off(ecm, unit0)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
|
||||
func on_threats_lost(th, ecms, unit0) -> void:
|
||||
func on_threats_lost(th, ecms, _unit0) -> void:
|
||||
for key in interfer.thrs:
|
||||
if interfer.thrs[key] == th.id:
|
||||
var ecm_id = key
|
||||
var ecm = ecms[ecm_id]
|
||||
interfer_off(ecm, unit0)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
|
||||
func pop_id() -> int:
|
||||
@@ -647,13 +647,19 @@ func get_krp(threat: threats.Threat):
|
||||
return krp
|
||||
|
||||
|
||||
func on_interfer_off(ecm: Interfer, _ecms, unit_caps):
|
||||
func on_interfer_off(ecm: Interfer, ecms, unit_caps):
|
||||
ecm.krp = INTERFER_OFF
|
||||
send_ecm(ecm, unit_caps)
|
||||
|
||||
|
||||
func interfer_off(ecm, _unit_caps):
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
if not unit_caps.online:
|
||||
var sz = ecms.size()
|
||||
signaller.emit_signal('on_prog_ecm_off', ecm)
|
||||
ecms.erase(ecm.ispp)
|
||||
thrs.erase(ecm.ispp)
|
||||
cu.erase(ecm.ispp)
|
||||
fs.erase(ecm.ispp)
|
||||
push_id(ecm.ispp)
|
||||
if sz != ecms.size():
|
||||
interfer.call_deferred('emit_signal', 'interfer_resized', ecms)
|
||||
|
||||
|
||||
func on_interfer_new(ecm, unit_caps):
|
||||
|
||||
@@ -119,6 +119,9 @@ class Fs:
|
||||
var freq_caps_rx: float = 0.0 ## Частота принятая от КАПС РПБ
|
||||
var width_caps_rx: float = 0.0 ## Ширина полосы принятая от КАПС РПБ
|
||||
var msvk: Array
|
||||
var ready: bool = false ## Готовность сектора к излучению
|
||||
var caps_online: bool = false ## Состояние связи с КАПС РПБ
|
||||
var yau_07_online: bool = false ## Состояние связи ЯУ-07
|
||||
|
||||
signal update_modulation(index)
|
||||
|
||||
@@ -148,7 +151,10 @@ class Fs:
|
||||
val = tools.set_bits(u.isa_ports[um_port], um_code_tx, 0x0007)
|
||||
data_arr.append(um_port)
|
||||
data_arr.append(val)
|
||||
|
||||
|
||||
# Установка готовности модуля ФС к излучению
|
||||
func set_ready():
|
||||
ready = isg and caps_online and yau_07_online
|
||||
|
||||
class PRD:
|
||||
enum STATE_DEVICE {
|
||||
@@ -208,7 +214,6 @@ class PRD:
|
||||
if port == fs.um_port:
|
||||
fs.um_code_rx = u.isa_ports[port] & 0x7
|
||||
|
||||
|
||||
func on_line_changed(unit_ems):
|
||||
if not unit_ems.online:
|
||||
yemsg_board.ems_load = yemsg_board.LoadState.NOT_DEFINED
|
||||
@@ -303,7 +308,6 @@ class PRD:
|
||||
break
|
||||
return STATE_DEVICE.NONE if all_online else STATE_DEVICE.ERROR
|
||||
|
||||
|
||||
func execute_cmd():
|
||||
if not len(cmd_array): return
|
||||
if unit_yau07.cmd_state != unit_yau07.CmdState.DONE: return
|
||||
@@ -338,21 +342,24 @@ class PRD:
|
||||
yemsg_board.set_wait()
|
||||
log.error('Не удалось прочитать файл настроек ячейки ЭМС-Г %s' %abs_dir)
|
||||
|
||||
|
||||
func on_update_modulation(index):
|
||||
yemsg_board.add_cmd(index/4, fs_dic[index].modulation)
|
||||
|
||||
func set_um(data_arr):
|
||||
cmd_array.append([unit_yau07.CmdCode.WRITE_ISA, data_arr])
|
||||
|
||||
|
||||
|
||||
func set_fs_caps_online(caps_online: bool):
|
||||
for fs in fs_dic.values():
|
||||
fs.caps_online = caps_online
|
||||
fs.set_ready()
|
||||
|
||||
func _ready() -> void:
|
||||
check_dir()
|
||||
for prd_name in PRD_NAMES:
|
||||
var unit_prd = network.get_unit_instance(prd_name)
|
||||
var new_prd = PRD.new(prd_name, unit_prd)
|
||||
prd_dict[prd_name] = new_prd
|
||||
new_prd.unit_yau07.connect('line_changed', on_yau07_line_changed.bind(new_prd))
|
||||
var unit_control = TestPRD.new({'unit_prd': unit_prd}, new_prd.cmd_array)
|
||||
add_child(unit_control)
|
||||
new_prd.unit_control = unit_control
|
||||
@@ -367,6 +374,7 @@ func _ready() -> void:
|
||||
fs_caps_id[FS_PRD[key][1]] = key
|
||||
var unit_caps = network.get_unit_instance('уарэп-капсрпб')
|
||||
unit_caps.connect('data_received', Callable(self, 'on_data_capsrpb_received'))
|
||||
unit_caps.connect('line_changed', Callable(self, 'on_caps_line_changed'))
|
||||
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(PrdState.CONTROL))
|
||||
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(PrdState.WORK))
|
||||
var unit_nav = network.get_unit_instance('навигация')
|
||||
@@ -433,7 +441,6 @@ func update_fs_state(ecms, trenaz_mode: bool):
|
||||
prd_module.set_um(um_data_array)
|
||||
|
||||
|
||||
|
||||
## Проверяет ниличие директории, если их нет, создаёт
|
||||
func check_dir():
|
||||
var dir = DirAccess.open(yemsconsts.emsg_files_folder)
|
||||
@@ -461,6 +468,7 @@ func on_data_capsrpb_received(unit0: capsrpb.CapsRpb):
|
||||
var fs_module = fs_dict[ii]
|
||||
if fs.has('isg'):
|
||||
fs_module.isg = int(fs['isg'])
|
||||
fs_module.set_ready()
|
||||
if fs.has('pow'):
|
||||
fs_module.pow_caps_rx = int(fs['pow'])
|
||||
if fs.has('freq'):
|
||||
@@ -479,3 +487,16 @@ func on_mode_changed(changed_mode: int) -> void:
|
||||
|
||||
func on_navi_data_received(data: Dictionary):
|
||||
course = data.get('k', 0.0)
|
||||
|
||||
|
||||
func on_caps_line_changed(unit_caps):
|
||||
for pribor_prd in prd_dict.values():
|
||||
pribor_prd.set_fs_caps_online(unit_caps.online)
|
||||
signaller.emit_signal('fs_update_state', fs_dict)
|
||||
|
||||
|
||||
func on_yau07_line_changed(unit_yau07, prd_pribor):
|
||||
for fs in prd_pribor.fs_dic.values():
|
||||
fs.yau_07_online = unit_yau07.online
|
||||
fs.set_ready()
|
||||
signaller.emit_signal('fs_update_state', fs_dict)
|
||||
|
||||
Reference in New Issue
Block a user