mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 19:38:30 +02:00
Activate owning-memory clang-tidy check (#1891)
* Activate owning-memory clang-tidy check * Lint * Lint * Fix issue with new NfcTag constructor * Update pointers for number and select * Add back the NOLINT to display buffer * Fix merge * DSMR fixes * Nextion fixes * Fix pipsolar * Fix lwip socket * Format * Change socket fix Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,7 @@ CONFIG_SCHEMA = output.FLOAT_OUTPUT_SCHEMA.extend(
|
||||
|
||||
async def to_code(config):
|
||||
paren = await cg.get_variable(config[CONF_TLC59208F_ID])
|
||||
rhs = paren.create_channel(config[CONF_CHANNEL])
|
||||
var = cg.Pvariable(config[CONF_ID], rhs)
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
cg.add(var.set_channel(config[CONF_CHANNEL]))
|
||||
cg.add(paren.register_channel(var))
|
||||
await output.register_output(var, config)
|
||||
|
||||
@@ -137,11 +137,11 @@ void TLC59208FOutput::loop() {
|
||||
this->update_ = false;
|
||||
}
|
||||
|
||||
TLC59208FChannel *TLC59208FOutput::create_channel(uint8_t channel) {
|
||||
this->min_channel_ = std::min(this->min_channel_, channel);
|
||||
this->max_channel_ = std::max(this->max_channel_, channel);
|
||||
auto *c = new TLC59208FChannel(this, channel);
|
||||
return c;
|
||||
void TLC59208FOutput::register_channel(TLC59208FChannel *channel) {
|
||||
auto c = channel->channel_;
|
||||
this->min_channel_ = std::min(this->min_channel_, c);
|
||||
this->max_channel_ = std::max(this->max_channel_, c);
|
||||
channel->set_parent(this);
|
||||
}
|
||||
|
||||
void TLC59208FChannel::write_state(float state) {
|
||||
|
||||
@@ -21,14 +21,15 @@ extern const uint8_t TLC59208F_MODE2_WDT_35MS;
|
||||
|
||||
class TLC59208FOutput;
|
||||
|
||||
class TLC59208FChannel : public output::FloatOutput {
|
||||
class TLC59208FChannel : public output::FloatOutput, public Parented<TLC59208FOutput> {
|
||||
public:
|
||||
TLC59208FChannel(TLC59208FOutput *parent, uint8_t channel) : parent_(parent), channel_(channel) {}
|
||||
void set_channel(uint8_t channel) { channel_ = channel; }
|
||||
|
||||
protected:
|
||||
friend class TLC59208FOutput;
|
||||
|
||||
void write_state(float state) override;
|
||||
|
||||
TLC59208FOutput *parent_;
|
||||
uint8_t channel_;
|
||||
};
|
||||
|
||||
@@ -37,7 +38,7 @@ class TLC59208FOutput : public Component, public i2c::I2CDevice {
|
||||
public:
|
||||
TLC59208FOutput(uint8_t mode = TLC59208F_MODE2_OCH) : mode_(mode) {}
|
||||
|
||||
TLC59208FChannel *create_channel(uint8_t channel);
|
||||
void register_channel(TLC59208FChannel *channel);
|
||||
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
Reference in New Issue
Block a user