From c5b64ff2f10046b5c82b55e12a13b7bdad62c5c1 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Fri, 10 Apr 2009 17:24:10 +0200 Subject: pressure_control: Refetch the state, if the device rebooted. Signed-off-by: Michael Buesch --- pressure_control/firmware/main.c | 2 ++ pressure_control/firmware/remote.c | 9 +++++++++ pressure_control/firmware/remote.h | 2 ++ 3 files changed, 13 insertions(+) (limited to 'pressure_control/firmware') 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); -- cgit v1.2.3