From 7cd72de8bcedf77208d28301778104a590598b06 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 30 Sep 2019 22:56:12 -0500 Subject: [PATCH] General cleanup, style --- Marlin/src/HAL/HAL_AVR/pinsDebug.h | 15 ++------- Marlin/src/HAL/HAL_LINUX/arduino.cpp | 2 +- Marlin/src/lcd/menu/menu.h | 47 ++++++++++++++-------------- 3 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug.h b/Marlin/src/HAL/HAL_AVR/pinsDebug.h index fa7018094..e4738e033 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug.h @@ -227,18 +227,9 @@ static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin"); void com_print(uint8_t N, uint8_t Z) { const uint8_t *TCCRA = (uint8_t*)TCCR_A(N); SERIAL_ECHOPGM(" COM"); - SERIAL_CHAR(N + '0'); - switch (Z) { - case 'A': - SERIAL_ECHOPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6)); - break; - case 'B': - SERIAL_ECHOPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4)); - break; - case 'C': - SERIAL_ECHOPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2)); - break; - } + SERIAL_CHAR('0' + N); + SERIAL_CHAR('A' + Z); + SERIAL_ECHOPAIR(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03)); } void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - WGM bit layout diff --git a/Marlin/src/HAL/HAL_LINUX/arduino.cpp b/Marlin/src/HAL/HAL_LINUX/arduino.cpp index 7915d685e..88128dd91 100644 --- a/Marlin/src/HAL/HAL_LINUX/arduino.cpp +++ b/Marlin/src/HAL/HAL_LINUX/arduino.cpp @@ -29,7 +29,7 @@ // Interrupts void cli() { } // Disable -void sei() { } // Enable +void sei() { } // Enable // Time functions void _delay_ms(const int delay_ms) { diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 7f167a7b9..2d7680e10 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -308,33 +308,34 @@ class MenuItem_bool { * MenuItem_int3::action_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) * */ -#define _MENU_ITEM_VARIANT_P(TYPE, VARIANT, USE_MULTIPLIER, PLABEL, V...) do { \ - _skipStatic = false; \ - if (_menuLineNr == _thisItemNr) { \ - PGM_P const plabel = PLABEL; \ - if (encoderLine == _thisItemNr && ui.use_click()) { \ - _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \ - MenuItem_##TYPE ::action ## VARIANT(plabel, ##V); \ - if (screen_changed) return; \ - } \ - if (ui.should_draw()) \ - draw_menu_item ## VARIANT ## _ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, plabel, ##V); \ - } \ - ++_thisItemNr; \ +#define _MENU_ITEM_VARIANT_P(TYPE, VARIANT, USE_MULTIPLIER, PLABEL, V...) do { \ + _skipStatic = false; \ + if (_menuLineNr == _thisItemNr) { \ + PGM_P const plabel = PLABEL; \ + if (encoderLine == _thisItemNr && ui.use_click()) { \ + _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \ + MenuItem_##TYPE ::action ## VARIANT(plabel, ##V); \ + if (screen_changed) return; \ + } \ + if (ui.should_draw()) \ + draw_menu_item ## VARIANT ## _ ## TYPE \ + (encoderLine == _thisItemNr, _lcdLineNr, plabel, ##V); \ + } \ + ++_thisItemNr; \ }while(0) // Used to print static text with no visible cursor. // Parameters: label [, bool center [, bool invert [, char *value] ] ] -#define STATIC_ITEM_P(PLABEL, V...) do{ \ - if (_menuLineNr == _thisItemNr) { \ - if (_skipStatic && encoderLine <= _thisItemNr) { \ - ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ - ++encoderLine; \ - } \ - if (ui.should_draw()) \ - draw_menu_item_static(_lcdLineNr, PLABEL, ##V); \ - } \ - ++_thisItemNr; \ +#define STATIC_ITEM_P(PLABEL, V...) do{ \ + if (_menuLineNr == _thisItemNr) { \ + if (_skipStatic && encoderLine <= _thisItemNr) { \ + ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ + ++encoderLine; \ + } \ + if (ui.should_draw()) \ + draw_menu_item_static(_lcdLineNr, PLABEL, ##V); \ + } \ + ++_thisItemNr; \ } while(0) #define MENU_ITEM_ADDON_START(X) do{ \