Merge remote-tracking branch 'origin/master-prd'

# Conflicts:
#	scenes/контроль/контроль.tscn
This commit is contained in:
sasha80
2025-09-02 14:32:37 +03:00
13 changed files with 561 additions and 739 deletions

View File

@@ -13,6 +13,32 @@ class SPT25 extends unit.Unit:
func _to_string() -> String: return String('СПТ-25 %s %s' % [self.name, ['отключен', 'на связи'][int(online)]])
##Вычисление контрольной суммы
func sciCalcFCS(src: PackedByteArray) -> int:
var P_DIV = 0
var ln = src[0]
var FCS = ~((src[2]<<8) + src[1])
for i in range(3, ln):
var C = src[i]
for j in 8:
if C & 1:
if FCS & 1:
FCS = ((FCS >> 1) | 0x8000)^P_DIV
else:
FCS = ((FCS >> 1) | 0x8000)
else:
if FCS & 1:
FCS = (FCS >> 1) ^ P_DIV
else:
FCS = FCS >> 1
C >>= 1
for j in 16:
if FCS & 1:
FCS = (FCS >> 1) ^ P_DIV
else:
FCS = FCS >> 1
return ~FCS
func _init(nm) -> void:
self.name = nm
tx_data.resize(5)