Merge pull request #1312 from mkbel/fix_long_press_modal

Fix long press modal
This commit is contained in:
PavelSindler 2018-11-07 10:28:24 +01:00 committed by GitHub
commit b80a0edac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View file

@ -21,6 +21,7 @@
#include "fastio.h"
#include "Configuration.h"
#include "pins.h"
#include "Timer.h"
#ifndef AT90USB
#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 LongTimer safetyTimer;
#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)

View file

@ -204,7 +204,7 @@ unsigned long pause_time = 0;
unsigned long start_pause_print = millis();
unsigned long t_fan_rising_edge = millis();
LongTimer safetyTimer;
LongTimer crashDetTimer;
static LongTimer crashDetTimer;
//unsigned long load_filament_time;

View file

@ -670,7 +670,7 @@ uint8_t lcd_update_enabled = 1;
uint32_t lcd_next_update_millis = 0;
uint8_t lcd_status_update_delay = 0;
uint8_t lcd_long_press_active = 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)
{
static uint8_t lcd_long_press_active = 0;
uint8_t newbutton = 0;
if (READ(BTN_EN1) == 0) newbutton |= EN_A;
if (READ(BTN_EN2) == 0) newbutton |= EN_B;
@ -783,14 +783,14 @@ void lcd_buttons_update(void)
safetyTimer.start();
if ((lcd_button_pressed == 0) && (lcd_long_press_active == 0))
{
//long press is not possible in modal mode
if (lcd_update_enabled) longPressTimer.start();
longPressTimer.start();
lcd_button_pressed = 1;
}
else if (longPressTimer.expired(LONG_PRESS_TIME))
{
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();
}
}

View file

@ -116,8 +116,6 @@ extern uint32_t lcd_next_update_millis;
extern uint8_t lcd_status_update_delay;
extern uint8_t lcd_long_press_active;
extern lcd_longpress_func_t lcd_longpress_func;
extern lcd_charsetup_func_t lcd_charsetup_func;