firmware should account for mc33810 dwell limit #7174

only:hellen154hyundai_f7
This commit is contained in:
rusefillc 2024-12-16 09:54:55 -05:00
parent af5099573a
commit e1de09896b
3 changed files with 29 additions and 0 deletions

View File

@ -525,6 +525,15 @@ bool validateConfigOnStartUpOrBurn() {
criticalError("Invalid cylinder count: %d", engineConfiguration->cylindersCount);
return false;
}
#if EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
int maxDwell = getMc33810maxDwellTimer(engineConfiguration->mc33810maxDwellTimer);
for (size_t i = 0;i<efi::size(config->sparkDwellValues);i++) {
float element = config->sparkDwellValues[i];
if (element > maxDwell) {
criticalError("Dwell %f while 33810 limit %d", element, maxDwell);
}
}
#endif // EFI_PROD_CODE && (BOARD_MC33810_COUNT > 0)
if (engineConfiguration->adcVcc > 5.0f || engineConfiguration->adcVcc < 1.0f) {
criticalError("Invalid adcVcc: %f", engineConfiguration->adcVcc);
return false;

View File

@ -845,6 +845,25 @@ void mc33810_req_init() {
}
}
int getMc33810maxDwellTimer(mc33810maxDwellTimer_e value) {
switch(value) {
case DWELL_16MS:
return 16;
case DWELL_2MS:
return 2;
case DWELL_32MS:
return 32;
case DWELL_4MS:
return 4;
case DWELL_64MS:
return 64;
case DWELL_8MS:
return 8;
}
return 0;
}
#else /* BOARD_MC33810_COUNT > 0 */
int mc33810_add(brain_pin_e base, unsigned int index, const mc33810_config *cfg)

View File

@ -52,3 +52,4 @@ int mc33810_add(brain_pin_e base, unsigned int index, const mc33810_config *cfg)
/* debug */
void mc33810_req_init();
int getMc33810maxDwellTimer(mc33810maxDwellTimer_e value);