CodeRabbitAI Nitpick 2
This commit is contained in:
@@ -148,16 +148,16 @@ script:
|
|||||||
then:
|
then:
|
||||||
- script.execute:
|
- script.execute:
|
||||||
id: touch_on_press_buttons
|
id: touch_on_press_buttons
|
||||||
touch_x: !lambda return touch_x;
|
touch_position: !lambda return touch_position;
|
||||||
|
|
||||||
- id: touch_on_press_buttons
|
- id: touch_on_press_buttons
|
||||||
mode: restart
|
mode: restart
|
||||||
parameters:
|
parameters:
|
||||||
touch_x: uint8_t
|
touch_position: uint8_t
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
id(button_press_start_time) = millis();
|
id(button_press_start_time) = millis();
|
||||||
id(button_press_position) = touch_x;
|
id(button_press_position) = touch_position;
|
||||||
uint8_t button = 0;
|
uint8_t button = 0;
|
||||||
auto model_index = sl_tx_model_gang->active_index();
|
auto model_index = sl_tx_model_gang->active_index();
|
||||||
if (model_index.has_value()) {
|
if (model_index.has_value()) {
|
||||||
@@ -166,7 +166,7 @@ script:
|
|||||||
button = 1; // Single button, always 1
|
button = 1; // Single button, always 1
|
||||||
} else {
|
} else {
|
||||||
const uint8_t step = ${TOUCH_POSITION_MAX_VALUE} / model_idx; // Width of each button region
|
const uint8_t step = ${TOUCH_POSITION_MAX_VALUE} / model_idx; // Width of each button region
|
||||||
button = (touch_x / step) + 1; // Determine button region
|
button = (touch_position / step) + 1; // Determine button region
|
||||||
if (button > model_idx)
|
if (button > model_idx)
|
||||||
button = model_idx; // Clamp to max button count
|
button = model_idx; // Clamp to max button count
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ script:
|
|||||||
- id: touch_on_press
|
- id: touch_on_press
|
||||||
mode: restart
|
mode: restart
|
||||||
parameters:
|
parameters:
|
||||||
touch_x: uint8_t
|
touch_position: uint8_t
|
||||||
then:
|
then:
|
||||||
# Extended by:
|
# Extended by:
|
||||||
# - HW Buttons
|
# - HW Buttons
|
||||||
@@ -212,10 +212,13 @@ tx_ultimate_easy:
|
|||||||
|
|
||||||
on_press:
|
on_press:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
ESP_LOGI("tx_ultimate_easy", "Pressed at position %" PRIu8, static_cast<uint8_t>(touch.x));
|
const uint8_t touch_position = static_cast<uint8_t>(touch.x);
|
||||||
- script.execute:
|
if (touch_position > ${TOUCH_POSITION_MAX_VALUE}) { // Check for valid range
|
||||||
id: touch_on_press
|
ESP_LOGE("core_hw_buttons", "Invalid touch position: %" PRIu8, touch_position);
|
||||||
touch_x: !lambda return static_cast<uint8_t>(touch.x);
|
} else {
|
||||||
|
ESP_LOGI("tx_ultimate_easy", "Pressed at position %" PRIu8, touch_position);
|
||||||
|
touch_on_press->execute(touch_position);
|
||||||
|
}
|
||||||
|
|
||||||
on_release:
|
on_release:
|
||||||
- lambda: ESP_LOGI("tx_ultimate_easy", "Released");
|
- lambda: ESP_LOGI("tx_ultimate_easy", "Released");
|
||||||
|
|||||||
Reference in New Issue
Block a user