Files
PRD_TU_MP550/scripts/modul_fs.gd
2025-02-07 04:14:27 +03:00

87 lines
2.7 KiB
GDScript

extends Node
const INDEX_SIZE = 0xC
var unit_fs = Fs.FGOS.new()
var counter: int = 0
func _ready() -> void:
pass
func _process(_delta: float) -> void:
pass
func _enter_tree() -> void:
pass
# Подключаем сигналы к методам
#Network.connect('data_send', _on_data_send)
#Network.connect('data_from_fs_1', _on_data_received)
#Network.connect('port_opened', _on_port_changed.bind(Color.GREEN))
#Network.connect('port_closed', _on_port_changed.bind(Color.GRAY))
#Network.connect('port_error', _on_port_changed.bind(Color.RED))
#func _on_port_changed(port_name: String, color: Color) -> void:
#$manage_panel/con/ip_connect.text = port_name
#$fs_connect.self_modulate = color
func _on_data_send():
pass
#
#func _on_data_received(data: PackedByteArray):
#var GRP = data.decode_u8(0x0)
#var CMD = data.decode_u8(0x1)
#match CMD:
#Constants.CMD.READ_CARRIER:
#if GRP == Constants.GROUP.BASE:
#$manage_panel/get_freq/freq_ind.text = str(data.decode_u64(0xC)) + ' Гц'
#Constants.CMD.READ_ATT:
#if GRP == Constants.GROUP.RF:
#$manage_panel/get_att/att_ind.text = '-' + str(data.decode_float(0x18)) + ' dB'
#Constants.CMD.READ_GEN_STATUS:
#if GRP == Constants.GROUP.GENERATOR:
#if data.decode_u32(0xC) == 0:
#$manage_panel/get_gen_status/status_ind.text = 'Включен'
#$manage_panel/get_gen_status/status_ind.modulate = Color.GREEN
#else:
#$manage_panel/get_gen_status/status_ind.text = 'Выключен'
#$manage_panel/get_gen_status/status_ind.modulate = Color.RED
#Constants.CMD.BASE_GET_CURRENT_TEMP:
#if GRP == Constants.GROUP.BASE:
#$temp_1.text = '%.2f' % data.decode_float(0xC) + ' °C'
#$temp_2.text = str(data.decode_float(0x10)) + ' °C'
#$temp_3.text = str(data.decode_float(0x14)) + ' °C'
#$read.text = str(data.hex_encode())
func _on_send_pressed() -> void:
unit_fs.get_carrier(counter)
func _on_get_att() -> void:
unit_fs.get_att_batch(counter)
func _on_start():
unit_fs.start_session(counter)
unit_fs.base_get_current_temp(counter)
func _on_get_status(toggled_btn):
var inverted_state = not toggled_btn
unit_fs.set_gen_state(inverted_state, counter)
unit_fs.get_gen_state(counter)
func _on_set_ferq():
var freq = int($set_space/write_to_set_freq.get_text()) * 1_000_000
unit_fs.set_carrier(freq, counter)
func _on_set_att():
var att = float($set_space/write_to_set_att.get_text())
unit_fs.set_att_batch(att, counter)