Skip to content

Commit

Permalink
🩹 Fix JyersUI/ProUI narrowing (#26453)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
classicrocker883 and thinkyhead authored Nov 22, 2023
1 parent f347349 commit c2376d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/jyersui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class TextScroller {

// Draw value text on
if (viewer_print_value) {
xy_int_t offset { 0, cell_height_px / 2 - 6 };
xy_uint_t offset { 0, cell_height_px / 2 - 6 };
if (isnan(bedlevel.z_values[x][y])) { // undefined
dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset.y, F("X"));
}
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ bool BedLevelTools::meshValidate() {

void BedLevelTools::drawBedMesh(int16_t selected/*=-1*/, uint8_t gridline_width/*=1*/, uint16_t padding_x/*=8*/, uint16_t padding_y_top/*=(40 + 53 - 7)*/) {
drawing_mesh = true;
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X);
const uint16_t cell_height_px = total_width_px / (GRID_MAX_POINTS_Y);
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x,
cell_width_px = total_width_px / (GRID_MAX_POINTS_X),
cell_height_px = total_width_px / (GRID_MAX_POINTS_Y);
const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), rmax = _MAX(v_min, v_max);

// Clear background from previous selection and select new square
Expand Down Expand Up @@ -247,7 +247,7 @@ bool BedLevelTools::meshValidate() {
// Draw value text on
const uint8_t fs = DWINUI::fontWidth(meshfont);
if (viewer_print_value) {
xy_int_t offset { 0, cell_height_px / 2 - fs };
xy_uint_t offset { 0, cell_height_px / 2 - fs };
if (isnan(bedlevel.z_values[x][y])) { // undefined
dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset.y, F("X"));
}
Expand Down

2 comments on commit c2376d6

@classicrocker883
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thinkyhead still getting that warning...
however, when I compile a 2nd time, it goes away.

Marlin\src\lcd\e3v2\proui\bedlevel_tools.cpp: In static member function 'static void BedLevelTools::drawBedMesh(int16_t, uint8_t, uint16_t, uint16_t)':
Marlin\src\lcd\e3v2\proui\bedlevel_tools.cpp:250:50: warning: narrowing conversion of '(((int)(((short unsigned int)((int)cell_height_px)) / 2)) - ((int)fs))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
       xy_uint_t offset { 0, cell_height_px / 2 - fs };

I dont understand how its there the first build, but gone the next.

@thisiskeithb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@classicrocker883: Please submit another PR.

Please sign in to comment.