Comment out Lovelace UI commands
It was a nice UI, but wasn't helping with the TFT upload.
This commit is contained in:
@@ -1888,34 +1888,34 @@ script:
|
|||||||
parameters:
|
parameters:
|
||||||
command: string
|
command: string
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
#- lambda: |-
|
||||||
static const char *const TAG = "script.lovelace_custom_command";
|
# static const char *const TAG = "script.lovelace_custom_command";
|
||||||
ESP_LOGV(TAG, "Sending command: %s", command.c_str());
|
# ESP_LOGV(TAG, "Sending command: %s", command.c_str());
|
||||||
|
|
||||||
auto crc16 = [](const uint8_t *data, uint16_t len) -> uint16_t {
|
# auto crc16 = [](const uint8_t *data, uint16_t len) -> uint16_t {
|
||||||
uint16_t crc = 0xFFFF;
|
# uint16_t crc = 0xFFFF;
|
||||||
while (len--) {
|
# while (len--) {
|
||||||
crc ^= *data++;
|
# crc ^= *data++;
|
||||||
for (uint8_t i = 0; i < 8; i++) {
|
# for (uint8_t i = 0; i < 8; i++) {
|
||||||
if ((crc & 0x01) != 0) {
|
# if ((crc & 0x01) != 0) {
|
||||||
crc >>= 1;
|
# crc >>= 1;
|
||||||
crc ^= 0xA001;
|
# crc ^= 0xA001;
|
||||||
} else {
|
# } else {
|
||||||
crc >>= 1;
|
# crc >>= 1;
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
return crc;
|
# return crc;
|
||||||
};
|
# };
|
||||||
|
|
||||||
std::vector<uint8_t> data = {0x55, 0xBB};
|
# std::vector<uint8_t> data = {0x55, 0xBB};
|
||||||
data.push_back(command.length() & 0xFF);
|
# data.push_back(command.length() & 0xFF);
|
||||||
data.push_back((command.length() >> 8) & 0xFF);
|
# data.push_back((command.length() >> 8) & 0xFF);
|
||||||
data.insert(data.end(), command.begin(), command.end());
|
# data.insert(data.end(), command.begin(), command.end());
|
||||||
auto crc = crc16(data.data(), data.size());
|
# auto crc = crc16(data.data(), data.size());
|
||||||
data.push_back(crc & 0xFF);
|
# data.push_back(crc & 0xFF);
|
||||||
data.push_back((crc >> 8) & 0xFF);
|
# data.push_back((crc >> 8) & 0xFF);
|
||||||
tf_uart->write_array(data.data(), data.size());
|
# tf_uart->write_array(data.data(), data.size());
|
||||||
|
|
||||||
- id: nextion_status
|
- id: nextion_status
|
||||||
mode: restart
|
mode: restart
|
||||||
|
|||||||
Reference in New Issue
Block a user