mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-26 15:48:28 +02:00
Cleanup dashboard JS (#491)
* Cleanup dashboard JS * Add vscode * Save start_mark/end_mark * Updates * Updates * Remove need for cv.nameable It's a bit hacky but removes so much bloat from integrations * Add enum helper * Document APIs, and Improvements * Fixes * Fixes * Update PULL_REQUEST_TEMPLATE.md * Updates * Updates * Updates
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include "ttp229_lsf.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ttp229_lsf {
|
||||
|
||||
static const char *TAG = "ttp229_lsf";
|
||||
|
||||
void TTP229LSFComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up ttp229...");
|
||||
if (!this->parent_->raw_request_from(this->address_, 2)) {
|
||||
this->error_code_ = COMMUNICATION_FAILED;
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
void TTP229LSFComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ttp229:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, "Communication with TTP229 failed!");
|
||||
break;
|
||||
case NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void TTP229LSFComponent::loop() {
|
||||
uint16_t touched = 0;
|
||||
if (!this->parent_->raw_receive_16(this->address_, &touched, 1)) {
|
||||
this->status_set_warning();
|
||||
return;
|
||||
}
|
||||
this->status_clear_warning();
|
||||
touched = reverse_bits_16(touched);
|
||||
for (auto *channel : this->channels_) {
|
||||
channel->process(touched);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ttp229_lsf
|
||||
} // namespace esphome
|
||||
Reference in New Issue
Block a user