mirror of https://github.com/rusefi/rusefi-1.git
fix type mismatch (#1808)
* fix type mismatch * comment * change field * switch to efitimesec16_t * add typedef * add type to configdefinition * build
This commit is contained in:
parent
a9608f9bd2
commit
8ebdf6fcdc
|
@ -28,6 +28,7 @@ typedef unsigned int time_t;
|
||||||
|
|
||||||
// time in seconds
|
// time in seconds
|
||||||
typedef time_t efitimesec_t;
|
typedef time_t efitimesec_t;
|
||||||
|
typedef uint16_t efitimesec16_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* integer time in milliseconds (1/1_000 of a second)
|
* integer time in milliseconds (1/1_000 of a second)
|
||||||
|
|
|
@ -6,5 +6,6 @@ EXTERN_ENGINE;
|
||||||
ButtonDebounce startStopButtonDebounce;
|
ButtonDebounce startStopButtonDebounce;
|
||||||
|
|
||||||
void initStartStopButton(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void initStartStopButton(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
startStopButtonDebounce.init(CONFIG(startCrankingDuration), &CONFIG(startStopButtonPin), &CONFIG(startStopButtonMode));
|
/* startCrankingDuration is efitimesec_t, so we need to multiply by 1000 to get milliseconds */
|
||||||
|
startStopButtonDebounce.init((CONFIG(startCrankingDuration)*1000), &CONFIG(startStopButtonPin), &CONFIG(startStopButtonMode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
ButtonDebounce* ButtonDebounce::s_firstDebounce = nullptr;
|
ButtonDebounce* ButtonDebounce::s_firstDebounce = nullptr;
|
||||||
|
|
||||||
void ButtonDebounce::init (int t, brain_pin_e *pin, pin_input_mode_e *mode) {
|
void ButtonDebounce::init (efitimems_t t, brain_pin_e *pin, pin_input_mode_e *mode) {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
ButtonDebounce *listItem = s_firstDebounce;
|
ButtonDebounce *listItem = s_firstDebounce;
|
||||||
if (listItem == nullptr) {
|
if (listItem == nullptr) {
|
||||||
|
|
|
@ -13,13 +13,13 @@
|
||||||
|
|
||||||
class ButtonDebounce {
|
class ButtonDebounce {
|
||||||
public:
|
public:
|
||||||
void init(int t, brain_pin_e *p, pin_input_mode_e *m);
|
void init(efitimems_t t, brain_pin_e *p, pin_input_mode_e *m);
|
||||||
void updateConfiguration();
|
void updateConfiguration();
|
||||||
bool readPinEvent();
|
bool readPinEvent();
|
||||||
bool readPinState();
|
bool readPinState();
|
||||||
static void updateConfigurationList();
|
static void updateConfigurationList();
|
||||||
private:
|
private:
|
||||||
int threshold;
|
efitick_t threshold;
|
||||||
efitick_t timeLast;
|
efitick_t timeLast;
|
||||||
brain_pin_e *pin;
|
brain_pin_e *pin;
|
||||||
brain_pin_e active_pin;
|
brain_pin_e active_pin;
|
||||||
|
|
|
@ -813,7 +813,7 @@ custom uart_device_e 1 bits,U32, @OFFSET@, [0:1], "Off", "UART1", "UART2", "UA
|
||||||
uint16_t tps1SecondaryMin;;"ADC", 1, 0, 0, 1000, 0
|
uint16_t tps1SecondaryMin;;"ADC", 1, 0, 0, 1000, 0
|
||||||
uint16_t tps1SecondaryMax;;"ADC", 1, 0, 0, 1000, 0
|
uint16_t tps1SecondaryMax;;"ADC", 1, 0, 0, 1000, 0
|
||||||
int16_t antiLagRpmTreshold;;"rpm", 1, 0, 0, 20000, 0
|
int16_t antiLagRpmTreshold;;"rpm", 1, 0, 0, 20000, 0
|
||||||
int16_t startCrankingDuration;Maximum time to crank starter;"Seconds", 1, 0, 0, 30, 0
|
efitimesec16_t startCrankingDuration;Maximum time to crank starter;"Seconds", 1, 0, 0, 30, 0
|
||||||
|
|
||||||
brain_pin_e triggerErrorPin;+This pin is used for debugging - snap a logic analyzer on it and see if it's ever high
|
brain_pin_e triggerErrorPin;+This pin is used for debugging - snap a logic analyzer on it and see if it's ever high
|
||||||
pin_output_mode_e triggerErrorPinMode;
|
pin_output_mode_e triggerErrorPinMode;
|
||||||
|
|
Binary file not shown.
|
@ -15,6 +15,7 @@ public class TypesHelper {
|
||||||
private static final String FLOAT_T = "float";
|
private static final String FLOAT_T = "float";
|
||||||
private static final String INT_32_T = "int";
|
private static final String INT_32_T = "int";
|
||||||
private static final String UINT_32_T = "uint32_t";
|
private static final String UINT_32_T = "uint32_t";
|
||||||
|
private static final String EFITIMESEC_16_T = "efitimesec16_t";
|
||||||
|
|
||||||
public static int getElementSize(ReaderState state, String type) {
|
public static int getElementSize(ReaderState state, String type) {
|
||||||
Objects.requireNonNull(state);
|
Objects.requireNonNull(state);
|
||||||
|
@ -51,7 +52,9 @@ public class TypesHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPrimitive2byte(String type) {
|
private static boolean isPrimitive2byte(String type) {
|
||||||
return type.equals(INT_16_T) || type.equals(UINT_16_T);
|
return type.equals(INT_16_T)
|
||||||
|
|| type.equals(UINT_16_T)
|
||||||
|
|| type.equals(EFITIMESEC_16_T);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPrimitive4byte(String type) {
|
private static boolean isPrimitive4byte(String type) {
|
||||||
|
@ -72,6 +75,8 @@ public class TypesHelper {
|
||||||
return "S16";
|
return "S16";
|
||||||
if (UINT_16_T.equals(type))
|
if (UINT_16_T.equals(type))
|
||||||
return "U16";
|
return "U16";
|
||||||
|
if (EFITIMESEC_16_T.equals(type))
|
||||||
|
return "U16";
|
||||||
if (INT8_T.equals(type))
|
if (INT8_T.equals(type))
|
||||||
return "S08";
|
return "S08";
|
||||||
if (UINT8_T.equals(type))
|
if (UINT8_T.equals(type))
|
||||||
|
|
Loading…
Reference in New Issue