Fix typo
This commit is contained in:
parent
95c912d757
commit
b50efdcab2
|
@ -62,6 +62,8 @@ extern ExtY rtY_Right; /* External outputs */
|
||||||
|
|
||||||
extern int16_t cmd1; // normalized input value. -1000 to 1000
|
extern int16_t cmd1; // normalized input value. -1000 to 1000
|
||||||
extern int16_t cmd2; // normalized input value. -1000 to 1000
|
extern int16_t cmd2; // normalized input value. -1000 to 1000
|
||||||
|
extern int16_t cmd1_in; // normalized input value. -1000 to 1000
|
||||||
|
extern int16_t cmd2_in; // normalized input value. -1000 to 1000
|
||||||
|
|
||||||
extern int16_t speedAvg; // Average measured speed
|
extern int16_t speedAvg; // Average measured speed
|
||||||
extern int16_t speedAvgAbs; // Average measured speed in absolute
|
extern int16_t speedAvgAbs; // Average measured speed in absolute
|
||||||
|
|
46
Src/util.c
46
Src/util.c
|
@ -128,23 +128,24 @@ static int16_t INPUT_MAX; // [-] Input target maximum limitation
|
||||||
static int16_t INPUT_MIN; // [-] Input target minimum limitation
|
static int16_t INPUT_MIN; // [-] Input target minimum limitation
|
||||||
|
|
||||||
|
|
||||||
static uint8_t cur_spd_valid = 0;
|
#if !defined(VARIANT_HOVERBOARD) && !defined(VARIANT_TRANSPOTTER)
|
||||||
static uint8_t adc_cal_valid = 0;
|
static uint8_t cur_spd_valid = 0;
|
||||||
static uint16_t INPUT1_MIN_CAL = INPUT1_MIN;
|
static uint8_t input_cal_valid = 0;
|
||||||
static uint16_t INPUT1_MAX_CAL = INPUT1_MAX;
|
static uint16_t INPUT1_MIN_CAL = INPUT1_MIN;
|
||||||
static uint16_t INPUT2_MIN_CAL = INPUT2_MIN;
|
static uint16_t INPUT1_MAX_CAL = INPUT1_MAX;
|
||||||
static uint16_t INPUT2_MAX_CAL = INPUT2_MAX;
|
static uint16_t INPUT2_MIN_CAL = INPUT2_MIN;
|
||||||
#ifdef INPUT1_MID_POT
|
static uint16_t INPUT2_MAX_CAL = INPUT2_MAX;
|
||||||
static uint16_t INPUT1_MID_CAL = INPUT1_MID;
|
#ifdef INPUT1_MID_POT
|
||||||
#else
|
static uint16_t INPUT1_MID_CAL = INPUT1_MID;
|
||||||
static uint16_t INPUT1_MID_CAL = 0;
|
#else
|
||||||
|
static uint16_t INPUT1_MID_CAL = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef INPUT1_MID_POT
|
||||||
|
static uint16_t INPUT2_MID_CAL = INPUT2_MID;
|
||||||
|
#else
|
||||||
|
static uint16_t INPUT2_MID_CAL = 0;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef INPUT1_MID_POT
|
|
||||||
static uint16_t INPUT2_MID_CAL = INPUT2_MID;
|
|
||||||
#else
|
|
||||||
static uint16_t INPUT2_MID_CAL = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(CONTROL_ADC) && defined(ADC_PROTECT_ENA)
|
#if defined(CONTROL_ADC) && defined(ADC_PROTECT_ENA)
|
||||||
static int16_t timeoutCntADC = 0; // Timeout counter for ADC Protection
|
static int16_t timeoutCntADC = 0; // Timeout counter for ADC Protection
|
||||||
|
@ -434,6 +435,8 @@ void adcCalibLim(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(VARIANT_HOVERBOARD) && !defined(VARIANT_TRANSPOTTER)
|
||||||
|
|
||||||
consoleLog("Input calibration started... ");
|
consoleLog("Input calibration started... ");
|
||||||
|
|
||||||
// Inititalization: MIN = a high values, MAX = a low value,
|
// Inititalization: MIN = a high values, MAX = a low value,
|
||||||
|
@ -487,6 +490,7 @@ void adcCalibLim(void) {
|
||||||
input_cal_valid = 0;
|
input_cal_valid = 0;
|
||||||
consoleLog("FAIL (Pots travel too short)\n");
|
consoleLog("FAIL (Pots travel too short)\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -502,6 +506,8 @@ void updateCurSpdLim(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(VARIANT_HOVERBOARD) && !defined(VARIANT_TRANSPOTTER)
|
||||||
|
|
||||||
consoleLog("Torque and Speed limits update started... ");
|
consoleLog("Torque and Speed limits update started... ");
|
||||||
|
|
||||||
int32_t input1_fixdt = cmd1_in << 16;
|
int32_t input1_fixdt = cmd1_in << 16;
|
||||||
|
@ -529,7 +535,7 @@ void updateCurSpdLim(void) {
|
||||||
|
|
||||||
cur_spd_valid = 1;
|
cur_spd_valid = 1;
|
||||||
consoleLog("OK\n");
|
consoleLog("OK\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -545,7 +551,7 @@ void saveConfig() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONTROL_ADC
|
#ifdef CONTROL_ADC
|
||||||
if (adc_cal_valid || cur_spd_valid) {
|
if (input_cal_valid || cur_spd_valid) {
|
||||||
HAL_FLASH_Unlock();
|
HAL_FLASH_Unlock();
|
||||||
EE_WriteVariable(VirtAddVarTab[0], FLASH_WRITE_KEY);
|
EE_WriteVariable(VirtAddVarTab[0], FLASH_WRITE_KEY);
|
||||||
EE_WriteVariable(VirtAddVarTab[1], INPUT1_MIN_CAL);
|
EE_WriteVariable(VirtAddVarTab[1], INPUT1_MIN_CAL);
|
||||||
|
@ -827,6 +833,7 @@ void readCommand(void) {
|
||||||
timeoutFlagSerial = timeoutFlagSerial_L || timeoutFlagSerial_R;
|
timeoutFlagSerial = timeoutFlagSerial_L || timeoutFlagSerial_R;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(VARIANT_HOVERBOARD) && !defined(VARIANT_TRANSPOTTER)
|
||||||
#ifdef INPUT1_MID_POT
|
#ifdef INPUT1_MID_POT
|
||||||
cmd1 = addDeadBand(cmd1_in, INPUT1_DEADBAND, INPUT1_MIN, INPUT1_MID, INPUT1_MAX, INPUT_MIN, INPUT_MAX);
|
cmd1 = addDeadBand(cmd1_in, INPUT1_DEADBAND, INPUT1_MIN, INPUT1_MID, INPUT1_MAX, INPUT_MIN, INPUT_MAX);
|
||||||
#else
|
#else
|
||||||
|
@ -840,7 +847,8 @@ void readCommand(void) {
|
||||||
cmd2 = MAP( cmd2_in , INPUT2_MIN_CAL, INPUT2_MAX_CAL, 0, INPUT_MAX ); // ADC2
|
cmd2 = MAP( cmd2_in , INPUT2_MIN_CAL, INPUT2_MAX_CAL, 0, INPUT_MAX ); // ADC2
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
cmd2 = addDeadBand(cmd2_in, INPUT2_DEADBAND, INPUT2_MIN, INPUT2_MID, INPUT2_MAX, INPUT_OUT_MIN, INPUT_MAX);
|
cmd2 = addDeadBand(cmd2_in, INPUT2_DEADBAND, INPUT2_MIN, INPUT2_MID, INPUT2_MAX, INPUT2_OUT_MIN, INPUT_MAX);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue