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:
David Holdeman 2020-09-19 16:17:44 -05:00 committed by GitHub
parent a9608f9bd2
commit 8ebdf6fcdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 6 deletions

View File

@ -28,6 +28,7 @@ typedef unsigned int time_t;
// time in seconds
typedef time_t efitimesec_t;
typedef uint16_t efitimesec16_t;
/**
* integer time in milliseconds (1/1_000 of a second)

View File

@ -6,5 +6,6 @@ EXTERN_ENGINE;
ButtonDebounce startStopButtonDebounce;
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));
}

View File

@ -12,7 +12,7 @@
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) {
ButtonDebounce *listItem = s_firstDebounce;
if (listItem == nullptr) {

View File

@ -13,13 +13,13 @@
class ButtonDebounce {
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();
bool readPinEvent();
bool readPinState();
static void updateConfigurationList();
private:
int threshold;
efitick_t threshold;
efitick_t timeLast;
brain_pin_e *pin;
brain_pin_e active_pin;

View File

@ -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 tps1SecondaryMax;;"ADC", 1, 0, 0, 1000, 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
pin_output_mode_e triggerErrorPinMode;

Binary file not shown.

View File

@ -15,6 +15,7 @@ public class TypesHelper {
private static final String FLOAT_T = "float";
private static final String INT_32_T = "int";
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) {
Objects.requireNonNull(state);
@ -51,7 +52,9 @@ public class TypesHelper {
}
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) {
@ -72,6 +75,8 @@ public class TypesHelper {
return "S16";
if (UINT_16_T.equals(type))
return "U16";
if (EFITIMESEC_16_T.equals(type))
return "U16";
if (INT8_T.equals(type))
return "S08";
if (UINT8_T.equals(type))