store cylinder count as plain number (#2915)

* update test framework

* eh

* hey look it's fewer warnings

* unwind

* fix

* config

* configs

* logic

* even java had some

* no need to be a typedef

* paste in actual cylinder count
This commit is contained in:
Matthew Kennedy 2021-07-07 05:31:05 -07:00 committed by GitHub
parent 4f0210fcda
commit 9377a01aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 10 deletions

View File

@ -119,8 +119,6 @@ typedef uint8_t gppwm_table_t[GPPWM_LOAD_COUNT][GPPWM_RPM_COUNT];
// this is different type simply to have different hi/low range in rusefi.ini
typedef ignition_table_t angle_table_t;
typedef uint32_t cylinders_count_t;
typedef int16_t fsio_pwm_freq_t;
typedef float fsio_setting_t;

View File

@ -134,7 +134,7 @@ static void pinbench(const char *delayStr, const char *onTimeStr, const char *of
isBenchTestPending = true; // let's signal bench thread to wake up
}
static void doRunFuel(cylinders_count_t humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr,
static void doRunFuel(size_t humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr,
const char *countStr) {
if (humanIndex < 1 || humanIndex > engineConfiguration->specs.cylindersCount) {
efiPrintf("Invalid index: %d", humanIndex);
@ -243,7 +243,7 @@ static void fuelbench(const char * onTimeStr, const char *offTimeStr, const char
fuelbench2("0", "1", onTimeStr, offTimeStr, countStr);
}
static void doRunSpark(cylinders_count_t humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr,
static void doRunSpark(size_t humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr,
const char *countStr) {
if (humanIndex < 1 || humanIndex > engineConfiguration->specs.cylindersCount) {
efiPrintf("Invalid index: %d", humanIndex);

View File

@ -133,7 +133,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
}
void FuelSchedule::addFuelEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (cylinders_count_t cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
for (size_t cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
InjectionEvent *ev = &elements[cylinderIndex];
ev->ownIndex = cylinderIndex; // todo: is this assignment needed here? we now initialize in constructor
bool result = addFuelEventsForCylinder(cylinderIndex PASS_ENGINE_PARAMETER_SUFFIX);
@ -153,7 +153,7 @@ void FuelSchedule::onTriggerTooth(size_t toothIndex, int rpm, efitick_t nowNt DE
return;
}
for (cylinders_count_t i = 0; i < CONFIG(specs.cylindersCount); i++) {
for (size_t i = 0; i < CONFIG(specs.cylindersCount); i++) {
elements[i].onTriggerTooth(toothIndex, rpm, nowNt);
}
}

View File

@ -369,7 +369,7 @@ static int getIgnitionPinForIndex(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUF
void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAMETER_SUFFIX) {
(void)ignitionMode;
#if EFI_ENGINE_CONTROL
for (cylinders_count_t cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
for (size_t cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
ENGINE(ignitionPin[cylinderIndex]) = getIgnitionPinForIndex(cylinderIndex PASS_ENGINE_PARAMETER_SUFFIX);
}
#endif /* EFI_ENGINE_CONTROL */
@ -413,7 +413,7 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
#endif /* EFI_UNIT_TEST */
for (cylinders_count_t i = 0; i < CONFIG(specs.cylindersCount); i++) {
for (size_t i = 0; i < CONFIG(specs.cylindersCount); i++) {
ENGINE(ignitionPositionWithinEngineCycle[i]) = ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
}

View File

@ -592,8 +592,7 @@ float[DWELL_CURVE_SIZE] sparkDwellRpmBins;On Single Coil or Wasted Spark setups
struct_no_prefix specs_s
float displacement;Engine displacement, in litres\nsee also cylindersCount;"L", 1, 0, 0, 1000, 2
custom cylinders_count_t 4 bits, U32, @OFFSET@, [0:3], "INVALID", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "INVALID", "INVALID", "INVALID"
cylinders_count_t cylindersCount;
uint32_t cylindersCount;;"", 1, 0, 1, @@MAX_CYLINDER_COUNT@@, 0
! see firing_order.h
! FO_1 = 0