Merge pull request #1312 from mkbel/fix_long_press_modal
Fix long press modal
This commit is contained in:
commit
b80a0edac0
4 changed files with 9 additions and 8 deletions
|
@ -21,6 +21,7 @@
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "pins.h"
|
#include "pins.h"
|
||||||
|
#include "Timer.h"
|
||||||
|
|
||||||
#ifndef AT90USB
|
#ifndef AT90USB
|
||||||
#define HardwareSerial_h // trick to disable the standard HWserial
|
#define HardwareSerial_h // trick to disable the standard HWserial
|
||||||
|
@ -367,6 +368,8 @@ extern uint16_t gcode_in_progress;
|
||||||
|
|
||||||
extern bool wizard_active; //autoload temporarily disabled during wizard
|
extern bool wizard_active; //autoload temporarily disabled during wizard
|
||||||
|
|
||||||
|
extern LongTimer safetyTimer;
|
||||||
|
|
||||||
#define PRINT_PERCENT_DONE_INIT 0xff
|
#define PRINT_PERCENT_DONE_INIT 0xff
|
||||||
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved)
|
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved)
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ unsigned long pause_time = 0;
|
||||||
unsigned long start_pause_print = millis();
|
unsigned long start_pause_print = millis();
|
||||||
unsigned long t_fan_rising_edge = millis();
|
unsigned long t_fan_rising_edge = millis();
|
||||||
LongTimer safetyTimer;
|
LongTimer safetyTimer;
|
||||||
LongTimer crashDetTimer;
|
static LongTimer crashDetTimer;
|
||||||
|
|
||||||
//unsigned long load_filament_time;
|
//unsigned long load_filament_time;
|
||||||
|
|
||||||
|
|
|
@ -670,7 +670,7 @@ uint8_t lcd_update_enabled = 1;
|
||||||
uint32_t lcd_next_update_millis = 0;
|
uint32_t lcd_next_update_millis = 0;
|
||||||
uint8_t lcd_status_update_delay = 0;
|
uint8_t lcd_status_update_delay = 0;
|
||||||
|
|
||||||
uint8_t lcd_long_press_active = 0;
|
|
||||||
|
|
||||||
lcd_longpress_func_t lcd_longpress_func = 0;
|
lcd_longpress_func_t lcd_longpress_func = 0;
|
||||||
|
|
||||||
|
@ -768,9 +768,9 @@ void lcd_update_enable(uint8_t enabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern LongTimer safetyTimer;
|
|
||||||
void lcd_buttons_update(void)
|
void lcd_buttons_update(void)
|
||||||
{
|
{
|
||||||
|
static uint8_t lcd_long_press_active = 0;
|
||||||
uint8_t newbutton = 0;
|
uint8_t newbutton = 0;
|
||||||
if (READ(BTN_EN1) == 0) newbutton |= EN_A;
|
if (READ(BTN_EN1) == 0) newbutton |= EN_A;
|
||||||
if (READ(BTN_EN2) == 0) newbutton |= EN_B;
|
if (READ(BTN_EN2) == 0) newbutton |= EN_B;
|
||||||
|
@ -783,14 +783,14 @@ void lcd_buttons_update(void)
|
||||||
safetyTimer.start();
|
safetyTimer.start();
|
||||||
if ((lcd_button_pressed == 0) && (lcd_long_press_active == 0))
|
if ((lcd_button_pressed == 0) && (lcd_long_press_active == 0))
|
||||||
{
|
{
|
||||||
//long press is not possible in modal mode
|
longPressTimer.start();
|
||||||
if (lcd_update_enabled) longPressTimer.start();
|
|
||||||
lcd_button_pressed = 1;
|
lcd_button_pressed = 1;
|
||||||
}
|
}
|
||||||
else if (longPressTimer.expired(LONG_PRESS_TIME))
|
else if (longPressTimer.expired(LONG_PRESS_TIME))
|
||||||
{
|
{
|
||||||
lcd_long_press_active = 1;
|
lcd_long_press_active = 1;
|
||||||
if (lcd_longpress_func)
|
//long press is not possible in modal mode
|
||||||
|
if (lcd_longpress_func && lcd_update_enabled)
|
||||||
lcd_longpress_func();
|
lcd_longpress_func();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,6 @@ extern uint32_t lcd_next_update_millis;
|
||||||
|
|
||||||
extern uint8_t lcd_status_update_delay;
|
extern uint8_t lcd_status_update_delay;
|
||||||
|
|
||||||
extern uint8_t lcd_long_press_active;
|
|
||||||
|
|
||||||
extern lcd_longpress_func_t lcd_longpress_func;
|
extern lcd_longpress_func_t lcd_longpress_func;
|
||||||
|
|
||||||
extern lcd_charsetup_func_t lcd_charsetup_func;
|
extern lcd_charsetup_func_t lcd_charsetup_func;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue