Browse Source

Use intptr types (simulator) (#20142)

Victor Oliveira 3 years ago
parent
commit
7930fd9ce8
No account linked to committer's email address

+ 1
- 1
Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp View File

@@ -458,7 +458,7 @@ uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_p
458 458
     case U8G_COM_MSG_WRITE_SEQ:
459 459
       tftio.DataTransferBegin(DATASIZE_16BIT);
460 460
       for (uint8_t i = 0; i < arg_val; i += 2)
461
-        tftio.WriteData(*(uint16_t *)(((uint32_t)arg_ptr) + i));
461
+        tftio.WriteData(*(uint16_t *)(((uintptr_t)arg_ptr) + i));
462 462
       tftio.DataTransferEnd();
463 463
       break;
464 464
 

+ 14
- 14
Marlin/src/lcd/tft/ui_480x320.cpp View File

@@ -941,7 +941,7 @@ static void disable_steppers() {
941 941
   queue.inject_P(PSTR("M84"));
942 942
 }
943 943
 
944
-static void drawBtn(int x, int y, const char* label, int32_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
944
+static void drawBtn(int x, int y, const char* label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
945 945
   uint16_t width = Images[imgBtn52Rounded].width;
946 946
   uint16_t height = Images[imgBtn52Rounded].height;
947 947
 
@@ -982,11 +982,11 @@ void MarlinUI::move_axis_screen() {
982 982
   // ROW 1 -> E- Y- CurY Z+
983 983
   int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
984 984
 
985
-  drawBtn(x, y, "E+", (int32_t)e_plus, imgUp, E_BTN_COLOR, !busy);
985
+  drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
986 986
 
987 987
   spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
988 988
   x += BTN_WIDTH + spacing;
989
-  drawBtn(x, y, "Y+", (int32_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
989
+  drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
990 990
 
991 991
   // Cur Y
992 992
   x += BTN_WIDTH;
@@ -995,7 +995,7 @@ void MarlinUI::move_axis_screen() {
995 995
   drawAxisValue(Y_AXIS);
996 996
 
997 997
   x += spacing;
998
-  drawBtn(x, y, "Z+", (int32_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
998
+  drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
999 999
 
1000 1000
   // ROW 2 -> "Ex"  X-  HOME X+  "Z"
1001 1001
   y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
@@ -1005,24 +1005,24 @@ void MarlinUI::move_axis_screen() {
1005 1005
   motionAxisState.eNamePos.x = x;
1006 1006
   motionAxisState.eNamePos.y = y;
1007 1007
   drawCurESelection();
1008
-  TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (int32_t)e_select));
1008
+  TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
1009 1009
 
1010 1010
   x += BTN_WIDTH + spacing;
1011
-  drawBtn(x, y, "X-", (int32_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
1011
+  drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
1012 1012
 
1013 1013
   x += BTN_WIDTH + spacing; //imgHome is 64x64
1014
-  TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (int32_t)do_home, imgHome, !busy));
1014
+  TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
1015 1015
 
1016 1016
   x += BTN_WIDTH + spacing;
1017 1017
   uint16_t xplus_x = x;
1018
-  drawBtn(x, y, "X+", (int32_t)x_plus, imgRight, X_BTN_COLOR, !busy);
1018
+  drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
1019 1019
 
1020 1020
   x += BTN_WIDTH + spacing;
1021 1021
   motionAxisState.zTypePos.x = x;
1022 1022
   motionAxisState.zTypePos.y = y;
1023 1023
   drawCurZSelection();
1024 1024
   #if HAS_BED_PROBE
1025
-    if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (int32_t)z_select);
1025
+    if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
1026 1026
   #endif
1027 1027
 
1028 1028
   // ROW 3 -> E- CurX Y-  Z-
@@ -1030,7 +1030,7 @@ void MarlinUI::move_axis_screen() {
1030 1030
   x = X_MARGIN;
1031 1031
   spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
1032 1032
 
1033
-  drawBtn(x, y, "E-", (int32_t)e_minus, imgDown, E_BTN_COLOR, !busy);
1033
+  drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
1034 1034
 
1035 1035
   // Cur E
1036 1036
   motionAxisState.eValuePos.x = x;
@@ -1043,10 +1043,10 @@ void MarlinUI::move_axis_screen() {
1043 1043
   drawAxisValue(X_AXIS);
1044 1044
 
1045 1045
   x += BTN_WIDTH + spacing;
1046
-  drawBtn(x, y, "Y-", (int32_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
1046
+  drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
1047 1047
 
1048 1048
   x += BTN_WIDTH + spacing;
1049
-  drawBtn(x, y, "Z-", (int32_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
1049
+  drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
1050 1050
 
1051 1051
   // Cur Z
1052 1052
   motionAxisState.zValuePos.x = x;
@@ -1060,11 +1060,11 @@ void MarlinUI::move_axis_screen() {
1060 1060
   motionAxisState.stepValuePos.y = y;
1061 1061
   if (!busy) {
1062 1062
     drawCurStepValue();
1063
-    TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (int32_t)step_size));
1063
+    TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
1064 1064
   }
1065 1065
 
1066 1066
   // alinged with x+
1067
-  drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (int32_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
1067
+  drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
1068 1068
 
1069 1069
   TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
1070 1070
 }

Loading…
Cancel
Save