summaryrefslogtreecommitdiffstats
path: root/pressure_control/firmware
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2010-06-13 20:48:54 +0200
committerMichael Buesch <mb@bu3sch.de>2010-06-13 20:48:54 +0200
commitd03bf642e8285b0cf91855a66f8cdc0c642c6854 (patch)
treea8fe2551a0012e1f4420f7beb670e7fae0a2da1b /pressure_control/firmware
parent102cbd589030183125e8430ca784c56968a47638 (diff)
downloadcnc-d03bf642e8285b0cf91855a66f8cdc0c642c6854.tar.xz
cnc-d03bf642e8285b0cf91855a66f8cdc0c642c6854.zip
pressure_control: Export maxima via serial interface
Also raise Z maximum Signed-off-by: Michael Buesch <mb@bu3sch.de>
Diffstat (limited to 'pressure_control/firmware')
-rw-r--r--pressure_control/firmware/main.c5
-rw-r--r--pressure_control/firmware/main.h7
-rw-r--r--pressure_control/firmware/remote.c14
-rw-r--r--pressure_control/firmware/remote.h10
4 files changed, 30 insertions, 6 deletions
diff --git a/pressure_control/firmware/main.c b/pressure_control/firmware/main.c
index d947228..4043d54 100644
--- a/pressure_control/firmware/main.c
+++ b/pressure_control/firmware/main.c
@@ -59,11 +59,6 @@ DEFINE_VALVE_1MAG(xy_control_valves,
static DEFINE_SENSOR(z_control_sensor, 0, 245, 4400, 10000);
static DEFINE_SENSOR(xy_control_sensor, (1<<MUX0), 245, 4400, 10000);
-/* Absolute maximum pressures (in mBar). */
-#define XY_MAX_PRESSURE 3500
-#define XY_MAX_HYSTERESIS 300
-#define Z_MAX_PRESSURE 1500
-#define Z_MAX_HYSTERESIS 300
/* Report hysteresis (in mBar).
* Don't report changes lower than this (With some exceptions). */
diff --git a/pressure_control/firmware/main.h b/pressure_control/firmware/main.h
index 915e66e..ecfbf45 100644
--- a/pressure_control/firmware/main.h
+++ b/pressure_control/firmware/main.h
@@ -75,4 +75,11 @@ extern struct valves xy_control_valves;
extern struct valves z_control_valves;
+/* Absolute maximum pressures (in mBar). */
+#define XY_MAX_PRESSURE 3500
+#define XY_MAX_HYSTERESIS 300
+#define Z_MAX_PRESSURE 2500
+#define Z_MAX_HYSTERESIS 300
+
+
#endif /* MAIN_H_ */
diff --git a/pressure_control/firmware/remote.c b/pressure_control/firmware/remote.c
index f54d4f5..172c5d0 100644
--- a/pressure_control/firmware/remote.c
+++ b/pressure_control/firmware/remote.c
@@ -312,6 +312,20 @@ static void handle_received_message(void)
case MSG_TURNON:
prepare_turn_on();
break;
+ case MSG_GET_MAXIMA: {
+ reply.id = MSG_MAXIMA;
+ if (rx_msg.getmaxima.island == 0) {
+ reply.maxima.pressure = XY_MAX_PRESSURE;
+ reply.maxima.hysteresis = XY_MAX_HYSTERESIS;
+ send_message(&reply);
+ } else if (rx_msg.getmaxima.island == 1) {
+ reply.maxima.pressure = Z_MAX_PRESSURE;
+ reply.maxima.hysteresis = Z_MAX_HYSTERESIS;
+ send_message(&reply);
+ } else
+ err = MSG_ERR_INVAL;
+ break;
+ }
case MSG_INVALID:
break;
default:
diff --git a/pressure_control/firmware/remote.h b/pressure_control/firmware/remote.h
index a513d56..c942a2b 100644
--- a/pressure_control/firmware/remote.h
+++ b/pressure_control/firmware/remote.h
@@ -27,7 +27,8 @@ enum remote_message_id {
MSG_RESTARTED,
MSG_SHUTDOWN,
MSG_TURNON,
-
+ MSG_GET_MAXIMA,
+ MSG_MAXIMA,
MSG_ID_MASK = 0x3F,
MSG_FLAG_QOVERFLOW = 0x40, /* TX queue overflow */
@@ -75,6 +76,13 @@ struct remote_message {
uint8_t nr; /* Valve ID in the island */
uint8_t state;
} __attribute__((packed)) valve;
+ struct {
+ uint8_t island; /* Valve island */
+ } __attribute__((packed)) getmaxima;
+ struct {
+ uint16_t pressure;
+ uint16_t hysteresis;
+ } __attribute__((packed)) maxima;
uint8_t __padding[4];
} __attribute__((packed));
bues.ch cgit interface