don't warn if we intentionally skipped this spark (#4961)

* don't warn if we intentionally skipped this spark

* header

* real nb2
This commit is contained in:
Matthew Kennedy 2023-01-10 16:07:44 -08:00 committed by GitHub
parent 6bfda5cb23
commit d5b00e1187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 10 deletions

View File

@ -45,6 +45,9 @@ public:
// For single sparks, this should be zero.
uint8_t sparksRemaining = 0;
// Track whether coil charge was intentionally skipped (spark limiter)
bool wasSparkLimited = false;
/**
* Desired timing advance
*/

View File

@ -53,7 +53,7 @@ static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *ou
output->signalFallSparkId = event->sparkId;
if (!output->currentLogicValue) {
if (!output->currentLogicValue && !event->wasSparkLimited) {
warning(CUSTOM_OUT_OF_ORDER_COIL, "out-of-order coil off %s", output->getName());
output->outOfOrder = true;
}
@ -340,6 +340,7 @@ static void scheduleSparkEvent(bool limitedSpark, IgnitionEvent *event,
* By the way 32-bit value should hold at least 400 hours of events at 6K RPM x 12 events per revolution
*/
event->sparkId = engine->engineState.sparkCounter++;
event->wasSparkLimited = limitedSpark;
efitick_t chargeTime = 0;

View File

@ -106,6 +106,11 @@ void initNewSensors() {
Sensor::setMockValue(SensorType::BatteryVoltage, 10);
}
#endif
#if EFI_SIMULATOR
// Simulator gets battery voltage so it detects ignition-on
Sensor::setMockValue(SensorType::BatteryVoltage, 14);
#endif // EFI_SIMULATOR
}
void stopSensors() {

View File

@ -28,10 +28,9 @@ TEST(realCrankingNB2, normalCranking) {
ASSERT_EQ(876, round(Sensor::getOrZero(SensorType::Rpm)));
EXPECT_EQ(3, eth.recentWarnings()->getCount());
EXPECT_EQ(CUSTOM_OUT_OF_ORDER_COIL, eth.recentWarnings()->get(0).Code);
EXPECT_EQ(CUSTOM_PRIMARY_NOT_ENOUGH_TEETH, eth.recentWarnings()->get(1).Code);
EXPECT_EQ(CUSTOM_CAM_TOO_MANY_TEETH, eth.recentWarnings()->get(2).Code);
EXPECT_EQ(2, eth.recentWarnings()->getCount());
EXPECT_EQ(CUSTOM_PRIMARY_NOT_ENOUGH_TEETH, eth.recentWarnings()->get(0).Code);
EXPECT_EQ(CUSTOM_CAM_TOO_MANY_TEETH, eth.recentWarnings()->get(1).Code);
}
TEST(realCrankingNB2, crankingMissingInjector) {
@ -50,9 +49,8 @@ TEST(realCrankingNB2, crankingMissingInjector) {
ASSERT_EQ(316, round(Sensor::getOrZero(SensorType::Rpm)));
EXPECT_EQ(4, eth.recentWarnings()->getCount());
EXPECT_EQ(CUSTOM_OUT_OF_ORDER_COIL, eth.recentWarnings()->get(0).Code);
EXPECT_EQ(CUSTOM_PRIMARY_NOT_ENOUGH_TEETH, eth.recentWarnings()->get(1).Code);
EXPECT_EQ(CUSTOM_CAM_TOO_MANY_TEETH, eth.recentWarnings()->get(2).Code);
EXPECT_EQ(CUSTOM_PRIMARY_TOO_MANY_TEETH, eth.recentWarnings()->get(3).Code);
EXPECT_EQ(3, eth.recentWarnings()->getCount());
EXPECT_EQ(CUSTOM_PRIMARY_NOT_ENOUGH_TEETH, eth.recentWarnings()->get(0).Code);
EXPECT_EQ(CUSTOM_CAM_TOO_MANY_TEETH, eth.recentWarnings()->get(1).Code);
EXPECT_EQ(CUSTOM_PRIMARY_TOO_MANY_TEETH, eth.recentWarnings()->get(2).Code);
}