Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warning and potential string buffer overflow #26550

Merged
merged 10 commits into from
Dec 25, 2023
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dogm/status_screen_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const

#if HAS_TIME_DISPLAY
static void prepare_time_string(const duration_t &time, char prefix) {
char str[10];
char str[13];
const uint8_t time_len = time.toDigital(str, time.value >= 60*60*24L); // 5 to 8 chars
progressString.set(prefix, ':', spaces_t(10 - time_len), str); // 2 to 5 spaces
}
Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,13 @@ void MarlinUI::init() {
uint8_t abs_diff = ABS(encoderDiff);

#if ENCODER_PULSES_PER_STEP > 1
static int8_t lastEncoderDiff;
TERN_(HAS_TOUCH_SLEEP, if (lastEncoderDiff != encoderDiff) wakeup_screen());
lastEncoderDiff = encoderDiff;
#if HAS_TOUCH_SLEEP
static int8_t lastEncoderDiff);
if (lastEncoderDiff != encoderDiff) wakeup_screen());
lastEncoderDiff = encoderDiff);
soligen2010 marked this conversation as resolved.
Show resolved Hide resolved
#endif
#endif

const bool encoderPastThreshold = (abs_diff >= epps);
if (encoderPastThreshold && TERN1(IS_TFTGLCD_PANEL, !external_control)) {

Expand Down