Skip to content

Commit

Permalink
Fixed an initialization omission in stick_sensor::value_.
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed May 3, 2024
1 parent d2c98da commit 2ad3f75
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -40,6 +40,10 @@ class game_pad_stick_converter final : public pqrs::dispatcher::extra::dispatche

class stick_sensor {
public:
stick_sensor(void)
: value_(0) {
}

double get_value(void) const {
return value_;
}
Expand All @@ -50,6 +54,8 @@ class game_pad_stick_converter final : public pqrs::dispatcher::extra::dispatche
if (logical_max != logical_min) {
// -1.0 ... 1.0
value_ = ((static_cast<double>(integer_value - logical_min) / static_cast<double>(logical_max - logical_min)) - 0.5) * 2.0;
} else {
value_ = 0;
}
}

Expand Down Expand Up @@ -424,6 +430,7 @@ class game_pad_stick_converter final : public pqrs::dispatcher::extra::dispatche
break;
default:
post_xy_event();
break;
}
},
// TODO: Replace hard-coded interval
Expand Down Expand Up @@ -457,6 +464,7 @@ class game_pad_stick_converter final : public pqrs::dispatcher::extra::dispatche
break;
default:
post_wheels_event();
break;
}
},
// TODO: Replace hard-coded interval
Expand Down

0 comments on commit 2ad3f75

Please sign in to comment.