mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
Nextion - Standardizing log messages (#5837)
This commit is contained in:
parent
019315afa0
commit
460362b11f
1 changed files with 28 additions and 10 deletions
|
@ -433,8 +433,10 @@ void Nextion::process_nextion_commands_() {
|
|||
uint8_t page_id = to_process[0];
|
||||
uint8_t component_id = to_process[1];
|
||||
uint8_t touch_event = to_process[2]; // 0 -> release, 1 -> press
|
||||
ESP_LOGD(TAG, "Got touch page=%u component=%u type=%s", page_id, component_id,
|
||||
touch_event ? "PRESS" : "RELEASE");
|
||||
ESP_LOGD(TAG, "Got touch event:");
|
||||
ESP_LOGD(TAG, " page_id: %u", page_id);
|
||||
ESP_LOGD(TAG, " component_id: %u", component_id);
|
||||
ESP_LOGD(TAG, " event type: %s", touch_event ? "PRESS" : "RELEASE");
|
||||
for (auto *touch : this->touch_) {
|
||||
touch->process_touch(page_id, component_id, touch_event != 0);
|
||||
}
|
||||
|
@ -448,7 +450,7 @@ void Nextion::process_nextion_commands_() {
|
|||
}
|
||||
|
||||
uint8_t page_id = to_process[0];
|
||||
ESP_LOGD(TAG, "Got new page=%u", page_id);
|
||||
ESP_LOGD(TAG, "Got new page: %u", page_id);
|
||||
this->page_callback_.call(page_id);
|
||||
break;
|
||||
}
|
||||
|
@ -466,7 +468,10 @@ void Nextion::process_nextion_commands_() {
|
|||
uint16_t x = (uint16_t(to_process[0]) << 8) | to_process[1];
|
||||
uint16_t y = (uint16_t(to_process[2]) << 8) | to_process[3];
|
||||
uint8_t touch_event = to_process[4]; // 0 -> release, 1 -> press
|
||||
ESP_LOGD(TAG, "Got touch at x=%u y=%u type=%s", x, y, touch_event ? "PRESS" : "RELEASE");
|
||||
ESP_LOGD(TAG, "Got touch event:");
|
||||
ESP_LOGD(TAG, " x: %u", x);
|
||||
ESP_LOGD(TAG, " y: %u", y);
|
||||
ESP_LOGD(TAG, " type: %s", touch_event ? "PRESS" : "RELEASE");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -588,7 +593,9 @@ void Nextion::process_nextion_commands_() {
|
|||
variable_name = to_process.substr(0, index);
|
||||
++index;
|
||||
|
||||
ESP_LOGN(TAG, "Got Switch variable_name=%s value=%d", variable_name.c_str(), to_process[0] != 0);
|
||||
ESP_LOGN(TAG, "Got Switch:");
|
||||
ESP_LOGN(TAG, " variable_name: %s", variable_name.c_str());
|
||||
ESP_LOGN(TAG, " value: %d", to_process[0] != 0);
|
||||
|
||||
for (auto *switchtype : this->switchtype_) {
|
||||
switchtype->process_bool(variable_name, to_process[index] != 0);
|
||||
|
@ -619,7 +626,9 @@ void Nextion::process_nextion_commands_() {
|
|||
value += to_process[i + index + 1] << (8 * i);
|
||||
}
|
||||
|
||||
ESP_LOGN(TAG, "Got sensor variable_name=%s value=%d", variable_name.c_str(), value);
|
||||
ESP_LOGN(TAG, "Got sensor:");
|
||||
ESP_LOGN(TAG, " variable_name: %s", variable_name.c_str());
|
||||
ESP_LOGN(TAG, " value: %d", value);
|
||||
|
||||
for (auto *sensor : this->sensortype_) {
|
||||
sensor->process_sensor(variable_name, value);
|
||||
|
@ -651,7 +660,9 @@ void Nextion::process_nextion_commands_() {
|
|||
|
||||
text_value = to_process.substr(index);
|
||||
|
||||
ESP_LOGN(TAG, "Got Text Sensor variable_name=%s value=%s", variable_name.c_str(), text_value.c_str());
|
||||
ESP_LOGN(TAG, "Got Text Sensor:");
|
||||
ESP_LOGN(TAG, " variable_name: %s", variable_name.c_str());
|
||||
ESP_LOGN(TAG, " value: %s", text_value.c_str());
|
||||
|
||||
// NextionTextSensorResponseQueue *nq = new NextionTextSensorResponseQueue;
|
||||
// nq->variable_name = variable_name;
|
||||
|
@ -682,7 +693,9 @@ void Nextion::process_nextion_commands_() {
|
|||
variable_name = to_process.substr(0, index);
|
||||
++index;
|
||||
|
||||
ESP_LOGN(TAG, "Got Binary Sensor variable_name=%s value=%d", variable_name.c_str(), to_process[index] != 0);
|
||||
ESP_LOGN(TAG, "Got Binary Sensor:");
|
||||
ESP_LOGN(TAG, " variable_name: %s", variable_name.c_str());
|
||||
ESP_LOGN(TAG, " value: %d", to_process[index] != 0);
|
||||
|
||||
for (auto *binarysensortype : this->binarysensortype_) {
|
||||
binarysensortype->process_bool(&variable_name[0], to_process[index] != 0);
|
||||
|
@ -772,7 +785,10 @@ void Nextion::set_nextion_sensor_state(int queue_type, const std::string &name,
|
|||
}
|
||||
|
||||
void Nextion::set_nextion_sensor_state(NextionQueueType queue_type, const std::string &name, float state) {
|
||||
ESP_LOGN(TAG, "Received state for variable %s, state %lf for queue type %d", name.c_str(), state, queue_type);
|
||||
ESP_LOGN(TAG, "Received state:");
|
||||
ESP_LOGN(TAG, " variable: %s", name.c_str());
|
||||
ESP_LOGN(TAG, " state: %lf", state);
|
||||
ESP_LOGN(TAG, " queue type: %d", queue_type);
|
||||
|
||||
switch (queue_type) {
|
||||
case NextionQueueType::SENSOR: {
|
||||
|
@ -809,7 +825,9 @@ void Nextion::set_nextion_sensor_state(NextionQueueType queue_type, const std::s
|
|||
}
|
||||
|
||||
void Nextion::set_nextion_text_state(const std::string &name, const std::string &state) {
|
||||
ESP_LOGD(TAG, "Received state for variable %s, state %s", name.c_str(), state.c_str());
|
||||
ESP_LOGD(TAG, "Received state:");
|
||||
ESP_LOGD(TAG, " variable: %s", name.c_str());
|
||||
ESP_LOGD(TAG, " state: %s", state.c_str());
|
||||
|
||||
for (auto *sensor : this->textsensortype_) {
|
||||
if (name == sensor->get_variable_name()) {
|
||||
|
|
Loading…
Reference in a new issue