proteus fails to start while powered by stim board #5545

only:proteus_f7
This commit is contained in:
rusefi 2023-08-29 00:24:46 -04:00
parent 291dcc6c1e
commit 720ba01d04
7 changed files with 23 additions and 23 deletions

View File

@ -290,7 +290,7 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
// make sure we do not turn the critical LED off if already have // make sure we do not turn the critical LED off if already have
// critical error by now // critical error by now
for (uint32_t i = 0; !hasFirmwareError() && i < sizeof(leds) / sizeof(leds[0]); i++) { for (uint32_t i = 0; !hasFirmwareError() && i < sizeof(leds) / sizeof(leds[0]); i++) {
leds[i]->setValue(value); leds[i]->setValue(value, /*force*/true);
} }
} }
@ -306,7 +306,7 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
// second invocation of BlinkingTask // second invocation of BlinkingTask
setAllLeds(0); setAllLeds(0);
} else if (counter % 2 == 0) { } else if (counter % 2 == 0) {
enginePins.communicationLedPin.setValue(0); enginePins.communicationLedPin.setValue(0, /*force*/true);
#if HW_CHECK_SD #if HW_CHECK_SD
extern int totalLoggedBytes; extern int totalLoggedBytes;
if (totalLoggedBytes > 2000) { if (totalLoggedBytes > 2000) {
@ -342,7 +342,7 @@ extern int totalLoggedBytes;
offTimeMs = 0.6 * onTimeMs; offTimeMs = 0.6 * onTimeMs;
} }
enginePins.communicationLedPin.setValue(1); enginePins.communicationLedPin.setValue(1, /*force*/true);
//#if HW_CHECK_MODE //#if HW_CHECK_MODE
// // we have to do anything possible to help users notice FACTORY MODE // // we have to do anything possible to help users notice FACTORY MODE
// enginePins.errorLedPin.setValue(0); // enginePins.errorLedPin.setValue(0);

View File

@ -252,7 +252,7 @@ void firmwareError(ObdCode code, const char *fmt, ...) {
va_end(ap); va_end(ap);
#endif #endif
criticalShutdown(); criticalShutdown();
enginePins.communicationLedPin.setValue(1); enginePins.communicationLedPin.setValue(1, /*force*/true);
hasFirmwareErrorFlag = true; hasFirmwareErrorFlag = true;
if (indexOf(fmt, '%') == -1) { if (indexOf(fmt, '%') == -1) {

View File

@ -492,14 +492,14 @@ void OutputPin::setOnchipValue(int electricalValue) {
} }
#endif // EFI_PROD_CODE #endif // EFI_PROD_CODE
void OutputPin::setValue(int logicValue) { void OutputPin::setValue(int logicValue, bool isForce) {
setValue(nullptr, logicValue); setValue(nullptr, logicValue, isForce);
} }
extern bool qcDirectPinControlMode; extern bool qcDirectPinControlMode;
void OutputPin::setValue(const char *msg, int logicValue) { void OutputPin::setValue(const char *msg, int logicValue, bool isForce) {
if (qcDirectPinControlMode) { if (qcDirectPinControlMode && !isForce) {
return; return;
} }
@ -553,7 +553,7 @@ bool OutputPin::getLogicValue() const {
void OutputPin::setDefaultPinState(pin_output_mode_e outputMode) { void OutputPin::setDefaultPinState(pin_output_mode_e outputMode) {
assertOMode(mode); assertOMode(mode);
this->mode = outputMode; this->mode = outputMode;
setValue(false); // initial state setValue(false, /*force*/true); // initial state
} }
brain_pin_diag_e OutputPin::getDiag() const { brain_pin_diag_e OutputPin::getDiag() const {

View File

@ -53,8 +53,8 @@ public:
bool isInitialized(); bool isInitialized();
bool getAndSet(int logicValue); bool getAndSet(int logicValue);
void setValue(const char *msg, int logicValue); void setValue(const char *msg, int logicValue, bool isForce = false);
TEST_VIRTUAL void setValue(int logicValue); TEST_VIRTUAL void setValue(int logicValue, bool isForce = false);
void toggle(); void toggle();
bool getLogicValue() const; bool getLogicValue() const;

View File

@ -71,7 +71,7 @@ public:
MockOutputPin(); MockOutputPin();
virtual ~MockOutputPin(); virtual ~MockOutputPin();
MOCK_METHOD(void, setValue, (int value), (override)); MOCK_METHOD(void, setValue, (int value, bool isForce), (override));
}; };
class MockExecutor : public TestExecutor { class MockExecutor : public TestExecutor {

View File

@ -9,7 +9,7 @@ using ::testing::StrictMock;
TEST(DcMotor, Disable) { TEST(DcMotor, Disable) {
StrictMock<MockOutputPin> dpin; StrictMock<MockOutputPin> dpin;
EXPECT_CALL(dpin, setValue(1)) EXPECT_CALL(dpin, setValue(1, testing::_))
.Times(2); // happens twice - once for initial disable, once for set(0) .Times(2); // happens twice - once for initial disable, once for set(0)
TwoPinDcMotor dut(dpin); TwoPinDcMotor dut(dpin);
@ -18,7 +18,7 @@ TEST(DcMotor, Disable) {
TEST(DcMotor, Disable2) { TEST(DcMotor, Disable2) {
StrictMock<MockOutputPin> dpin; StrictMock<MockOutputPin> dpin;
EXPECT_CALL(dpin, setValue(1)).Times(4); EXPECT_CALL(dpin, setValue(1, testing::_)).Times(4);
TwoPinDcMotor dut(dpin); TwoPinDcMotor dut(dpin);
@ -32,10 +32,10 @@ TEST(DcMotor, Enable) {
InSequence is; InSequence is;
// Construction disables // Construction disables
EXPECT_CALL(dpin, setValue(1)).Times(2); EXPECT_CALL(dpin, setValue(1, testing::_)).Times(2);
// Then enable // Then enable
EXPECT_CALL(dpin, setValue(0)); EXPECT_CALL(dpin, setValue(0, testing::_));
} }
TwoPinDcMotor dut(dpin); TwoPinDcMotor dut(dpin);
@ -44,7 +44,7 @@ TEST(DcMotor, Enable) {
TEST(DcMotor, SetUnconfigured) { TEST(DcMotor, SetUnconfigured) {
StrictMock<MockOutputPin> dpin; StrictMock<MockOutputPin> dpin;
EXPECT_CALL(dpin, setValue(1)).Times(3); EXPECT_CALL(dpin, setValue(1, testing::_)).Times(3);
TwoPinDcMotor dut(dpin); TwoPinDcMotor dut(dpin);
EXPECT_FLOAT_EQ(dut.get(), 0); EXPECT_FLOAT_EQ(dut.get(), 0);

View File

@ -50,14 +50,14 @@ TEST(GpPwm, OutputOnOff) {
InSequence i; InSequence i;
// Rising edge test // Rising edge test
EXPECT_CALL(pin, setValue(0)); EXPECT_CALL(pin, setValue(0, false));
EXPECT_CALL(pin, setValue(1)); EXPECT_CALL(pin, setValue(1, false));
EXPECT_CALL(pin, setValue(1)); EXPECT_CALL(pin, setValue(1, false));
// Falling edge test // Falling edge test
EXPECT_CALL(pin, setValue(1)); EXPECT_CALL(pin, setValue(1, false));
EXPECT_CALL(pin, setValue(0)); EXPECT_CALL(pin, setValue(0, false));
EXPECT_CALL(pin, setValue(0)); EXPECT_CALL(pin, setValue(0, false));
} }
ch.init(false, nullptr, &pin, nullptr, &cfg); ch.init(false, nullptr, &pin, nullptr, &cfg);