mirror of https://github.com/rusefi/rusefi.git
parent
30e0c2550a
commit
68fee9905f
|
@ -230,6 +230,7 @@ int sent_channel::Decoder(uint16_t clocks) {
|
||||||
{
|
{
|
||||||
/* Full packet with correct CRC has been received */
|
/* Full packet with correct CRC has been received */
|
||||||
rxLast = rxReg;
|
rxLast = rxReg;
|
||||||
|
hasValidFast = true;
|
||||||
/* TODO: add timestamp? */
|
/* TODO: add timestamp? */
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
@ -276,8 +277,10 @@ int sent_channel::GetMsg(uint32_t* rx) {
|
||||||
*rx = rxLast;
|
*rx = rxLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: add check if any packet was received */
|
if (!hasValidFast) {
|
||||||
/* TODO: add check for time since last message reseived */
|
return -1;
|
||||||
|
}
|
||||||
|
/* TODO: add check for time since last message received */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
|
|
||||||
/* fast channel shift register*/
|
/* fast channel shift register*/
|
||||||
uint32_t rxReg;
|
uint32_t rxReg;
|
||||||
|
bool hasValidFast = false;
|
||||||
/* fast channel last received valid message */
|
/* fast channel last received valid message */
|
||||||
uint32_t rxLast;
|
uint32_t rxLast;
|
||||||
|
|
||||||
|
|
|
@ -120,5 +120,5 @@ TEST(sent, testFuelPressure) {
|
||||||
TEST(sent, testNoMessages) {
|
TEST(sent, testNoMessages) {
|
||||||
static sent_channel channel;
|
static sent_channel channel;
|
||||||
bool isError = channel.GetMsg(nullptr) != 0;
|
bool isError = channel.GetMsg(nullptr) != 0;
|
||||||
ASSERT_FALSE(isError);
|
ASSERT_TRUE(isError);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue