summaryrefslogtreecommitdiffstats
path: root/pressure_control
diff options
context:
space:
mode:
Diffstat (limited to 'pressure_control')
-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
-rwxr-xr-xpressure_control/remote/pctl-remote26
5 files changed, 56 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));
diff --git a/pressure_control/remote/pctl-remote b/pressure_control/remote/pctl-remote
index ab8d023..e98cc48 100755
--- a/pressure_control/remote/pctl-remote
+++ b/pressure_control/remote/pctl-remote
@@ -59,6 +59,8 @@ MSG_SET_VALVE = 16
MSG_RESTARTED = 17
MSG_SHUTDOWN = 18
MSG_TURNON = 19
+MSG_GET_MAXIMA = 20
+MSG_MAXIMA = 21
# Message flags
MSG_FLAG_QOVERFLOW = 0x40
MSG_FLAG_REQ_ERRCODE = 0x80
@@ -667,6 +669,30 @@ class MainWidget(QWidget):
return False
self.parseCurrentPressureMsg(reply)
+ # Get the X/Y maxima
+ reply = remote.sendMessageSyncReply(MSG_GET_MAXIMA, 0, "%c" % 0,
+ MSG_MAXIMA)
+ if not reply:
+ print "Failed to fetch X/Y maxima. No reply."
+ return False
+ reply = remote.getPayload(reply)
+ pressureMbar = ord(reply[0]) | (ord(reply[1]) << 8)
+ hysteresisMbar = ord(reply[2]) | (ord(reply[3]) << 8)
+ self.xy.pressureSpin.setMaximum(float(pressureMbar) / 1000)
+ self.xy.hystSpin.setMaximum(float(pressureMbar) / 1000)
+
+ # Get the Z maxima
+ reply = remote.sendMessageSyncReply(MSG_GET_MAXIMA, 0, "%c" % 1,
+ MSG_MAXIMA)
+ if not reply:
+ print "Failed to fetch Z maxima. No reply."
+ return False
+ reply = remote.getPayload(reply)
+ pressureMbar = ord(reply[0]) | (ord(reply[1]) << 8)
+ hysteresisMbar = ord(reply[2]) | (ord(reply[3]) << 8)
+ self.z.pressureSpin.setMaximum(float(pressureMbar) / 1000)
+ self.z.hystSpin.setMaximum(float(pressureMbar) / 1000)
+
# Get the desired pressure
reply = remote.sendMessageSyncReply(MSG_GET_DESIRED_PRESSURE, 0, "",
MSG_DESIRED_PRESSURE)
bues.ch cgit interface