From 76fc555eeecb70598bcaaab4b72beb5637f0fa87 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 23 Jul 2009 22:17:06 +0200 Subject: pressure_control: Introduce hardcoded absolute maximum values Signed-off-by: Michael Buesch --- pressure_control/firmware/main.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/pressure_control/firmware/main.c b/pressure_control/firmware/main.c index 436b3d8..9f6cdd9 100644 --- a/pressure_control/firmware/main.c +++ b/pressure_control/firmware/main.c @@ -44,25 +44,34 @@ struct pressure_config cfg_z; struct pressure_state state; /* The 1000Hz jiffies counter */ static jiffies_t jiffies_counter; +/* The sensor that we're currently handling. */ +static uint8_t sensor_cycle; + +/* The hardware definitions. */ 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< XY_MAX_PRESSURE) + cfg_xy.desired = XY_MAX_PRESSURE; + if (cfg_xy.hysteresis > XY_MAX_HYSTERESIS) + cfg_xy.hysteresis = XY_MAX_HYSTERESIS; + memcpy(&cfg_z, new_z, sizeof(cfg_z)); + if (cfg_z.desired > Z_MAX_PRESSURE) + cfg_z.desired = Z_MAX_PRESSURE; + if (cfg_z.hysteresis > Z_MAX_HYSTERESIS) + cfg_z.hysteresis = Z_MAX_HYSTERESIS; + eeprom_store_config(); irq_restore(sreg); } -- cgit v1.2.3