Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
OrientationInterpreter default settings now provide more sensitive or…
…ientation detection. Fixes: NB#232872.
  • Loading branch information
Antti Virtanen committed Mar 9, 2011
1 parent 40b5443 commit 65425c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
9 changes: 4 additions & 5 deletions config/90-sensord-default.conf
Expand Up @@ -14,7 +14,6 @@ proximity-evdev_match_name = gpio-keys
als_dev_path_rm680 = /dev/bh1770glc_als
als_dev_path_rm696 = /dev/apds990x0


# ALS adaptor sysfs for Nokia N900
als-sysfs_path = /sys/devices/platform/i2c_omap.2/i2c-2/2-0029/device0/illuminance0_input

Expand All @@ -36,10 +35,10 @@ magnetometer_scale_coefficient = 300
# Orientation parameters
orientation_threshold_landscape = 25
orientation_threshold_portrait = 20
orientation_overflow_min = 800
orientation_overflow_max = 1250
orientation_poll_interval = 1000
orientation_buffer_size = 10
# orientation_overflow_min = 800
# orientation_overflow_max = 1250
orientation_poll_interval = 100
orientation_buffer_size = 4

# Offset for Screen.TopEdge. If 0, Screen.TopEdge equals side edges from
# OrientationSensor. Each additional value rotates the top one step to
Expand Down
1 change: 1 addition & 0 deletions debian/changelog
Expand Up @@ -13,6 +13,7 @@ sensord (0.6.41) unstable; urgency=low
* Downsampling (which works by dropping samples) can be now enabled/disabled.
* OrientationInterpreter filter orientation_buffer_size is now configurable.
* Threshold accessors removed from OrientationFilter since those had no effect.
* OrientationInterpreter default settings now provide more sensitive orientation detection. Fixes: NB#232872.

-- Antti Virtanen <antti.i.virtanen@nokia.com> Mon, 07 Mar 2011 16:17:54 +0200

Expand Down
17 changes: 8 additions & 9 deletions filters/orientationinterpreter/orientationinterpreter.cpp
Expand Up @@ -29,16 +29,15 @@

#include "orientationinterpreter.h"
#include "logging.h"
#include "config.h"
#include <math.h>
#include <stdlib.h>
#include "config.h"
#include <limits.h>

const int OrientationInterpreter::DEFAULT_THRESHOLD = 250;
const float OrientationInterpreter::RADIANS_TO_DEGREES = 180.0/M_PI;
const int OrientationInterpreter::ANGLE_LIMIT = 45;
const int OrientationInterpreter::SAME_AXIS_LIMIT = 5;
const int OrientationInterpreter::OVERFLOW_MIN = 800;
const int OrientationInterpreter::OVERFLOW_MAX = 1250;
const int OrientationInterpreter::OVERFLOW_MIN = 0;
const int OrientationInterpreter::OVERFLOW_MAX = INT_MAX;
const int OrientationInterpreter::THRESHOLD_LANDSCAPE = 25;
const int OrientationInterpreter::THRESHOLD_PORTRAIT = 20;
const int OrientationInterpreter::DISCARD_TIME = 750000;
Expand Down Expand Up @@ -116,8 +115,8 @@ void OrientationInterpreter::accDataAvailable(unsigned, const AccelerationData*

bool OrientationInterpreter::overFlowCheck()
{
int gVector = ((data.x_ * data.x_ + data.y_ * data.y_ + data.z_ * data.z_) / 1000);
return !((gVector >= minLimit) && (gVector <= maxLimit));
int vector = ((data.x_ * data.x_ + data.y_ * data.y_ + data.z_ * data.z_) / 1000);
return !((vector >= minLimit) && (vector <= maxLimit));
}

int OrientationInterpreter::orientationCheck(const AccelerationData &data, OrientationMode mode) const
Expand All @@ -131,7 +130,7 @@ int OrientationInterpreter::orientationCheck(const AccelerationData &data, Orie
PoseData OrientationInterpreter::rotateToPortrait(int rotation)
{
PoseData newTopEdge = PoseData::Undefined;
newTopEdge.orientation_ = (rotation>=0) ? PoseData::BottomUp : PoseData::BottomDown;
newTopEdge.orientation_ = (rotation >= 0) ? PoseData::BottomUp : PoseData::BottomDown;

// Some threshold to switching between portrait modes
if (topEdge.orientation_ == PoseData::BottomUp || topEdge.orientation_ == PoseData::BottomDown)
Expand All @@ -149,7 +148,7 @@ PoseData OrientationInterpreter::rotateToLandscape(int rotation)
{

PoseData newTopEdge = PoseData::Undefined;
newTopEdge.orientation_ = (rotation>=0) ? PoseData::LeftUp : PoseData::RightUp;
newTopEdge.orientation_ = (rotation >= 0) ? PoseData::LeftUp : PoseData::RightUp;
// Some threshold to switching between landscape modes
if (topEdge.orientation_ == PoseData::LeftUp || topEdge.orientation_ == PoseData::RightUp)
{
Expand Down
2 changes: 0 additions & 2 deletions filters/orientationinterpreter/orientationinterpreter.h
Expand Up @@ -90,9 +90,7 @@ class OrientationInterpreter : public QObject, public FilterBase
int orientationCheck(const AccelerationData&, OrientationMode) const;
PoseData orientationRotation(const AccelerationData&, OrientationMode, PoseData (OrientationInterpreter::*)(int));

static const int DEFAULT_THRESHOLD;
static const float RADIANS_TO_DEGREES;
static const int ANGLE_LIMIT;
static const int SAME_AXIS_LIMIT;

static const int OVERFLOW_MIN;
Expand Down

0 comments on commit 65425c2

Please sign in to comment.