parent
c86d9c4f43
commit
164219c942
42
Src/util.c
42
Src/util.c
|
@ -201,27 +201,27 @@ static uint8_t standstillAcv = 0;
|
||||||
/* =========================== Retargeting printf =========================== */
|
/* =========================== Retargeting printf =========================== */
|
||||||
/* retarget the C library printf function to the USART */
|
/* retarget the C library printf function to the USART */
|
||||||
#if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3)
|
#if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||||
#else
|
#else
|
||||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||||
|
#endif
|
||||||
|
PUTCHAR_PROTOTYPE {
|
||||||
|
#if defined(DEBUG_SERIAL_USART2)
|
||||||
|
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000);
|
||||||
|
#elif defined(DEBUG_SERIAL_USART3)
|
||||||
|
HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 1000);
|
||||||
#endif
|
#endif
|
||||||
PUTCHAR_PROTOTYPE {
|
return ch;
|
||||||
#if defined(DEBUG_SERIAL_USART2)
|
}
|
||||||
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000);
|
|
||||||
#elif defined(DEBUG_SERIAL_USART3)
|
#ifdef __GNUC__
|
||||||
HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 1000);
|
int _write(int file, char *data, int len) {
|
||||||
#endif
|
int i;
|
||||||
return ch;
|
for (i = 0; i < len; i++) { __io_putchar( *data++ );}
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef __GNUC__
|
|
||||||
int _write(int file, char *data, int len) {
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < len; i++) { __io_putchar( *data++ );}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,7 +572,9 @@ void adcCalibLim(void) {
|
||||||
HAL_Delay(5);
|
HAL_Delay(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3)
|
||||||
printf("Input1 is ");
|
printf("Input1 is ");
|
||||||
|
#endif
|
||||||
INPUT1_TYP_CAL = checkInputType(INPUT1_MIN_temp, INPUT1_MID_temp, INPUT1_MAX_temp);
|
INPUT1_TYP_CAL = checkInputType(INPUT1_MIN_temp, INPUT1_MID_temp, INPUT1_MAX_temp);
|
||||||
if (INPUT1_TYP_CAL == INPUT1_TYPE || INPUT1_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto)
|
if (INPUT1_TYP_CAL == INPUT1_TYPE || INPUT1_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto)
|
||||||
INPUT1_MIN_CAL = INPUT1_MIN_temp + INPUT_MARGIN;
|
INPUT1_MIN_CAL = INPUT1_MIN_temp + INPUT_MARGIN;
|
||||||
|
@ -588,7 +590,9 @@ void adcCalibLim(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3)
|
||||||
printf("Input2 is ");
|
printf("Input2 is ");
|
||||||
|
#endif
|
||||||
INPUT2_TYP_CAL = checkInputType(INPUT2_MIN_temp, INPUT2_MID_temp, INPUT2_MAX_temp);
|
INPUT2_TYP_CAL = checkInputType(INPUT2_MIN_temp, INPUT2_MID_temp, INPUT2_MAX_temp);
|
||||||
if (INPUT2_TYP_CAL == INPUT2_TYPE || INPUT2_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto)
|
if (INPUT2_TYP_CAL == INPUT2_TYPE || INPUT2_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto)
|
||||||
INPUT2_MIN_CAL = INPUT2_MIN_temp + INPUT_MARGIN;
|
INPUT2_MIN_CAL = INPUT2_MIN_temp + INPUT_MARGIN;
|
||||||
|
|
Loading…
Reference in New Issue