parent
30e0c2550a
commit
68fee9905f
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ private:
|
|||
|
||||
/* fast channel shift register*/
|
||||
uint32_t rxReg;
|
||||
bool hasValidFast = false;
|
||||
/* fast channel last received valid message */
|
||||
uint32_t rxLast;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue