From 08f269afd4926edca9cdfd00c3d15d419e6c87a4 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 4 Jan 2015 23:43:14 +0100 Subject: 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. --- trygvisio_soil_moisture.ino | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'trygvisio_soil_moisture.ino') 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 } } } -- cgit v1.2.3