From e91dbe74b81cd1ac9c95975cdbd6c9230fb3e9cf Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Mon, 7 Oct 2024 10:39:26 +0300 Subject: [PATCH] Use underscore names for member variables --- .../controllers/smart_switch_controller.cpp | 41 +++++++++-------- .../controllers/smart_switch_controller.h | 10 ++--- src/sensesp/net/networking.h | 4 +- src/sensesp/sensors/analog_input.cpp | 6 +-- src/sensesp/sensors/analog_input.h | 2 +- src/sensesp/sensors/analog_reader.h | 2 +- src/sensesp/sensors/digital_input.h | 12 ++--- src/sensesp/sensors/system_info.cpp | 2 +- src/sensesp/signalk/signalk_output.h | 4 +- src/sensesp/signalk/signalk_put_request.h | 12 ++--- src/sensesp/signalk/signalk_time.cpp | 2 +- src/sensesp/signalk/signalk_types.cpp | 22 +++++----- src/sensesp/signalk/signalk_ws_client.h | 2 +- src/sensesp/system/observablevalue.h | 32 +++++++------- src/sensesp/system/valueproducer.h | 8 ++-- src/sensesp/transforms/change_filter.cpp | 2 +- src/sensesp/transforms/curveinterpolator.cpp | 44 +++++++++---------- src/sensesp/transforms/curveinterpolator.h | 6 +-- src/sensesp/transforms/lambda_transform.h | 14 +++--- src/sensesp/transforms/linear.h | 2 +- src/sensesp/transforms/median.cpp | 2 +- src/sensesp/transforms/moving_average.cpp | 6 +-- src/sensesp/transforms/repeat.h | 2 +- 23 files changed, 119 insertions(+), 120 deletions(-) diff --git a/src/sensesp/controllers/smart_switch_controller.cpp b/src/sensesp/controllers/smart_switch_controller.cpp index f5b5ed623..6b32f7591 100644 --- a/src/sensesp/controllers/smart_switch_controller.cpp +++ b/src/sensesp/controllers/smart_switch_controller.cpp @@ -10,11 +10,11 @@ SmartSwitchController::SmartSwitchController(bool auto_initialize, const char* sk_sync_paths[]) : BooleanTransform(config_path), auto_initialize_{auto_initialize} { if (sk_sync_paths != NULL) { - sync_paths.clear(); + sync_paths_.clear(); int i = 0; while (strlen(sk_sync_paths[i]) > 0) { SyncPath path(sk_sync_paths[i]); - sync_paths.insert(path); + sync_paths_.insert(path); i++; } // while } @@ -23,14 +23,13 @@ SmartSwitchController::SmartSwitchController(bool auto_initialize, // Emit the initial state once the event loop starts if (auto_initialize_) { - event_loop()->onDelay(0, - [this]() { this->emit(is_on); }); + event_loop()->onDelay(0, [this]() { this->emit(is_on_); }); } } void SmartSwitchController::set(const bool& new_value) { - is_on = new_value; - this->emit(is_on); + is_on_ = new_value; + this->emit(is_on_); } void SmartSwitchController::set(const ClickTypes& new_value) { @@ -46,34 +45,34 @@ void SmartSwitchController::set(const ClickTypes& new_value) { } // All other click types toggle the current state... - is_on = !is_on; - this->emit(is_on); + is_on_ = !is_on_; + this->emit(is_on_); if (new_value == ClickTypes::DoubleClick) { // Sync any specified sync paths... - for (auto& path : sync_paths) { - ESP_LOGD(__FILENAME__, "Sync status to %s", path.sk_sync_path.c_str()); - path.put_request->set(is_on); + for (auto& path : sync_paths_) { + ESP_LOGD(__FILENAME__, "Sync status to %s", path.sk_sync_path_.c_str()); + path.put_request_->set(is_on_); } } } void SmartSwitchController::set(const String& new_value) { if (TextToTruth::is_valid_true(new_value)) { - is_on = true; + is_on_ = true; } else if (TextToTruth::is_valid_false(new_value)) { - is_on = false; + is_on_ = false; } else { // All other values simply toggle... - is_on = !is_on; + is_on_ = !is_on_; } - this->emit(is_on); + this->emit(is_on_); } bool SmartSwitchController::to_json(JsonObject& root) { JsonArray jPaths = root["sync_paths"].to(); - for (auto& path : sync_paths) { - jPaths.add(path.sk_sync_path); + for (auto& path : sync_paths_) { + jPaths.add(path.sk_sync_path_); } return true; } @@ -81,10 +80,10 @@ bool SmartSwitchController::to_json(JsonObject& root) { bool SmartSwitchController::from_json(const JsonObject& config) { JsonArray arr = config["sync_paths"]; if (arr.size() > 0) { - sync_paths.clear(); + sync_paths_.clear(); for (String sk_path : arr) { SyncPath path(sk_path); - sync_paths.insert(path); + sync_paths_.insert(path); } } @@ -94,9 +93,9 @@ bool SmartSwitchController::from_json(const JsonObject& config) { SmartSwitchController::SyncPath::SyncPath() {} SmartSwitchController::SyncPath::SyncPath(String sk_sync_path) - : sk_sync_path{sk_sync_path} { + : sk_sync_path_{sk_sync_path} { ESP_LOGD(__FILENAME__, "DoubleClick will also sync %s", sk_sync_path.c_str()); - this->put_request = new BoolSKPutRequest(sk_sync_path, "", false); + this->put_request_ = new BoolSKPutRequest(sk_sync_path, "", false); } } // namespace sensesp diff --git a/src/sensesp/controllers/smart_switch_controller.h b/src/sensesp/controllers/smart_switch_controller.h index ebd95ffb3..d6e4a19a0 100644 --- a/src/sensesp/controllers/smart_switch_controller.h +++ b/src/sensesp/controllers/smart_switch_controller.h @@ -74,21 +74,21 @@ class SmartSwitchController : public BooleanTransform, /// Used to store configuration internally. class SyncPath { public: - String sk_sync_path; - BoolSKPutRequest* put_request; + BoolSKPutRequest* put_request_; + String sk_sync_path_; SyncPath(); SyncPath(String sk_sync_path); friend bool operator<(const SyncPath& lhs, const SyncPath& rhs) { - return lhs.sk_sync_path < rhs.sk_sync_path; + return lhs.sk_sync_path_ < rhs.sk_sync_path_; } }; protected: - bool is_on = false; + bool is_on_ = false; bool auto_initialize_; - std::set sync_paths; + std::set sync_paths_; }; const String ConfigSchema(const SmartSwitchController& obj) { diff --git a/src/sensesp/net/networking.h b/src/sensesp/net/networking.h index f642751c9..dcb33f171 100644 --- a/src/sensesp/net/networking.h +++ b/src/sensesp/net/networking.h @@ -44,12 +44,12 @@ class WiFiStateProducer : public ValueProducer { protected: WiFiStateProducer() { - this->output = WiFiState::kWifiNoAP; + this->output_ = WiFiState::kWifiNoAP; setup_wifi_callbacks(); // Emit the current state as soon as the event loop starts - event_loop()->onDelay(0, [this]() { this->emit(this->output); }); + event_loop()->onDelay(0, [this]() { this->emit(this->output_); }); } void setup_wifi_callbacks() { diff --git a/src/sensesp/sensors/analog_input.cpp b/src/sensesp/sensors/analog_input.cpp index 1c659a692..ecb9ecca7 100644 --- a/src/sensesp/sensors/analog_input.cpp +++ b/src/sensesp/sensors/analog_input.cpp @@ -13,15 +13,15 @@ AnalogInput::AnalogInput(uint8_t pin, unsigned int read_delay, pin{pin}, read_delay{read_delay}, output_scale{output_scale} { - analog_reader = new AnalogReader(pin); + analog_reader_ = std::unique_ptr(new AnalogReader(pin)); load(); - if (this->analog_reader->configure()) { + if (this->analog_reader_->configure()) { event_loop()->onRepeat(read_delay, [this]() { this->update(); }); } } -void AnalogInput::update() { this->emit(output_scale * analog_reader->read()); } +void AnalogInput::update() { this->emit(output_scale * analog_reader_->read()); } bool AnalogInput::to_json(JsonObject& root) { root["read_delay"] = read_delay; diff --git a/src/sensesp/sensors/analog_input.h b/src/sensesp/sensors/analog_input.h index 781dc421a..5855a48fb 100644 --- a/src/sensesp/sensors/analog_input.h +++ b/src/sensesp/sensors/analog_input.h @@ -51,7 +51,7 @@ class AnalogInput : public FloatSensor { uint8_t pin{}; unsigned int read_delay; float output_scale; - BaseAnalogReader* analog_reader{}; + BaseAnalogReader* analog_reader_; void update(); }; diff --git a/src/sensesp/sensors/analog_reader.h b/src/sensesp/sensors/analog_reader.h index eba3c4136..5de3b2f1e 100644 --- a/src/sensesp/sensors/analog_reader.h +++ b/src/sensesp/sensors/analog_reader.h @@ -23,7 +23,7 @@ class BaseAnalogReader { }; class ESP32AnalogReader : public BaseAnalogReader { - private: + protected: int pin_; adc_atten_t attenuation_ = ADC_ATTEN_DB_12; // This should work with ESP32 and newer variants, ADCs are different diff --git a/src/sensesp/sensors/digital_input.h b/src/sensesp/sensors/digital_input.h index ccf4f34fe..180a73d37 100644 --- a/src/sensesp/sensors/digital_input.h +++ b/src/sensesp/sensors/digital_input.h @@ -99,7 +99,7 @@ class DigitalInputCounter : public DigitalInput, public Sensor { event_loop()->onRepeat(read_delay_, [this]() { noInterrupts(); - output = counter_; + output_ = counter_; counter_ = 0; interrupts(); notify(); @@ -206,19 +206,19 @@ class DigitalInputChange : public DigitalInput, public Sensor { interrupt_type_{interrupt_type}, triggered_{true} { load(); - output = (bool)digitalRead(pin_); - last_output_ = !output; // ensure that we always send the first output + output_ = (bool)digitalRead(pin_); + last_output_ = !output_; // ensure that we always send the first output_ event_loop()->onInterrupt(pin_, interrupt_type_, [this]() { - output = (bool)digitalRead(pin_); + output_ = (bool)digitalRead(pin_); triggered_ = true; }); event_loop()->onTick([this]() { - if (triggered_ && (output != last_output_)) { + if (triggered_ && (output_ != last_output_)) { noInterrupts(); triggered_ = false; - last_output_ = output; + last_output_ = output_; interrupts(); notify(); } diff --git a/src/sensesp/sensors/system_info.cpp b/src/sensesp/sensors/system_info.cpp index 1bfaeca5b..ad642393a 100644 --- a/src/sensesp/sensors/system_info.cpp +++ b/src/sensesp/sensors/system_info.cpp @@ -16,7 +16,7 @@ void SystemHz::update() { return; } - output = (tick_count_ * 1000) / elapsed_millis_; + output_ = (tick_count_ * 1000) / elapsed_millis_; tick_count_ = 0; elapsed_millis_ = 0; diff --git a/src/sensesp/signalk/signalk_output.h b/src/sensesp/signalk/signalk_output.h index 882e2e25d..cb10c10ef 100644 --- a/src/sensesp/signalk/signalk_output.h +++ b/src/sensesp/signalk/signalk_output.h @@ -42,7 +42,7 @@ class SKOutput : public SKEmitter, public SymmetricTransform { virtual void as_signalk_json(JsonDocument& doc) override { doc["path"] = this->get_sk_path(); - doc["value"] = ValueProducer::output; + doc["value"] = ValueProducer::output_; } virtual bool to_json(JsonObject& root) override { @@ -98,7 +98,7 @@ class SKOutputRawJson : public SKOutput { virtual void as_signalk_json(JsonDocument& doc) override { doc["path"] = this->get_sk_path(); - doc["value"] = serialized(ValueProducer::output); + doc["value"] = serialized(ValueProducer::output_); } }; diff --git a/src/sensesp/signalk/signalk_put_request.h b/src/sensesp/signalk/signalk_put_request.h index 1730c1495..8807b610a 100644 --- a/src/sensesp/signalk/signalk_put_request.h +++ b/src/sensesp/signalk/signalk_put_request.h @@ -145,14 +145,14 @@ class SKPutRequest : public SKPutRequestBase, SKPutRequest(String sk_path, String config_path = "", bool ignore_duplicates = true, uint32_t timeout = 5000) : SKPutRequestBase(sk_path, config_path, timeout), - ignore_duplicates{ignore_duplicates} {} + ignore_duplicates_{ignore_duplicates} {} virtual void set(const T& new_value) override { - if (ignore_duplicates && new_value == value) { + if (ignore_duplicates_ && new_value == value_) { return; } if (!request_pending()) { - this->value = new_value; + this->value_ = new_value; send_put_request(); } else { ESP_LOGW(__FILENAME__, @@ -161,12 +161,12 @@ class SKPutRequest : public SKPutRequestBase, }; virtual void set_put_value(JsonObject& put_data) override { - put_data["value"] = value; + put_data["value"] = value_; }; protected: - T value; - bool ignore_duplicates; + T value_; + bool ignore_duplicates_; }; template diff --git a/src/sensesp/signalk/signalk_time.cpp b/src/sensesp/signalk/signalk_time.cpp index 1c8d6ecae..b1ea846ee 100644 --- a/src/sensesp/signalk/signalk_time.cpp +++ b/src/sensesp/signalk/signalk_time.cpp @@ -10,7 +10,7 @@ SKOutputTime::SKOutputTime(const String& sk_path, const String& config_path) void SKOutputTime::as_signalk_json(JsonDocument& doc){ doc["path"] = this->sk_path_; - doc["value"] = output; + doc["value"] = output_; } bool SKOutputTime::to_json(JsonObject& doc) { diff --git a/src/sensesp/signalk/signalk_types.cpp b/src/sensesp/signalk/signalk_types.cpp index 69f4bd3da..d39d9d4f0 100644 --- a/src/sensesp/signalk/signalk_types.cpp +++ b/src/sensesp/signalk/signalk_types.cpp @@ -16,10 +16,10 @@ template <> void SKOutput::as_signalk_json(JsonDocument& doc) { doc["path"] = this->get_sk_path(); JsonObject value = doc["value"].to(); - value["latitude"] = output.latitude; - value["longitude"] = output.longitude; - if (output.altitude != kPositionInvalidAltitude) { - value["altitude"] = output.altitude; + value["latitude"] = output_.latitude; + value["longitude"] = output_.longitude; + if (output_.altitude != kPositionInvalidAltitude) { + value["altitude"] = output_.altitude; } } @@ -27,10 +27,10 @@ template <> void SKOutput::as_signalk_json(JsonDocument& doc) { doc["path"] = this->get_sk_path(); JsonObject value = doc["value"].to(); - value["east"] = output.east; - value["north"] = output.north; - if (output.up != kPositionInvalidAltitude) { - value["up"] = output.up; + value["east"] = output_.east; + value["north"] = output_.north; + if (output_.up != kPositionInvalidAltitude) { + value["up"] = output_.up; } } @@ -38,9 +38,9 @@ template <> void SKOutput::as_signalk_json(JsonDocument& doc) { doc["path"] = this->get_sk_path(); JsonObject value = doc["value"].to(); - value["roll"] = output.roll; - value["pitch"] = output.pitch; - value["yaw"] = output.yaw; + value["roll"] = output_.roll; + value["pitch"] = output_.pitch; + value["yaw"] = output_.yaw; } } // namespace sensesp diff --git a/src/sensesp/signalk/signalk_ws_client.h b/src/sensesp/signalk/signalk_ws_client.h index c7aaa0494..e72753cc5 100644 --- a/src/sensesp/signalk/signalk_ws_client.h +++ b/src/sensesp/signalk/signalk_ws_client.h @@ -88,7 +88,7 @@ class SKWSClient : virtual public FileSystemSaveable, */ void sendTXT(String& payload); - private: + protected: // these are the actually used values String server_address_ = ""; uint16_t server_port_ = 80; diff --git a/src/sensesp/system/observablevalue.h b/src/sensesp/system/observablevalue.h index 72251bff2..6caf2d487 100644 --- a/src/sensesp/system/observablevalue.h +++ b/src/sensesp/system/observablevalue.h @@ -14,12 +14,12 @@ class ObservableValue; template bool operator==(ObservableValue const& lhs, T const& rhs) { - return lhs.output == rhs; + return lhs.output_ == rhs; } template bool operator!=(ObservableValue const& lhs, T const& rhs) { - return lhs.output != rhs; + return lhs.output_ != rhs; } /** @@ -41,35 +41,35 @@ class ObservableValue : public ValueConsumer, public ValueProducer { } T& operator++() { - set(this->output + 1); - return this->output; + set(this->output_ + 1); + return this->output_; } T& operator--() { - set(this->output - 1); - return this->output; + set(this->output_ - 1); + return this->output_; } T operator++(int) { - T old = this->output; - set(this->output + 1); + T old = this->output_; + set(this->output_ + 1); return old; } T operator--(int) { - T old = this->output; - set(this->output - 1); + T old = this->output_; + set(this->output_ - 1); return old; } const T& operator+=(const T& value) { - set(this->output + value); - return this->output; + set(this->output_ + value); + return this->output_; } const T& operator-=(const T& value) { - set(this->output - value); - return this->output; + set(this->output_ - value); + return this->output_; } protected: @@ -96,7 +96,7 @@ class PersistingObservableValue : public ObservableValue, load(); // Emit the current state as soon as the event loop starts - event_loop()->onDelay(0, [this]() { this->emit(this->output); }); + event_loop()->onDelay(0, [this]() { this->emit(this->output_); }); } virtual void set(const T& value) override { @@ -105,7 +105,7 @@ class PersistingObservableValue : public ObservableValue, } virtual bool to_json(JsonObject& doc) override { - doc["value"] = this->output; + doc["value"] = this->output_; return true; } diff --git a/src/sensesp/system/valueproducer.h b/src/sensesp/system/valueproducer.h index f69015051..0257ff1d2 100644 --- a/src/sensesp/system/valueproducer.h +++ b/src/sensesp/system/valueproducer.h @@ -24,12 +24,12 @@ template class ValueProducer : virtual public Observable { public: ValueProducer() {} - ValueProducer(const T& initial_value) : output(initial_value) {} + ValueProducer(const T& initial_value) : output_(initial_value) {} /** * Returns the current value of this producer */ - virtual const T& get() const { return output; } + virtual const T& get() const { return output_; } /** * Connects this producer to the specified consumer, registering that @@ -110,7 +110,7 @@ class ValueProducer : virtual public Observable { * Set a new output value and notify consumers about it */ void emit(const T& new_value) { - this->output = new_value; + this->output_ = new_value; Observable::notify(); } @@ -119,7 +119,7 @@ class ValueProducer : virtual public Observable { * The current value of this producer is stored here in this output member * (unless descendant classes override ValueProducer::get()) */ - T output; + T output_; }; typedef ValueProducer FloatProducer; diff --git a/src/sensesp/transforms/change_filter.cpp b/src/sensesp/transforms/change_filter.cpp index ef77901aa..13b8dae54 100644 --- a/src/sensesp/transforms/change_filter.cpp +++ b/src/sensesp/transforms/change_filter.cpp @@ -20,7 +20,7 @@ ChangeFilter::ChangeFilter(float min_delta, float max_delta, int max_skips, } void ChangeFilter::set(const float& new_value) { - float delta = absf(new_value - output); + float delta = absf(new_value - output_); if ((delta >= min_delta_ && delta <= max_delta_) || skips_ > max_skips_) { skips_ = 0; this->emit(new_value); diff --git a/src/sensesp/transforms/curveinterpolator.cpp b/src/sensesp/transforms/curveinterpolator.cpp index 2869d593e..0e947440f 100644 --- a/src/sensesp/transforms/curveinterpolator.cpp +++ b/src/sensesp/transforms/curveinterpolator.cpp @@ -7,10 +7,10 @@ namespace sensesp { CurveInterpolator::Sample::Sample() = default; CurveInterpolator::Sample::Sample(float input, float output) - : input{input}, output{output} {} + : input_{input}, output_{output} {} CurveInterpolator::Sample::Sample(JsonObject& obj) - : input{obj["input"]}, output{obj["output"]} {} + : input_{obj["input"]}, output_{obj["output"]} {} /** * @brief Construct a new CurveInterpolator object @@ -34,29 +34,29 @@ CurveInterpolator::CurveInterpolator(std::set* defaults, void CurveInterpolator::set(const float& input) { if (samples_.empty()) { - output = 0; // or any default output if no samples are available + output_ = 0; // or any default output if no samples are available notify(); return; } std::set::iterator it = samples_.begin(); - float x0 = it->input; - float y0 = it->output; + float x0 = it->input_; + float y0 = it->output_; // Check if the input is below the lowest sample point if (input < x0) { // Need to extrapolate below the first point if (samples_.size() > 1) { auto second_it = std::next(it); - float x1 = second_it->input; - float y1 = second_it->output; + float x1 = second_it->input_; + float y1 = second_it->output_; float const gradient = (y1 - y0) / (x1 - x0); - output = y0 + gradient * + output_ = y0 + gradient * (input - x0); // Extrapolate using the first segment's gradient } else { - output = y0; // Only one sample, output its value + output_ = y0; // Only one sample, output its value } notify(); return; @@ -64,9 +64,9 @@ void CurveInterpolator::set(const float& input) { // Search for the correct interval or the last sample point while (it != samples_.end()) { - if (input > it->input) { - x0 = it->input; - y0 = it->output; + if (input > it->input_) { + x0 = it->input_; + y0 = it->output_; ++it; } else { break; @@ -75,22 +75,22 @@ void CurveInterpolator::set(const float& input) { // Interpolate or extrapolate above the highest point if (it != samples_.end()) { - float x1 = it->input; - float y1 = it->output; - output = (y0 * (x1 - input) + y1 * (input - x0)) / (x1 - x0); + float x1 = it->input_; + float y1 = it->output_; + output_ = (y0 * (x1 - input) + y1 * (input - x0)) / (x1 - x0); } else { // Hit the end of the table with no match, calculate output using the // gradient from the last two points auto last = samples_.rbegin(); auto second_last = std::next(last); - float x1 = last->input; - float y1 = last->output; - float x2 = second_last->input; - float y2 = second_last->output; + float x1 = last->input_; + float y1 = last->output_; + float x2 = second_last->input_; + float y2 = second_last->output_; float const gradient = (y1 - y2) / (x1 - x2); // Extrapolate using the gradient - output = y1 + gradient * (input - x1); + output_ = y1 + gradient * (input - x1); } notify(); @@ -105,8 +105,8 @@ bool CurveInterpolator::to_json(JsonObject& doc) { ESP_LOGE(__FILENAME__, "No memory for sample"); return false; } - entry["input"] = sample.input; - entry["output"] = sample.output; + entry["input"] = sample.input_; + entry["output"] = sample.output_; } return true; } diff --git a/src/sensesp/transforms/curveinterpolator.h b/src/sensesp/transforms/curveinterpolator.h index c9ae896d9..01685d4f5 100644 --- a/src/sensesp/transforms/curveinterpolator.h +++ b/src/sensesp/transforms/curveinterpolator.h @@ -40,15 +40,15 @@ class CurveInterpolator : public FloatTransform { public: class Sample { public: - float input{}; - float output{}; + float input_{}; + float output_{}; Sample(); Sample(float input, float output); Sample(JsonObject& obj); friend bool operator<(const Sample& lhs, const Sample& rhs) { - return lhs.input < rhs.input; + return lhs.input_ < rhs.input_; } }; diff --git a/src/sensesp/transforms/lambda_transform.h b/src/sensesp/transforms/lambda_transform.h index 9067aca61..c4e69f11a 100644 --- a/src/sensesp/transforms/lambda_transform.h +++ b/src/sensesp/transforms/lambda_transform.h @@ -152,26 +152,26 @@ class LambdaTransform : public Transform { void set(const IN& input) override { switch (num_params_) { case 0: - this->output = function0_(input); + this->output_ = function0_(input); break; case 1: - this->output = function1_(input, param1_); + this->output_ = function1_(input, param1_); break; case 2: - this->output = function2_(input, param1_, param2_); + this->output_ = function2_(input, param1_, param2_); break; case 3: - this->output = function3_(input, param1_, param2_, param3_); + this->output_ = function3_(input, param1_, param2_, param3_); break; case 4: - this->output = function4_(input, param1_, param2_, param3_, param4_); + this->output_ = function4_(input, param1_, param2_, param3_, param4_); break; case 5: - this->output = + this->output_ = function5_(input, param1_, param2_, param3_, param4_, param5_); break; case 6: - this->output = function6_(input, param1_, param2_, param3_, param4_, + this->output_ = function6_(input, param1_, param2_, param3_, param4_, param5_, param6_); break; default: diff --git a/src/sensesp/transforms/linear.h b/src/sensesp/transforms/linear.h index 61617623d..6e9bb834b 100644 --- a/src/sensesp/transforms/linear.h +++ b/src/sensesp/transforms/linear.h @@ -7,7 +7,7 @@ namespace sensesp { /** * @brief Performs a linear transform on the input value: - * output = (input * multiplier) + offset. + * output_ = (input * multiplier) + offset. * * @param multiplier The input is multiplied this value. * diff --git a/src/sensesp/transforms/median.cpp b/src/sensesp/transforms/median.cpp index aab42c673..11ba0b163 100644 --- a/src/sensesp/transforms/median.cpp +++ b/src/sensesp/transforms/median.cpp @@ -15,7 +15,7 @@ void Median::set(const float& input) { // Its time to output a value sort(buf_.begin(), buf_.end()); const unsigned int mid = sample_size_ / 2; - output = buf_[mid]; + output_ = buf_[mid]; buf_.clear(); notify(); } diff --git a/src/sensesp/transforms/moving_average.cpp b/src/sensesp/transforms/moving_average.cpp index 9d690f02c..fa4988f0b 100644 --- a/src/sensesp/transforms/moving_average.cpp +++ b/src/sensesp/transforms/moving_average.cpp @@ -20,12 +20,12 @@ void MovingAverage::set(const float& input) { // So the first value to be included in the average doesn't default to 0.0 if (!initialized_) { buf_.assign(sample_size_, input); - output = input; + output_ = input; initialized_ = true; } else { // Subtract 1/nth of the oldest value and add 1/nth of the newest value - output += -multiplier_ * buf_[ptr_] / sample_size_; - output += multiplier_ * input / sample_size_; + output_ += -multiplier_ * buf_[ptr_] / sample_size_; + output_ += multiplier_ * input / sample_size_; // Save the most recent input, then advance to the next storage location. // When storage location n is reached, start over again at 0. diff --git a/src/sensesp/transforms/repeat.h b/src/sensesp/transforms/repeat.h index 6a25ed4d1..b0c89d76a 100644 --- a/src/sensesp/transforms/repeat.h +++ b/src/sensesp/transforms/repeat.h @@ -172,7 +172,7 @@ class RepeatConstantRate : public RepeatExpiring { } void set(T input) override { - this->output = input; + this->output_ = input; this->age_ = 0; } };