Bath-Biodevices-Without-Borders / Bath-Biodevices-Without-Borders/System
Improve how stable index is found
- Dominant language
- C++
- Stars
- 1
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
# Improve how stable index is found
## Problem
Currently, the program finds the first index where the difference between the current and previous value are less than a given value for each readings array. The program then finds the maximum index.
The problem is is that the data could be unstable, then stable, then unstable once more. In addition, the readings could never be stable. To solve this, the program needs to search through the array to find the range of values where the difference between the minimum and maximum value in that range are less than a given value.
In addition, the given values used to determine if the reading range is stable needs to be researched for each sensor.
Investigation needs to be conducted into this problem. For a starting point, I recommend learning about control systems and how electromechanical devices stabilize using feedback loops.
## Current Operation
The function takes seven parameters: an integer `numOfReadings` representing the number of readings, and six pointers to arrays of floating-point numbers representing the readings from different sensors.
The function starts by finding the index of the first stable reading for each sensor. It does this by calling the `findStableIndex()` function for each sensor's readings. The `findStableIndex()` function takes three parameters: a pointer to an array of readings, the number of readings, and a value that determines whether a reading is considered stable. If the difference between a reading and the previous reading is greater than this value, the reading is considered unstable. The `findStableIndex()` function returns the index of the first stable reading in the array.
Once the function has found the index of the first stable reading for each sensor, it finds the maximum of these indices. This is done using the max() function, which returns the maximum of two values. The maximum index is considered to be the index of the first stable reading across all sensors. This is because if a reading is stable for one sensor but not for another, it is not considered stable overall.
Finally, the function returns the index of the first stable reading across all sensors. This index can be used to ignore the initial unstable readings from each sensor and only consider the stable readings for further processing.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating findStableIndex() and the function that processes the six sensor-reading arrays; review how max() combines the returned indices. Investigate control-system feedback and sensor-specific stability thresholds, then define the range-search behavior, including what happens when readings never become stable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100