From 422c441533d234cd5baf865cbfd75c1e7dd6065f Mon Sep 17 00:00:00 2001 From: KlausMu Date: Thu, 8 Feb 2024 07:28:50 +0100 Subject: [PATCH] added support for IR DENON commands --- Platformio/src/commandHandler.cpp | 20 +++++++++++++++++++- Platformio/src/commandHandler.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Platformio/src/commandHandler.cpp b/Platformio/src/commandHandler.cpp index 71e8be1..65a83d3 100644 --- a/Platformio/src/commandHandler.cpp +++ b/Platformio/src/commandHandler.cpp @@ -84,7 +84,7 @@ void executeCommandWithData(std::string command, commandData commandData, std::s auto current = commandData.commandPayloads.begin(); data = std::stoull(*current, &sz, 0); } - Serial.printf("execute: will send IR SONY, data (%" PRIu64 ")\r\n", data); + Serial.printf("execute: will send IR SONY 15 bit, data (%" PRIu64 ")\r\n", data); IrSender.sendSony(data, 15); } break; @@ -108,6 +108,24 @@ void executeCommandWithData(std::string command, commandData commandData, std::s break; } + case IR_DENON: { + std::string::size_type sz = 0; // alias of size_t + uint64_t data; + if (commandData.commandPayloads.empty() && (additionalPayload == "")) { + Serial.printf("execute: cannot send IR DENON 48 bit, because both data and payload are empty\r\n"); + } else { + if (additionalPayload != "") { + data = std::stoull(additionalPayload, &sz, 0); + } else { + auto current = commandData.commandPayloads.begin(); + data = std::stoull(*current, &sz, 0); + } + Serial.printf("execute: will send IR DENON 48 bit, data (%" PRIu64 ")\r\n", data); + IrSender.sendDenon(data, 48); + } + break; + } + #ifdef ENABLE_WIFI_AND_MQTT case MQTT: { auto current = commandData.commandPayloads.begin(); diff --git a/Platformio/src/commandHandler.h b/Platformio/src/commandHandler.h index 3d2c5cb..1a03e90 100644 --- a/Platformio/src/commandHandler.h +++ b/Platformio/src/commandHandler.h @@ -103,6 +103,7 @@ enum commandHandlers { IR_SAMSUNG, IR_SONY, IR_RC5, + IR_DENON, #ifdef ENABLE_WIFI_AND_MQTT MQTT, #endif