tune via CAN #3361

pauseCANdueToSerial
This commit is contained in:
rusefillc 2021-12-05 21:20:54 -05:00
parent 9b9c06d5a1
commit dbb3de3618
3 changed files with 7 additions and 1 deletions

View File

@ -76,6 +76,7 @@ int CanStreamerState::sendFrame(const IsoTpFrameHeader & header, const uint8_t *
int CanStreamerState::receiveFrame(CANRxFrame *rxmsg, uint8_t *buf, int num, can_sysinterval_t timeout) {
if (rxmsg == nullptr || rxmsg->DLC < 1)
return 0;
engine->pauseCANdueToSerial = true;
int frameType = (rxmsg->data8[0] >> 4) & 0xf;
int numBytesAvailable, frameIdx;
uint8_t *srcBuf = rxmsg->data8;

View File

@ -120,6 +120,11 @@ public:
bool isPwmEnabled = true;
const char *prevOutputName = nullptr;
/**
* ELM327 cannot handle both RX and TX at the same time, we have to stay quite once first ISO/TP packet was detected
* this is a pretty temporary hack only while we are trying ELM327, long term ISO/TP and rusEFI broadcast should find a way to coexists
*/
bool pauseCANdueToSerial = false;
PinRepository pinRepository;

View File

@ -31,7 +31,7 @@ void CanWrite::PeriodicTask(efitime_t nowNt) {
CanCycle cycle(cycleCount);
//in case we have Verbose Can enabled, we should keep user configured period
if (engineConfiguration->enableVerboseCanTx) {
if (engineConfiguration->enableVerboseCanTx && !engine->pauseCANdueToSerial) {
uint16_t cycleCountsPeriodMs = cycleCount * CAN_CYCLE_PERIOD;
if (0 != engineConfiguration->canSleepPeriodMs) {
if (cycleCountsPeriodMs % engineConfiguration->canSleepPeriodMs) {