Only unlock telemetry data that was locked before (#618)
commit85b0dedf0b3accf44c57a07232dfa9966f2c70c8
authorJohannes <schugabe@gmx.at>
Wed, 19 May 2021 03:22:17 +0000 (19 05:22 +0200)
committerGitHub <noreply@github.com>
Wed, 19 May 2021 03:22:17 +0000 (19 13:22 +1000)
treeea008c8a078d474fa8ff1fbf1b6319b06a06af04
parent6d03ae50e0a915fe9ed3d95b8d2bddbf27e24958
Only unlock telemetry data that was locked before (#618)

* Fixes a bug that prevents sending of telemetry data if only one type of message is received from the FC.

Unlocking the old tlm message did happen in the same method that did fetch the next tlm message to be sent.
If no other type of tlm message is received the unlock step did also clear the update flag and prevented any further communication.

To fix this bug the Unlock/GetNextPayload is split in two methods. Now the current message is unlocked explicit after the sending is done.
After that a new message can be stored. The next call to GetNextPayload returns this message.

* Move unlock of tlm back to GetNextPayload

Add check to only unlock items that are locked. This makes the explicit unlock unecessary and simplifies the usage of the class.
src/lib/Telemetry/telemetry.cpp
src/lib/Telemetry/telemetry.h
src/test/telemetry_native/test_telemetry.cpp