From 67b1ba7ea0a86eac679eafc8c724fcb6bb4f8c4f Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 21 Jun 2015 19:15:37 +0200 Subject: o Letting each sensor use the configured update interval. o Changing the ID of the "get value" command. It has to include the sensor index when used as a notification message. Dunno if this is the best strategy. I guess messages are cheap, but complexity is expensive. --- app.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app.h') diff --git a/app.h b/app.h index 6c48aa4..26e52cb 100644 --- a/app.h +++ b/app.h @@ -7,14 +7,18 @@ #define SENSOR_NAME_LEN 10 +// TODO: Randomize these numbers. There are no reason why they should be in order. + enum sm_cmd_code { SM_CMD_GET_SENSOR_COUNT = 1, - SM_CMD_GET_VALUE = 2, + // Used to be 2 + SM_CMD_GET_VALUE = 8, SM_CMD_SET_WARNING_VALUE = 3, SM_CMD_GET_WARNING_VALUE = 4, SM_CMD_SET_SENSOR_NAME = 5, SM_CMD_GET_SENSOR_NAME = 6, SM_CMD_SET_UPDATE_INTERVAL = 7, + // 8 is used SM_CMD_FAIL = 255, }; @@ -29,7 +33,11 @@ struct sm_get_value_req { uint8_t sensor; }; +/** + * This includes the sensor id because it can be used as a notification too + */ struct sm_get_value_res { + uint8_t sensor; uint16_t value; }; @@ -126,4 +134,3 @@ void write_res(struct sm_res const& res); #endif // vim: set ft=arduino: - -- cgit v1.2.3