I'm trying to use Acceleremeter and Orientation sensors. Together. By Erel sample, where all sensor types can be added, with shared Sub Sensor_SensorChanged (Values() As Float).
When i was debugging the code of accel only - all was OK as usual. But when i have added Orientation sensor also - values of the acceleromer sometimes are BIGGER than its Sensor.MaxValue !!!
And big values are only if to save them into a map (AccelData):
And check later in Timer_Tick sub.
Anyone touched such issue ? Any help ? Exact calculations are not possible now... :-(
When i was debugging the code of accel only - all was OK as usual. But when i have added Orientation sensor also - values of the acceleromer sometimes are BIGGER than its Sensor.MaxValue !!!
And big values are only if to save them into a map (AccelData):
B4X:
Sub Sensor_SensorChanged (Values() As Float)
Dim ps As PhoneSensors
Dim sd As SensorData
ps = Sender
sd = SensorsMap.Get(ps) 'Get the associated SensorData obejct
Dim stamp As Long = DateTime.Now
If sd.Name.Contains("ACCELEROMETER") Then
AccelMAX = ps.MaxValue
AccelData.Put(stamp, Values)
If AccelData.Size > 10 Then
AccelData.Remove(AccelData.GetKeyAt(0))
End If
Else If sd.Name.Contains("ORIENTATION") Then 'MAGNETIC
CompassData.Put(stamp, Values)
'Log(sd.Name & " X=" & Values(0))
If CompassData.Size > 10 Then
CompassData.Remove(CompassData.GetKeyAt(0))
End If
End If
End Sub
And check later in Timer_Tick sub.
Anyone touched such issue ? Any help ? Exact calculations are not possible now... :-(
Last edited: