Default press time to 0

This commit is contained in:
Terrence
2025-05-07 16:42:23 +08:00
parent c0acf30b25
commit ee0df3470c
6 changed files with 10 additions and 10 deletions

View File

@@ -9,7 +9,7 @@
AdcButton::AdcButton(const button_adc_config_t& adc_config) : Button(nullptr) { AdcButton::AdcButton(const button_adc_config_t& adc_config) : Button(nullptr) {
button_config_t btn_config = { button_config_t btn_config = {
.long_press_time = 2000, .long_press_time = 2000,
.short_press_time = 50, .short_press_time = 0,
}; };
ESP_ERROR_CHECK(iot_button_new_adc_device(&btn_config, &adc_config, &button_handle_)); ESP_ERROR_CHECK(iot_button_new_adc_device(&btn_config, &adc_config, &button_handle_));
} }

View File

@@ -11,7 +11,7 @@
class Button { class Button {
public: public:
Button(button_handle_t button_handle); Button(button_handle_t button_handle);
Button(gpio_num_t gpio_num, bool active_high = false, uint16_t long_press_time = 1000, uint16_t short_press_time = 50); Button(gpio_num_t gpio_num, bool active_high = false, uint16_t long_press_time = 0, uint16_t short_press_time = 0);
~Button(); ~Button();
void OnPressDown(std::function<void()> callback); void OnPressDown(std::function<void()> callback);

View File

@@ -111,7 +111,7 @@ private:
// Button A // Button A
button_config_t btn_a_config = { button_config_t btn_a_config = {
.long_press_time = 1000, .long_press_time = 1000,
.short_press_time = 50 .short_press_time = 0
}; };
button_driver_t btn_a_driver = { button_driver_t btn_a_driver = {
.enable_power_save = false, .enable_power_save = false,
@@ -140,7 +140,7 @@ private:
// Button B // Button B
button_config_t btn_b_config = { button_config_t btn_b_config = {
.long_press_time = 1000, .long_press_time = 1000,
.short_press_time = 50 .short_press_time = 0
}; };
button_driver_t btn_b_driver = { button_driver_t btn_b_driver = {
.enable_power_save = false, .enable_power_save = false,

View File

@@ -173,7 +173,7 @@ private:
// Boot Button // Boot Button
button_config_t boot_btn_config = { button_config_t boot_btn_config = {
.long_press_time = 2000, .long_press_time = 2000,
.short_press_time = 50 .short_press_time = 0
}; };
button_driver_t boot_btn_driver = { button_driver_t boot_btn_driver = {
.enable_power_save = false, .enable_power_save = false,
@@ -195,7 +195,7 @@ private:
// Power Button // Power Button
button_config_t pwr_btn_config = { button_config_t pwr_btn_config = {
.long_press_time = 5000, .long_press_time = 5000,
.short_press_time = 50 .short_press_time = 0
}; };
button_driver_t pwr_btn_driver = { button_driver_t pwr_btn_driver = {
.enable_power_save = false, .enable_power_save = false,

View File

@@ -389,7 +389,7 @@ private:
// Boot Button // Boot Button
button_config_t boot_btn_config = { button_config_t boot_btn_config = {
.long_press_time = 2000, .long_press_time = 2000,
.short_press_time = 50 .short_press_time = 0
}; };
button_driver_t boot_btn_driver = { button_driver_t boot_btn_driver = {
.enable_power_save = false, .enable_power_save = false,
@@ -408,7 +408,7 @@ private:
// Power Button // Power Button
button_config_t pwr_btn_config = { button_config_t pwr_btn_config = {
.long_press_time = 5000, .long_press_time = 5000,
.short_press_time = 50 .short_press_time = 0
}; };
button_driver_t pwr_btn_driver = { button_driver_t pwr_btn_driver = {
.enable_power_save = false, .enable_power_save = false,

View File

@@ -242,12 +242,12 @@ private:
// watcher 是通过长按滚轮进行开机的, 需要等待滚轮释放, 否则用户开机松手时可能会误触成单击 // watcher 是通过长按滚轮进行开机的, 需要等待滚轮释放, 否则用户开机松手时可能会误触成单击
ESP_LOGI(TAG, "waiting for knob button release"); ESP_LOGI(TAG, "waiting for knob button release");
while(IoExpanderGetLevel(BSP_KNOB_BTN) == 0) { while(IoExpanderGetLevel(BSP_KNOB_BTN) == 0) {
vTaskDelay(50 / portTICK_PERIOD_MS); vTaskDelay(pdMS_TO_TICKS(50));
} }
button_config_t btn_config = { button_config_t btn_config = {
.long_press_time = 2000, .long_press_time = 2000,
.short_press_time = 50 .short_press_time = 0
}; };
button_driver_t btn_driver = { button_driver_t btn_driver = {
.enable_power_save = false, .enable_power_save = false,