aboutsummaryrefslogtreecommitdiff
path: root/trygvisio_soil_moisture.ino
diff options
context:
space:
mode:
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
}
}
}