@@ -12,6 +12,20 @@ config LOG_VALVE_LEVEL
|
||||
Set the log level for the Valve Library.
|
||||
0 = None, 1 = Error, 2 = Warning, 3 = Info, 4 = Debug
|
||||
|
||||
config VALVE_INTERVALL_CURRENT_CHECK_MS
|
||||
int "Interval Current Check (ms)"
|
||||
default 100
|
||||
help
|
||||
Set the interval in milliseconds for checking the motor current
|
||||
during valve operation. This is used to detect obstacles.
|
||||
|
||||
config VALVE_INITIAL_INTERVALL_CURRENT_CHECK_MS
|
||||
int "Initial Current Check (ms)"
|
||||
default 200
|
||||
help
|
||||
Set the initial delay in milliseconds before the first current check
|
||||
after starting the valve operation. This allows the motor to stabilize.
|
||||
|
||||
config VALVE_OBSTACLE_THRESHOLD_OPEN_MA
|
||||
int "Obstacle Threshold Open (mA)"
|
||||
default 200
|
||||
@@ -25,7 +39,7 @@ config VALVE_OBSTACLE_THRESHOLD_CLOSE_MA
|
||||
default 200
|
||||
help
|
||||
Set the current threshold in milliamps for obstacle detection
|
||||
during valve closing. If the motor current exceeds this value,
|
||||
during vaslve closing. If the motor current exceeds this value,
|
||||
an obstacle is detected and the valve stops.
|
||||
|
||||
endif # LIB_VALVE
|
||||
|
||||
@@ -58,7 +58,7 @@ static void valve_work_handler(struct k_work *work)
|
||||
valve_stop();
|
||||
return;
|
||||
} else if (current_ma > end_current_threshold_open_ma) {
|
||||
k_work_schedule(&valve_work, VALVE_ENDPOSITION_CHECK_INTERVAL);
|
||||
k_work_schedule(&valve_work, VALVE_CURRENT_CHECK_INTERVAL);
|
||||
return;
|
||||
}
|
||||
LOG_DBG("Valve finished opening");
|
||||
@@ -73,7 +73,7 @@ static void valve_work_handler(struct k_work *work)
|
||||
valve_stop();
|
||||
return;
|
||||
} else if (current_ma > end_current_threshold_close_ma) {
|
||||
k_work_schedule(&valve_work, VALVE_ENDPOSITION_CHECK_INTERVAL);
|
||||
k_work_schedule(&valve_work, VALVE_CURRENT_CHECK_INTERVAL);
|
||||
return;
|
||||
}
|
||||
current_state = VALVE_STATE_CLOSED;
|
||||
@@ -158,7 +158,7 @@ void valve_open(void)
|
||||
if (max_opening_time_s > 0) {
|
||||
k_timer_start(&movement_timer, K_SECONDS(max_opening_time_s), K_NO_WAIT);
|
||||
}
|
||||
k_work_schedule(&valve_work, K_MSEC(100));
|
||||
k_work_schedule(&valve_work, VALVE_INITIAL_CURRENT_CHECK_INTERVAL);
|
||||
}
|
||||
|
||||
void valve_close(void)
|
||||
@@ -171,7 +171,7 @@ void valve_close(void)
|
||||
k_timer_start(&movement_timer, K_SECONDS(max_closing_time_s), K_NO_WAIT);
|
||||
}
|
||||
current_movement = VALVE_MOVEMENT_CLOSING;
|
||||
k_work_schedule(&valve_work, VALVE_ENDPOSITION_CHECK_INTERVAL);
|
||||
k_work_schedule(&valve_work, VALVE_INITIAL_CURRENT_CHECK_INTERVAL);
|
||||
}
|
||||
|
||||
void valve_stop(void)
|
||||
|
||||
Reference in New Issue
Block a user