remove debug code
This commit is contained in:
@ -35,7 +35,6 @@ void frontendDisable() {
|
|||||||
|
|
||||||
void frontendAdcCallback(ADC_HandleTypeDef* hadc) {
|
void frontendAdcCallback(ADC_HandleTypeDef* hadc) {
|
||||||
static int32_t holdValue = 0;
|
static int32_t holdValue = 0;
|
||||||
static uint32_t cnt = 0;
|
|
||||||
|
|
||||||
HAL_GPIO_TogglePin(Debug_Signal_1_GPIO_Port, Debug_Signal_1_Pin);
|
HAL_GPIO_TogglePin(Debug_Signal_1_GPIO_Port, Debug_Signal_1_Pin);
|
||||||
|
|
||||||
@ -44,25 +43,17 @@ void frontendAdcCallback(ADC_HandleTypeDef* hadc) {
|
|||||||
|
|
||||||
if (holdValue == 0) {
|
if (holdValue == 0) {
|
||||||
holdValue = currentValue;
|
holdValue = currentValue;
|
||||||
logMsg("frontend enabled, hold: %d", holdValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentValue - holdValue > frontendAdcThreshold) {
|
if (currentValue - holdValue > frontendAdcThreshold) {
|
||||||
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_SET);
|
|
||||||
cnt++;
|
|
||||||
if (cnt > 25) {
|
|
||||||
logMsg("frontend, high: %d, hold: %d, diff: %d", currentValue, holdValue, currentValue - holdValue);
|
|
||||||
cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_RESET);
|
||||||
cnt = 0;
|
} else {
|
||||||
|
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_SET);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (holdValue != 0) {
|
if (holdValue != 0) {
|
||||||
holdValue = 0;
|
holdValue = 0;
|
||||||
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_SET);
|
||||||
logMsg("frontend disabled");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ static void handleRequestEngine(void *handle) {
|
|||||||
logMsg("hre state ENABLE_FRONTEND");
|
logMsg("hre state ENABLE_FRONTEND");
|
||||||
frontendEnable();
|
frontendEnable();
|
||||||
localMbusCommHandle->state = DISABLE_FRONTEND;
|
localMbusCommHandle->state = DISABLE_FRONTEND;
|
||||||
schAdd(handleRequestEngine, handle, 20, 0);
|
schAdd(handleRequestEngine, handle, 500, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISABLE_FRONTEND:
|
case DISABLE_FRONTEND:
|
||||||
|
Reference in New Issue
Block a user