mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
[switch] Inline the trivial inverted accessors
This commit is contained in:
@@ -69,9 +69,6 @@ void Switch::publish_state(bool state) {
|
|||||||
}
|
}
|
||||||
bool Switch::assumed_state() { return false; }
|
bool Switch::assumed_state() { return false; }
|
||||||
|
|
||||||
void Switch::set_inverted(bool inverted) { this->inverted_ = inverted; }
|
|
||||||
bool Switch::is_inverted() const { return this->inverted_; }
|
|
||||||
|
|
||||||
void log_switch(const char *tag, const char *prefix, const char *type, Switch *obj) {
|
void log_switch(const char *tag, const char *prefix, const char *type, Switch *obj) {
|
||||||
if (obj != nullptr) {
|
if (obj != nullptr) {
|
||||||
// Prepare restore mode string
|
// Prepare restore mode string
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Switch : public EntityBase {
|
|||||||
*
|
*
|
||||||
* @param inverted Whether to invert this switch.
|
* @param inverted Whether to invert this switch.
|
||||||
*/
|
*/
|
||||||
void set_inverted(bool inverted);
|
void set_inverted(bool inverted) { this->inverted_ = inverted; }
|
||||||
|
|
||||||
/** Set callback for state changes.
|
/** Set callback for state changes.
|
||||||
*
|
*
|
||||||
@@ -117,7 +117,7 @@ class Switch : public EntityBase {
|
|||||||
*/
|
*/
|
||||||
virtual bool assumed_state();
|
virtual bool assumed_state();
|
||||||
|
|
||||||
bool is_inverted() const;
|
bool is_inverted() const { return this->inverted_; }
|
||||||
|
|
||||||
void set_restore_mode(SwitchRestoreMode restore_mode) { this->restore_mode = restore_mode; }
|
void set_restore_mode(SwitchRestoreMode restore_mode) { this->restore_mode = restore_mode; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user