From 1776fd3bd3d539dcf17f00d5ee4cd9f2ef672c12 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 14 Nov 2024 22:07:53 -0800 Subject: [PATCH 1/5] docs: added documentation to private members of class DataUpload documented exitState, can_upload, initSuccess --- src/cellular/dataUpload.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cellular/dataUpload.hpp b/src/cellular/dataUpload.hpp index dac4bafc..13fe4d25 100644 --- a/src/cellular/dataUpload.hpp +++ b/src/cellular/dataUpload.hpp @@ -44,9 +44,24 @@ class DataUpload : public Task{ void exit(void); private: + /** + * @brief Stores if data upload state successfully initializes. + * Variable storing 1 if system successfully enters data upload state, or 0 if system times out + * before entering data upload state. + */ int initSuccess; system_tick_t lastConnectTime; + /** + * @brief Exits data upload state. + * Function ends data upload process then enters deep sleep state. + */ STATES_e exitState(void); + /** + * @brief Identifies if data upload is possible. + * Returns that the data upload is possible if: the recorder has data, is connected to a cloud + * service, is not in water, and the battery has enough voltage for an upload. Otherwise, + * changes current state from upload state to deep sleep, or deployed if currently in water. + */ STATES_e can_upload(void); }; #endif \ No newline at end of file From c926f212c53b3e385c55a1b61574d8f6ab9332e3 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 21 Nov 2024 22:38:00 -0800 Subject: [PATCH 2/5] fix: in DataUpload, commented unused function & added docs documented initSuccess, and canUpload commented out exitState (unused function) --- src/cellular/dataUpload.cpp | 5 ++++- src/cellular/dataUpload.hpp | 11 ++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cellular/dataUpload.cpp b/src/cellular/dataUpload.cpp index fe2d626b..10af155e 100644 --- a/src/cellular/dataUpload.cpp +++ b/src/cellular/dataUpload.cpp @@ -157,7 +157,10 @@ void DataUpload::exit(void) } } +// In smartfin-fw2/src/dataUpload::DataUpload::exitState(void), we return based on the water sensor state. If the system is in the water, we redeploy, otherwise we go to sleep. +/* STATES_e DataUpload::exitState(void) { return STATE_DEEP_SLEEP; -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/src/cellular/dataUpload.hpp b/src/cellular/dataUpload.hpp index 13fe4d25..e6a3830d 100644 --- a/src/cellular/dataUpload.hpp +++ b/src/cellular/dataUpload.hpp @@ -51,16 +51,13 @@ class DataUpload : public Task{ */ int initSuccess; system_tick_t lastConnectTime; - /** - * @brief Exits data upload state. - * Function ends data upload process then enters deep sleep state. - */ - STATES_e exitState(void); + //In smartfin-fw2/src/dataUpload::DataUpload::exitState(void), we return based on the water sensor state. If the system is in the water, we redeploy, otherwise we go to sleep. + //STATES_e exitState(void); /** * @brief Identifies if data upload is possible. * Returns that the data upload is possible if: the recorder has data, is connected to a cloud - * service, is not in water, and the battery has enough voltage for an upload. Otherwise, - * changes current state from upload state to deep sleep, or deployed if currently in water. + * service, is not in water, and the battery has enough voltage for an upload. If the system is currently in water, we redeploy, otherwise we go to sleep. + * @return Returns state enumeration of STATE_UPLOAD, STATE_DEEP_SLEEP, or STATE_DEPLOYED upon execution. */ STATES_e can_upload(void); }; From c083ee44bbbcb2017ae3495c3e09db52c6a4288f Mon Sep 17 00:00:00 2001 From: Tyler Date: Fri, 10 Jan 2025 00:14:04 -0800 Subject: [PATCH 3/5] docs: set a truth table for dataUpload return state dataupload returns if data upload is possible, if we should go to redeployment, or sleep, depending on if the recorder has data, if we are connected to cloud services, if we are in water, and if battery has sufficient voltage. illustrated in the docs via a truth table. --- src/cellular/dataUpload.hpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/cellular/dataUpload.hpp b/src/cellular/dataUpload.hpp index e6a3830d..11887978 100644 --- a/src/cellular/dataUpload.hpp +++ b/src/cellular/dataUpload.hpp @@ -51,12 +51,26 @@ class DataUpload : public Task{ */ int initSuccess; system_tick_t lastConnectTime; - //In smartfin-fw2/src/dataUpload::DataUpload::exitState(void), we return based on the water sensor state. If the system is in the water, we redeploy, otherwise we go to sleep. - //STATES_e exitState(void); /** * @brief Identifies if data upload is possible. - * Returns that the data upload is possible if: the recorder has data, is connected to a cloud - * service, is not in water, and the battery has enough voltage for an upload. If the system is currently in water, we redeploy, otherwise we go to sleep. + * | recorder has data | connected to cloud service | in water | battery has sufficient voltage | data upload is possible | smartfin redeploys | smartfin goes to sleep | + * |-------------------|----------------------------|----------|--------------------------------|-------------------------|--------------------|------------------------| + * | 0 | 0 | 0 | 0 | 0 | 0 | 1 | + * | 0 | 0 | 0 | 1 | 0 | 0 | 1 | + * | 0 | 0 | 1 | 0 | 0 | 0 | 1 | + * | 0 | 0 | 1 | 1 | 0 | 0 | 1 | + * | 0 | 1 | 0 | 0 | 0 | 0 | 1 | + * | 0 | 1 | 0 | 1 | 0 | 0 | 1 | + * | 0 | 1 | 1 | 0 | 0 | 0 | 1 | + * | 0 | 1 | 1 | 1 | 0 | 0 | 1 | + * | 1 | 0 | 0 | 0 | 0 | 0 | 1 | + * | 1 | 0 | 0 | 1 | 0 | 0 | 1 | + * | 1 | 0 | 1 | 0 | 0 | 0 | 1 | + * | 1 | 0 | 1 | 1 | 0 | 0 | 1 | + * | 1 | 1 | 0 | 0 | 0 | 0 | 1 | + * | 1 | 1 | 0 | 1 | 1 | 0 | 0 | + * | 1 | 1 | 1 | 0 | 0 | 1 | 0 | + * | 1 | 1 | 1 | 1 | 0 | 1 | 0 | * @return Returns state enumeration of STATE_UPLOAD, STATE_DEEP_SLEEP, or STATE_DEPLOYED upon execution. */ STATES_e can_upload(void); From c6651aa8381f79594b87c862e0c2d7026bc455df Mon Sep 17 00:00:00 2001 From: Tyler Date: Sat, 11 Jan 2025 23:03:00 -0800 Subject: [PATCH 4/5] docs: new table for DataUpload return state updated table for DataUpload on return state of smartfin for clarity --- src/cellular/dataUpload.hpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/cellular/dataUpload.hpp b/src/cellular/dataUpload.hpp index 11887978..5fcc1309 100644 --- a/src/cellular/dataUpload.hpp +++ b/src/cellular/dataUpload.hpp @@ -53,24 +53,11 @@ class DataUpload : public Task{ system_tick_t lastConnectTime; /** * @brief Identifies if data upload is possible. - * | recorder has data | connected to cloud service | in water | battery has sufficient voltage | data upload is possible | smartfin redeploys | smartfin goes to sleep | - * |-------------------|----------------------------|----------|--------------------------------|-------------------------|--------------------|------------------------| - * | 0 | 0 | 0 | 0 | 0 | 0 | 1 | - * | 0 | 0 | 0 | 1 | 0 | 0 | 1 | - * | 0 | 0 | 1 | 0 | 0 | 0 | 1 | - * | 0 | 0 | 1 | 1 | 0 | 0 | 1 | - * | 0 | 1 | 0 | 0 | 0 | 0 | 1 | - * | 0 | 1 | 0 | 1 | 0 | 0 | 1 | - * | 0 | 1 | 1 | 0 | 0 | 0 | 1 | - * | 0 | 1 | 1 | 1 | 0 | 0 | 1 | - * | 1 | 0 | 0 | 0 | 0 | 0 | 1 | - * | 1 | 0 | 0 | 1 | 0 | 0 | 1 | - * | 1 | 0 | 1 | 0 | 0 | 0 | 1 | - * | 1 | 0 | 1 | 1 | 0 | 0 | 1 | - * | 1 | 1 | 0 | 0 | 0 | 0 | 1 | - * | 1 | 1 | 0 | 1 | 1 | 0 | 0 | - * | 1 | 1 | 1 | 0 | 0 | 1 | 0 | - * | 1 | 1 | 1 | 1 | 0 | 1 | 0 | + * + * | | Return State | | | + * |----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | | data upload is possible | smartfin redeploys | smartfin goes to sleep | + * | required conditions: | All of the following conditions must be met:

- Recorder has data is TRUE
- Connected to cloud is TRUE
- In water is FALSE
- Sufficient voltage is TRUE | All of the following conditions must be met:

- Recorder has data is TRUE
- Connected to cloud is TRUE
- In water is TRUE
- Sufficient voltage: TRUE or FALSE | Any one of the conditions are met:

- Recorder has data is FALSE
- Connected to cloud is FALSE
- In water is FALSE at the same time sufficient voltage is FALSE | * @return Returns state enumeration of STATE_UPLOAD, STATE_DEEP_SLEEP, or STATE_DEPLOYED upon execution. */ STATES_e can_upload(void); From 351efa3271ae96747a008ec980f3ecbe3aaaea74 Mon Sep 17 00:00:00 2001 From: Tyler Date: Sat, 11 Jan 2025 23:10:07 -0800 Subject: [PATCH 5/5] docs: fixed spelling mistake in dataUpload.hpp --- src/cellular/dataUpload.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cellular/dataUpload.hpp b/src/cellular/dataUpload.hpp index b004ea2c..e740a3ee 100644 --- a/src/cellular/dataUpload.hpp +++ b/src/cellular/dataUpload.hpp @@ -79,7 +79,7 @@ class DataUpload : public Task * |----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| * | | data upload is possible | smartfin redeploys | smartfin goes to sleep | * | required conditions: | All of the following conditions must be met:

- Recorder has data is TRUE
- Connected to cloud is TRUE
- In water is FALSE
- Sufficient voltage is TRUE | All of the following conditions must be met:

- Recorder has data is TRUE
- Connected to cloud is TRUE
- In water is TRUE
- Sufficient voltage: TRUE or FALSE | Any one of the conditions are met:

- Recorder has data is FALSE
- Connected to cloud is FALSE
- In water is FALSE at the same time sufficient voltage is FALSE | - * @return Returns current state indicationg upload readiness in form of state enumeration of STATE_UPLOAD, STATE_DEEP_SLEEP, or STATE_DEPLOYED upon execution. + * @return Returns current state indicating upload readiness in form of state enumeration of STATE_UPLOAD, STATE_DEEP_SLEEP, or STATE_DEPLOYED upon execution. */ STATES_e can_upload(void); };