summaryrefslogtreecommitdiffstats
path: root/pressure_control/firmware
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-06-15 20:18:53 +0200
committerMichael Buesch <mb@bu3sch.de>2009-06-15 20:18:53 +0200
commitda6a3bc5e525a05f301937b0d12f5c41a139eaf6 (patch)
tree5324fe819428317afbb1a18576ef6d53793feba3 /pressure_control/firmware
parentde67aab07c60f73a00318ab493e61fc1bdb87ec5 (diff)
downloadcnc-da6a3bc5e525a05f301937b0d12f5c41a139eaf6.tar.xz
cnc-da6a3bc5e525a05f301937b0d12f5c41a139eaf6.zip
pressure-control: set min pressure to 0.5bar
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Diffstat (limited to 'pressure_control/firmware')
-rw-r--r--pressure_control/firmware/main.c6
-rw-r--r--pressure_control/firmware/valves.h19
2 files changed, 14 insertions, 11 deletions
diff --git a/pressure_control/firmware/main.c b/pressure_control/firmware/main.c
index 365ded8..436b3d8 100644
--- a/pressure_control/firmware/main.c
+++ b/pressure_control/firmware/main.c
@@ -45,8 +45,8 @@ struct pressure_state state;
/* The 1000Hz jiffies counter */
static jiffies_t jiffies_counter;
-DEFINE_VALVE(z_control_valves, VALVES_2MAG, D, 6, 7, 4, 5);
-DEFINE_VALVE(xy_control_valves, VALVES_1MAG, C, 2, -1, 3, -1);
+DEFINE_VALVE(z_control_valves, VALVES_2MAG, D, 6, 7, 4, 5, 0);
+DEFINE_VALVE(xy_control_valves, VALVES_1MAG, C, 2, -1, 3, -1, 400);
static DEFINE_SENSOR(z_control_sensor, 0, 245, 4400, 10000);
static DEFINE_SENSOR(xy_control_sensor, (1<<MUX0), 245, 4400, 10000);
@@ -192,7 +192,7 @@ static void do_check_pressure(struct valves *valves,
report_change = (cur_state != VALVES_IDLE);
valves_global_switch(valves, VALVES_IDLE);
}
- if (mbar < 800) {
+ if (mbar < valves->state_force_threshold) {
/* If the pressure in the reservoir is low,
* the feedforward of the pneumatic valve for
* flow-out might not work correctly. So force poke
diff --git a/pressure_control/firmware/valves.h b/pressure_control/firmware/valves.h
index 7586904..ddc043e 100644
--- a/pressure_control/firmware/valves.h
+++ b/pressure_control/firmware/valves.h
@@ -38,17 +38,20 @@ struct valves {
uint8_t current_global_state; /* enum valves_global_state */
bool need_switch_to_idle; /* Need transition to VALVE_STATE_IDLE. */
jiffies_t switch_to_idle_time; /* Deadline for VALVE_STATE_IDLE transition. */
+
+ uint16_t state_force_threshold; /* Threshold for forcing the valve state */
};
-#define DEFINE_VALVE(name, _type, portid, bit0_open, bit0_close, bit1_open, bit1_close) \
+#define DEFINE_VALVE(name, _type, portid, bit0_open, bit0_close, bit1_open, bit1_close, force_thres) \
struct valves name = { \
- .type = _type, \
- .ddr = _SFR_ADDR(DDR##portid), \
- .port = _SFR_ADDR(PORT##portid), \
- .bit_0_open = bit0_open, \
- .bit_0_close = bit0_close, \
- .bit_1_open = bit1_open, \
- .bit_1_close = bit1_close, \
+ .type = _type, \
+ .ddr = _SFR_ADDR(DDR##portid), \
+ .port = _SFR_ADDR(PORT##portid), \
+ .bit_0_open = bit0_open, \
+ .bit_0_close = bit0_close, \
+ .bit_1_open = bit1_open, \
+ .bit_1_close = bit1_close, \
+ .state_force_threshold = force_thres, \
}
#define VALVE_TOGGLE_MSEC 10
bues.ch cgit interface