My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

draw_acceleration_settings.cpp 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../../../inc/MarlinConfigPre.h"
  23. #if HAS_TFT_LVGL_UI
  24. #include "lv_conf.h"
  25. #include "draw_ui.h"
  26. #include "../../../../MarlinCore.h"
  27. #include "../../../../module/planner.h"
  28. extern lv_group_t * g;
  29. static lv_obj_t * scr;
  30. #define ID_ACCE_RETURN 1
  31. #define ID_ACCE_PRINT 2
  32. #define ID_ACCE_RETRA 3
  33. #define ID_ACCE_TRAVEL 4
  34. #define ID_ACCE_X 5
  35. #define ID_ACCE_Y 6
  36. #define ID_ACCE_Z 7
  37. #define ID_ACCE_E0 8
  38. #define ID_ACCE_E1 9
  39. #define ID_ACCE_UP 10
  40. #define ID_ACCE_DOWN 11
  41. static void event_handler(lv_obj_t * obj, lv_event_t event) {
  42. switch (obj->mks_obj_id) {
  43. case ID_ACCE_RETURN:
  44. if (event == LV_EVENT_CLICKED) {
  45. }
  46. else if (event == LV_EVENT_RELEASED) {
  47. uiCfg.para_ui_page = 0;
  48. lv_clear_acceleration_settings();
  49. draw_return_ui();
  50. }
  51. break;
  52. case ID_ACCE_PRINT:
  53. if (event == LV_EVENT_CLICKED) {
  54. }
  55. else if (event == LV_EVENT_RELEASED) {
  56. value = PrintAcceleration;
  57. lv_clear_acceleration_settings();
  58. lv_draw_number_key();
  59. }
  60. break;
  61. case ID_ACCE_RETRA:
  62. if (event == LV_EVENT_CLICKED) {
  63. }
  64. else if (event == LV_EVENT_RELEASED) {
  65. value = RetractAcceleration;
  66. lv_clear_acceleration_settings();
  67. lv_draw_number_key();
  68. }
  69. break;
  70. case ID_ACCE_TRAVEL:
  71. if (event == LV_EVENT_CLICKED) {
  72. }
  73. else if (event == LV_EVENT_RELEASED) {
  74. value = TravelAcceleration;
  75. lv_clear_acceleration_settings();
  76. lv_draw_number_key();
  77. }
  78. break;
  79. case ID_ACCE_X:
  80. if (event == LV_EVENT_CLICKED) {
  81. }
  82. else if (event == LV_EVENT_RELEASED) {
  83. value = XAcceleration;
  84. lv_clear_acceleration_settings();
  85. lv_draw_number_key();
  86. }
  87. break;
  88. case ID_ACCE_Y:
  89. if (event == LV_EVENT_CLICKED) {
  90. }
  91. else if (event == LV_EVENT_RELEASED) {
  92. value = YAcceleration;
  93. lv_clear_acceleration_settings();
  94. lv_draw_number_key();
  95. }
  96. break;
  97. case ID_ACCE_Z:
  98. if (event == LV_EVENT_CLICKED) {
  99. }
  100. else if (event == LV_EVENT_RELEASED) {
  101. value = ZAcceleration;
  102. lv_clear_acceleration_settings();
  103. lv_draw_number_key();
  104. }
  105. break;
  106. case ID_ACCE_E0:
  107. if (event == LV_EVENT_CLICKED) {
  108. }
  109. else if (event == LV_EVENT_RELEASED) {
  110. value = E0Acceleration;
  111. lv_clear_acceleration_settings();
  112. lv_draw_number_key();
  113. }
  114. break;
  115. case ID_ACCE_E1:
  116. if (event == LV_EVENT_CLICKED) {
  117. }
  118. else if (event == LV_EVENT_RELEASED) {
  119. value = E1Acceleration;
  120. lv_clear_acceleration_settings();
  121. lv_draw_number_key();
  122. }
  123. break;
  124. case ID_ACCE_UP:
  125. if (event == LV_EVENT_CLICKED) {
  126. }
  127. else if (event == LV_EVENT_RELEASED) {
  128. uiCfg.para_ui_page = 0;
  129. lv_clear_acceleration_settings();
  130. lv_draw_acceleration_settings();
  131. }
  132. break;
  133. case ID_ACCE_DOWN:
  134. if (event == LV_EVENT_CLICKED) {
  135. }
  136. else if (event == LV_EVENT_RELEASED) {
  137. uiCfg.para_ui_page = 1;
  138. lv_clear_acceleration_settings();
  139. lv_draw_acceleration_settings();
  140. }
  141. break;
  142. }
  143. }
  144. void lv_draw_acceleration_settings(void) {
  145. lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
  146. lv_obj_t *labelPrintText = NULL, *buttonPrintValue = NULL, *labelPrintValue = NULL;
  147. lv_obj_t *labelRetraText = NULL, *buttonRetraValue = NULL, *labelRetraValue = NULL;
  148. lv_obj_t *labelTravelText = NULL, *buttonTravelValue = NULL, *labelTravelValue = NULL;
  149. lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
  150. lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
  151. lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
  152. lv_obj_t *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
  153. lv_obj_t *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
  154. lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
  155. if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ACCELERATION_UI) {
  156. disp_state_stack._disp_index++;
  157. disp_state_stack._disp_state[disp_state_stack._disp_index] = ACCELERATION_UI;
  158. }
  159. disp_state = ACCELERATION_UI;
  160. scr = lv_obj_create(NULL, NULL);
  161. lv_obj_set_style(scr, &tft_style_scr);
  162. lv_scr_load(scr);
  163. lv_obj_clean(scr);
  164. lv_obj_t * title = lv_label_create(scr, NULL);
  165. lv_obj_set_style(title, &tft_style_label_rel);
  166. lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
  167. lv_label_set_text(title, machine_menu.AccelerationConfTitle);
  168. lv_refr_now(lv_refr_get_disp_refreshing());
  169. if (uiCfg.para_ui_page != 1) {
  170. labelPrintText = lv_label_create(scr, NULL);
  171. lv_obj_set_style(labelPrintText, &tft_style_label_rel);
  172. lv_obj_set_pos(labelPrintText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
  173. lv_label_set_text(labelPrintText, machine_menu.PrintAcceleration);
  174. buttonPrintValue = lv_btn_create(scr, NULL);
  175. lv_obj_set_pos(buttonPrintValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
  176. lv_obj_set_size(buttonPrintValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
  177. lv_obj_set_event_cb_mks(buttonPrintValue, event_handler, ID_ACCE_PRINT, NULL, 0);
  178. lv_btn_set_style(buttonPrintValue, LV_BTN_STYLE_REL, &style_para_value);
  179. lv_btn_set_style(buttonPrintValue, LV_BTN_STYLE_PR, &style_para_value);
  180. labelPrintValue = lv_label_create(buttonPrintValue, NULL);
  181. line1 = lv_line_create(scr, NULL);
  182. lv_ex_line(line1, line_points[0]);
  183. labelRetraText = lv_label_create(scr, NULL);
  184. lv_obj_set_style(labelRetraText, &tft_style_label_rel);
  185. lv_obj_set_pos(labelRetraText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
  186. lv_label_set_text(labelRetraText, machine_menu.RetractAcceleration);
  187. buttonRetraValue = lv_btn_create(scr, NULL);
  188. lv_obj_set_pos(buttonRetraValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
  189. lv_obj_set_size(buttonRetraValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
  190. lv_obj_set_event_cb_mks(buttonRetraValue, event_handler, ID_ACCE_RETRA, NULL, 0);
  191. lv_btn_set_style(buttonRetraValue, LV_BTN_STYLE_REL, &style_para_value);
  192. lv_btn_set_style(buttonRetraValue, LV_BTN_STYLE_PR, &style_para_value);
  193. labelRetraValue = lv_label_create(buttonRetraValue, NULL);
  194. line2 = lv_line_create(scr, NULL);
  195. lv_ex_line(line2, line_points[1]);
  196. labelTravelText = lv_label_create(scr, NULL);
  197. lv_obj_set_style(labelTravelText, &tft_style_label_rel);
  198. lv_obj_set_pos(labelTravelText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
  199. lv_label_set_text(labelTravelText, machine_menu.TravelAcceleration);
  200. buttonTravelValue = lv_btn_create(scr, NULL);
  201. lv_obj_set_pos(buttonTravelValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
  202. lv_obj_set_size(buttonTravelValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
  203. lv_obj_set_event_cb_mks(buttonTravelValue, event_handler, ID_ACCE_TRAVEL, NULL, 0);
  204. lv_btn_set_style(buttonTravelValue, LV_BTN_STYLE_REL, &style_para_value);
  205. lv_btn_set_style(buttonTravelValue, LV_BTN_STYLE_PR, &style_para_value);
  206. labelTravelValue = lv_label_create(buttonTravelValue, NULL);
  207. line3 = lv_line_create(scr, NULL);
  208. lv_ex_line(line3, line_points[2]);
  209. labelXText = lv_label_create(scr, NULL);
  210. lv_obj_set_style(labelXText, &tft_style_label_rel);
  211. lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
  212. lv_label_set_text(labelXText, machine_menu.X_Acceleration);
  213. buttonXValue = lv_btn_create(scr, NULL);
  214. lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
  215. lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
  216. lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_ACCE_X, NULL, 0);
  217. lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
  218. lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
  219. labelXValue = lv_label_create(buttonXValue, NULL);
  220. line4 = lv_line_create(scr, NULL);
  221. lv_ex_line(line4, line_points[3]);
  222. buttonTurnPage = lv_btn_create(scr, NULL);
  223. lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_DOWN, NULL, 0);
  224. lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
  225. lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
  226. #if HAS_ROTARY_ENCODER
  227. if (gCfgItems.encoder_enable) {
  228. lv_group_add_obj(g, buttonPrintValue);
  229. lv_group_add_obj(g, buttonRetraValue);
  230. lv_group_add_obj(g, buttonTravelValue);
  231. lv_group_add_obj(g, buttonXValue);
  232. lv_group_add_obj(g, buttonTurnPage);
  233. }
  234. #endif
  235. }
  236. else {
  237. labelYText = lv_label_create(scr, NULL);
  238. lv_obj_set_style(labelYText, &tft_style_label_rel);
  239. lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
  240. lv_label_set_text(labelYText, machine_menu.Y_Acceleration);
  241. buttonYValue = lv_btn_create(scr, NULL);
  242. lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
  243. lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
  244. lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
  245. lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
  246. lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
  247. labelYValue = lv_label_create(buttonYValue, NULL);
  248. line1 = lv_line_create(scr, NULL);
  249. lv_ex_line(line1, line_points[0]);
  250. labelZText = lv_label_create(scr, NULL);
  251. lv_obj_set_style(labelZText, &tft_style_label_rel);
  252. lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
  253. lv_label_set_text(labelZText, machine_menu.Z_Acceleration);
  254. buttonZValue = lv_btn_create(scr, NULL);
  255. lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
  256. lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE); lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
  257. lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_ACCE_Z, NULL, 0);
  258. lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
  259. lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
  260. labelZValue = lv_label_create(buttonZValue, NULL);
  261. line2 = lv_line_create(scr, NULL);
  262. lv_ex_line(line2, line_points[1]);
  263. labelE0Text = lv_label_create(scr, NULL);
  264. lv_obj_set_style(labelE0Text, &tft_style_label_rel);
  265. lv_obj_set_pos(labelE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
  266. lv_label_set_text(labelE0Text, machine_menu.E0_Acceleration);
  267. buttonE0Value = lv_btn_create(scr, NULL);
  268. lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
  269. lv_obj_set_size(buttonE0Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE); lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
  270. lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_ACCE_E0, NULL, 0);
  271. lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_REL, &style_para_value);
  272. lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_PR, &style_para_value);
  273. labelE0Value = lv_label_create(buttonE0Value, NULL);
  274. line3 = lv_line_create(scr, NULL);
  275. lv_ex_line(line3, line_points[2]);
  276. labelE1Text = lv_label_create(scr, NULL);
  277. lv_obj_set_style(labelE1Text, &tft_style_label_rel);
  278. lv_obj_set_pos(labelE1Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
  279. lv_label_set_text(labelE1Text, machine_menu.E1_Acceleration);
  280. buttonE1Value = lv_btn_create(scr, NULL);
  281. lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
  282. lv_obj_set_size(buttonE1Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE); lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
  283. lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_ACCE_E1, NULL, 0);
  284. lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_REL, &style_para_value);
  285. lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_PR, &style_para_value);
  286. labelE1Value = lv_label_create(buttonE1Value, NULL);
  287. line4 = lv_line_create(scr, NULL);
  288. lv_ex_line(line4, line_points[3]);
  289. buttonTurnPage = lv_btn_create(scr, NULL);
  290. lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_UP, NULL, 0);
  291. //lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
  292. //lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
  293. //lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
  294. //lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
  295. lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
  296. lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
  297. #if HAS_ROTARY_ENCODER
  298. if (gCfgItems.encoder_enable) {
  299. lv_group_add_obj(g, buttonYValue);
  300. lv_group_add_obj(g, buttonZValue);
  301. lv_group_add_obj(g, buttonE0Value);
  302. lv_group_add_obj(g, buttonE1Value);
  303. lv_group_add_obj(g, buttonTurnPage);
  304. }
  305. #endif
  306. }
  307. //lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
  308. //lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
  309. //labelTurnPage = lv_label_create(buttonTurnPage, NULL);
  310. lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
  311. lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
  312. labelTurnPage = lv_label_create(buttonTurnPage, NULL);
  313. buttonBack = lv_btn_create(scr, NULL);
  314. lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ACCE_RETURN, NULL, 0);
  315. //lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
  316. //lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
  317. //lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
  318. //lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
  319. lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
  320. lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
  321. lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
  322. lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
  323. label_Back = lv_label_create(buttonBack, NULL);
  324. #if HAS_ROTARY_ENCODER
  325. if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
  326. #endif
  327. //lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
  328. //lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
  329. if (gCfgItems.multiple_language != 0) {
  330. if (uiCfg.para_ui_page != 1) {
  331. lv_label_set_text(labelTurnPage, machine_menu.next);
  332. lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
  333. ZERO(public_buf_l);
  334. sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration);
  335. lv_label_set_text(labelPrintValue, public_buf_l);
  336. lv_obj_align(labelPrintValue, buttonPrintValue, LV_ALIGN_CENTER, 0, 0);
  337. ZERO(public_buf_l);
  338. sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.retract_acceleration);
  339. lv_label_set_text(labelRetraValue, public_buf_l);
  340. lv_obj_align(labelRetraValue, buttonRetraValue, LV_ALIGN_CENTER, 0, 0);
  341. ZERO(public_buf_l);
  342. sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.travel_acceleration);
  343. lv_label_set_text(labelTravelValue, public_buf_l);
  344. lv_obj_align(labelTravelValue, buttonTravelValue, LV_ALIGN_CENTER, 0, 0);
  345. ZERO(public_buf_l);
  346. sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
  347. lv_label_set_text(labelXValue, public_buf_l);
  348. lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
  349. }
  350. else {
  351. lv_label_set_text(labelTurnPage, machine_menu.previous);
  352. lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
  353. ZERO(public_buf_l);
  354. sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
  355. lv_label_set_text(labelYValue, public_buf_l);
  356. lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
  357. ZERO(public_buf_l);
  358. sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
  359. lv_label_set_text(labelZValue, public_buf_l);
  360. lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
  361. ZERO(public_buf_l);
  362. sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
  363. lv_label_set_text(labelE0Value, public_buf_l);
  364. lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
  365. ZERO(public_buf_l);
  366. sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
  367. lv_label_set_text(labelE1Value, public_buf_l);
  368. lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
  369. }
  370. lv_label_set_text(label_Back, common_menu.text_back);
  371. lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
  372. }
  373. }
  374. void lv_clear_acceleration_settings() {
  375. #if HAS_ROTARY_ENCODER
  376. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  377. #endif
  378. lv_obj_del(scr);
  379. }
  380. #endif // HAS_TFT_LVGL_UI