mirror of
https://github.com/esphome/esphome.git
synced 2025-04-03 09:20:29 +01:00
Update mcp4461_output.h
This commit is contained in:
parent
4863da15fe
commit
642089e6c7
@ -11,13 +11,14 @@ namespace mcp4461 {
|
|||||||
class Mcp4461Wiper : public output::FloatOutput {
|
class Mcp4461Wiper : public output::FloatOutput {
|
||||||
public:
|
public:
|
||||||
Mcp4461Wiper(Mcp4461Component *parent, Mcp4461WiperIdx wiper, bool enable, bool terminal_a, bool terminal_b,
|
Mcp4461Wiper(Mcp4461Component *parent, Mcp4461WiperIdx wiper, bool enable, bool terminal_a, bool terminal_b,
|
||||||
bool terminal_w)
|
bool terminal_w, float initial_value)
|
||||||
: parent_(parent),
|
: parent_(parent),
|
||||||
wiper_(wiper),
|
wiper_(wiper),
|
||||||
enable_(enable),
|
enable_(enable),
|
||||||
terminal_a_(terminal_a),
|
terminal_a_(terminal_a),
|
||||||
terminal_b_(terminal_b),
|
terminal_b_(terminal_b),
|
||||||
terminal_w_(terminal_w) {
|
terminal_w_(terminal_w),
|
||||||
|
initial_value_(initial_value) {
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
// update wiper connection state
|
// update wiper connection state
|
||||||
if (!(this->enable_) && wiper_idx < 4) {
|
if (!(this->enable_) && wiper_idx < 4) {
|
||||||
@ -30,6 +31,7 @@ class Mcp4461Wiper : public output::FloatOutput {
|
|||||||
parent->disable_terminal(wiper, 'b');
|
parent->disable_terminal(wiper, 'b');
|
||||||
if (!terminal_w && wiper_idx < 4)
|
if (!terminal_w && wiper_idx < 4)
|
||||||
parent->disable_terminal(wiper, 'w');
|
parent->disable_terminal(wiper, 'w');
|
||||||
|
this->set_initial_value(initial_value);
|
||||||
}
|
}
|
||||||
uint16_t get_wiper_level();
|
uint16_t get_wiper_level();
|
||||||
void save_level();
|
void save_level();
|
||||||
@ -47,7 +49,7 @@ class Mcp4461Wiper : public output::FloatOutput {
|
|||||||
Mcp4461WiperIdx wiper_;
|
Mcp4461WiperIdx wiper_;
|
||||||
bool enable_;
|
bool enable_;
|
||||||
uint16_t state_;
|
uint16_t state_;
|
||||||
uint16_t initial_value_;
|
float initial_value_;
|
||||||
bool terminal_a_;
|
bool terminal_a_;
|
||||||
bool terminal_b_;
|
bool terminal_b_;
|
||||||
bool terminal_w_;
|
bool terminal_w_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user