mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 08:55:22 +01:00
lint
This commit is contained in:
parent
a62b6548d2
commit
1bec1faf6d
42 changed files with 151 additions and 176 deletions
|
@ -30,8 +30,7 @@ template<typename... Ts> class HomeAssistantServiceCallAction : public Action<Ts
|
|||
this->variables_.push_back(TemplatableKeyValuePair<Ts...>(key, value));
|
||||
}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
HomeassistantServiceResponse resp;
|
||||
resp.service = this->service_.value(x...);
|
||||
resp.is_event = this->is_event_;
|
||||
|
@ -56,6 +55,7 @@ template<typename... Ts> class HomeAssistantServiceCallAction : public Action<Ts
|
|||
this->parent_->send_homeassistant_service_call(resp);
|
||||
}
|
||||
|
||||
protected:
|
||||
APIServer *parent_;
|
||||
bool is_event_;
|
||||
std::vector<TemplatableKeyValuePair<Ts...>> data_;
|
||||
|
|
|
@ -138,12 +138,12 @@ template<typename... Ts> class BinarySensorPublishAction : public Action<Ts...>
|
|||
explicit BinarySensorPublishAction(BinarySensor *sensor) : sensor_(sensor) {}
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto val = this->state_.value(x...);
|
||||
this->sensor_->publish_state(val);
|
||||
}
|
||||
|
||||
protected:
|
||||
BinarySensor *sensor_;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(ClimateFanMode, fan_mode)
|
||||
TEMPLATABLE_VALUE(ClimateSwingMode, swing_mode)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->climate_->make_call();
|
||||
call.set_mode(this->mode_.optional_value(x...));
|
||||
call.set_target_temperature(this->target_temperature_.optional_value(x...));
|
||||
|
@ -31,6 +30,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
|||
call.perform();
|
||||
}
|
||||
|
||||
protected:
|
||||
Climate *climate_;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ template<typename... Ts> class OpenAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit OpenAction(Cover *cover) : cover_(cover) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->cover_->open(); }
|
||||
void play(Ts... x) override { this->cover_->open(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
};
|
||||
|
||||
|
@ -21,9 +21,9 @@ template<typename... Ts> class CloseAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit CloseAction(Cover *cover) : cover_(cover) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->cover_->close(); }
|
||||
void play(Ts... x) override { this->cover_->close(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
};
|
||||
|
||||
|
@ -31,9 +31,9 @@ template<typename... Ts> class StopAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit StopAction(Cover *cover) : cover_(cover) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->cover_->stop(); }
|
||||
void play(Ts... x) override { this->cover_->stop(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
};
|
||||
|
||||
|
@ -45,8 +45,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(float, position)
|
||||
TEMPLATABLE_VALUE(float, tilt)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->cover_->make_call();
|
||||
if (this->stop_.has_value())
|
||||
call.set_stop(this->stop_.value(x...));
|
||||
|
@ -57,6 +56,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
|||
call.perform();
|
||||
}
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
};
|
||||
|
||||
|
@ -67,8 +67,7 @@ template<typename... Ts> class CoverPublishAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(float, tilt)
|
||||
TEMPLATABLE_VALUE(CoverOperation, current_operation)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->position_.has_value())
|
||||
this->cover_->position = this->position_.value(x...);
|
||||
if (this->tilt_.has_value())
|
||||
|
@ -78,6 +77,7 @@ template<typename... Ts> class CoverPublishAction : public Action<Ts...> {
|
|||
this->cover_->publish_state();
|
||||
}
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
};
|
||||
|
||||
|
|
|
@ -85,9 +85,9 @@ template<typename... Ts> class EnterDeepSleepAction : public Action<Ts...> {
|
|||
public:
|
||||
EnterDeepSleepAction(DeepSleepComponent *deep_sleep) : deep_sleep_(deep_sleep) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->deep_sleep_->begin_sleep(true); }
|
||||
void play(Ts... x) override { this->deep_sleep_->begin_sleep(true); }
|
||||
|
||||
protected:
|
||||
DeepSleepComponent *deep_sleep_;
|
||||
};
|
||||
|
||||
|
@ -95,9 +95,9 @@ template<typename... Ts> class PreventDeepSleepAction : public Action<Ts...> {
|
|||
public:
|
||||
PreventDeepSleepAction(DeepSleepComponent *deep_sleep) : deep_sleep_(deep_sleep) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->deep_sleep_->prevent_deep_sleep(); }
|
||||
void play(Ts... x) override { this->deep_sleep_->prevent_deep_sleep(); }
|
||||
|
||||
protected:
|
||||
DeepSleepComponent *deep_sleep_;
|
||||
};
|
||||
|
||||
|
|
|
@ -104,8 +104,7 @@ class DFPlayer : public uart::UARTDevice, public Component {
|
|||
|
||||
#define DFPLAYER_SIMPLE_ACTION(ACTION_CLASS, ACTION_METHOD) \
|
||||
template<typename... Ts> class ACTION_CLASS : public Action<Ts...>, public Parented<DFPlayer> { \
|
||||
protected: \
|
||||
void play_(Ts... x) override { this->parent_->ACTION_METHOD(); } \
|
||||
void play(Ts... x) override { this->parent_->ACTION_METHOD(); } \
|
||||
};
|
||||
|
||||
DFPLAYER_SIMPLE_ACTION(NextAction, next)
|
||||
|
@ -116,8 +115,7 @@ template<typename... Ts> class PlayFileAction : public Action<Ts...>, public Par
|
|||
TEMPLATABLE_VALUE(uint16_t, file)
|
||||
TEMPLATABLE_VALUE(boolean, loop)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto file = this->file_.value(x...);
|
||||
auto loop = this->loop_.value(x...);
|
||||
if (loop) {
|
||||
|
@ -134,8 +132,7 @@ template<typename... Ts> class PlayFolderAction : public Action<Ts...>, public P
|
|||
TEMPLATABLE_VALUE(uint16_t, file)
|
||||
TEMPLATABLE_VALUE(boolean, loop)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto folder = this->folder_.value(x...);
|
||||
auto file = this->file_.value(x...);
|
||||
auto loop = this->loop_.value(x...);
|
||||
|
@ -151,8 +148,7 @@ template<typename... Ts> class SetDeviceAction : public Action<Ts...>, public Pa
|
|||
public:
|
||||
TEMPLATABLE_VALUE(Device, device)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto device = this->device_.value(x...);
|
||||
this->parent_->set_device(device);
|
||||
}
|
||||
|
@ -162,8 +158,7 @@ template<typename... Ts> class SetVolumeAction : public Action<Ts...>, public Pa
|
|||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, volume)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto volume = this->volume_.value(x...);
|
||||
this->parent_->set_volume(volume);
|
||||
}
|
||||
|
@ -173,8 +168,7 @@ template<typename... Ts> class SetEqAction : public Action<Ts...>, public Parent
|
|||
public:
|
||||
TEMPLATABLE_VALUE(EqPreset, eq)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto eq = this->eq_.value(x...);
|
||||
this->parent_->set_eq(eq);
|
||||
}
|
||||
|
|
|
@ -392,8 +392,7 @@ template<typename... Ts> class DisplayPageShowAction : public Action<Ts...> {
|
|||
public:
|
||||
TEMPLATABLE_VALUE(DisplayPage *, page)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto *page = this->page_.value(x...);
|
||||
if (page != nullptr) {
|
||||
page->show();
|
||||
|
@ -405,8 +404,7 @@ template<typename... Ts> class DisplayPageShowNextAction : public Action<Ts...>
|
|||
public:
|
||||
DisplayPageShowNextAction(DisplayBuffer *buffer) : buffer_(buffer) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->buffer_->show_next_page(); }
|
||||
void play(Ts... x) override { this->buffer_->show_next_page(); }
|
||||
|
||||
DisplayBuffer *buffer_;
|
||||
};
|
||||
|
@ -415,8 +413,7 @@ template<typename... Ts> class DisplayPageShowPrevAction : public Action<Ts...>
|
|||
public:
|
||||
DisplayPageShowPrevAction(DisplayBuffer *buffer) : buffer_(buffer) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->buffer_->show_prev_page(); }
|
||||
void play(Ts... x) override { this->buffer_->show_prev_page(); }
|
||||
|
||||
DisplayBuffer *buffer_;
|
||||
};
|
||||
|
|
|
@ -38,8 +38,7 @@ template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
|
|||
SetFrequencyAction(ESP8266PWM *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, frequency);
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) {
|
||||
void play(Ts... x) {
|
||||
float freq = this->frequency_.value(x...);
|
||||
this->parent_->update_frequency(freq);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(bool, oscillating)
|
||||
TEMPLATABLE_VALUE(FanSpeed, speed)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->state_->turn_on();
|
||||
if (this->oscillating_.has_value()) {
|
||||
call.set_oscillating(this->oscillating_.value(x...));
|
||||
|
@ -33,8 +32,7 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit TurnOffAction(FanState *state) : state_(state) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->state_->turn_off().perform(); }
|
||||
void play(Ts... x) override { this->state_->turn_off().perform(); }
|
||||
|
||||
FanState *state_;
|
||||
};
|
||||
|
@ -43,8 +41,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit ToggleAction(FanState *state) : state_(state) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->state_->toggle().perform(); }
|
||||
void play(Ts... x) override { this->state_->toggle().perform(); }
|
||||
|
||||
FanState *state_;
|
||||
};
|
||||
|
|
|
@ -59,9 +59,9 @@ template<class C, typename... Ts> class GlobalVarSetAction : public Action<Ts...
|
|||
|
||||
TEMPLATABLE_VALUE(T, value);
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->parent_->value() = this->value_.value(x...); }
|
||||
void play(Ts... x) override { this->parent_->value() = this->value_.value(x...); }
|
||||
|
||||
protected:
|
||||
C *parent_;
|
||||
};
|
||||
|
||||
|
|
|
@ -71,8 +71,7 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
|
|||
|
||||
void set_json(std::function<void(Ts..., JsonObject &)> json_func) { this->json_func_ = json_func; }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->set_url(this->url_.value(x...));
|
||||
this->parent_->set_method(this->method_.value(x...));
|
||||
if (this->body_.has_value()) {
|
||||
|
@ -107,6 +106,7 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
|
|||
this->parent_->close();
|
||||
}
|
||||
|
||||
protected:
|
||||
void encode_json_(Ts... x, JsonObject &root) {
|
||||
for (const auto &item : this->json_) {
|
||||
auto val = item.second;
|
||||
|
|
|
@ -76,9 +76,9 @@ template<typename... Ts> class ResetAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit ResetAction(IntegrationSensor *parent) : parent_(parent) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->parent_->reset(); }
|
||||
void play(Ts... x) override { this->parent_->reset(); }
|
||||
|
||||
protected:
|
||||
IntegrationSensor *parent_;
|
||||
};
|
||||
|
||||
|
|
|
@ -43,12 +43,12 @@ template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
|
|||
SetFrequencyAction(LEDCOutput *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, frequency);
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) {
|
||||
void play(Ts... x) {
|
||||
float freq = this->frequency_.value(x...);
|
||||
this->parent_->apply_frequency(freq);
|
||||
}
|
||||
|
||||
protected:
|
||||
LEDCOutput *parent_;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
|||
|
||||
TEMPLATABLE_VALUE(uint32_t, transition_length)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->state_->toggle();
|
||||
call.set_transition_length(this->transition_length_.optional_value(x...));
|
||||
call.perform();
|
||||
}
|
||||
|
||||
protected:
|
||||
LightState *state_;
|
||||
};
|
||||
|
||||
|
@ -38,8 +38,7 @@ template<typename... Ts> class LightControlAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(float, color_temperature)
|
||||
TEMPLATABLE_VALUE(std::string, effect)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->make_call();
|
||||
call.set_state(this->state_.optional_value(x...));
|
||||
call.set_brightness(this->brightness_.optional_value(x...));
|
||||
|
@ -54,6 +53,7 @@ template<typename... Ts> class LightControlAction : public Action<Ts...> {
|
|||
call.perform();
|
||||
}
|
||||
|
||||
protected:
|
||||
LightState *parent_;
|
||||
};
|
||||
|
||||
|
@ -64,8 +64,7 @@ template<typename... Ts> class DimRelativeAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(float, relative_brightness)
|
||||
TEMPLATABLE_VALUE(uint32_t, transition_length)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->make_call();
|
||||
float rel = this->relative_brightness_.value(x...);
|
||||
float cur;
|
||||
|
@ -78,6 +77,7 @@ template<typename... Ts> class DimRelativeAction : public Action<Ts...> {
|
|||
call.perform();
|
||||
}
|
||||
|
||||
protected:
|
||||
LightState *parent_;
|
||||
};
|
||||
|
||||
|
@ -143,8 +143,7 @@ template<typename... Ts> class AddressableSet : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(uint8_t, blue)
|
||||
TEMPLATABLE_VALUE(uint8_t, white)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto *out = (AddressableLight *) this->parent_->get_output();
|
||||
int32_t range_from = this->range_from_.value_or(x..., 0);
|
||||
int32_t range_to = this->range_to_.value_or(x..., out->size() - 1) + 1;
|
||||
|
@ -160,6 +159,7 @@ template<typename... Ts> class AddressableSet : public Action<Ts...> {
|
|||
out->schedule_show();
|
||||
}
|
||||
|
||||
protected:
|
||||
LightState *parent_;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ template<typename... Ts> class MHZ19CalibrateZeroAction : public Action<Ts...> {
|
|||
public:
|
||||
MHZ19CalibrateZeroAction(MHZ19Component *mhz19) : mhz19_(mhz19) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->mhz19_->calibrate_zero(); }
|
||||
void play(Ts... x) override { this->mhz19_->calibrate_zero(); }
|
||||
|
||||
protected:
|
||||
MHZ19Component *mhz19_;
|
||||
};
|
||||
|
||||
|
@ -48,9 +48,9 @@ template<typename... Ts> class MHZ19ABCEnableAction : public Action<Ts...> {
|
|||
public:
|
||||
MHZ19ABCEnableAction(MHZ19Component *mhz19) : mhz19_(mhz19) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->mhz19_->abc_enable(); }
|
||||
void play(Ts... x) override { this->mhz19_->abc_enable(); }
|
||||
|
||||
protected:
|
||||
MHZ19Component *mhz19_;
|
||||
};
|
||||
|
||||
|
@ -58,9 +58,9 @@ template<typename... Ts> class MHZ19ABCDisableAction : public Action<Ts...> {
|
|||
public:
|
||||
MHZ19ABCDisableAction(MHZ19Component *mhz19) : mhz19_(mhz19) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->mhz19_->abc_disable(); }
|
||||
void play(Ts... x) override { this->mhz19_->abc_disable(); }
|
||||
|
||||
protected:
|
||||
MHZ19Component *mhz19_;
|
||||
};
|
||||
|
||||
|
|
|
@ -299,12 +299,12 @@ template<typename... Ts> class MQTTPublishAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(uint8_t, qos)
|
||||
TEMPLATABLE_VALUE(bool, retain)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->publish(this->topic_.value(x...), this->payload_.value(x...), this->qos_.value(x...),
|
||||
this->retain_.value(x...));
|
||||
}
|
||||
|
||||
protected:
|
||||
MQTTClientComponent *parent_;
|
||||
};
|
||||
|
||||
|
@ -317,14 +317,15 @@ template<typename... Ts> class MQTTPublishJsonAction : public Action<Ts...> {
|
|||
|
||||
void set_payload(std::function<void(Ts..., JsonObject &)> payload) { this->payload_ = payload; }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto f = std::bind(&MQTTPublishJsonAction<Ts...>::encode_, this, x..., std::placeholders::_1);
|
||||
auto topic = this->topic_.value(x...);
|
||||
auto qos = this->qos_.value(x...);
|
||||
auto retain = this->retain_.value(x...);
|
||||
this->parent_->publish_json(topic, f, qos, retain);
|
||||
}
|
||||
|
||||
protected:
|
||||
void encode_(Ts... x, JsonObject &root) { this->payload_(x..., root); }
|
||||
std::function<void(Ts..., JsonObject &)> payload_;
|
||||
MQTTClientComponent *parent_;
|
||||
|
|
|
@ -12,9 +12,9 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
|||
public:
|
||||
TurnOffAction(BinaryOutput *output) : output_(output) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->output_->turn_off(); }
|
||||
void play(Ts... x) override { this->output_->turn_off(); }
|
||||
|
||||
protected:
|
||||
BinaryOutput *output_;
|
||||
};
|
||||
|
||||
|
@ -22,9 +22,9 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
|||
public:
|
||||
TurnOnAction(BinaryOutput *output) : output_(output) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->output_->turn_on(); }
|
||||
void play(Ts... x) override { this->output_->turn_on(); }
|
||||
|
||||
protected:
|
||||
BinaryOutput *output_;
|
||||
};
|
||||
|
||||
|
@ -34,9 +34,9 @@ template<typename... Ts> class SetLevelAction : public Action<Ts...> {
|
|||
|
||||
TEMPLATABLE_VALUE(float, level)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->output_->set_level(this->level_.value(x...)); }
|
||||
void play(Ts... x) override { this->output_->set_level(this->level_.value(x...)); }
|
||||
|
||||
protected:
|
||||
FloatOutput *output_;
|
||||
};
|
||||
|
||||
|
|
|
@ -75,8 +75,7 @@ template<typename... Ts> class PIDAutotuneAction : public Action<Ts...> {
|
|||
void set_positive_output(float positive_output) { positive_output_ = positive_output; }
|
||||
void set_negative_output(float negative_output) { negative_output_ = negative_output; }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) {
|
||||
void play(Ts... x) {
|
||||
auto tuner = make_unique<PIDAutotuner>();
|
||||
tuner->set_noiseband(this->noiseband_);
|
||||
tuner->set_output_negative(this->negative_output_);
|
||||
|
@ -84,6 +83,7 @@ template<typename... Ts> class PIDAutotuneAction : public Action<Ts...> {
|
|||
this->parent_->start_autotune(std::move(tuner));
|
||||
}
|
||||
|
||||
protected:
|
||||
float noiseband_;
|
||||
float positive_output_;
|
||||
float negative_output_;
|
||||
|
|
|
@ -24,8 +24,7 @@ template<typename... Ts> class JVCAction : public RemoteTransmitterActionBase<Ts
|
|||
public:
|
||||
TEMPLATABLE_VALUE(uint32_t, data)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
JVCData data{};
|
||||
data.data = this->data_.value(x...);
|
||||
JVCProtocol().encode(dst, data);
|
||||
|
|
|
@ -27,8 +27,7 @@ template<typename... Ts> class LGAction : public RemoteTransmitterActionBase<Ts.
|
|||
TEMPLATABLE_VALUE(uint32_t, data)
|
||||
TEMPLATABLE_VALUE(uint8_t, nbits)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
LGData data{};
|
||||
data.data = this->data_.value(x...);
|
||||
data.nbits = this->nbits_.value(x...);
|
||||
|
|
|
@ -26,8 +26,7 @@ template<typename... Ts> class NECAction : public RemoteTransmitterActionBase<Ts
|
|||
TEMPLATABLE_VALUE(uint16_t, address)
|
||||
TEMPLATABLE_VALUE(uint16_t, command)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
NECData data{};
|
||||
data.address = this->address_.value(x...);
|
||||
data.command = this->command_.value(x...);
|
||||
|
|
|
@ -27,8 +27,7 @@ template<typename... Ts> class PanasonicAction : public RemoteTransmitterActionB
|
|||
TEMPLATABLE_VALUE(uint16_t, address)
|
||||
TEMPLATABLE_VALUE(uint32_t, command)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
PanasonicData data{};
|
||||
data.address = this->address_.value(x...);
|
||||
data.command = this->command_.value(x...);
|
||||
|
|
|
@ -26,8 +26,7 @@ template<typename... Ts> class PioneerAction : public RemoteTransmitterActionBas
|
|||
TEMPLATABLE_VALUE(uint16_t, rc_code_1)
|
||||
TEMPLATABLE_VALUE(uint16_t, rc_code_2)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
PioneerData data{};
|
||||
data.rc_code_1 = this->rc_code_1_.value(x...);
|
||||
data.rc_code_2 = this->rc_code_2_.value(x...);
|
||||
|
|
|
@ -46,8 +46,7 @@ template<typename... Ts> class RawAction : public RemoteTransmitterActionBase<Ts
|
|||
}
|
||||
TEMPLATABLE_VALUE(uint32_t, carrier_frequency);
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
if (this->code_static_ != nullptr) {
|
||||
for (size_t i = 0; i < this->code_static_len_; i++) {
|
||||
auto val = this->code_static_[i];
|
||||
|
@ -62,6 +61,7 @@ template<typename... Ts> class RawAction : public RemoteTransmitterActionBase<Ts
|
|||
dst->set_carrier_frequency(this->carrier_frequency_.value(x...));
|
||||
}
|
||||
|
||||
protected:
|
||||
std::function<std::vector<int32_t>(Ts...)> code_func_{};
|
||||
const int32_t *code_static_{nullptr};
|
||||
int32_t code_static_len_{0};
|
||||
|
|
|
@ -27,8 +27,7 @@ template<typename... Ts> class RC5Action : public RemoteTransmitterActionBase<Ts
|
|||
TEMPLATABLE_VALUE(uint8_t, address)
|
||||
TEMPLATABLE_VALUE(uint8_t, command)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
RC5Data data{};
|
||||
data.address = this->address_.value(x...);
|
||||
data.command = this->command_.value(x...);
|
||||
|
|
|
@ -71,8 +71,7 @@ template<typename... Ts> class RCSwitchRawAction : public RemoteTransmitterActio
|
|||
TEMPLATABLE_VALUE(RCSwitchBase, protocol);
|
||||
TEMPLATABLE_VALUE(std::string, code);
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
auto code = this->code_.value(x...);
|
||||
uint64_t the_code = decode_binary_string(code);
|
||||
uint8_t nbits = code.size();
|
||||
|
@ -89,8 +88,7 @@ template<typename... Ts> class RCSwitchTypeAAction : public RemoteTransmitterAct
|
|||
TEMPLATABLE_VALUE(std::string, device);
|
||||
TEMPLATABLE_VALUE(bool, state);
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
auto group = this->group_.value(x...);
|
||||
auto device = this->device_.value(x...);
|
||||
auto state = this->state_.value(x...);
|
||||
|
@ -113,8 +111,7 @@ template<typename... Ts> class RCSwitchTypeBAction : public RemoteTransmitterAct
|
|||
TEMPLATABLE_VALUE(uint8_t, channel);
|
||||
TEMPLATABLE_VALUE(bool, state);
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
auto address = this->address_.value(x...);
|
||||
auto channel = this->channel_.value(x...);
|
||||
auto state = this->state_.value(x...);
|
||||
|
@ -136,8 +133,7 @@ template<typename... Ts> class RCSwitchTypeCAction : public RemoteTransmitterAct
|
|||
TEMPLATABLE_VALUE(uint8_t, device);
|
||||
TEMPLATABLE_VALUE(bool, state);
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
auto family = this->family_.value(x...);
|
||||
auto group = this->group_.value(x...);
|
||||
auto device = this->device_.value(x...);
|
||||
|
@ -160,8 +156,7 @@ template<typename... Ts> class RCSwitchTypeDAction : public RemoteTransmitterAct
|
|||
TEMPLATABLE_VALUE(uint8_t, device);
|
||||
TEMPLATABLE_VALUE(bool, state);
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
auto group = this->group_.value(x...);
|
||||
auto device = this->device_.value(x...);
|
||||
auto state = this->state_.value(x...);
|
||||
|
|
|
@ -326,17 +326,17 @@ template<typename... Ts> class RemoteTransmitterActionBase : public Action<Ts...
|
|||
TEMPLATABLE_VALUE(uint32_t, send_times);
|
||||
TEMPLATABLE_VALUE(uint32_t, send_wait);
|
||||
|
||||
protected:
|
||||
virtual void encode_(RemoteTransmitData *dst, Ts... x) = 0;
|
||||
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->transmit();
|
||||
this->encode_(call.get_data(), x...);
|
||||
this->encode(call.get_data(), x...);
|
||||
call.set_send_times(this->send_times_.value_or(x..., 1));
|
||||
call.set_send_wait(this->send_wait_.value_or(x..., 0));
|
||||
call.perform();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void encode(RemoteTransmitData *dst, Ts... x) = 0;
|
||||
|
||||
RemoteTransmitterBase *parent_{};
|
||||
};
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ template<typename... Ts> class SamsungAction : public RemoteTransmitterActionBas
|
|||
public:
|
||||
TEMPLATABLE_VALUE(uint32_t, data)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
SamsungData data{};
|
||||
data.data = this->data_.value(x...);
|
||||
SamsungProtocol().encode(dst, data);
|
||||
|
|
|
@ -27,8 +27,7 @@ template<typename... Ts> class SonyAction : public RemoteTransmitterActionBase<T
|
|||
TEMPLATABLE_VALUE(uint32_t, data)
|
||||
TEMPLATABLE_VALUE(uint8_t, nbits)
|
||||
|
||||
protected:
|
||||
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||
SonyData data{};
|
||||
data.data = this->data_.value(x...);
|
||||
data.nbits = this->nbits_.value(x...);
|
||||
|
|
|
@ -68,8 +68,7 @@ template<typename... Ts> class RFBridgeSendCodeAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(uint16_t, high)
|
||||
TEMPLATABLE_VALUE(uint32_t, code)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) {
|
||||
void play(Ts... x) {
|
||||
RFBridgeData data{};
|
||||
data.sync = this->sync_.value(x...);
|
||||
data.low = this->low_.value(x...);
|
||||
|
@ -78,6 +77,7 @@ template<typename... Ts> class RFBridgeSendCodeAction : public Action<Ts...> {
|
|||
this->parent_->send_code(data);
|
||||
}
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
|
@ -85,9 +85,9 @@ template<typename... Ts> class RFBridgeLearnAction : public Action<Ts...> {
|
|||
public:
|
||||
RFBridgeLearnAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) { this->parent_->learn(); }
|
||||
void play(Ts... x) { this->parent_->learn(); }
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
|
|
|
@ -75,8 +75,9 @@ template<typename... Ts> class RotaryEncoderSetValueAction : public Action<Ts...
|
|||
RotaryEncoderSetValueAction(RotaryEncoderSensor *encoder) : encoder_(encoder) {}
|
||||
TEMPLATABLE_VALUE(int, value)
|
||||
|
||||
void play(Ts... x) override { this->encoder_->set_value(this->value_.value(x...)); }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->encoder_->set_value(this->value_.value(x...)); }
|
||||
RotaryEncoderSensor *encoder_;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ template<typename... Ts> class ScriptExecuteAction : public Action<Ts...> {
|
|||
public:
|
||||
ScriptExecuteAction(Script *script) : script_(script) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->script_->trigger(); }
|
||||
void play(Ts... x) override { this->script_->trigger(); }
|
||||
|
||||
protected:
|
||||
Script *script_;
|
||||
};
|
||||
|
||||
|
@ -33,9 +33,9 @@ template<typename... Ts> class ScriptStopAction : public Action<Ts...> {
|
|||
public:
|
||||
ScriptStopAction(Script *script) : script_(script) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->script_->stop(); }
|
||||
void play(Ts... x) override { this->script_->stop(); }
|
||||
|
||||
protected:
|
||||
Script *script_;
|
||||
};
|
||||
|
||||
|
@ -76,10 +76,10 @@ template<typename... Ts> class ScriptWaitAction : public Action<Ts...>, public C
|
|||
|
||||
float get_setup_priority() const override { return setup_priority::DATA; }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { /* ignore - see play_complex */
|
||||
void play(Ts... x) override { /* ignore - see play_complex */
|
||||
}
|
||||
|
||||
protected:
|
||||
Script *script_;
|
||||
std::tuple<Ts...> var_{};
|
||||
};
|
||||
|
|
|
@ -26,8 +26,9 @@ template<typename... Ts> class SensorPublishAction : public Action<Ts...> {
|
|||
SensorPublishAction(Sensor *sensor) : sensor_(sensor) {}
|
||||
TEMPLATABLE_VALUE(float, state)
|
||||
|
||||
void play(Ts... x) override { this->sensor_->publish_state(this->state_.value(x...)); }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->sensor_->publish_state(this->state_.value(x...)); }
|
||||
Sensor *sensor_;
|
||||
};
|
||||
|
||||
|
|
|
@ -65,8 +65,9 @@ template<typename... Ts> class ServoWriteAction : public Action<Ts...> {
|
|||
ServoWriteAction(Servo *servo) : servo_(servo) {}
|
||||
TEMPLATABLE_VALUE(float, value)
|
||||
|
||||
void play(Ts... x) override { this->servo_->write(this->value_.value(x...)); }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->servo_->write(this->value_.value(x...)); }
|
||||
Servo *servo_;
|
||||
};
|
||||
|
||||
|
@ -74,8 +75,9 @@ template<typename... Ts> class ServoDetachAction : public Action<Ts...> {
|
|||
public:
|
||||
ServoDetachAction(Servo *servo) : servo_(servo) {}
|
||||
|
||||
void play(Ts... x) override { this->servo_->detach(); }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->servo_->detach(); }
|
||||
Servo *servo_;
|
||||
};
|
||||
|
||||
|
|
|
@ -78,13 +78,13 @@ template<typename... Ts> class Sim800LSendSmsAction : public Action<Ts...> {
|
|||
TEMPLATABLE_VALUE(std::string, recipient)
|
||||
TEMPLATABLE_VALUE(std::string, message)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) {
|
||||
void play(Ts... x) {
|
||||
auto recipient = this->recipient_.value(x...);
|
||||
auto message = this->message_.value(x...);
|
||||
this->parent_->send_sms(recipient, message);
|
||||
}
|
||||
|
||||
protected:
|
||||
Sim800LComponent *parent_;
|
||||
};
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ template<typename... Ts> class SetTargetAction : public Action<Ts...> {
|
|||
|
||||
TEMPLATABLE_VALUE(int32_t, target)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->parent_->set_target(this->target_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->set_target(this->target_.value(x...)); }
|
||||
|
||||
protected:
|
||||
Stepper *parent_;
|
||||
};
|
||||
|
||||
|
@ -55,9 +55,9 @@ template<typename... Ts> class ReportPositionAction : public Action<Ts...> {
|
|||
|
||||
TEMPLATABLE_VALUE(int32_t, position)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->parent_->report_position(this->position_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->report_position(this->position_.value(x...)); }
|
||||
|
||||
protected:
|
||||
Stepper *parent_;
|
||||
};
|
||||
|
||||
|
@ -67,13 +67,13 @@ template<typename... Ts> class SetSpeedAction : public Action<Ts...> {
|
|||
|
||||
TEMPLATABLE_VALUE(float, speed);
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
float speed = this->speed_.value(x...);
|
||||
this->parent_->set_max_speed(speed);
|
||||
this->parent_->on_update_speed();
|
||||
}
|
||||
|
||||
protected:
|
||||
Stepper *parent_;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit TurnOnAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->switch_->turn_on(); }
|
||||
void play(Ts... x) override { this->switch_->turn_on(); }
|
||||
|
||||
protected:
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
|
@ -21,9 +21,9 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit TurnOffAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->switch_->turn_off(); }
|
||||
void play(Ts... x) override { this->switch_->turn_off(); }
|
||||
|
||||
protected:
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
|
@ -31,9 +31,9 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
|||
public:
|
||||
explicit ToggleAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->switch_->toggle(); }
|
||||
void play(Ts... x) override { this->switch_->toggle(); }
|
||||
|
||||
protected:
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
|
@ -74,8 +74,9 @@ template<typename... Ts> class SwitchPublishAction : public Action<Ts...> {
|
|||
SwitchPublishAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
void play(Ts... x) override { this->switch_->publish_state(this->state_.value(x...)); }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->switch_->publish_state(this->state_.value(x...)); }
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
|
|
|
@ -31,8 +31,9 @@ template<typename... Ts> class TextSensorPublishAction : public Action<Ts...> {
|
|||
TextSensorPublishAction(TextSensor *sensor) : sensor_(sensor) {}
|
||||
TEMPLATABLE_VALUE(std::string, state)
|
||||
|
||||
void play(Ts... x) override { this->sensor_->publish_state(this->state_.value(x...)); }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->sensor_->publish_state(this->state_.value(x...)); }
|
||||
TextSensor *sensor_;
|
||||
};
|
||||
|
||||
|
|
|
@ -43,8 +43,7 @@ template<typename... Ts> class SetLevelPercentAction : public Action<Ts...>, pub
|
|||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, level_percent)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto level_percent = this->level_percent_.value(x...);
|
||||
this->parent_->set_level_percent(level_percent);
|
||||
}
|
||||
|
@ -54,8 +53,7 @@ template<typename... Ts> class SetLevelAction : public Action<Ts...>, public Par
|
|||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, level)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto level = this->level_.value(x...);
|
||||
this->parent_->set_level(level);
|
||||
}
|
||||
|
@ -65,21 +63,20 @@ template<typename... Ts> class SetBrightnessAction : public Action<Ts...>, publi
|
|||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, brightness)
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
auto brightness = this->brightness_.value(x...);
|
||||
this->parent_->set_brightness(brightness);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class TurnOnAction : public Action<Ts...>, public Parented<TM1651Display> {
|
||||
protected:
|
||||
void play_(Ts... x) override { this->parent_->turn_on(); }
|
||||
public:
|
||||
void play(Ts... x) override { this->parent_->turn_on(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class TurnOffAction : public Action<Ts...>, public Parented<TM1651Display> {
|
||||
protected:
|
||||
void play_(Ts... x) override { this->parent_->turn_off(); }
|
||||
public:
|
||||
void play(Ts... x) override { this->parent_->turn_off(); }
|
||||
};
|
||||
|
||||
} // namespace tm1651
|
||||
|
|
|
@ -17,8 +17,7 @@ template<typename... Ts> class UARTWriteAction : public Action<Ts...>, public Pa
|
|||
this->static_ = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->static_) {
|
||||
this->parent_->write_array(this->data_static_);
|
||||
} else {
|
||||
|
@ -26,6 +25,7 @@ template<typename... Ts> class UARTWriteAction : public Action<Ts...>, public Pa
|
|||
this->parent_->write_array(val);
|
||||
}
|
||||
}
|
||||
protected:
|
||||
bool static_{false};
|
||||
std::function<std::vector<uint8_t>(Ts...)> data_func_{};
|
||||
std::vector<uint8_t> data_static_{};
|
||||
|
|
|
@ -77,12 +77,12 @@ template<typename... Ts> class Action {
|
|||
public:
|
||||
virtual void play_complex(Ts... x) {
|
||||
this->num_running_++;
|
||||
this->play_(x...);
|
||||
this->play(x...);
|
||||
this->play_next_(x...);
|
||||
}
|
||||
virtual void stop_complex() {
|
||||
if (num_running_) {
|
||||
this->stop_();
|
||||
this->stop();
|
||||
this->num_running_ = 0;
|
||||
}
|
||||
this->stop_next_();
|
||||
|
@ -92,7 +92,7 @@ template<typename... Ts> class Action {
|
|||
protected:
|
||||
friend ActionList<Ts...>;
|
||||
|
||||
virtual void play_(Ts... x) = 0;
|
||||
virtual void play(Ts... x) = 0;
|
||||
void play_next_(Ts... x) {
|
||||
if (this->num_running_ > 0) {
|
||||
this->num_running_--;
|
||||
|
@ -108,7 +108,7 @@ template<typename... Ts> class Action {
|
|||
this->play_next_tuple_(tuple, typename gens<sizeof...(Ts)>::type());
|
||||
}
|
||||
|
||||
virtual void stop_() {}
|
||||
virtual void stop() {}
|
||||
void stop_next_() {
|
||||
if (this->next_ != nullptr) {
|
||||
this->next_->stop_complex();
|
||||
|
|
|
@ -115,22 +115,19 @@ template<typename... Ts> class DelayAction : public Action<Ts...>, public Compon
|
|||
}
|
||||
float get_setup_priority() const override { return setup_priority::HARDWARE; }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { /* ignore - see play_complex */
|
||||
void play(Ts... x) override { /* ignore - see play_complex */
|
||||
}
|
||||
|
||||
void stop_() override {
|
||||
this->cancel_timeout("");
|
||||
}
|
||||
void stop() override { this->cancel_timeout(""); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class LambdaAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit LambdaAction(std::function<void(Ts...)> &&f) : f_(std::move(f)) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->f_(x...); }
|
||||
void play(Ts... x) override { this->f_(x...); }
|
||||
|
||||
protected:
|
||||
std::function<void(Ts...)> f_;
|
||||
};
|
||||
|
||||
|
@ -166,15 +163,15 @@ template<typename... Ts> class IfAction : public Action<Ts...> {
|
|||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { /* ignore - see play_complex */
|
||||
void play(Ts... x) override { /* ignore - see play_complex */
|
||||
}
|
||||
|
||||
void stop_() override {
|
||||
void stop() override {
|
||||
this->then_.stop();
|
||||
this->else_.stop();
|
||||
}
|
||||
|
||||
protected:
|
||||
Condition<Ts...> *condition_;
|
||||
ActionList<Ts...> then_;
|
||||
ActionList<Ts...> else_;
|
||||
|
@ -216,12 +213,12 @@ template<typename... Ts> class WhileAction : public Action<Ts...> {
|
|||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { /* ignore - see play_complex */
|
||||
void play(Ts... x) override { /* ignore - see play_complex */
|
||||
}
|
||||
|
||||
void stop_() override { this->then_.stop(); }
|
||||
void stop() override { this->then_.stop(); }
|
||||
|
||||
protected:
|
||||
Condition<Ts...> *condition_;
|
||||
ActionList<Ts...> then_;
|
||||
std::tuple<Ts...> var_{};
|
||||
|
@ -257,10 +254,10 @@ template<typename... Ts> class WaitUntilAction : public Action<Ts...>, public Co
|
|||
|
||||
float get_setup_priority() const override { return setup_priority::DATA; }
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { /* ignore - see play_complex */
|
||||
void play(Ts... x) override { /* ignore - see play_complex */
|
||||
}
|
||||
|
||||
protected:
|
||||
Condition<Ts...> *condition_;
|
||||
std::tuple<Ts...> var_{};
|
||||
};
|
||||
|
@ -269,9 +266,9 @@ template<typename... Ts> class UpdateComponentAction : public Action<Ts...> {
|
|||
public:
|
||||
UpdateComponentAction(PollingComponent *component) : component_(component) {}
|
||||
|
||||
protected:
|
||||
void play_(Ts... x) override { this->component_->update(); }
|
||||
void play(Ts... x) override { this->component_->update(); }
|
||||
|
||||
protected:
|
||||
PollingComponent *component_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue