auto-sync
This commit is contained in:
parent
403d447c1e
commit
8bd52dc891
|
@ -69,7 +69,6 @@ void setMazdaMiataNbEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
boardConfiguration->fanPin = GPIOE_6;
|
boardConfiguration->fanPin = GPIOE_6;
|
||||||
boardConfiguration->fanPinMode = OM_DEFAULT;
|
boardConfiguration->fanPinMode = OM_DEFAULT;
|
||||||
|
|
||||||
boardConfiguration->electronicThrottlePin1 = GPIO_UNASSIGNED;
|
|
||||||
boardConfiguration->clutchDownPin = GPIO_UNASSIGNED;
|
boardConfiguration->clutchDownPin = GPIO_UNASSIGNED;
|
||||||
|
|
||||||
// set_whole_fuel_map 3
|
// set_whole_fuel_map 3
|
||||||
|
|
|
@ -157,8 +157,8 @@
|
||||||
#define EFI_UART_GPS TRUE
|
#define EFI_UART_GPS TRUE
|
||||||
//#define EFI_UART_GPS FALSE
|
//#define EFI_UART_GPS FALSE
|
||||||
|
|
||||||
//#define EFI_ELECTRONIC_THROTTLE_BODY TRUE
|
#define EFI_ELECTRONIC_THROTTLE_BODY TRUE
|
||||||
#define EFI_ELECTRONIC_THROTTLE_BODY FALSE
|
//#define EFI_ELECTRONIC_THROTTLE_BODY FALSE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do we need Malfunction Indicator blinking logic?
|
* Do we need Malfunction Indicator blinking logic?
|
||||||
|
|
|
@ -181,7 +181,10 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) {
|
||||||
boardConfiguration->idle.solenoidPinMode = OM_DEFAULT;
|
boardConfiguration->idle.solenoidPinMode = OM_DEFAULT;
|
||||||
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
|
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
|
||||||
boardConfiguration->fuelPumpPinMode = OM_DEFAULT;
|
boardConfiguration->fuelPumpPinMode = OM_DEFAULT;
|
||||||
boardConfiguration->electronicThrottlePin1 = GPIO_UNASSIGNED;
|
boardConfiguration->etbControlPin1 = GPIO_UNASSIGNED;
|
||||||
|
boardConfiguration->etbControlPin2 = GPIO_UNASSIGNED;
|
||||||
|
boardConfiguration->etbDirectionPin1 = GPIO_UNASSIGNED;
|
||||||
|
boardConfiguration->etbDirectionPin2 = GPIO_UNASSIGNED;
|
||||||
boardConfiguration->o2heaterPin = GPIO_UNASSIGNED;
|
boardConfiguration->o2heaterPin = GPIO_UNASSIGNED;
|
||||||
|
|
||||||
boardConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
|
boardConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// this section was generated by config_definition.jar on Thu May 28 20:18:40 EDT 2015
|
// this section was generated by config_definition.jar on Fri May 29 18:47:53 EDT 2015
|
||||||
// begin
|
// begin
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -326,11 +326,11 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* offset 152
|
* offset 152
|
||||||
*/
|
*/
|
||||||
brain_pin_e electronicThrottlePin1;
|
int unuseddddd1;
|
||||||
/**
|
/**
|
||||||
* offset 156
|
* offset 156
|
||||||
*/
|
*/
|
||||||
pin_output_mode_e electronicThrottlePin1Mode;
|
int unuseddddd2;
|
||||||
/**
|
/**
|
||||||
* some cars have a switch to indicate that clutch pedal is all the way down
|
* some cars have a switch to indicate that clutch pedal is all the way down
|
||||||
* offset 160
|
* offset 160
|
||||||
|
@ -396,7 +396,35 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* offset 232
|
* offset 232
|
||||||
*/
|
*/
|
||||||
float unusedADC[16];
|
brain_pin_e etbDirectionPin1;
|
||||||
|
/**
|
||||||
|
* offset 236
|
||||||
|
*/
|
||||||
|
brain_pin_e etbDirectionPin2;
|
||||||
|
/**
|
||||||
|
* offset 240
|
||||||
|
*/
|
||||||
|
brain_pin_e etbControlPin1;
|
||||||
|
/**
|
||||||
|
* offset 244
|
||||||
|
*/
|
||||||
|
brain_pin_e etbControlPin2;
|
||||||
|
/**
|
||||||
|
* offset 248
|
||||||
|
*/
|
||||||
|
pin_output_mode_e electronicThrottlePin1Mode;
|
||||||
|
/**
|
||||||
|
* offset 252
|
||||||
|
*/
|
||||||
|
float etbPFactor;
|
||||||
|
/**
|
||||||
|
* offset 256
|
||||||
|
*/
|
||||||
|
float etbIFactor;
|
||||||
|
/**
|
||||||
|
* offset 260
|
||||||
|
*/
|
||||||
|
float unusedADC[9];
|
||||||
/**
|
/**
|
||||||
* offset 296
|
* offset 296
|
||||||
*/
|
*/
|
||||||
|
@ -1366,4 +1394,4 @@ typedef struct {
|
||||||
} persistent_config_s;
|
} persistent_config_s;
|
||||||
|
|
||||||
// end
|
// end
|
||||||
// this section was generated by config_definition.jar on Thu May 28 20:18:40 EDT 2015
|
// this section was generated by config_definition.jar on Fri May 29 18:47:53 EDT 2015
|
||||||
|
|
|
@ -259,9 +259,9 @@
|
||||||
#define fanPin_offset_hex 300
|
#define fanPin_offset_hex 300
|
||||||
#define fanPinMode_offset 772
|
#define fanPinMode_offset 772
|
||||||
#define fanPinMode_offset_hex 304
|
#define fanPinMode_offset_hex 304
|
||||||
#define electronicThrottlePin1_offset 776
|
#define unuseddddd1_offset 776
|
||||||
#define electronicThrottlePin1_offset_hex 308
|
#define unuseddddd1_offset_hex 308
|
||||||
#define electronicThrottlePin1Mode_offset 780
|
#define unuseddddd2_offset 780
|
||||||
#define clutchDownPin_offset 784
|
#define clutchDownPin_offset 784
|
||||||
#define clutchDownPin_offset_hex 310
|
#define clutchDownPin_offset_hex 310
|
||||||
#define clutchDownPinMode_offset 788
|
#define clutchDownPinMode_offset 788
|
||||||
|
@ -294,8 +294,20 @@
|
||||||
#define digitalPotentiometerChipSelect3_offset_hex 350
|
#define digitalPotentiometerChipSelect3_offset_hex 350
|
||||||
#define digitalPotentiometerChipSelect4_offset 852
|
#define digitalPotentiometerChipSelect4_offset 852
|
||||||
#define digitalPotentiometerChipSelect4_offset_hex 354
|
#define digitalPotentiometerChipSelect4_offset_hex 354
|
||||||
#define unusedADC_offset 856
|
#define etbDirectionPin1_offset 856
|
||||||
#define unusedADC_offset_hex 358
|
#define etbDirectionPin1_offset_hex 358
|
||||||
|
#define etbDirectionPin2_offset 860
|
||||||
|
#define etbControlPin1_offset 864
|
||||||
|
#define etbControlPin1_offset_hex 360
|
||||||
|
#define etbControlPin2_offset 868
|
||||||
|
#define etbControlPin2_offset_hex 364
|
||||||
|
#define electronicThrottlePin1Mode_offset 872
|
||||||
|
#define electronicThrottlePin1Mode_offset_hex 368
|
||||||
|
#define etbPFactor_offset 876
|
||||||
|
#define etbIFactor_offset 880
|
||||||
|
#define etbIFactor_offset_hex 370
|
||||||
|
#define unusedADC_offset 884
|
||||||
|
#define unusedADC_offset_hex 374
|
||||||
#define triggerInputPins1_offset 920
|
#define triggerInputPins1_offset 920
|
||||||
#define triggerInputPins1_offset_hex 398
|
#define triggerInputPins1_offset_hex 398
|
||||||
#define triggerInputPins2_offset 924
|
#define triggerInputPins2_offset 924
|
||||||
|
|
|
@ -30,10 +30,13 @@
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
#include "pwm_generator_logic.h"
|
#include "pwm_generator_logic.h"
|
||||||
|
#include "pid.h"
|
||||||
|
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
||||||
|
|
||||||
static Logging logger;
|
#define ETB_FREQ 400
|
||||||
|
|
||||||
|
static LoggingWithStorage logger("ETB");
|
||||||
/**
|
/**
|
||||||
* @brief Control Thread stack
|
* @brief Control Thread stack
|
||||||
*/
|
*/
|
||||||
|
@ -41,12 +44,16 @@ static THD_WORKING_AREA(etbTreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||||
/**
|
/**
|
||||||
* @brief Pulse-Width Modulation state
|
* @brief Pulse-Width Modulation state
|
||||||
*/
|
*/
|
||||||
static SimplePwm etbPwm;
|
static SimplePwm etbPwmUp;
|
||||||
|
static OutputPin output1;
|
||||||
|
static SimplePwm etbPwmDown;
|
||||||
|
static OutputPin output2;
|
||||||
|
|
||||||
|
static Pid pid(10, 0, 0, 1, 90);
|
||||||
|
|
||||||
static float prevTps;
|
static float prevTps;
|
||||||
|
|
||||||
extern engine_configuration_s *engineConfiguration;
|
EXTERN_ENGINE;
|
||||||
extern board_configuration_s *boardConfiguration;
|
|
||||||
|
|
||||||
static msg_t etbThread(void *arg) {
|
static msg_t etbThread(void *arg) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
@ -68,26 +75,29 @@ static msg_t etbThread(void *arg) {
|
||||||
static void setThrottleConsole(int level) {
|
static void setThrottleConsole(int level) {
|
||||||
scheduleMsg(&logger, "setting throttle=%d", level);
|
scheduleMsg(&logger, "setting throttle=%d", level);
|
||||||
|
|
||||||
etbPwm.multiWave.switchTimes[0] = 0.01 + (minI(level, 98)) / 100.0;
|
float dc = 0.01 + (minI(level, 98)) / 100.0;
|
||||||
print("st = %f\r\n", etbPwm.multiWave.switchTimes[0]);
|
etbPwmUp.setSimplePwmDutyCycle(dc);
|
||||||
|
print("st = %f\r\n", dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initElectronicThrottle(void) {
|
void initElectronicThrottle(void) {
|
||||||
initLogging(&logger, "Electronic Throttle");
|
|
||||||
|
|
||||||
engineConfiguration->tpsMin = 140;
|
|
||||||
engineConfiguration->tpsMax = 898;
|
|
||||||
|
|
||||||
// these two lines are controlling direction
|
// these two lines are controlling direction
|
||||||
// outputPinRegister("etb1", ELECTRONIC_THROTTLE_CONTROL_1, ETB_CONTROL_LINE_1_PORT, ETB_CONTROL_LINE_1_PIN);
|
// outputPinRegister("etb1", ELECTRONIC_THROTTLE_CONTROL_1, ETB_CONTROL_LINE_1_PORT, ETB_CONTROL_LINE_1_PIN);
|
||||||
// outputPinRegister("etb2", ELECTRONIC_THROTTLE_CONTROL_2, ETB_CONTROL_LINE_2_PORT, ETB_CONTROL_LINE_2_PIN);
|
// outputPinRegister("etb2", ELECTRONIC_THROTTLE_CONTROL_2, ETB_CONTROL_LINE_2_PORT, ETB_CONTROL_LINE_2_PIN);
|
||||||
|
|
||||||
// this line used for PWM
|
// this line used for PWM
|
||||||
startSimplePwmExt(&etbPwm, "etb",
|
startSimplePwmExt(&etbPwmUp, "etb1",
|
||||||
boardConfiguration->electronicThrottlePin1,
|
boardConfiguration->etbControlPin1,
|
||||||
ELECTRONIC_THROTTLE_CONTROL_1,
|
&output1,
|
||||||
500,
|
ETB_FREQ,
|
||||||
0.80);
|
0.80,
|
||||||
|
applyPinState);
|
||||||
|
startSimplePwmExt(&etbPwmUp, "etb2",
|
||||||
|
boardConfiguration->etbControlPin2,
|
||||||
|
&output2,
|
||||||
|
ETB_FREQ,
|
||||||
|
0.80,
|
||||||
|
applyPinState);
|
||||||
|
|
||||||
addConsoleActionI("e", setThrottleConsole);
|
addConsoleActionI("e", setThrottleConsole);
|
||||||
chThdCreateStatic(etbTreadStack, sizeof(etbTreadStack), NORMALPRIO, (tfunc_t) etbThread, NULL);
|
chThdCreateStatic(etbTreadStack, sizeof(etbTreadStack), NORMALPRIO, (tfunc_t) etbThread, NULL);
|
||||||
|
|
|
@ -326,9 +326,8 @@ struct_no_prefix board_configuration_s
|
||||||
brain_pin_e fanPin;
|
brain_pin_e fanPin;
|
||||||
pin_output_mode_e fanPinMode;
|
pin_output_mode_e fanPinMode;
|
||||||
|
|
||||||
brain_pin_e electronicThrottlePin1;
|
int unuseddddd1;
|
||||||
pin_output_mode_e electronicThrottlePin1Mode;
|
int unuseddddd2;
|
||||||
|
|
||||||
brain_pin_e clutchDownPin;some cars have a switch to indicate that clutch pedal is all the way down
|
brain_pin_e clutchDownPin;some cars have a switch to indicate that clutch pedal is all the way down
|
||||||
pin_input_mode_e clutchDownPinMode;
|
pin_input_mode_e clutchDownPinMode;
|
||||||
|
|
||||||
|
@ -351,7 +350,17 @@ spi_device_e digitalPotentiometerSpiDevice;Digital Potentiometer is used by stoc
|
||||||
brain_pin_e[DIGIPOT_COUNT iterate] digitalPotentiometerChipSelect;
|
brain_pin_e[DIGIPOT_COUNT iterate] digitalPotentiometerChipSelect;
|
||||||
|
|
||||||
custom adc_channel_mode_e 4 bits, U32, @OFFSET@, [0:1], "Off", "Slow", "Fast", "INVALID"
|
custom adc_channel_mode_e 4 bits, U32, @OFFSET@, [0:1], "Off", "Slow", "Fast", "INVALID"
|
||||||
float[16] unusedADC;
|
|
||||||
|
brain_pin_e etbDirectionPin1;
|
||||||
|
brain_pin_e etbDirectionPin2;
|
||||||
|
brain_pin_e etbControlPin1;
|
||||||
|
brain_pin_e etbControlPin2;
|
||||||
|
pin_output_mode_e electronicThrottlePin1Mode;
|
||||||
|
|
||||||
|
float etbPFactor;
|
||||||
|
float etbIFactor;
|
||||||
|
|
||||||
|
float[9] unusedADC;
|
||||||
|
|
||||||
|
|
||||||
brain_input_pin_e[3 iterate] triggerInputPins;
|
brain_input_pin_e[3 iterate] triggerInputPins;
|
||||||
|
|
Loading…
Reference in New Issue