Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
probstlukas committed Dec 26, 2023
1 parent f59eef7 commit bd24516
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions open_earable/lib/apps/jump_height_test/jump_height_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class _JumpHeightChartState extends State<JumpHeightChart> {
});
}

/// Calculates the height of the jump.
DataValue _calculateHeightData(XYZValue accValue) {
// Subtract gravity to get acceleration due to movement.
double currentAcc = accValue._z * cos(_pitch) + accValue._x * sin(_pitch) - _gravity;;
Expand All @@ -143,6 +144,7 @@ class _JumpHeightChartState extends State<JumpHeightChart> {
return Jump(DateTime.fromMillisecondsSinceEpoch(accValue._timestamp), _height);
}

/// Updates the data of the chart.
_updateData(DataValue value) {
setState(() {
_data.add(value);
Expand All @@ -162,6 +164,7 @@ class _JumpHeightChartState extends State<JumpHeightChart> {
});
}

/// Gets the color of the chart lines.
_getColor(String title) {
switch (title) {
case "Height Data":
Expand Down Expand Up @@ -194,6 +197,7 @@ class _JumpHeightChartState extends State<JumpHeightChart> {
_dataSubscription?.cancel();
}

/// Checks the length of the data an removes the oldest data if it is too long.
_checkLength(data) {
if (data.length > _numDatapoints) {
data.removeRange(0, data.length - _numDatapoints);
Expand Down

0 comments on commit bd24516

Please sign in to comment.