aboutsummaryrefslogtreecommitdiff
path: root/trygvisio_soil_moisture.ino
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-01-04 23:43:14 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-01-04 23:43:14 +0100
commit08f269afd4926edca9cdfd00c3d15d419e6c87a4 (patch)
tree75554752ddc85f55c8a1be36ea7e4ae0191d7300 /trygvisio_soil_moisture.ino
parent2f50ae8864aa2ba9e5807432eb878552389a9cb2 (diff)
downloadtrygvisio_soil_moisture-08f269afd4926edca9cdfd00c3d15d419e6c87a4.tar.gz
trygvisio_soil_moisture-08f269afd4926edca9cdfd00c3d15d419e6c87a4.tar.bz2
trygvisio_soil_moisture-08f269afd4926edca9cdfd00c3d15d419e6c87a4.tar.xz
trygvisio_soil_moisture-08f269afd4926edca9cdfd00c3d15d419e6c87a4.zip
o Adding an operation to set the wanted update interval.
Useful for debugging to stream values and later devices where this can control how often the values are broadcasted.
Diffstat (limited to 'trygvisio_soil_moisture.ino')
-rw-r--r--trygvisio_soil_moisture.ino20
1 files changed, 12 insertions, 8 deletions
diff --git a/trygvisio_soil_moisture.ino b/trygvisio_soil_moisture.ino
index 9d9f9f9..ecadbdf 100644
--- a/trygvisio_soil_moisture.ino
+++ b/trygvisio_soil_moisture.ino
@@ -182,6 +182,8 @@ static void aci_loop() {
// Get the device version of the nRF8001 and store it in the Hardware Revision String.
// This will trigger a ACI_CMD_GET_DEVICE_VERSION.
lib_aci_device_version();
+
+ sm_on_connect();
break;
case ACI_EVT_PIPE_STATUS:
@@ -329,7 +331,7 @@ void loop() {
}
}
- on_loop();
+ sm_on_loop();
}
static void show_pipes() {
@@ -378,17 +380,15 @@ void notify_battery_level(uint8_t value) {
}
void notify_soil_moisture(const struct sm_res& res, uint8_t body_len) {
-#if SM_DEBUG == 1
- write_res(res);
-#endif
uint8_t *data = (uint8_t *)&res;
uint8_t len = SM_RES_HEADER_SIZE + body_len;
- Serial.print(F("notify_soil_moisture, code="));
- Serial.print(res.code, DEC);
- Serial.print(F(", body_len="));
- Serial.println(body_len, DEC);
+// Serial.print(F("notify_soil_moisture, code="));
+// Serial.print(res.code, DEC);
+// Serial.print(F(", body_len="));
+// Serial.println(body_len, DEC);
+
// Serial.print(F("aci_state.data_credit_available="));
// Serial.println(aci_state.data_credit_available, DEC);
@@ -400,6 +400,10 @@ void notify_soil_moisture(const struct sm_res& res, uint8_t body_len) {
boolean sent = lib_aci_send_data(pipe_tx, data, len);
if (sent) {
aci_state.data_credit_available--;
+
+#if SM_DEBUG == 1
+ write_res(res);
+#endif
}
}
}