misc fixes (#4411)
* fix warnings * break to debugger in case of panic * move the check * s
This commit is contained in:
parent
4c72d09952
commit
eb442998dc
|
@ -69,6 +69,9 @@ int CanStreamerState::sendFrame(const IsoTpFrameHeader & header, const uint8_t *
|
|||
offset = 3;
|
||||
maxNumBytes = 0; // no data is sent with 'flow control' frame
|
||||
break;
|
||||
default:
|
||||
// bad frame type
|
||||
return 0;
|
||||
}
|
||||
|
||||
int numBytes = minI(maxNumBytes, num);
|
||||
|
@ -118,6 +121,9 @@ int CanStreamerState::receiveFrame(CANRxFrame *rxmsg, uint8_t *buf, int num, can
|
|||
case ISO_TP_FRAME_FLOW_CONTROL:
|
||||
// todo: currently we just ignore the FC frame
|
||||
return 0;
|
||||
default:
|
||||
// bad frame type
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(TS_CAN_DEVICE_SHORT_PACKETS_IN_ONE_FRAME)
|
||||
|
|
|
@ -438,13 +438,11 @@ void Engine::OnTriggerSyncronization(bool wasSynchronized, bool isDecodingError)
|
|||
engine->triggerErrorDetection.add(isDecodingError);
|
||||
|
||||
if (triggerCentral.isTriggerDecoderError()) {
|
||||
warning(CUSTOM_OBD_TRG_DECODING, "trigger decoding issue. expected %d/%d/%d got %d/%d/%d",
|
||||
warning(CUSTOM_OBD_TRG_DECODING, "trigger decoding issue. expected %d/%d got %d/%d",
|
||||
TRIGGER_WAVEFORM(getExpectedEventCount(0)),
|
||||
TRIGGER_WAVEFORM(getExpectedEventCount(1)),
|
||||
TRIGGER_WAVEFORM(getExpectedEventCount(2)),
|
||||
triggerCentral.triggerState.currentCycle.eventCount[0],
|
||||
triggerCentral.triggerState.currentCycle.eventCount[1],
|
||||
triggerCentral.triggerState.currentCycle.eventCount[2]);
|
||||
triggerCentral.triggerState.currentCycle.eventCount[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,11 @@ extern uint8_t criticalErrorLedState;
|
|||
#if EFI_SIMULATOR || EFI_PROD_CODE
|
||||
|
||||
void chDbgPanic3(const char *msg, const char * file, int line) {
|
||||
#if EFI_PROD_CODE
|
||||
// Attempt to break in to the debugger, if attached
|
||||
__asm volatile("BKPT #0\n");
|
||||
#endif
|
||||
|
||||
if (hasOsPanicError())
|
||||
return;
|
||||
dbg_panic_file = file;
|
||||
|
@ -112,6 +117,7 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
|||
} else {
|
||||
// Not the main thread.
|
||||
// All hope is now lost.
|
||||
|
||||
// Reboot!
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ void Gm4l6xTransmissionController::setPcState(gear_e gear) {
|
|||
shiftingFrom = getCurrentGear();
|
||||
isShifting = true;
|
||||
}
|
||||
|
||||
switch (getCurrentGear()) {
|
||||
case REVERSE:
|
||||
pcts = &config->tcu_pcValsR;
|
||||
|
@ -136,7 +137,12 @@ void Gm4l6xTransmissionController::setPcState(gear_e gear) {
|
|||
case GEAR_4:
|
||||
pcts = &config->tcu_pcVals4;
|
||||
break;
|
||||
default:
|
||||
// TODO: how did we get here?
|
||||
pcPwm.setSimplePwmDutyCycle(0);
|
||||
return;
|
||||
}
|
||||
|
||||
float duty = 0.01f * interpolate2d(engine->engineState.sd.airMassInOneCylinder, config->tcu_pcAirmassBins, *pcts);
|
||||
pcPwm.setSimplePwmDutyCycle(duty);
|
||||
}
|
||||
|
|
|
@ -299,6 +299,10 @@ int L9779::spi_rw_array(const uint16_t *tx, uint16_t *rx, int n)
|
|||
uint16_t rxdata;
|
||||
SPIDriver *spi = cfg->spi_bus;
|
||||
|
||||
if (n <= 0) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* Acquire ownership of the bus. */
|
||||
spiAcquireBus(spi);
|
||||
/* Setup transfer parameters. */
|
||||
|
|
|
@ -399,6 +399,10 @@ int Tle8888::spi_rw_array(const uint16_t *tx, uint16_t *rx, int n)
|
|||
uint16_t rxdata;
|
||||
SPIDriver *spi = cfg->spi_bus;
|
||||
|
||||
if (n <= 0) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 15.1 SPI Protocol
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue