Correct total packet count in tpm2net implementation (fix #1127) (#1128)

* Fixed calculation for _tpm2TotalPackets
This commit is contained in:
mlaurijsse
2021-02-23 20:42:54 +01:00
committed by GitHub
parent 3ae9bc998b
commit 68d06f14fe
2 changed files with 4 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ bool LedDeviceTpm2net::init(const QJsonObject &deviceConfig)
{
_tpm2_max = deviceConfig["max-packet"].toInt(170);
_tpm2ByteCount = 3 * _ledCount;
_tpm2TotalPackets = 1 + _tpm2ByteCount / _tpm2_max;
_tpm2TotalPackets = (_tpm2ByteCount / _tpm2_max) + ((_tpm2ByteCount % _tpm2_max) != 0);
isInitOK = true;
}