From 503c01aa5743481ea8a19dfd52ce8feda8713940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 30 Jul 2023 15:21:14 +0000 Subject: [PATCH] tmc2130: write chopper config and powerdown setting first I noticed this is how the order is in 3.13.0 and before. I want to keep it exactly the same. This somehow saves 2 bytes of flash. Probably compiler magic. Change in memory: Flash: -2 bytes SRAM: 0 bytes --- Firmware/tmc2130.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 035a3db34..1e4cce56d 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -282,6 +282,8 @@ uint16_t __tcoolthrs(uint8_t axis) static void tmc2130_XYZ_reg_init(uint8_t axis) { + tmc2130_setup_chopper(axis, tmc2130_mres[axis]); + tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); const bool isStealth = (tmc2130_mode == TMC2130_MODE_SILENT); if (axis == Z_AXIS) { #ifdef TMC2130_STEALTH_Z @@ -300,8 +302,6 @@ static void tmc2130_XYZ_reg_init(uint8_t axis) tmc2130_wr(axis, TMC2130_REG_PWMCONF, pwmconf[axis].dw); tmc2130_wr(axis, TMC2130_REG_TPWMTHRS, TMC2130_TPWMTHRS); } - tmc2130_setup_chopper(axis, tmc2130_mres[axis]); - tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); } void tmc2130_init(TMCInitParams params)