summaryrefslogtreecommitdiffstats
path: root/pressure_control/firmware/valves.c
diff options
context:
space:
mode:
authormb <mb@frink.(none)>2009-05-03 12:55:59 +0200
committermb <mb@frink.(none)>2009-05-03 12:55:59 +0200
commit117c46526241b433abd2ce198d9a9e03c1587e7f (patch)
treed582826e918acfaaf711505557d3adec7b36a2f3 /pressure_control/firmware/valves.c
parentf6164dcedbd3c6d9ad094fd34a0ec031692385cb (diff)
downloadcnc-117c46526241b433abd2ce198d9a9e03c1587e7f.tar.xz
cnc-117c46526241b433abd2ce198d9a9e03c1587e7f.zip
pressure_control: Disarm auto-idle while pressure is low.
Signed-off-by: mb <mb@frink.(none)>
Diffstat (limited to 'pressure_control/firmware/valves.c')
-rw-r--r--pressure_control/firmware/valves.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/pressure_control/firmware/valves.c b/pressure_control/firmware/valves.c
index 86ea85b..700760a 100644
--- a/pressure_control/firmware/valves.c
+++ b/pressure_control/firmware/valves.c
@@ -59,10 +59,12 @@ void valve1_switch(uint8_t state)
void valves_global_switch(uint8_t state)
{
- if (state == current_global_state)
- return;
- current_global_state = state;
+ if (state != current_global_state)
+ __valves_global_switch(state);
+}
+void __valves_global_switch(uint8_t state)
+{
switch (state) {
case VALVES_IDLE:
valve0_switch(VALVE_STATE_12);
@@ -79,6 +81,12 @@ void valves_global_switch(uint8_t state)
}
switch_to_idle_time = get_jiffies() + msec_to_jiffies(VALVE_TOGGLE_MSEC);
need_switch_to_idle = 1;
+ current_global_state = state;
+}
+
+void valves_disarm_auto_idle(void)
+{
+ need_switch_to_idle = 0;
}
void valves_work(void)
@@ -104,7 +112,7 @@ static inline void valves_ddr_setup(void)
void valves_shutdown(void)
{
- valves_global_switch(VALVES_FLOW_OUT);
+ __valves_global_switch(VALVES_FLOW_OUT);
valve_wait_toggle();
valve0_switch(VALVE_STATE_IDLE);
valve1_switch(VALVE_STATE_IDLE);
@@ -113,7 +121,7 @@ void valves_shutdown(void)
void valves_emergency_state(void)
{
valves_ddr_setup();
- valves_global_switch(VALVES_IDLE);
+ __valves_global_switch(VALVES_IDLE);
valve_wait_toggle();
valve0_switch(VALVE_STATE_IDLE);
valve1_switch(VALVE_STATE_IDLE);
@@ -122,5 +130,5 @@ void valves_emergency_state(void)
void valves_init(void)
{
valves_ddr_setup();
- valves_global_switch(VALVES_IDLE);
+ __valves_global_switch(VALVES_IDLE);
}
bues.ch cgit interface