MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.28k stars 19.24k forks source link

[BUG] Still receiving warning: narrowing conversion from 'int' to 'short int' #26452

Closed classicrocker883 closed 11 months ago

classicrocker883 commented 11 months ago

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

The error happens in both JyersUI and ProUI

Marlin/src/lcd/e3v2/jyersui/dwin.cpp: In member function 'void<unnamed struct>::drawBedMesh(int16_t, uint8_t, uint16_t, uint16_t)':
Marlin/src/lcd/e3v2/jyersui/dwin.cpp:392:51: warning: narrowing conversion of '(((int)(((short unsigned int)((int)cell_height_px)) / 2)) - 6)' from 'int' to 'short int' [-Wnarrowing]
  392 |           xy_int_t offset { 0, cell_height_px / 2 - 6 };

^JyersUI^

Marlin\src\lcd\e3v2\proui\bedlevel_tools.cpp: In static member function 'static void BedLevelToolsClass::Draw_Bed_Mesh(int16_t, uint8_t, uint16_t, uint16_t)':
Marlin\src\lcd\e3v2\proui\bedlevel_tools.cpp:232:47: warning: narrowing conversion of '(((int)(((short unsigned int)((int)cell_height_px)) / 2)) - ((int)fs))' from 'int' to 'short int' [-Wnarrowing]
  232 |       xy_int_t offset { 0, cell_height_px / 2 - fs };

^ProUI^

I know @thinkyhead just updated the code, but the warning still happens. before, the code xy_int_t offset { 0, cell_height_px / 2 - fs }; was xy_int8_t and that also gave the warning.

I suggested it can be changed to xy_long_t because that gave no warning.

Bug Timeline

started with 376673d - 🚸 Minor touch calibration improvement (#26445)

Expected behavior

no warning is expected

Actual behavior

warning is given

Steps to Reproduce

  1. Load Ender-3 V2 Configuration files
  2. ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
  3. DWIN_LCD_PROUI or DWIN_CREALIT_LCD_JYERSUI
  4. compile

Version of Marlin Firmware

bugfix-2.1.x

Printer model

Ender-3V2, Aquila

Electronics

No response

LCD/Controller

4.3" DWIN

Other add-ons

No response

Bed Leveling

UBL Bilinear mesh

Your Slicer

None

Host Software

None

Don't forget to include

Additional information & file uploads

configurations files

thisiskeithb commented 11 months ago

Closing since you’ve opened a PR.

github-actions[bot] commented 9 months ago

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.