mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 09:08:41 +00:00
[one_wire] allow changing address at runtime (#12150)
This commit is contained in:
@@ -13,6 +13,11 @@ const std::string &OneWireDevice::get_address_name() {
|
||||
return this->address_name_;
|
||||
}
|
||||
|
||||
void OneWireDevice::set_address(uint64_t address) {
|
||||
this->address_ = address;
|
||||
this->address_name_.clear();
|
||||
}
|
||||
|
||||
bool OneWireDevice::send_command_(uint8_t cmd) {
|
||||
if (!this->bus_->select(this->address_))
|
||||
return false;
|
||||
|
||||
@@ -15,7 +15,7 @@ class OneWireDevice {
|
||||
public:
|
||||
/// @brief store the address of the device
|
||||
/// @param address of the device
|
||||
void set_address(uint64_t address) { this->address_ = address; }
|
||||
void set_address(uint64_t address);
|
||||
|
||||
void set_index(uint8_t index) { this->index_ = index; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user