Compare commits
7 Commits
main
...
v2025.8.2d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa5bbfe870 | ||
|
|
9978657d28 | ||
|
|
5ca68c8ab4 | ||
|
|
671a10da81 | ||
|
|
36d9ad196c | ||
|
|
7f8e0c7edc | ||
|
|
a5761c6393 |
@@ -1,5 +1,7 @@
|
|||||||
// tx_ultimate_easy_light.cpp
|
// tx_ultimate_easy_light.cpp
|
||||||
|
|
||||||
|
#ifdef TX_ULTIMATE_EASY_CORE_HW_LEDS
|
||||||
|
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "tx_ultimate_easy_light.h"
|
#include "tx_ultimate_easy_light.h"
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
@@ -8,6 +10,9 @@
|
|||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace tx_ultimate_easy {
|
namespace tx_ultimate_easy {
|
||||||
|
|
||||||
|
// Log tag
|
||||||
|
static const char *TAG = "tx_ultimate_easy.light";
|
||||||
|
|
||||||
// Constant definitions
|
// Constant definitions
|
||||||
const LightAttributes LIGHT_ATTRS_DEFAULT = {100, 255, 255, 255};
|
const LightAttributes LIGHT_ATTRS_DEFAULT = {100, 255, 255, 255};
|
||||||
const uint32_t LIGHT_ATTRS_DEFAULT_PACKED = 0x64FFFFFF;
|
const uint32_t LIGHT_ATTRS_DEFAULT_PACKED = 0x64FFFFFF;
|
||||||
@@ -15,7 +20,7 @@ namespace esphome {
|
|||||||
|
|
||||||
// Function implementations
|
// Function implementations
|
||||||
uint32_t pack_light_attributes(const LightAttributes& attr) {
|
uint32_t pack_light_attributes(const LightAttributes& attr) {
|
||||||
return (uint32_t(attr.brightness) << 24) |
|
return (uint32_t(std::min(attr.brightness, uint8_t(100))) << 24) |
|
||||||
(uint32_t(attr.red) << 16) |
|
(uint32_t(attr.red) << 16) |
|
||||||
(uint32_t(attr.green) << 8) |
|
(uint32_t(attr.green) << 8) |
|
||||||
(uint32_t(attr.blue));
|
(uint32_t(attr.blue));
|
||||||
@@ -23,7 +28,7 @@ namespace esphome {
|
|||||||
|
|
||||||
LightAttributes unpack_light_attributes(uint32_t packed) {
|
LightAttributes unpack_light_attributes(uint32_t packed) {
|
||||||
return {
|
return {
|
||||||
.brightness = uint8_t((packed >> 24) & 0xFF),
|
.brightness = std::min(uint8_t((packed >> 24) & 0xFF), uint8_t(100)),
|
||||||
.red = uint8_t((packed >> 16) & 0xFF),
|
.red = uint8_t((packed >> 16) & 0xFF),
|
||||||
.green = uint8_t((packed >> 8) & 0xFF),
|
.green = uint8_t((packed >> 8) & 0xFF),
|
||||||
.blue = uint8_t(packed & 0xFF)
|
.blue = uint8_t(packed & 0xFF)
|
||||||
@@ -49,3 +54,5 @@ namespace esphome {
|
|||||||
|
|
||||||
} // namespace tx_ultimate_easy
|
} // namespace tx_ultimate_easy
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
||||||
|
#endif // TX_ULTIMATE_EASY_CORE_HW_LEDS
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef TX_ULTIMATE_EASY_CORE_HW_LEDS
|
||||||
|
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/components/uart/uart.h"
|
#include "esphome/components/uart/uart.h"
|
||||||
@@ -13,9 +15,6 @@
|
|||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace tx_ultimate_easy {
|
namespace tx_ultimate_easy {
|
||||||
// Log tag
|
|
||||||
static const char *TAG = "tx_ultimate_easy.light";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Light attributes structure for storing color and brightness data.
|
* @brief Light attributes structure for storing color and brightness data.
|
||||||
*
|
*
|
||||||
@@ -113,3 +112,5 @@ namespace esphome {
|
|||||||
|
|
||||||
} // namespace tx_ultimate_easy
|
} // namespace tx_ultimate_easy
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
||||||
|
#endif // TX_ULTIMATE_EASY_CORE_HW_LEDS
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// tx_ultimate_easy_touch.cpp
|
// tx_ultimate_easy_touch.cpp
|
||||||
|
|
||||||
|
#ifdef TX_ULTIMATE_EASY_CORE_HW_TOUCH
|
||||||
|
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "tx_ultimate_easy_touch.h"
|
#include "tx_ultimate_easy_touch.h"
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
@@ -8,6 +10,9 @@
|
|||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace tx_ultimate_easy {
|
namespace tx_ultimate_easy {
|
||||||
|
|
||||||
|
// Log tag
|
||||||
|
static const char *TAG = "tx_ultimate_easy.touch";
|
||||||
|
|
||||||
void TxUltimateEasy::setup() {
|
void TxUltimateEasy::setup() {
|
||||||
ESP_LOGI(TAG, "TX Ultimate Easy is initialized");
|
ESP_LOGI(TAG, "TX Ultimate Easy is initialized");
|
||||||
}
|
}
|
||||||
@@ -225,3 +230,5 @@ namespace esphome {
|
|||||||
|
|
||||||
} // namespace tx_ultimate_easy
|
} // namespace tx_ultimate_easy
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
||||||
|
#endif // TX_ULTIMATE_EASY_CORE_HW_TOUCH
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef TX_ULTIMATE_EASY_CORE_HW_TOUCH
|
||||||
|
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/components/uart/uart.h"
|
#include "esphome/components/uart/uart.h"
|
||||||
@@ -31,9 +33,6 @@ namespace esphome {
|
|||||||
constexpr int VALID_DATA_BYTE_2 = 0x01;
|
constexpr int VALID_DATA_BYTE_2 = 0x01;
|
||||||
constexpr int VALID_DATA_BYTE_3 = 0x02;
|
constexpr int VALID_DATA_BYTE_3 = 0x02;
|
||||||
|
|
||||||
// Log tag
|
|
||||||
static const char *TAG = "tx_ultimate_easy.touch";
|
|
||||||
|
|
||||||
struct TouchPoint {
|
struct TouchPoint {
|
||||||
uint8_t button = 0;
|
uint8_t button = 0;
|
||||||
int8_t x = -1;
|
int8_t x = -1;
|
||||||
@@ -84,3 +83,5 @@ namespace esphome {
|
|||||||
|
|
||||||
} // namespace tx_ultimate_easy
|
} // namespace tx_ultimate_easy
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
||||||
|
#endif // TX_ULTIMATE_EASY_CORE_HW_TOUCH
|
||||||
|
|||||||
Reference in New Issue
Block a user