Native SENT TPS input #5079

hasValidFast progress!

only:mre_f4
This commit is contained in:
Andrey 2023-03-01 15:23:38 -05:00
parent 30e0c2550a
commit 68fee9905f
3 changed files with 7 additions and 3 deletions

View File

@ -230,6 +230,7 @@ int sent_channel::Decoder(uint16_t clocks) {
{
/* Full packet with correct CRC has been received */
rxLast = rxReg;
hasValidFast = true;
/* TODO: add timestamp? */
ret = 1;
}
@ -276,8 +277,10 @@ int sent_channel::GetMsg(uint32_t* rx) {
*rx = rxLast;
}
/* TODO: add check if any packet was received */
/* TODO: add check for time since last message reseived */
if (!hasValidFast) {
return -1;
}
/* TODO: add check for time since last message received */
return 0;
}

View File

@ -64,6 +64,7 @@ private:
/* fast channel shift register*/
uint32_t rxReg;
bool hasValidFast = false;
/* fast channel last received valid message */
uint32_t rxLast;

View File

@ -120,5 +120,5 @@ TEST(sent, testFuelPressure) {
TEST(sent, testNoMessages) {
static sent_channel channel;
bool isError = channel.GetMsg(nullptr) != 0;
ASSERT_FALSE(isError);
ASSERT_TRUE(isError);
}