mirror of
https://github.com/esphome/esphome.git
synced 2025-03-29 05:58:19 +00:00
Update mcp4461.cpp
This commit is contained in:
parent
7ae18bdc6c
commit
23c219a99b
@ -134,7 +134,7 @@ void Mcp4461Component::loop() {
|
|||||||
|
|
||||||
uint8_t Mcp4461Component::get_status_register() {
|
uint8_t Mcp4461Component::get_status_register() {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint8_t reg = 0;
|
uint8_t reg = 0;
|
||||||
@ -191,7 +191,7 @@ uint8_t Mcp4461Component::get_wiper_address_(uint8_t wiper) {
|
|||||||
|
|
||||||
uint16_t Mcp4461Component::get_wiper_level(Mcp4461WiperIdx wiper) {
|
uint16_t Mcp4461Component::get_wiper_level(Mcp4461WiperIdx wiper) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -230,7 +230,7 @@ void Mcp4461Component::update_wiper_level(Mcp4461WiperIdx wiper) {
|
|||||||
|
|
||||||
void Mcp4461Component::set_wiper_level(Mcp4461WiperIdx wiper, uint16_t value) {
|
void Mcp4461Component::set_wiper_level(Mcp4461WiperIdx wiper, uint16_t value) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -265,7 +265,7 @@ void Mcp4461Component::write_wiper_level_(uint8_t wiper, uint16_t value) {
|
|||||||
|
|
||||||
void Mcp4461Component::enable_wiper(Mcp4461WiperIdx wiper) {
|
void Mcp4461Component::enable_wiper(Mcp4461WiperIdx wiper) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -276,7 +276,7 @@ void Mcp4461Component::enable_wiper(Mcp4461WiperIdx wiper) {
|
|||||||
|
|
||||||
void Mcp4461Component::disable_wiper(Mcp4461WiperIdx wiper) {
|
void Mcp4461Component::disable_wiper(Mcp4461WiperIdx wiper) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -287,7 +287,7 @@ void Mcp4461Component::disable_wiper(Mcp4461WiperIdx wiper) {
|
|||||||
|
|
||||||
bool Mcp4461Component::increase_wiper(Mcp4461WiperIdx wiper) {
|
bool Mcp4461Component::increase_wiper(Mcp4461WiperIdx wiper) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -316,7 +316,7 @@ bool Mcp4461Component::increase_wiper(Mcp4461WiperIdx wiper) {
|
|||||||
|
|
||||||
bool Mcp4461Component::decrease_wiper(Mcp4461WiperIdx wiper) {
|
bool Mcp4461Component::decrease_wiper(Mcp4461WiperIdx wiper) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -369,7 +369,7 @@ uint8_t Mcp4461Component::calc_terminal_connector_byte_(Mcp4461TerminalIdx termi
|
|||||||
|
|
||||||
uint8_t Mcp4461Component::get_terminal_register(Mcp4461TerminalIdx terminal_connector) {
|
uint8_t Mcp4461Component::get_terminal_register(Mcp4461TerminalIdx terminal_connector) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint8_t reg = 0;
|
uint8_t reg = 0;
|
||||||
@ -390,6 +390,10 @@ uint8_t Mcp4461Component::get_terminal_register(Mcp4461TerminalIdx terminal_conn
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mcp4461Component::update_terminal_register(Mcp4461TerminalIdx terminal_connector) {
|
void Mcp4461Component::update_terminal_register(Mcp4461TerminalIdx terminal_connector) {
|
||||||
|
if (this->is_failed()) {
|
||||||
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((static_cast<uint8_t>(terminal_connector) != 0 && static_cast<uint8_t>(terminal_connector) != 1)) {
|
if ((static_cast<uint8_t>(terminal_connector) != 0 && static_cast<uint8_t>(terminal_connector) != 1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -436,7 +440,7 @@ bool Mcp4461Component::set_terminal_register(Mcp4461TerminalIdx terminal_connect
|
|||||||
|
|
||||||
void Mcp4461Component::enable_terminal(Mcp4461WiperIdx wiper, char terminal) {
|
void Mcp4461Component::enable_terminal(Mcp4461WiperIdx wiper, char terminal) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -466,7 +470,7 @@ void Mcp4461Component::enable_terminal(Mcp4461WiperIdx wiper, char terminal) {
|
|||||||
|
|
||||||
void Mcp4461Component::disable_terminal(Mcp4461WiperIdx wiper, char terminal) {
|
void Mcp4461Component::disable_terminal(Mcp4461WiperIdx wiper, char terminal) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
|
||||||
@ -496,7 +500,7 @@ void Mcp4461Component::disable_terminal(Mcp4461WiperIdx wiper, char terminal) {
|
|||||||
|
|
||||||
uint16_t Mcp4461Component::get_eeprom_value(Mcp4461EepromLocation location) {
|
uint16_t Mcp4461Component::get_eeprom_value(Mcp4461EepromLocation location) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint8_t reg = 0;
|
uint8_t reg = 0;
|
||||||
@ -516,7 +520,7 @@ uint16_t Mcp4461Component::get_eeprom_value(Mcp4461EepromLocation location) {
|
|||||||
|
|
||||||
bool Mcp4461Component::set_eeprom_value(Mcp4461EepromLocation location, uint16_t value) {
|
bool Mcp4461Component::set_eeprom_value(Mcp4461EepromLocation location, uint16_t value) {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGW(TAG, LOG_PARENT_FAILED_STR);
|
ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint8_t addr = 0;
|
uint8_t addr = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user