aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-01-11 12:24:36 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-01-11 12:24:36 +0100
commita50f58aed59d325dc73da795df2a5cf4253c171f (patch)
tree6ab9ee218e9d3e2112a1b13764b2b9d24be56389
parent9c3ff3ca4ac5eb076fd6add2e5f14c294e915567 (diff)
downloadtrygvisio_soil_moisture-a50f58aed59d325dc73da795df2a5cf4253c171f.tar.gz
trygvisio_soil_moisture-a50f58aed59d325dc73da795df2a5cf4253c171f.tar.bz2
trygvisio_soil_moisture-a50f58aed59d325dc73da795df2a5cf4253c171f.tar.xz
trygvisio_soil_moisture-a50f58aed59d325dc73da795df2a5cf4253c171f.zip
o Adding another sensor for prototype board #1.
o Fixing a bug, the values are 10 bits so they need a uint16_t to fit.
-rw-r--r--app.cpp5
-rw-r--r--app.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/app.cpp b/app.cpp
index 606864d..7c5507a 100644
--- a/app.cpp
+++ b/app.cpp
@@ -7,14 +7,14 @@
#undef PROGMEM
#define PROGMEM __attribute__((section(".progmem.data")))
-#define SENSOR_COUNT 1
+#define SENSOR_COUNT 2
// See http://redbearlab.com/blendmicro/ for pins.
struct sm_sensor {
uint8_t a_pin;
uint8_t d1_pin;
uint8_t d2_pin;
- uint8_t value;
+ uint16_t value;
uint16_t warning_value;
uint16_t update_interval;
uint8_t name_length;
@@ -22,6 +22,7 @@ struct sm_sensor {
} sensors[SENSOR_COUNT] = {
// A Pin, D1 Pin, D2 Pin, Value, Warning Value, Update Interval, Length of Name, Name
{ 8, 3, 5, 0, 10, 0, 9, 'sensor #1'},
+ { 10, 11, 12, 0, 10, 0, 9, 'sensor #2'},
};
static unsigned long next_update[SENSOR_COUNT];
diff --git a/app.h b/app.h
index 5039c0e..f1b829a 100644
--- a/app.h
+++ b/app.h
@@ -29,7 +29,7 @@ struct sm_get_value_req {
};
struct sm_get_value_res {
- uint8_t value;
+ uint16_t value;
};
struct sm_set_warning_value_req {