diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index e3af7a90f3..99601b595e 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -303,10 +303,10 @@ void updateDevConsoleState(void) { * that would be 'show fuel for rpm 3500 maf 4.0' */ -static void showFuelMap2(float rpm, float engineLoad) { +static void showFuelInfo2(float rpm, float engineLoad) { float baseFuel = getBaseTableFuel((int) rpm, engineLoad); - scheduleMsg(&logger2, "algo=%s", algorithmToString(engineConfiguration->algorithm)); + scheduleMsg(&logger2, "algo=%s/pump=%s", algorithmToString(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY))); scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel()); @@ -325,8 +325,8 @@ static void showFuelMap2(float rpm, float engineLoad) { } } -static void showFuelMap(void) { - showFuelMap2((float) getRpm(), getEngineLoad()); +static void showFuelInfo(void) { + showFuelInfo2((float) getRpm(), getEngineLoad()); } #endif /* EFI_PROD_CODE */ @@ -419,8 +419,8 @@ void initStatusLoop(void) { #if EFI_PROD_CODE initLogging(&logger2, "main event handler"); - addConsoleActionFF("fuelinfo2", showFuelMap2); - addConsoleAction("fuelinfo", showFuelMap); + addConsoleActionFF("fuelinfo2", showFuelInfo2); + addConsoleAction("fuelinfo", showFuelInfo); addConsoleAction("status", printStatus); #endif /* EFI_PROD_CODE */ diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index bfa1425ce7..bb81e226b8 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -69,6 +69,7 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura /** * CH_FREQUENCY is the number of system ticks in a second */ +// todo: this should probably be configurable? #define FUEL_PUMP_DELAY (4 * CH_FREQUENCY) static VirtualTimer everyMsTimer; diff --git a/firmware/emulation/rfi_perftest.cpp b/firmware/emulation/rfi_perftest.cpp index 96d1885918..64f7d9d78f 100644 --- a/firmware/emulation/rfi_perftest.cpp +++ b/firmware/emulation/rfi_perftest.cpp @@ -103,20 +103,23 @@ static void testMath(const int count) { int64_t temp64 = 0; start = currentTimeMillis(); - for (int64_t i = 0; i < count; i++) + for (int64_t i = 0; i < count; i++) { temp64 += i; + } time = currentTimeMillis() - start; - if (temp64 != 0) + if (temp64 != 0) { scheduleMsg(&logger, "Finished %d iterations of int64_t summation in %dms", count, time); + } temp64 = 1; start = currentTimeMillis(); - for (int64_t i = 0; i < count; i++) + for (int64_t i = 0; i < count; i++) { temp64 *= i; + } time = currentTimeMillis() - start; - if (temp64 == 0) + if (temp64 == 0) { scheduleMsg(&logger, "Finished %d iterations of int64_t multiplication in %dms", count, time); - + } start = currentTimeMillis(); for (int i = 0; i < count; i++) @@ -124,52 +127,65 @@ static void testMath(const int count) { time = currentTimeMillis() - start; scheduleMsg(&logger, "Finished %d iterations of empty loop in %dms", count, time); - int tempi = 1; + uint32_t tempi = 1; start = currentTimeMillis(); - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { tempi += tempi; + } time = currentTimeMillis() - start; - if (tempi == 0) - scheduleMsg(&logger, "Finished %d iterations of int summation in %dms", count, time); + if (tempi == 0) { + // Finished 100000 iterations of uint32_t summation in 11ms + scheduleMsg(&logger, "Finished %d iterations of uint32_t summation in %dms", count, time); + } start = currentTimeMillis(); tempi = 1; - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { tempi += (tempi + 100) / 130; + } time = currentTimeMillis() - start; - if (tempi != 0) - scheduleMsg(&logger, "Finished %d iterations of int division in %dms", count, time); + if (tempi != 0) { + // Finished 100000 iterations of uint32_t division in 16ms + scheduleMsg(&logger, "Finished %d iterations of uint32_t division in %dms", count, time); + } start = currentTimeMillis(); - long templ = 1; - for (int i = 0; i < count; i++) - templ += templ; + temp64 = 1; + for (int i = 0; i < count; i++) { + temp64 += temp64; + } time = currentTimeMillis() - start; - if (templ == 0) - scheduleMsg(&logger, "Finished %d iterations of long summation in %dms", count, time); + if (temp64 == 0) { + // Finished 100000 iterations of int64_t summation in 21ms + scheduleMsg(&logger, "Finished %d iterations of int64_t summation in %dms", count, time); + } start = currentTimeMillis(); - templ = 1; - for (int i = 0; i < count; i++) - templ += (templ + 100) / 130; + temp64 = 1; + for (int i = 0; i < count; i++) { + temp64 += (temp64 + 100) / 130; + } time = currentTimeMillis() - start; - if (templ != 0) { - // Finished 100000 iterations of long division in 45ms - scheduleMsg(&logger, "Finished %d iterations of long division in %dms", count, time); + if (temp64 != 0) { + // Finished 100000 iterations of int64_t division in 181ms + scheduleMsg(&logger, "Finished %d iterations of int64_t division in %dms", count, time); } start = currentTimeMillis(); float tempf = 1; - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { tempf += tempf; + } time = currentTimeMillis() - start; - if (tempf != 0) + if (tempf != 0) { scheduleMsg(&logger, "Finished %d iterations of float summation in %dms", count, time); + } start = currentTimeMillis(); tempf = 1; - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { tempf += (tempf + 100) / 130.0; + } time = currentTimeMillis() - start; if (tempf != 0) { // Finished 100000 iterations of float division in 65ms @@ -178,35 +194,45 @@ static void testMath(const int count) { start = currentTimeMillis(); tempf = 1; - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { tempf += logf(tempf); + } time = currentTimeMillis() - start; - if (tempf != 0) + if (tempf != 0) { + // Finished 100000 iterations of float log in 191ms scheduleMsg(&logger, "Finished %d iterations of float log in %dms", count, time); + } start = currentTimeMillis(); double tempd = 1; for (int i = 0; i < count; i++) tempd += tempd / 2; time = currentTimeMillis() - start; - if (tempd != 0) + if (tempd != 0) { + // Finished 100000 iterations of double summation in 80ms scheduleMsg(&logger, "Finished %d iterations of double summation in %dms", count, time); + } start = currentTimeMillis(); tempd = 1; for (int i = 0; i < count; i++) tempd += (tempd + 100) / 130.0; time = currentTimeMillis() - start; - if (tempd != 0) + if (tempd != 0) { + // Finished 100000 iterations of double division in 497ms scheduleMsg(&logger, "Finished %d iterations of double division in %dms", count, time); + } start = currentTimeMillis(); tempd = 1; - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { tempd += log(tempd); + } time = currentTimeMillis() - start; - if (tempd != 0) + if (tempd != 0) { + // Finished 100000 iterations of double log in 242ms scheduleMsg(&logger, "Finished %d iterations of double log in %dms", count, time); + } } static void runTests(const int count) {