summaryrefslogtreecommitdiffstats
path: root/pressure_control/firmware
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-04-10 17:24:10 +0200
committerMichael Buesch <mb@bu3sch.de>2009-04-10 17:24:10 +0200
commitc5b64ff2f10046b5c82b55e12a13b7bdad62c5c1 (patch)
tree8ef111c0ff769bfeb5ce643a9e1ab3ed6539514e /pressure_control/firmware
parent75a29d4d986e32bd82bc6468bba11567932a5349 (diff)
downloadcnc-c5b64ff2f10046b5c82b55e12a13b7bdad62c5c1.tar.xz
cnc-c5b64ff2f10046b5c82b55e12a13b7bdad62c5c1.zip
pressure_control: Refetch the state, if the device rebooted.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Diffstat (limited to 'pressure_control/firmware')
-rw-r--r--pressure_control/firmware/main.c2
-rw-r--r--pressure_control/firmware/remote.c9
-rw-r--r--pressure_control/firmware/remote.h2
3 files changed, 13 insertions, 0 deletions
diff --git a/pressure_control/firmware/main.c b/pressure_control/firmware/main.c
index 7cf98f4..c5f8498 100644
--- a/pressure_control/firmware/main.c
+++ b/pressure_control/firmware/main.c
@@ -181,6 +181,8 @@ int main(void)
sei();
print("Monitoring...\n");
+ remote_work();
+ remote_notify_restart();
while (1) {
mb();
if (state.sensor_trigger_cnt == 0) {
diff --git a/pressure_control/firmware/remote.c b/pressure_control/firmware/remote.c
index cb646a7..d51a58b 100644
--- a/pressure_control/firmware/remote.c
+++ b/pressure_control/firmware/remote.c
@@ -384,6 +384,15 @@ void remote_pressure_change_notification(uint16_t mbar)
send_message(&msg);
}
+void remote_notify_restart(void)
+{
+ struct remote_message msg;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.id = MSG_RESTARTED;
+ send_message(&msg);
+}
+
#if USE_2X
# define UBRR_FACTOR 2
#else
diff --git a/pressure_control/firmware/remote.h b/pressure_control/firmware/remote.h
index 14c4110..ed739eb 100644
--- a/pressure_control/firmware/remote.h
+++ b/pressure_control/firmware/remote.h
@@ -24,6 +24,7 @@ enum remote_message_id {
MSG_CONFIG_FLAGS,
MSG_SET_CONFIG_FLAGS,
MSG_SET_VALVE,
+ MSG_RESTARTED,
};
enum remote_message_error {
@@ -79,6 +80,7 @@ void print_dec_signed(int16_t number);
void print_hex(uint8_t number);
void remote_pressure_change_notification(uint16_t mbar);
+void remote_notify_restart(void);
void remote_work(void);
void remote_1khz_work(void);
bues.ch cgit interface