split pronto codes if they are too long (#3812)

Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
Samuel Sieb 2022-09-15 12:27:50 -07:00 committed by GitHub
parent 917bbc669c
commit 7a91ca9809
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,7 +227,18 @@ optional<ProntoData> ProntoProtocol::decode(RemoteReceiveData src) {
return out;
}
void ProntoProtocol::dump(const ProntoData &data) { ESP_LOGD(TAG, "Received Pronto: data=%s", data.data.c_str()); }
void ProntoProtocol::dump(const ProntoData &data) {
std::string first, rest;
if (data.data.size() < 230) {
first = data.data;
} else {
first = data.data.substr(0, 229);
rest = data.data.substr(230);
}
ESP_LOGD(TAG, "Received Pronto: data=%s", first.c_str());
if (!rest.empty())
ESP_LOGD(TAG, "%s", rest.c_str());
}
} // namespace remote_base
} // namespace esphome