From 2a05e2cd65052a304d25ba05c807df33e7e88d1a Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 12 Jan 2015 21:03:53 -0600 Subject: [PATCH] auto-sync --- .../controllers/algo/auto_generated_enums.cpp | 6 ---- firmware/controllers/algo/engine.h | 10 ++++-- firmware/controllers/algo/io_pins.h | 4 --- firmware/controllers/algo/rusefi_types.h | 35 +++++++++++++++++++ firmware/controllers/math/efitime.h | 35 ++++--------------- firmware/controllers/math/engine_math.h | 1 - .../trigger/main_trigger_callback.cpp | 2 +- firmware/global.h | 1 + 8 files changed, 52 insertions(+), 42 deletions(-) create mode 100644 firmware/controllers/algo/rusefi_types.h diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index a93c299ffa..76c6053ae2 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -9,12 +9,6 @@ case AC_RELAY: return "AC_RELAY"; case ALTERNATOR_SWITCH: return "ALTERNATOR_SWITCH"; -case ELECTRONIC_THROTTLE_CONTROL_1: - return "ELECTRONIC_THROTTLE_CONTROL_1"; -case ELECTRONIC_THROTTLE_CONTROL_2: - return "ELECTRONIC_THROTTLE_CONTROL_2"; -case ELECTRONIC_THROTTLE_CONTROL_3: - return "ELECTRONIC_THROTTLE_CONTROL_3"; case FAN_RELAY: return "FAN_RELAY"; case FUEL_PUMP_RELAY: diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index f8149c3f7a..5abe8f28b6 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -67,12 +67,12 @@ public: class EngineState { public: /** + * WIP: accessing these values here would be a performance optimization since log() function needed for + * thermistor logic is relatively heavy * Access to these two fields is not synchronized in any way - that should work since float read/write are atomic. */ float iat; float clt; - - }; class RpmCalculator; @@ -85,11 +85,17 @@ public: engine_configuration_s *engineConfiguration; engine_configuration2_s *engineConfiguration2; + /** + * this is about 'stopengine' command + */ uint64_t stopEngineRequestTimeNt; Thermistor iat; Thermistor clt; + /** + * ignition dwell duration as crankshaft angle + */ float dwellAngle; float advance; diff --git a/firmware/controllers/algo/io_pins.h b/firmware/controllers/algo/io_pins.h index a404613ca2..72e0c3e31b 100644 --- a/firmware/controllers/algo/io_pins.h +++ b/firmware/controllers/algo/io_pins.h @@ -63,10 +63,6 @@ typedef enum { IO_INVALID, - ELECTRONIC_THROTTLE_CONTROL_1, - ELECTRONIC_THROTTLE_CONTROL_2, - ELECTRONIC_THROTTLE_CONTROL_3, - /** * these seven segment display pins are related to unused external tachometer code * I still have the hardware so maybe one day I will fix it, but for now it's just dead code diff --git a/firmware/controllers/algo/rusefi_types.h b/firmware/controllers/algo/rusefi_types.h new file mode 100644 index 0000000000..bcfe072f3f --- /dev/null +++ b/firmware/controllers/algo/rusefi_types.h @@ -0,0 +1,35 @@ +/** + * @file rusefi_types.h + * + * @date Jan 12, 2015 + * @author Andrey Belomutskiy, (c) 2012-2014 + */ +#ifndef CONTROLLERS_ALGO_RUSEFI_TYPES_H_ +#define CONTROLLERS_ALGO_RUSEFI_TYPES_H_ + +/** + * integer time in milliseconds + * 32 bit 4B / 1000 = 4M seconds = 1111.11 hours = 46 days. + * Please restart your ECU every 46 days? :) + */ +typedef uint32_t efitimems_t; + +/** + * 64 bit time in microseconds, since boot + */ +typedef uint64_t efitimeus_t; + +/** + * platform-dependent tick since boot + * in case of stm32f4 that's a CPU tick + */ +typedef uint64_t efitick_t; + +typedef float angle_t; + +/** + * numeric value from 0 to 100 + */ +typedef float percent_t; + +#endif /* CONTROLLERS_ALGO_RUSEFI_TYPES_H_ */ diff --git a/firmware/controllers/math/efitime.h b/firmware/controllers/math/efitime.h index d853fcaa1d..05454fdc2a 100644 --- a/firmware/controllers/math/efitime.h +++ b/firmware/controllers/math/efitime.h @@ -12,34 +12,7 @@ #include #include "efifeatures.h" - -/** - * integer time in milliseconds - * 32 bit 4B / 1000 = 4M seconds = 1111.11 hours = 46 days. - * Please restart your ECU every 46 days? :) - */ -typedef uint32_t efitimems_t; - -/** - * 64 bit time in microseconds, since boot - */ -typedef uint64_t efitimeus_t; - -/** - * platform-dependent tick since boot - * in case of stm32f4 that's a CPU tick - */ -typedef uint64_t efitick_t; - -/** - * numeric value from 0 to 100 - */ -typedef float percent_t; - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ +#include "rusefi_types.h" #define US_PER_SECOND 1000000 #define US_PER_SECOND_LL 1000000LL @@ -51,6 +24,12 @@ extern "C" // todo: implement a function to work with times considering counter overflow #define overflowDiff(now, time) ((now) - (time)) +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + /** * 64-bit counter of microseconds (1/1 000 000 of a second) since MCU reset * diff --git a/firmware/controllers/math/engine_math.h b/firmware/controllers/math/engine_math.h index b36cfb2cba..1e10355faa 100644 --- a/firmware/controllers/math/engine_math.h +++ b/firmware/controllers/math/engine_math.h @@ -14,7 +14,6 @@ #include "table_helper.h" #include "engine.h" -// todo: this value is too low for 6 cyl engine, get it back to 60 #define OUTPUT_SIGNAL_MAX_SIZE 90 typedef ArrayList OutputSignalList; diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index 4ac36b97c1..d4ff36815e 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -280,7 +280,7 @@ void showMainHistogram(void) { static void doSomeCalc(int rpm DECLARE_ENGINE_PARAMETER_S) { /** * Within one engine cycle all cylinders are fired with same timing advance. - * todo: one day we can control cylinders individually + * todo: one day we can control cylinders individually? */ float dwellMs = getSparkDwellMsT(rpm PASS_ENGINE_PARAMETER); diff --git a/firmware/global.h b/firmware/global.h index 3440a97221..d364611ca4 100644 --- a/firmware/global.h +++ b/firmware/global.h @@ -25,6 +25,7 @@ typedef unsigned int time_t; #endif #include "efifeatures.h" +#include "rusefi_types.h" #include "rusefi_enums.h" #if EFI_PROD_CODE #include "io_pins.h"