Skip to content

Commit

Permalink
fix: resolve compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
leon0399 committed Aug 9, 2024
1 parent 3465d35 commit 2016f1d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions lib/freertos/senseshift/freertos/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ class ComponentUpdateTask : public Task<ComponentUpdateTask<Tp>> {
[[noreturn]] void run()
{
auto now = millis();
auto targetHz = 1000 / this->updateDelay_;

while (true) {
now = millis();
Expand All @@ -151,7 +150,7 @@ class ComponentUpdateTask : public Task<ComponentUpdateTask<Tp>> {

const auto elapsed = millis() - now;

log_d("T: %d, Fmax: %dHz, Ft: %dHz", elapsed, 1000 / elapsed, targetHz);
log_d("T: %d, Fmax: %dHz, Ft: %dHz", elapsed, 1000 / elapsed, 1000 / this->updateDelay_);
if (elapsed < this->updateDelay_) {
delay(this->updateDelay_ - elapsed);
}
Expand Down
9 changes: 5 additions & 4 deletions lib/io/senseshift/input/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ class ExponentialMovingAverageFilter : public IFilter<Tp> {

/// Deadzone filter. Clamps acc_ to center if it is within the deadzone.
/// Usually used to filter out noise in the joystick.
class CenterDeadzoneFilter : public IFilter<float> {
class SinglePointDeadzoneFilter : public IFilter<float> {
public:
explicit CenterDeadzoneFilter(float deadzone, float center = 0.5F) : deadzone_(deadzone), center_(center){};
explicit SinglePointDeadzoneFilter(float deadzone, float center = 0.5F) : deadzone_(deadzone), center_(center){};

inline auto filter(ISimpleSensor<float>* /*sensor*/, float value) -> float override
{
Expand All @@ -270,11 +270,12 @@ class CenterDeadzoneFilter : public IFilter<float> {
}

private:
const float deadzone_;
const float center_;

float deadzone_;
};

using CenterDeadzoneFilter = SinglePointDeadzoneFilter;

/// Interpolates the value from the lookup table.
/// Can be used to determine battery level from the voltage.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/io/senseshift/input/sensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class SimpleSensorDecorator : public Sensor<Tp> {
using ValueType = Tp;
using SourceType = ISimpleSensor<ValueType>;

explicit SimpleSensorDecorator(SourceType* source) : source_(source), Sensor<Tp>()
explicit SimpleSensorDecorator(SourceType* source) : Sensor<Tp>(), source_(source)
{
}

Expand Down
2 changes: 1 addition & 1 deletion lib/io/senseshift/input/sensor/analog_threshold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class AnalogThresholdSensor : public BinarySensor {
Sensor<Tp>* source, Tp threshold_upper, Tp threshold_lower, bool attach_callbacks = false
) :
source_(source),
threshold_upper_(threshold_upper),
threshold_lower_(threshold_lower),
threshold_upper_(threshold_upper),
attach_callbacks_(attach_callbacks)
{
}
Expand Down

0 comments on commit 2016f1d

Please sign in to comment.