Closed classicrocker883 closed 3 months ago
https://github.com/MarlinFirmware/Marlin/pull/26881 from 2 days ago. This was added to stepper.h _MAX((STEPPER_TIMER_RATE) / HAL_TIMER_TYPE_MAX, 1U) // 32-bit shouldn't go below 1
This triggers the warning.
I purpose
diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h
index 2a171bebd0..c24953c24e 100644
--- a/Marlin/src/module/stepper.h
+++ b/Marlin/src/module/stepper.h
@@ -299,7 +299,7 @@ class Stepper {
// and avoid the most unreasonably slow step rates.
static constexpr uint32_t minimal_step_rate = (
#ifdef CPU_32_BIT
- _MAX((STEPPER_TIMER_RATE) / HAL_TIMER_TYPE_MAX, 1U) // 32-bit shouldn't go below 1
+ _MAX((uint32_t(STEPPER_TIMER_RATE) / HAL_TIMER_TYPE_MAX), 1U) // 32-bit shouldn't go below 1
#else
(F_CPU) / 500000U // AVR shouldn't go below 32 (16MHz) or 40 (20MHz)
#endif
as STEPPER_TIMER_RATE/HAL_TIMER_TYPE_MAX can never be negative
why not just make it _MAX((STEPPER_TIMER_RATE) / HAL_TIMER_TYPE_MAX, 1)
?
the end result would be no different.
Int comparisons are faster than signed and can use less code, does it make a lot of different, no, just marginally better
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Did you test the latest
bugfix-2.1.x
code?Yes, and the problem still exists.
Bug Description
I noticed this recently: Link to where the warning is present under "> Run STM32F103RE_creality Tests"
CrealityUI configs (to test on your own)
The code in question: Marlin\src\module\stepper.h:302 -
_MAX((STEPPER_TIMER_RATE) / HAL_TIMER_TYPE_MAX, 1U)
So, the warning goes away when removing the
U
in1U
so it is just1
Also, another workaround is under macros.h:
however, this is probably related to a recent commit, so that should be looked into.
Bug Timeline
Within the past couple days. You can look at a pull request check (STM32F103RE_creality) from 4 days ago (since 7/15) and the warning is not there
Expected behavior
Should be no warning
Actual behavior
Warning when using Creality configs/CI Build Tests (Actions)
Steps to Reproduce
STM32F103RE_creality
in platformio.iniOption B:
Details
Version of Marlin Firmware
bugfix-2.1.x
Printer model
Creality Ender-3
Electronics
BOARD_CREALITY_V4
LCD/Controller
DWIN_CREALITY_LCD
Other add-ons
No response
Bed Leveling
None
Your Slicer
None
Host Software
None
Don't forget to include
Configuration.h
andConfiguration_adv.h
.Additional information & file uploads
Configs used