Skip to content

Commit

Permalink
detect head motion event
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiGong-dev committed Dec 12, 2021
1 parent 420a595 commit 48d880e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,19 @@ class _MyHomePageState extends State<MyHomePage> {
_attitudeRollReading = event["roll"];
_attitudeYawReading = event["yaw"];
});
if (_currentMotionType != _lastMotionType &&
_currentMotionType != "still") {
// ignore: todo
//todo: handle motion event
debugPrint("$_currentMotionType once");
}
_updateMotionType();
});
}

// _updateMotionType() {
// _lastMotionType = _currentMotionType;
// }
_updateMotionType() {
_lastMotionType = _currentMotionType;
}

double _max(Map attitudeMap) {
double pitch = attitudeMap["pitch"];
Expand Down Expand Up @@ -190,9 +197,6 @@ class _MyHomePageState extends State<MyHomePage> {
Yaw: $_attitudeYawReading
type: $_currentMotionType
'''),
if (_currentMotionType != _lastMotionType &&
_currentMotionType != "still")
Text("motion type: $_currentMotionType"),
if (_sensorAvailable == 'true' &&
_attitudeRollReading == 0 &&
_attitudePitchReading == 0 &&
Expand Down

0 comments on commit 48d880e

Please sign in to comment.