Plausibility delay for SDC measurement
This commit is contained in:
parent
02fb39669a
commit
a4fd5d26f5
|
@ -88,6 +88,16 @@ static void loop_delay() {
|
||||||
}
|
}
|
||||||
last_loop = HAL_GetTick();
|
last_loop = HAL_GetTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void update_sdc() {
|
||||||
|
static int last[2] = {0, 0};
|
||||||
|
int current = HAL_GPIO_ReadPin(SDC_VOLTAGE_GPIO_Port, SDC_VOLTAGE_Pin) == GPIO_PIN_SET;
|
||||||
|
if (last[0] == last[1] && last[0] == current) {
|
||||||
|
sdc_closed = current;
|
||||||
|
}
|
||||||
|
last[0] = last[1];
|
||||||
|
last[1] = current;
|
||||||
|
}
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,8 +148,7 @@ int main(void)
|
||||||
/* USER CODE END WHILE */
|
/* USER CODE END WHILE */
|
||||||
|
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
sdc_closed = HAL_GPIO_ReadPin(SDC_VOLTAGE_GPIO_Port, SDC_VOLTAGE_Pin) ==
|
update_sdc();
|
||||||
GPIO_PIN_SET;
|
|
||||||
|
|
||||||
slaves_check();
|
slaves_check();
|
||||||
shunt_check();
|
shunt_check();
|
||||||
|
|
Loading…
Reference in New Issue