delay enabling frontend after end of sending

This commit is contained in:
2020-11-26 09:42:51 +01:00
parent 7a12bba4df
commit 73c1360978
2 changed files with 32 additions and 10 deletions

View File

@ -28,17 +28,17 @@ void frontendSetThreshold(int32_t threshold) {
void frontendEnable() {
frontendEnabled = true;
show(DEBUG_1, ON);
}
void frontendDisable() {
frontendEnabled = false;
show(DEBUG_1, OFF);
}
void frontendAdcCallback(ADC_HandleTypeDef* hadc) {
static int32_t holdValue = 0;
// show(DEBUG_2, TOGGLE);
if (frontendEnabled) {
int32_t currentValue = (int32_t) HAL_ADC_GetValue(hadc);
@ -52,10 +52,8 @@ void frontendAdcCallback(ADC_HandleTypeDef* hadc) {
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_SET);
}
} else {
if (holdValue != 0) {
holdValue = 0;
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_SET);
}
holdValue = 0;
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_SET);
}
}