Skip to content

Commit

Permalink
fix bug in chsc6x not returning true when there was actually new data…
Browse files Browse the repository at this point in the history
…; minor refactor and update some defaults
  • Loading branch information
finger563 committed Aug 26, 2024
1 parent a74256e commit 5341cd1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/chsc6x/include/chsc6x.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Chsc6x : public BasePeripheral<> {
x_ = 0;
y_ = 0;
num_touch_points_ = 0;
return false;
return true;
}
x_ = data[2];
y_ = data[4];
Expand Down
4 changes: 3 additions & 1 deletion components/esp-box/example/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ CONFIG_ESP_TIMER_TASK_STACK_SIZE=6144
# set the functions into IRAM
CONFIG_SPI_MASTER_IN_IRAM=y

CONFIG_LV_DEF_REFR_PERIOD=16

#
# LVGL configuration - # Themes
#
CONFIG_LV_USE_THEME_DEFAULT=y
CONFIG_LV_THEME_DEFAULT_DARK=y
CONFIG_LV_THEME_DEFAULT_GROW=y
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=30
4 changes: 3 additions & 1 deletion components/matouch-rotary-display/example/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ CONFIG_ESP_TIMER_TASK_STACK_SIZE=6144
# set the functions into IRAM
CONFIG_SPI_MASTER_IN_IRAM=y

CONFIG_LV_DEF_REFR_PERIOD=16

#
# LVGL configuration - # Themes
#
CONFIG_LV_USE_THEME_DEFAULT=y
CONFIG_LV_THEME_DEFAULT_DARK=y
CONFIG_LV_THEME_DEFAULT_GROW=y
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=30
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ extern "C" void app_main(void) {
}

static void on_rotate_pressed(lv_event_t *event) {
std::lock_guard<std::recursive_mutex> lock(lvgl_mutex);
clear_circles();
std::lock_guard<std::recursive_mutex> lock(lvgl_mutex);
static auto rotation = LV_DISPLAY_ROTATION_0;
rotation = static_cast<lv_display_rotation_t>((static_cast<int>(rotation) + 1) % 4);
lv_display_t *disp = _lv_refr_get_disp_refreshing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ CONFIG_ESP_TIMER_TASK_STACK_SIZE=6144
# set the functions into IRAM
CONFIG_SPI_MASTER_IN_IRAM=y

CONFIG_LV_DEF_REFR_PERIOD=16
#
# LVGL configuration - # Themes
#
CONFIG_LV_USE_THEME_DEFAULT=y
CONFIG_LV_THEME_DEFAULT_DARK=y
CONFIG_LV_THEME_DEFAULT_GROW=y
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=30
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class SsRoundDisplay : public espp::BaseComponent {

protected:
SsRoundDisplay();
void touch_interrupt_handler(const espp::Interrupt::Event &event);
bool update_touch();
void lcd_wait_lines();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ SsRoundDisplay::SsRoundDisplay()
, touch_interrupt_pin_({
.gpio_num = pin_config_.touch_interrupt,
.callback =
[this](const auto &event) {
if (update_touch()) {
if (touch_callback_) {
touch_callback_(touchpad_data());
}
}
},
std::bind(&SsRoundDisplay::touch_interrupt_handler, this, std::placeholders::_1),
.active_level = touch_interrupt_level,
.interrupt_type = espp::Interrupt::Type::FALLING_EDGE,
}) {
Expand Down Expand Up @@ -75,6 +69,14 @@ bool SsRoundDisplay::initialize_touch(const SsRoundDisplay::touch_callback_t &ca
return true;
}

void SsRoundDisplay::touch_interrupt_handler(const espp::Interrupt::Event &event) {
if (update_touch()) {
if (touch_callback_) {
touch_callback_(touchpad_data());
}
}
}

bool SsRoundDisplay::update_touch() {
// ensure the touch is initialized
if (!touch_) {
Expand Down
2 changes: 1 addition & 1 deletion components/t-deck/example/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ CONFIG_LV_DEF_REFR_PERIOD=16
CONFIG_LV_USE_THEME_DEFAULT=y
CONFIG_LV_THEME_DEFAULT_DARK=y
CONFIG_LV_THEME_DEFAULT_GROW=y
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80
CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=30

0 comments on commit 5341cd1

Please sign in to comment.