-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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 Buffer Corruption #19268
Fix Buffer Corruption #19268
Conversation
Fixes files over 22 characters long in the DWIN screen for the ender3 V2
|
@AnHardt good point. I had recommended this solution because it matches the logic in the calling function, which centers the text on the screen. That didn’t account for multi-byte characters so it slipped my mind. If not accounted for here, it will crop the string too short. It should be easy to confirm that by using some translated file names. Simply making the buffer larger might introduce issues for single-byte characters if printing strings wider than the display misbehaves. |
The T5UIC1 doesn't handle utf8 being sent to it anyways. It'll take ascii or GB2312, it's why all the Chinese text is from a stored image file. It really needs a utf to gb2312 charmap for full language compatability |
If that is the case then it seems we should just ignore any concern for multi-byte characters in this PR. |
I don't know that it'll ever need to be that large, but according to the docs the buffer can up to 254 bytes |
If we increase the size to 254 there would need to be some testing to see what happens when the string is too wide for the screen, unless you already know... |
I have no problem testing if you'd like. |
The |
The screen just draws to the end of the screen and omits the rest. edited to add the 11 (the bytes for the string command itself [mode, colors, x,y]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will want to test this change out, but I think this captures the suggestions from @enigmaquip.
(Hopefully you can just click "accept suggestion" to make these changes)
After some testing, this centered the text better. Co-authored-by: Jason Smith <[email protected]>
Co-authored-by: Jason Smith <[email protected]>
This last one did seem to center stuff better. Some truncation is to be expected when text is too long since you can only ever fit so much on screen. |
Thanks! I was looking askance at that array yesterday but got distracted. |
* commit 'bc7720c0cd3917f44200c0b78e1b635e4c7b6797': (483 commits) Minor HAL cleanup [cron] Bump distribution date (2020-09-09) Update HAL/STM32 platform to 8.0 (MarlinFirmware#18496) Make M600 heat up the nozzle. Reset runout on fail. (MarlinFirmware#19298) [cron] Bump distribution date (2020-09-08) TFT is neither "graphical" nor "character" (MarlinFirmware#19297) Sanity-check BABYSTEP_DISPLAY_TOTAL with ColorUI (MarlinFirmware#19284) Fix M166 Gradient Mix for DELTA (MarlinFirmware#19285) Separate Neopixel followup (MarlinFirmware#19287) Clean up LCD conditionals, DWIN Whitespace cleanup Adjust GTR PeripheralPins to avoid timer conflicts (MarlinFirmware#19183) STM32F1 EP with USB_COMPOSITE (MarlinFirmware#19281) Menu items for Separate NeoPixel (MarlinFirmware#19280) [cron] Bump distribution date (2020-09-07) Clarify disabling StallGuard for axes (MarlinFirmware#19263) Touch UI long filenames fixes (MarlinFirmware#19262) Fix Ender 3 V2 (DWIN) buffer overrun (MarlinFirmware#19268) Fix STM32F1 SPI device init, MKS_LCD12864 (MarlinFirmware#19271) Emergency Parser for STM32F1 (MarlinFirmware#19279) ... # Conflicts: # .github/issue_template.md # Marlin/Configuration.h # Marlin/Configuration_adv.h # README.md
* commit 'bc7720c0cd3917f44200c0b78e1b635e4c7b6797': (483 commits) Minor HAL cleanup [cron] Bump distribution date (2020-09-09) Update HAL/STM32 platform to 8.0 (MarlinFirmware#18496) Make M600 heat up the nozzle. Reset runout on fail. (MarlinFirmware#19298) [cron] Bump distribution date (2020-09-08) TFT is neither "graphical" nor "character" (MarlinFirmware#19297) Sanity-check BABYSTEP_DISPLAY_TOTAL with ColorUI (MarlinFirmware#19284) Fix M166 Gradient Mix for DELTA (MarlinFirmware#19285) Separate Neopixel followup (MarlinFirmware#19287) Clean up LCD conditionals, DWIN Whitespace cleanup Adjust GTR PeripheralPins to avoid timer conflicts (MarlinFirmware#19183) STM32F1 EP with USB_COMPOSITE (MarlinFirmware#19281) Menu items for Separate NeoPixel (MarlinFirmware#19280) [cron] Bump distribution date (2020-09-07) Clarify disabling StallGuard for axes (MarlinFirmware#19263) Touch UI long filenames fixes (MarlinFirmware#19262) Fix Ender 3 V2 (DWIN) buffer overrun (MarlinFirmware#19268) Fix STM32F1 SPI device init, MKS_LCD12864 (MarlinFirmware#19271) Emergency Parser for STM32F1 (MarlinFirmware#19279) ... # Conflicts: # .github/issue_template.md # README.md
* 2.0.x: (483 commits) Minor HAL cleanup [cron] Bump distribution date (2020-09-09) Update HAL/STM32 platform to 8.0 (MarlinFirmware#18496) Make M600 heat up the nozzle. Reset runout on fail. (MarlinFirmware#19298) [cron] Bump distribution date (2020-09-08) TFT is neither "graphical" nor "character" (MarlinFirmware#19297) Sanity-check BABYSTEP_DISPLAY_TOTAL with ColorUI (MarlinFirmware#19284) Fix M166 Gradient Mix for DELTA (MarlinFirmware#19285) Separate Neopixel followup (MarlinFirmware#19287) Clean up LCD conditionals, DWIN Whitespace cleanup Adjust GTR PeripheralPins to avoid timer conflicts (MarlinFirmware#19183) STM32F1 EP with USB_COMPOSITE (MarlinFirmware#19281) Menu items for Separate NeoPixel (MarlinFirmware#19280) [cron] Bump distribution date (2020-09-07) Clarify disabling StallGuard for axes (MarlinFirmware#19263) Touch UI long filenames fixes (MarlinFirmware#19262) Fix Ender 3 V2 (DWIN) buffer overrun (MarlinFirmware#19268) Fix STM32F1 SPI device init, MKS_LCD12864 (MarlinFirmware#19271) Emergency Parser for STM32F1 (MarlinFirmware#19279) ... # Conflicts: # Marlin/Configuration.h # platformio.ini
Description
Fixes files over 22 characters long in the DWIN screen for the ender3 V2. Adjust buffer for size of the DWIN screen width. Also Set of DWIN_Strings so the the string buffer is not longer than the string.
Benefits
This fixes the over 22 character file name issue that caused buffer corruption. This resolves the high speed and some of the crashes associated with this buffer corruption.
Configurations
configs.zip
Related Issues
#18790