From 82deea9220b724530d3eac6264dd72dafb0ff9d7 Mon Sep 17 00:00:00 2001 From: Prusa Research Date: Tue, 18 Jul 2023 12:07:01 +0200 Subject: [PATCH] Release v5.0.0-alpha4 --- include/marlin/Configuration_MK4.h | 7 ++++--- include/marlin/Configuration_MK4_adv.h | 9 ++++++--- src/buddy/main.cpp | 12 ++++++------ src/common/app_metrics.cpp | 13 +++++++++++-- src/common/hwio_XLBuddy.cpp | 23 ++++++++++++++--------- src/common/otp.cpp | 7 +++---- src/common/otp.h | 8 ++++---- src/common/selftest/selftest_MK4.cpp | 2 +- src/gui/version_info_ILI9488.cpp | 4 ++-- src/gui/version_info_ST7789V.cpp | 6 +++--- src/hw/mk3.5/hw_configuration.cpp | 6 +++--- src/hw/mk4_ix/CMakeLists.txt | 1 + src/hw/mk4_ix/hw_configuration.cpp | 22 ++-------------------- src/hw/mk4_ix/hw_configuration.hpp | 18 ++++++++++-------- tests/unit/common/otp_test.cpp | 8 ++++---- 15 files changed, 74 insertions(+), 72 deletions(-) diff --git a/include/marlin/Configuration_MK4.h b/include/marlin/Configuration_MK4.h index e439307f97..2d87e019f2 100644 --- a/include/marlin/Configuration_MK4.h +++ b/include/marlin/Configuration_MK4.h @@ -1444,13 +1444,14 @@ // Homing speeds (mm/m) #ifdef HAS_LDO_400_STEP - #define HOMING_FEEDRATE_XY (62 * 60) + #include "hw_configuration.hpp" + #define HOMING_FEEDRATE_XY buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (80 * 60) : (62 * 60) #else - #define HOMING_FEEDRATE_XY (62 * 60)//(150 * 60) + #define HOMING_FEEDRATE_XY (80 * 60)//(150 * 60) #endif #define HOMING_FEEDRATE_Z (8 * 60) -#define HOMING_FEEDRATE_INVERTED_Z (30 * 60) +#define HOMING_FEEDRATE_INVERTED_Z buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (60 * 60) : (30 * 60) // Validate that endstops are triggered on homing moves //#define VALIDATE_HOMING_ENDSTOPS diff --git a/include/marlin/Configuration_MK4_adv.h b/include/marlin/Configuration_MK4_adv.h index 7bea66e1b1..c0637eedfc 100644 --- a/include/marlin/Configuration_MK4_adv.h +++ b/include/marlin/Configuration_MK4_adv.h @@ -1807,7 +1807,8 @@ #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #if X_DRIVER_TYPE == TMC2130 #if defined(HAS_LDO_400_STEP) - #define X_STALL_SENSITIVITY -2 + #include "hw_configuration.hpp" + #define X_STALL_SENSITIVITY buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (int16_t) -4 : (int16_t) -2 #else #define X_STALL_SENSITIVITY 3 #endif @@ -1817,7 +1818,8 @@ #if Y_DRIVER_TYPE == TMC2130 #if defined(HAS_LDO_400_STEP) - #define Y_STALL_SENSITIVITY -2 + #include "hw_configuration.hpp" + #define Y_STALL_SENSITIVITY buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (int16_t) -4 : (int16_t) -2 #else #define Y_STALL_SENSITIVITY 3 #endif @@ -1826,7 +1828,8 @@ #endif #if Z_DRIVER_TYPE == TMC2130 - #define Z_STALL_SENSITIVITY 3 + #include "hw_configuration.hpp" + #define Z_STALL_SENSITIVITY buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (int16_t) 1 : (int16_t) 3 #elif Z_DRIVER_TYPE == TMC2209 #define Z_STALL_SENSITIVITY 100 #endif diff --git a/src/buddy/main.cpp b/src/buddy/main.cpp index a18f008476..f4a8be9e9b 100644 --- a/src/buddy/main.cpp +++ b/src/buddy/main.cpp @@ -103,12 +103,6 @@ extern "C" void main_cpp(void) { hw_gpio_init(); hw_dma_init(); -// must do this before timer 1 -// timer 1 interrupt calls Configuration -#if BOARD_IS_XBUDDY - buddy::hw::Configuration::Instance(); -#endif - #if BOARD_IS_BUDDY || BOARD_IS_XBUDDY hw_tim1_init(); #endif @@ -587,6 +581,12 @@ extern "C" void startup_task(void const *) { init_stores(); taskEXIT_CRITICAL(); +// must do this before timer 1, timer 1 interrupt calls Configuration +// also must be before initializing global variables +#if BOARD_IS_XBUDDY + buddy::hw::Configuration::Instance(); +#endif + // init global variables and call constructors extern void __libc_init_array(void); __libc_init_array(); diff --git a/src/common/app_metrics.cpp b/src/common/app_metrics.cpp index 815a395a23..4d8c35f40b 100644 --- a/src/common/app_metrics.cpp +++ b/src/common/app_metrics.cpp @@ -56,9 +56,18 @@ void buddy::metrics::RecordRuntimeStats() { if (metric_record_is_due(&buddy_revision)) { board_revision_t board_revision; if (otp_get_board_revision(&board_revision) == false) { - board_revision.br = 0; + board_revision = 0; } - metric_record_string(&buddy_revision, "%u.%u", board_revision.bytes[0], board_revision.bytes[1]); + metric_record_string(&buddy_revision, "%u", board_revision); + } + + static metric_t buddy_bom = METRIC("buddy_bom", METRIC_VALUE_STRING, 10 * 10003, METRIC_HANDLER_ENABLE_ALL); + if (metric_record_is_due(&buddy_bom)) { + uint8_t bom; + if (otp_get_bom_id(&bom) == false) { + bom = 0; + } + metric_record_string(&buddy_bom, "%u", bom); } static metric_t current_filamnet = METRIC("filament", METRIC_VALUE_STRING, 10 * 1007, METRIC_HANDLER_ENABLE_ALL); diff --git a/src/common/hwio_XLBuddy.cpp b/src/common/hwio_XLBuddy.cpp index 710b84515f..0c9f0e785c 100644 --- a/src/common/hwio_XLBuddy.cpp +++ b/src/common/hwio_XLBuddy.cpp @@ -26,6 +26,7 @@ #include