Доработка ЭМС

This commit is contained in:
TotMaxim
2025-11-27 21:47:12 +03:00
parent 1f93815d25
commit 2a090d02a3
17 changed files with 820 additions and 135 deletions

View File

@@ -49,6 +49,10 @@ var _dkm_status_bit: int = 0
var _dry_contact_status_bit: int = 0xFF
var _cmd_number_count: int = 0
var _last_received_command: int = -1
var _input_impulse: int = 0xffff
var _input_const: int = 0xffff
var _output_impulse: int = 0xffff
var _output_const: int = 0xffff
var ukp0_data: PackedByteArray
var ukp1_data: PackedByteArray
@@ -198,6 +202,14 @@ func get_ip_status()->int:
return _dry_contact_status_bit
func set_ems_g_status(in_imp: int, in_const: int, out_imp: int, out_const: int) -> void:
'''Установка статуса входов и выходов ЕМС'''
_input_impulse = in_imp
_input_const = in_const
_output_impulse = out_imp
_output_const = out_const
func set_isa_port(port_addr: int, value: int) -> bool:
'''Установка значения ISA порта'''
if port_addr < 0 or port_addr > 0xFFFF:
@@ -343,13 +355,15 @@ func _encode_device_data(buffer: PackedByteArray) -> void:
func _encode_ems_g_data(buffer: PackedByteArray) -> void:
'''Кодирование данных EMS-G'''
var ems_g_data = [
0x9e00, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000,
0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff
]
for i in range(ems_g_data.size()):
buffer.encode_u16(EMS_G_DATA_OFFSET + i * 2, ems_g_data[i])
#var ems_g_data = [
#0x9e00, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff,
#0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff,
#0xffff
#]
buffer.encode_u16(EMS_G_DATA_OFFSET, _input_const)
buffer.encode_u16(EMS_G_DATA_OFFSET + 6, _input_impulse)
buffer.encode_u16(EMS_G_DATA_OFFSET + 12, _output_const)
buffer.encode_u16(EMS_G_DATA_OFFSET + 18, _output_impulse)
func _encode_ug_data(buffer: PackedByteArray) -> void: