Fix indentation in lcd_update() and split some of the preprocessor disabled functionality into separate functions. No change in resulting binary.
This commit is contained in:
parent
9d72062cd7
commit
49dd8d83fb
2 changed files with 128 additions and 104 deletions
|
@ -2482,8 +2482,8 @@ static void lcd_menu_xyz_skew()
|
|||
//|01234567890123456789|
|
||||
//|Measured skew: N/A |
|
||||
//|--------------------|
|
||||
//|Slight skew: 0.12°|
|
||||
//|Severe skew: 0.25°|
|
||||
//|Slight skew: 0.12d|
|
||||
//|Severe skew: 0.25d|
|
||||
//----------------------
|
||||
float angleDiff = eeprom_read_float((float*)(EEPROM_XYZ_CAL_SKEW));
|
||||
lcd_printf_P(_N(
|
||||
|
@ -7498,22 +7498,76 @@ void lcd_update_enable(bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void debugBlink()
|
||||
{
|
||||
#ifdef DEBUG_BLINK_ACTIVE
|
||||
static bool active_led = false;
|
||||
active_led = !active_led;
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
digitalWrite(LED_PIN, active_led?HIGH:LOW);
|
||||
#endif //DEBUG_BLINK_ACTIVE
|
||||
}
|
||||
|
||||
static inline void handleReprapKeyboard()
|
||||
{
|
||||
#ifdef REPRAPWORLD_KEYPAD
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)
|
||||
{
|
||||
reprapworld_keypad_move_z_up();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)
|
||||
{
|
||||
reprapworld_keypad_move_z_down();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)
|
||||
{
|
||||
reprapworld_keypad_move_x_left();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT)
|
||||
{
|
||||
reprapworld_keypad_move_x_right();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN)
|
||||
{
|
||||
reprapworld_keypad_move_y_down();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Y_UP)
|
||||
{
|
||||
reprapworld_keypad_move_y_up();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_HOME)
|
||||
{
|
||||
reprapworld_keypad_move_home();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void readSlowButtons()
|
||||
{
|
||||
#ifdef LCD_HAS_SLOW_BUTTONS
|
||||
slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handle keyboard input and update display
|
||||
*
|
||||
* @param lcdDrawUpdateOverride
|
||||
* @param forceRedraw if true, force redraw of display regardless of timer
|
||||
*/
|
||||
void lcd_update(uint8_t lcdDrawUpdateOverride, bool forceRedraw)
|
||||
{
|
||||
|
||||
if (lcdDrawUpdate < lcdDrawUpdateOverride)
|
||||
{
|
||||
lcdDrawUpdate = lcdDrawUpdateOverride;
|
||||
}
|
||||
|
||||
if (!lcd_update_enabled)
|
||||
return;
|
||||
|
||||
#ifdef LCD_HAS_SLOW_BUTTONS
|
||||
slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
|
||||
#endif
|
||||
if (!lcd_update_enabled) return;
|
||||
|
||||
readSlowButtons();
|
||||
lcd_buttons_update();
|
||||
|
||||
|
||||
#if (SDCARDDETECT > 0)
|
||||
if ((IS_SD_INSERTED != lcd_oldcardstatus && lcd_detected()))
|
||||
{
|
||||
|
@ -7529,7 +7583,6 @@ void lcd_update(uint8_t lcdDrawUpdateOverride, bool forceRedraw)
|
|||
{
|
||||
card.initsd();
|
||||
LCD_MESSAGERPGM(_i("Card inserted"));////MSG_SD_INSERTED c=0 r=0
|
||||
//get_description();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7537,47 +7590,19 @@ void lcd_update(uint8_t lcdDrawUpdateOverride, bool forceRedraw)
|
|||
LCD_MESSAGERPGM(_i("Card removed"));////MSG_SD_REMOVED c=0 r=0
|
||||
}
|
||||
}
|
||||
#endif//CARDINSERTED
|
||||
#endif //(SDCARDDETECT > 0)
|
||||
|
||||
if (lcd_next_update_millis.expired(LCD_UPDATE_INTERVAL) || forceRedraw)
|
||||
{
|
||||
lcd_next_update_millis.start();
|
||||
#ifdef DEBUG_BLINK_ACTIVE
|
||||
static bool active_led = false;
|
||||
active_led = !active_led;
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
digitalWrite(LED_PIN, active_led?HIGH:LOW);
|
||||
#endif //DEBUG_BLINK_ACTIVE
|
||||
|
||||
debugBlink();
|
||||
|
||||
#ifdef ULTIPANEL
|
||||
#ifdef REPRAPWORLD_KEYPAD
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) {
|
||||
reprapworld_keypad_move_z_up();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) {
|
||||
reprapworld_keypad_move_z_down();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) {
|
||||
reprapworld_keypad_move_x_left();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) {
|
||||
reprapworld_keypad_move_x_right();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
|
||||
reprapworld_keypad_move_y_down();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
|
||||
reprapworld_keypad_move_y_up();
|
||||
}
|
||||
if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
|
||||
reprapworld_keypad_move_home();
|
||||
}
|
||||
#endif
|
||||
handleReprapKeyboard();
|
||||
|
||||
if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP)
|
||||
{
|
||||
if (lcdDrawUpdate == 0)
|
||||
lcdDrawUpdate = 1;
|
||||
if (lcdDrawUpdate == 0) lcdDrawUpdate = 1;
|
||||
encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP;
|
||||
encoderDiff = 0;
|
||||
lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
|
||||
|
@ -7587,10 +7612,7 @@ void lcd_update(uint8_t lcdDrawUpdateOverride, bool forceRedraw)
|
|||
#endif//ULTIPANEL
|
||||
|
||||
(*currentMenu)();
|
||||
|
||||
#ifdef LCD_HAS_STATUS_INDICATORS
|
||||
lcd_implementation_update_indicators();
|
||||
#endif
|
||||
|
||||
#ifdef ULTIPANEL
|
||||
if (lcd_timeoutToStatus < millis() && currentMenu != lcd_status_screen)
|
||||
|
@ -7598,7 +7620,8 @@ void lcd_update(uint8_t lcdDrawUpdateOverride, bool forceRedraw)
|
|||
// Exiting a menu. Let's call the menu function the last time with menuExiting flag set to true
|
||||
// to give it a chance to save its state.
|
||||
// This is useful for example, when the babystep value has to be written into EEPROM.
|
||||
if (currentMenu != NULL) {
|
||||
if (currentMenu != NULL)
|
||||
{
|
||||
menuExiting = true;
|
||||
(*currentMenu)();
|
||||
menuExiting = false;
|
||||
|
|
|
@ -1390,9 +1390,10 @@ static void lcd_implementation_quick_feedback()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef LCD_HAS_STATUS_INDICATORS
|
||||
|
||||
static void lcd_implementation_update_indicators()
|
||||
{
|
||||
#ifdef LCD_HAS_STATUS_INDICATORS
|
||||
#if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI)
|
||||
//set the LEDS - referred to as backlights by the LiquidTWI2 library
|
||||
static uint8_t ledsprev = 0;
|
||||
|
@ -1408,8 +1409,8 @@ static void lcd_implementation_update_indicators()
|
|||
ledsprev = leds;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LCD_HAS_SLOW_BUTTONS
|
||||
extern uint32_t blocking_enc;
|
||||
|
|
Loading…
Reference in a new issue