Skip to content

Event doesn't always cancel #8

Description

@lukehold

Hi,

Great package but I'm seeing mixed results with cancelling the stream. I'm recording actions and my app grabs the pitch and roll at the start of a record session, then records events and deducts this first event from each record. I do this because the phone could be at any angle to start with and it needs to be normalised. So grabbing a first value of pitch and roll is vital, and hence I need the stream to close so it doesn't keep updating this value. I use:

_vectorStream = AeyriumSensor.sensorEvents.listen(
      (SensorEvent event) {
        if (event.pitch != null) {
          _sensorVectorOffset = Vector(event.pitch, event.roll);
          _vectorStream.cancel();
        }
      },
    );

Usually this works for the first four or five attempts and then after that it no longer closes the stream, and starts overriding this offset value.

Can you please advise what the issue is and how to close your stream consistently?

Luke

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions