рефактор машины состояний контроля

This commit is contained in:
Maxim
2025-09-01 13:21:33 +03:00
parent 9cc9b834d8
commit cd23da9a2d
9 changed files with 89 additions and 102 deletions

View File

@@ -12,11 +12,12 @@ const constants_v = {
'ADDR_UG_LITERA_3': 0x10A,
'TEMP_THRESHOLD': 70,
'POWER_THRESHOLD': 40,
'TIMER_DELAY': 5.0,
'RAY_DOU_NUM': 0x3,
'ATT_UM_4': 0x7,
'ATT_UM_5': 0x7,
'POWER_UM': 70,
'TIMER_DELAY': 5.0,
'STATE_MASHINE_TIMER': 0.3,
}
# Конфигурация параметров для каждого прибора
const PRIBOR_CONFIG_V := {
@@ -27,7 +28,7 @@ const PRIBOR_CONFIG_V := {
}
# Конфигурация частот и ширин для каждого ФС
const FS_PARAMS_V := {
4: {'freq': 1227.0, 'width': 110.0},
4: {'freq': 1227.0, 'width': 100.0},
5: {'freq': 1575.0, 'width': 110.0},
}
enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 }
@@ -64,8 +65,8 @@ var control_results_v: Dictionary = {
'dkm_5': false,
'dou_4': false,
'dou_5': false,
'fs_4': false,
'fs_5': false,
'fs_4': 2,
'fs_5': 2,
}
var test_control_v = preload('res://scripts/pribor-prd.gd')
@@ -111,7 +112,7 @@ func initialize_connections() -> void:
func setup_timer() -> void:
add_child(mashine_timer)
mashine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
mashine_timer.wait_time = 0.5
mashine_timer.wait_time = constants_v.STATE_MASHINE_TIMER
mashine_timer.start()
@@ -202,13 +203,16 @@ func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void:
f.state = new_state
result_dic[fs_meta] = new_state
if result_dic.fs_4:
$kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR
$dou4_A5.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR
if result_dic.fs_5:
$kasseta_FS_VD/ref_A6.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR
if result_dic.fs_5 == 1:
$kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR
$dou5_A6.state = STATE_VAL.GOOD if result_dic.dou_5 else STATE_VAL.ERROR
else:
result_dic.fs_5 = false
if result_dic.fs_4 == 1:
$kasseta_FS_VD/ref_A6.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR
$dou4_A5.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR
else:
result_dic.fs_4 = false
power_fill(power_dic)
var result = true

View File

@@ -153,7 +153,6 @@ offset_left = 485.0
offset_top = 242.0
offset_right = 652.0
offset_bottom = 337.0
animation_duration = null
fname = "УМ1535Б"
rname = "A7"
value0_info = "Мощность, Вт"
@@ -166,7 +165,6 @@ offset_left = 485.0
offset_top = 337.0
offset_right = 652.0
offset_bottom = 432.0
animation_duration = null
fname = "УМ1535А"
rname = "A8"
value0_info = "Мощность, Вт"
@@ -179,7 +177,6 @@ offset_left = 485.0
offset_top = 432.0
offset_right = 652.0
offset_bottom = 527.0
animation_duration = null
fname = "УМ1535А"
rname = "A9"
value0_info = "Мощность, Вт"
@@ -192,7 +189,6 @@ offset_left = 485.0
offset_top = 527.0
offset_right = 652.0
offset_bottom = 622.0
animation_duration = null
fname = "УМ1535А"
rname = "A10"
value0_info = "Мощность, Вт"
@@ -205,7 +201,6 @@ offset_left = 485.0
offset_top = 622.0
offset_right = 652.0
offset_bottom = 717.0
animation_duration = null
fname = "УМ1535А"
rname = "A11"
value0_info = "Мощность, Вт"
@@ -218,7 +213,6 @@ offset_left = 485.0
offset_top = 717.0
offset_right = 652.0
offset_bottom = 812.0
animation_duration = null
fname = "УМ1535А"
rname = "A12"
value0_info = "Мощность, Вт"
@@ -231,7 +225,6 @@ offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
animation_duration = null
fname = "УМ1535А"
rname = "A13"
value0_info = "Мощность, Вт"
@@ -244,7 +237,6 @@ offset_left = 8.0
offset_top = 337.0
offset_right = 175.0
offset_bottom = 432.0
animation_duration = null
fname = "УМ1535А"
rname = "A14"
value0_info = "Мощность, Вт"
@@ -257,7 +249,6 @@ offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
animation_duration = null
fname = "УМ1535А"
rname = "A15"
value0_info = "Мощность, Вт"
@@ -270,7 +261,6 @@ offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
animation_duration = null
fname = "УМ1535А"
rname = "A16"
value0_info = "Мощность, Вт"
@@ -283,7 +273,6 @@ offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
animation_duration = null
fname = "УМ1535А"
rname = "A17"
value0_info = "Мощность, Вт"
@@ -296,7 +285,6 @@ offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0
animation_duration = null
fname = "УМ1535А"
rname = "A18"
value0_info = "Мощность, Вт"