From 53a246884e05e429d0f9c76256736dd7f649274b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Feb 2023 03:54:41 -0600 Subject: [PATCH] misc. cleanup --- Marlin/src/HAL/AVR/HAL.cpp | 2 +- Marlin/src/HAL/AVR/registers.cpp | 11 ++++++++++- Marlin/src/HAL/AVR/registers.h | 3 +-- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 4 +++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.cpp b/Marlin/src/HAL/AVR/HAL.cpp index 4cd569aa61aa..467156279d3c 100644 --- a/Marlin/src/HAL/AVR/HAL.cpp +++ b/Marlin/src/HAL/AVR/HAL.cpp @@ -85,7 +85,7 @@ void MarlinHAL::init() { init_pwm_timers(); // Init user timers to default frequency - 1000HZ - #if defined(BEEPER_PIN) && !ENABLED(ATMEGA_NO_BEEPFIX) + #if PIN_EXISTS(BEEPER) && ENABLED(HAL_AVR_DIRTY_INIT) && DISABLED(ATMEGA_NO_BEEPFIX) // Make sure no alternative is locked onto the BEEPER. // This fixes the issue where the ATmega is constantly beeping. // Might disable other peripherals using the pin; to circumvent that please undefine one of the above things! diff --git a/Marlin/src/HAL/AVR/registers.cpp b/Marlin/src/HAL/AVR/registers.cpp index 9a0b5525987e..08a74c952ab9 100644 --- a/Marlin/src/HAL/AVR/registers.cpp +++ b/Marlin/src/HAL/AVR/registers.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,6 +20,12 @@ * */ +#ifdef __AVR__ + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(HAL_AVR_DIRTY_INIT) + #include "registers.h" // Since the compiler could be creating multiple copies of function code-graphs for each header inline-inclusion, @@ -968,3 +974,6 @@ ATmegaPinFunctions _ATmega_getPinFunctions(int pin) { return ATmegaPinFunctions(); // default and empty. } + +#endif // HAL_AVR_DIRTY_INIT +#endif // __AVR__ diff --git a/Marlin/src/HAL/AVR/registers.h b/Marlin/src/HAL/AVR/registers.h index 03c738f3fa76..64c0955c3e8e 100644 --- a/Marlin/src/HAL/AVR/registers.h +++ b/Marlin/src/HAL/AVR/registers.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm @@ -19,7 +19,6 @@ * along with this program. If not, see . * */ - #pragma once #include diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 8bdba4234282..78f9434184ac 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -512,7 +512,9 @@ void MarlinUI::draw_status_screen() { const bool show_e_total = TERN0(LCD_SHOW_E_TOTAL, printingIsActive()); - static u8g_uint_t progress_bar_solid_width = 0; + #if HAS_PRINT_PROGRESS + static u8g_uint_t progress_bar_solid_width = 0; + #endif // At the first page, generate new display values if (first_page) {