Compare commits

...

7 Commits

Author SHA1 Message Date
Edward Firmo
aa5bbfe870 Ensure brightness is limited to 100
As suggested by coderabbitai.
2025-08-06 19:22:16 +02:00
Edward Firmo
9978657d28 Remove TAG from .h 2025-08-06 19:12:59 +02:00
Edward Firmo
5ca68c8ab4 Move tag to .cpp 2025-08-06 19:06:39 +02:00
Edward Firmo
671a10da81 Merge branch 'v2025.8.2dev' of https://github.com/edwardtfn/TX-Ultimate-Easy into v2025.8.2dev 2025-08-06 19:05:56 +02:00
Edward Firmo
36d9ad196c Merge pull request #122 from edwardtfn/nvs-optimization
Nvs optimization
2025-08-06 18:25:12 +02:00
Edward Firmo
7f8e0c7edc Remove duplicated files 2025-08-06 16:45:08 +02:00
Edward Firmo
a5761c6393 Merge pull request #121 from edwardtfn/nvs-optimization
Nvs optimization
2025-08-06 16:33:35 +02:00
4 changed files with 24 additions and 8 deletions

View File

@@ -1,5 +1,7 @@
// tx_ultimate_easy_light.cpp
#ifdef TX_ULTIMATE_EASY_CORE_HW_LEDS
#include "esphome/core/log.h"
#include "tx_ultimate_easy_light.h"
#include <cinttypes>
@@ -8,6 +10,9 @@
namespace esphome {
namespace tx_ultimate_easy {
// Log tag
static const char *TAG = "tx_ultimate_easy.light";
// Constant definitions
const LightAttributes LIGHT_ATTRS_DEFAULT = {100, 255, 255, 255};
const uint32_t LIGHT_ATTRS_DEFAULT_PACKED = 0x64FFFFFF;
@@ -15,7 +20,7 @@ namespace esphome {
// Function implementations
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.green) << 8) |
(uint32_t(attr.blue));
@@ -23,7 +28,7 @@ namespace esphome {
LightAttributes unpack_light_attributes(uint32_t packed) {
return {
.brightness = uint8_t((packed >> 24) & 0xFF),
.brightness = std::min(uint8_t((packed >> 24) & 0xFF), uint8_t(100)),
.red = uint8_t((packed >> 16) & 0xFF),
.green = uint8_t((packed >> 8) & 0xFF),
.blue = uint8_t(packed & 0xFF)
@@ -49,3 +54,5 @@ namespace esphome {
} // namespace tx_ultimate_easy
} // namespace esphome
#endif // TX_ULTIMATE_EASY_CORE_HW_LEDS

View File

@@ -2,6 +2,8 @@
#pragma once
#ifdef TX_ULTIMATE_EASY_CORE_HW_LEDS
#include "esphome/core/automation.h"
#include "esphome/core/component.h"
#include "esphome/components/uart/uart.h"
@@ -13,9 +15,6 @@
namespace esphome {
namespace tx_ultimate_easy {
// Log tag
static const char *TAG = "tx_ultimate_easy.light";
/**
* @brief Light attributes structure for storing color and brightness data.
*
@@ -113,3 +112,5 @@ namespace esphome {
} // namespace tx_ultimate_easy
} // namespace esphome
#endif // TX_ULTIMATE_EASY_CORE_HW_LEDS

View File

@@ -1,5 +1,7 @@
// tx_ultimate_easy_touch.cpp
#ifdef TX_ULTIMATE_EASY_CORE_HW_TOUCH
#include "esphome/core/log.h"
#include "tx_ultimate_easy_touch.h"
#include <cinttypes>
@@ -8,6 +10,9 @@
namespace esphome {
namespace tx_ultimate_easy {
// Log tag
static const char *TAG = "tx_ultimate_easy.touch";
void TxUltimateEasy::setup() {
ESP_LOGI(TAG, "TX Ultimate Easy is initialized");
}
@@ -225,3 +230,5 @@ namespace esphome {
} // namespace tx_ultimate_easy
} // namespace esphome
#endif // TX_ULTIMATE_EASY_CORE_HW_TOUCH

View File

@@ -2,6 +2,8 @@
#pragma once
#ifdef TX_ULTIMATE_EASY_CORE_HW_TOUCH
#include "esphome/core/automation.h"
#include "esphome/core/component.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_3 = 0x02;
// Log tag
static const char *TAG = "tx_ultimate_easy.touch";
struct TouchPoint {
uint8_t button = 0;
int8_t x = -1;
@@ -84,3 +83,5 @@ namespace esphome {
} // namespace tx_ultimate_easy
} // namespace esphome
#endif // TX_ULTIMATE_EASY_CORE_HW_TOUCH