My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

draw_number_key.cpp 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981
  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 "../../lvgl/src/lv_objx/lv_imgbtn.h"
  26. //#include "../../lvgl/src/lv_objx/lv_img.h"
  27. //#include "../../lvgl/src/lv_core/lv_disp.h"
  28. //#include "../../lvgl/src/lv_core/lv_refr.h"
  29. //#include "../../MarlinCore.h"
  30. #include "draw_ui.h"
  31. #include "../../../../MarlinCore.h"
  32. #include "../../../../module/temperature.h"
  33. #include "../../../../gcode/queue.h"
  34. #if ENABLED(POWER_LOSS_RECOVERY)
  35. #include "../../../../feature/powerloss.h"
  36. #endif
  37. #include "../../../../gcode/gcode.h"
  38. #include "../../../../module/planner.h"
  39. #if HAS_TRINAMIC_CONFIG
  40. #include "../../../../module/stepper/indirection.h"
  41. #include "../../../../feature/tmc_util.h"
  42. #endif
  43. #if HAS_BED_PROBE
  44. #include "../../../../module/probe.h"
  45. #endif
  46. extern lv_group_t * g;
  47. static lv_obj_t * scr;
  48. static lv_obj_t *buttonValue = NULL;
  49. static lv_obj_t *labelValue = NULL;
  50. static char key_value[11] = {0};
  51. static uint8_t cnt = 0;
  52. static char point_flg = 1;
  53. #define ID_NUM_KEY1 1
  54. #define ID_NUM_KEY2 2
  55. #define ID_NUM_KEY3 3
  56. #define ID_NUM_KEY4 4
  57. #define ID_NUM_KEY5 5
  58. #define ID_NUM_KEY6 6
  59. #define ID_NUM_KEY7 7
  60. #define ID_NUM_KEY8 8
  61. #define ID_NUM_KEY9 9
  62. #define ID_NUM_KEY0 10
  63. #define ID_NUM_BACK 11
  64. #define ID_NUM_RESET 12
  65. #define ID_NUM_CONFIRM 13
  66. #define ID_NUM_POINT 14
  67. #define ID_NUM_NAGETIVE 15
  68. static void disp_key_value() {
  69. char *temp;
  70. #if HAS_TRINAMIC_CONFIG
  71. float milliamps;
  72. #endif
  73. ZERO(public_buf_m);
  74. switch (value) {
  75. case PrintAcceleration:
  76. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.acceleration);
  77. break;
  78. case RetractAcceleration:
  79. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.retract_acceleration);
  80. break;
  81. case TravelAcceleration:
  82. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.travel_acceleration);
  83. break;
  84. case XAcceleration:
  85. sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
  86. break;
  87. case YAcceleration:
  88. sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
  89. break;
  90. case ZAcceleration:
  91. sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
  92. break;
  93. case E0Acceleration:
  94. sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
  95. break;
  96. case E1Acceleration:
  97. sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
  98. break;
  99. case XMaxFeedRate:
  100. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);
  101. break;
  102. case YMaxFeedRate:
  103. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]);
  104. break;
  105. case ZMaxFeedRate:
  106. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]);
  107. break;
  108. case E0MaxFeedRate:
  109. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]);
  110. break;
  111. case E1MaxFeedRate:
  112. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]);
  113. break;
  114. case XJerk:
  115. #if HAS_CLASSIC_JERK
  116. sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
  117. #endif
  118. break;
  119. case YJerk:
  120. #if HAS_CLASSIC_JERK
  121. sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Y_AXIS]);
  122. #endif
  123. break;
  124. case ZJerk:
  125. #if HAS_CLASSIC_JERK
  126. sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Z_AXIS]);
  127. #endif
  128. break;
  129. case EJerk:
  130. #if HAS_CLASSIC_JERK
  131. sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[E_AXIS]);
  132. #endif
  133. break;
  134. case Xstep:
  135. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);
  136. break;
  137. case Ystep:
  138. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]);
  139. break;
  140. case Zstep:
  141. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]);
  142. break;
  143. case E0step:
  144. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]);
  145. break;
  146. case E1step:
  147. sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]);
  148. break;
  149. case Xcurrent:
  150. #if AXIS_IS_TMC(X)
  151. milliamps = stepperX.getMilliamps();
  152. sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
  153. #endif
  154. break;
  155. case Ycurrent:
  156. #if AXIS_IS_TMC(Y)
  157. milliamps = stepperY.getMilliamps();
  158. sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
  159. #endif
  160. break;
  161. case Zcurrent:
  162. #if AXIS_IS_TMC(Z)
  163. milliamps = stepperZ.getMilliamps();
  164. sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
  165. #endif
  166. break;
  167. case E0current:
  168. #if AXIS_IS_TMC(E0)
  169. milliamps = stepperE0.getMilliamps();
  170. sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
  171. #endif
  172. break;
  173. case E1current:
  174. #if AXIS_IS_TMC(E1)
  175. milliamps = stepperE1.getMilliamps();
  176. sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
  177. #endif
  178. break;
  179. case pause_pos_x:
  180. sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosX);
  181. break;
  182. case pause_pos_y:
  183. sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosY);
  184. break;
  185. case pause_pos_z:
  186. sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosZ);
  187. break;
  188. case level_pos_x1:
  189. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[0][0]);
  190. break;
  191. case level_pos_y1:
  192. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[0][1]);
  193. break;
  194. case level_pos_x2:
  195. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[1][0]);
  196. break;
  197. case level_pos_y2:
  198. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[1][1]);
  199. break;
  200. case level_pos_x3:
  201. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[2][0]);
  202. break;
  203. case level_pos_y3:
  204. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[2][1]);
  205. break;
  206. case level_pos_x4:
  207. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[3][0]);
  208. break;
  209. case level_pos_y4:
  210. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[3][1]);
  211. break;
  212. case level_pos_x5:
  213. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[4][0]);
  214. break;
  215. case level_pos_y5:
  216. sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[4][1]);
  217. break;
  218. #if HAS_BED_PROBE
  219. case x_offset:
  220. #if HAS_PROBE_XY_OFFSET
  221. sprintf_P(public_buf_m, PSTR("%.1f"), probe.offset.x);
  222. #endif
  223. break;
  224. case y_offset:
  225. #if HAS_PROBE_XY_OFFSET
  226. sprintf_P(public_buf_m, PSTR("%.1f"), probe.offset.y);
  227. #endif
  228. break;
  229. case z_offset:
  230. sprintf_P(public_buf_m, PSTR("%.1f"), probe.offset.z);
  231. break;
  232. #endif
  233. case load_length:
  234. sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_load_length);
  235. break;
  236. case load_speed:
  237. sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_load_speed);
  238. break;
  239. case unload_length:
  240. sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_unload_length);
  241. break;
  242. case unload_speed:
  243. sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_unload_speed);
  244. break;
  245. case filament_temp:
  246. sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filament_limit_temper);
  247. break;
  248. case x_sensitivity:
  249. #if X_SENSORLESS
  250. sprintf_P(public_buf_m, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0));
  251. #endif
  252. break;
  253. case y_sensitivity:
  254. #if Y_SENSORLESS
  255. sprintf_P(public_buf_m, PSTR("%d"), TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0));
  256. #endif
  257. break;
  258. case z_sensitivity:
  259. #if Z_SENSORLESS
  260. sprintf_P(public_buf_m, PSTR("%d"), TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0));
  261. #endif
  262. break;
  263. case z2_sensitivity:
  264. #if Z2_SENSORLESS
  265. sprintf_P(public_buf_m, PSTR("%d"), TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0));
  266. #endif
  267. break;
  268. }
  269. ZERO(key_value);
  270. strcpy(key_value, public_buf_m);
  271. cnt = strlen(key_value);
  272. temp = strchr(key_value, '.');
  273. if (temp)
  274. point_flg = 0;
  275. else
  276. point_flg = 1;
  277. lv_label_set_text(labelValue, key_value);
  278. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  279. }
  280. static void set_value_confirm() {
  281. #if HAS_TRINAMIC_CONFIG
  282. uint16_t current_mA;
  283. #endif
  284. switch (value) {
  285. case PrintAcceleration:
  286. planner.settings.acceleration = atof(key_value);
  287. break;
  288. case RetractAcceleration:
  289. planner.settings.retract_acceleration = atof(key_value);
  290. break;
  291. case TravelAcceleration:
  292. planner.settings.travel_acceleration = atof(key_value);
  293. break;
  294. case XAcceleration:
  295. planner.settings.max_acceleration_mm_per_s2[X_AXIS] = atof(key_value);
  296. break;
  297. case YAcceleration:
  298. planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = atof(key_value);
  299. break;
  300. case ZAcceleration:
  301. planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = atof(key_value);
  302. break;
  303. case E0Acceleration:
  304. planner.settings.max_acceleration_mm_per_s2[E_AXIS] = atof(key_value);
  305. break;
  306. case E1Acceleration:
  307. planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)] = atof(key_value);
  308. break;
  309. case XMaxFeedRate:
  310. planner.settings.max_feedrate_mm_s[X_AXIS] = atof(key_value);
  311. break;
  312. case YMaxFeedRate:
  313. planner.settings.max_feedrate_mm_s[Y_AXIS] = atof(key_value);
  314. break;
  315. case ZMaxFeedRate:
  316. planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value);
  317. break;
  318. case E0MaxFeedRate:
  319. planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value);
  320. break;
  321. case E1MaxFeedRate:
  322. planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value);
  323. break;
  324. case XJerk:
  325. #if HAS_CLASSIC_JERK
  326. planner.max_jerk[X_AXIS] = atof(key_value);
  327. #endif
  328. break;
  329. case YJerk:
  330. #if HAS_CLASSIC_JERK
  331. planner.max_jerk[Y_AXIS] = atof(key_value);
  332. #endif
  333. break;
  334. case ZJerk:
  335. #if HAS_CLASSIC_JERK
  336. planner.max_jerk[Z_AXIS] = atof(key_value);
  337. #endif
  338. break;
  339. case EJerk:
  340. #if HAS_CLASSIC_JERK
  341. planner.max_jerk[E_AXIS] = atof(key_value);
  342. #endif
  343. break;
  344. case Xstep:
  345. planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value);
  346. planner.refresh_positioning();
  347. break;
  348. case Ystep:
  349. planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value);
  350. planner.refresh_positioning();
  351. break;
  352. case Zstep:
  353. planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value);
  354. planner.refresh_positioning();
  355. break;
  356. case E0step:
  357. planner.settings.axis_steps_per_mm[E_AXIS] = atof(key_value);
  358. planner.refresh_positioning();
  359. break;
  360. case E1step:
  361. planner.settings.axis_steps_per_mm[E_AXIS_N(1)] = atof(key_value);
  362. planner.refresh_positioning();
  363. break;
  364. case Xcurrent:
  365. #if AXIS_IS_TMC(X)
  366. current_mA = atoi(key_value);
  367. stepperX.rms_current(current_mA);
  368. #endif
  369. break;
  370. case Ycurrent:
  371. #if AXIS_IS_TMC(Y)
  372. current_mA = atoi(key_value);
  373. stepperY.rms_current(current_mA);
  374. #endif
  375. break;
  376. case Zcurrent:
  377. #if AXIS_IS_TMC(Z)
  378. current_mA = atoi(key_value);
  379. stepperZ.rms_current(current_mA);
  380. #endif
  381. break;
  382. case E0current:
  383. #if AXIS_IS_TMC(E0)
  384. current_mA = atoi(key_value);
  385. stepperE0.rms_current(current_mA);
  386. #endif
  387. break;
  388. case E1current:
  389. #if AXIS_IS_TMC(E1)
  390. current_mA = atoi(key_value);
  391. stepperE1.rms_current(current_mA);
  392. #endif
  393. break;
  394. case pause_pos_x:
  395. gCfgItems.pausePosX = atof(key_value);
  396. update_spi_flash();
  397. break;
  398. case pause_pos_y:
  399. gCfgItems.pausePosY = atof(key_value);
  400. update_spi_flash();
  401. break;
  402. case pause_pos_z:
  403. gCfgItems.pausePosZ = atof(key_value);
  404. update_spi_flash();
  405. break;
  406. case level_pos_x1:
  407. gCfgItems.levelingPos[0][0] = atoi(key_value);
  408. update_spi_flash();
  409. break;
  410. case level_pos_y1:
  411. gCfgItems.levelingPos[0][1] = atoi(key_value);
  412. update_spi_flash();
  413. break;
  414. case level_pos_x2:
  415. gCfgItems.levelingPos[1][0] = atoi(key_value);
  416. update_spi_flash();
  417. break;
  418. case level_pos_y2:
  419. gCfgItems.levelingPos[1][1] = atoi(key_value);
  420. update_spi_flash();
  421. break;
  422. case level_pos_x3:
  423. gCfgItems.levelingPos[2][0] = atoi(key_value);
  424. update_spi_flash();
  425. break;
  426. case level_pos_y3:
  427. gCfgItems.levelingPos[2][1] = atoi(key_value);
  428. update_spi_flash();
  429. break;
  430. case level_pos_x4:
  431. gCfgItems.levelingPos[3][0] = atoi(key_value);
  432. update_spi_flash();
  433. break;
  434. case level_pos_y4:
  435. gCfgItems.levelingPos[3][1] = atoi(key_value);
  436. update_spi_flash();
  437. break;
  438. case level_pos_x5:
  439. gCfgItems.levelingPos[4][0] = atoi(key_value);
  440. update_spi_flash();
  441. break;
  442. case level_pos_y5:
  443. gCfgItems.levelingPos[4][1] = atoi(key_value);
  444. update_spi_flash();
  445. break;
  446. #if HAS_BED_PROBE
  447. case x_offset:
  448. #if HAS_PROBE_XY_OFFSET
  449. float x;
  450. x = atof(key_value);
  451. if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE))
  452. probe.offset.x = x;
  453. #endif
  454. break;
  455. case y_offset:
  456. #if HAS_PROBE_XY_OFFSET
  457. float y;
  458. y = atof(key_value);
  459. if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE))
  460. probe.offset.y = y;
  461. #endif
  462. break;
  463. case z_offset:
  464. float z;
  465. z = atof(key_value);
  466. if (WITHIN(z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
  467. probe.offset.z = z;
  468. break;
  469. #endif
  470. case load_length:
  471. gCfgItems.filamentchange_load_length = atoi(key_value);
  472. uiCfg.filament_loading_time = (uint32_t)((gCfgItems.filamentchange_load_length*60.0/gCfgItems.filamentchange_load_speed)+0.5);
  473. update_spi_flash();
  474. break;
  475. case load_speed:
  476. gCfgItems.filamentchange_load_speed = atoi(key_value);
  477. uiCfg.filament_loading_time = (uint32_t)((gCfgItems.filamentchange_load_length*60.0/gCfgItems.filamentchange_load_speed)+0.5);
  478. update_spi_flash();
  479. break;
  480. case unload_length:
  481. gCfgItems.filamentchange_unload_length = atoi(key_value);
  482. uiCfg.filament_unloading_time = (uint32_t)((gCfgItems.filamentchange_unload_length*60.0/gCfgItems.filamentchange_unload_speed)+0.5);
  483. update_spi_flash();
  484. break;
  485. case unload_speed:
  486. gCfgItems.filamentchange_unload_speed = atoi(key_value);
  487. uiCfg.filament_unloading_time = (uint32_t)((gCfgItems.filamentchange_unload_length*60.0/gCfgItems.filamentchange_unload_speed)+0.5);
  488. update_spi_flash();
  489. break;
  490. case filament_temp:
  491. gCfgItems.filament_limit_temper = atoi(key_value);
  492. update_spi_flash();
  493. break;
  494. case x_sensitivity:
  495. #if X_SENSORLESS
  496. stepperX.homing_threshold(atoi(key_value));
  497. #endif
  498. break;
  499. case y_sensitivity:
  500. #if Y_SENSORLESS
  501. stepperY.homing_threshold(atoi(key_value));
  502. #endif
  503. break;
  504. case z_sensitivity:
  505. #if Z_SENSORLESS
  506. stepperZ.homing_threshold(atoi(key_value));
  507. #endif
  508. break;
  509. case z2_sensitivity:
  510. #if Z2_SENSORLESS
  511. stepperZ2.homing_threshold(atoi(key_value));
  512. #endif
  513. break;
  514. }
  515. gcode.process_subcommands_now_P(PSTR("M500"));
  516. }
  517. static void event_handler(lv_obj_t * obj, lv_event_t event) {
  518. switch (obj->mks_obj_id) {
  519. case ID_NUM_KEY1:
  520. if (event == LV_EVENT_CLICKED) {
  521. }
  522. else if (event == LV_EVENT_RELEASED) {
  523. if (cnt <= 10) {
  524. key_value[cnt] = (char)'1';
  525. lv_label_set_text(labelValue, key_value);
  526. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  527. cnt++;
  528. }
  529. }
  530. break;
  531. case ID_NUM_KEY2:
  532. if (event == LV_EVENT_CLICKED) {
  533. }
  534. else if (event == LV_EVENT_RELEASED) {
  535. if (cnt <= 10) {
  536. key_value[cnt] = (char)'2';
  537. lv_label_set_text(labelValue, key_value);
  538. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  539. cnt++;
  540. }
  541. }
  542. break;
  543. case ID_NUM_KEY3:
  544. if (event == LV_EVENT_CLICKED) {
  545. }
  546. else if (event == LV_EVENT_RELEASED) {
  547. if (cnt <= 10) {
  548. key_value[cnt] = (char)'3';
  549. lv_label_set_text(labelValue, key_value);
  550. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  551. cnt++;
  552. }
  553. }
  554. break;
  555. case ID_NUM_KEY4:
  556. if (event == LV_EVENT_CLICKED) {
  557. }
  558. else if (event == LV_EVENT_RELEASED) {
  559. if (cnt <= 10) {
  560. key_value[cnt] = (char)'4';
  561. lv_label_set_text(labelValue, key_value);
  562. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  563. cnt++;
  564. }
  565. }
  566. break;
  567. case ID_NUM_KEY5:
  568. if (event == LV_EVENT_CLICKED) {
  569. }
  570. else if (event == LV_EVENT_RELEASED) {
  571. if (cnt <= 10) {
  572. key_value[cnt] = (char)'5';
  573. lv_label_set_text(labelValue, key_value);
  574. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  575. cnt++;
  576. }
  577. }
  578. break;
  579. case ID_NUM_KEY6:
  580. if (event == LV_EVENT_CLICKED) {
  581. }
  582. else if (event == LV_EVENT_RELEASED) {
  583. if (cnt <= 10) {
  584. key_value[cnt] = (char)'6';
  585. lv_label_set_text(labelValue, key_value);
  586. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  587. cnt++;
  588. }
  589. }
  590. break;
  591. case ID_NUM_KEY7:
  592. if (event == LV_EVENT_CLICKED) {
  593. }
  594. else if (event == LV_EVENT_RELEASED) {
  595. if (cnt <= 10) {
  596. key_value[cnt] = (char)'7';
  597. lv_label_set_text(labelValue, key_value);
  598. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  599. cnt++;
  600. }
  601. }
  602. break;
  603. case ID_NUM_KEY8:
  604. if (event == LV_EVENT_CLICKED) {
  605. }
  606. else if (event == LV_EVENT_RELEASED) {
  607. if (cnt <= 10) {
  608. key_value[cnt] = (char)'8';
  609. lv_label_set_text(labelValue, key_value);
  610. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  611. cnt++;
  612. }
  613. }
  614. break;
  615. case ID_NUM_KEY9:
  616. if (event == LV_EVENT_CLICKED) {
  617. }
  618. else if (event == LV_EVENT_RELEASED) {
  619. if (cnt <= 10) {
  620. key_value[cnt] = (char)'9';
  621. lv_label_set_text(labelValue, key_value);
  622. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  623. cnt++;
  624. }
  625. }
  626. break;
  627. case ID_NUM_KEY0:
  628. if (event == LV_EVENT_CLICKED) {
  629. }
  630. else if (event == LV_EVENT_RELEASED) {
  631. if (cnt <= 10) {
  632. key_value[cnt] = (char)'0';
  633. lv_label_set_text(labelValue, key_value);
  634. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  635. cnt++;
  636. }
  637. }
  638. break;
  639. case ID_NUM_BACK:
  640. if (event == LV_EVENT_CLICKED) {
  641. }
  642. else if (event == LV_EVENT_RELEASED) {
  643. if (cnt > 0)
  644. cnt--;
  645. if (key_value[cnt] == (char)'.') point_flg = 1;
  646. key_value[cnt] = (char)'\0';
  647. lv_label_set_text(labelValue, key_value);
  648. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  649. }
  650. break;
  651. case ID_NUM_RESET:
  652. if (event == LV_EVENT_CLICKED) {
  653. }
  654. else if (event == LV_EVENT_RELEASED) {
  655. ZERO(key_value);
  656. cnt = 0;
  657. key_value[cnt] = (char)'0';
  658. point_flg = 1;
  659. lv_label_set_text(labelValue, key_value);
  660. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  661. }
  662. break;
  663. case ID_NUM_POINT:
  664. if (event == LV_EVENT_CLICKED) {
  665. }
  666. else if (event == LV_EVENT_RELEASED) {
  667. if ((cnt != 0) && (point_flg == 1)) {
  668. point_flg = 0;
  669. key_value[cnt] = (char)'.';
  670. lv_label_set_text(labelValue, key_value);
  671. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  672. cnt++;
  673. }
  674. }
  675. break;
  676. case ID_NUM_NAGETIVE:
  677. if (event == LV_EVENT_CLICKED) {
  678. }
  679. else if (event == LV_EVENT_RELEASED) {
  680. if (cnt == 0) {
  681. key_value[cnt] = (char)'-';
  682. lv_label_set_text(labelValue, key_value);
  683. lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
  684. cnt++;
  685. }
  686. }
  687. break;
  688. case ID_NUM_CONFIRM:
  689. if (event == LV_EVENT_CLICKED) {
  690. }
  691. else if (event == LV_EVENT_RELEASED) {
  692. last_disp_state = NUMBER_KEY_UI;
  693. if (strlen(key_value) != 0)
  694. set_value_confirm();
  695. lv_clear_number_key();
  696. draw_return_ui();
  697. }
  698. break;
  699. }
  700. }
  701. void lv_draw_number_key(void) {
  702. lv_obj_t *NumberKey_1 = NULL, *NumberKey_2 = NULL, *NumberKey_3 = NULL, *NumberKey_4 = NULL, *NumberKey_5 = NULL;
  703. lv_obj_t *NumberKey_6 = NULL, *NumberKey_7 = NULL, *NumberKey_8 = NULL, *NumberKey_9 = NULL, *NumberKey_0 = NULL;
  704. lv_obj_t *KeyPoint = NULL, *KeyConfirm = NULL, *KeyReset = NULL, *KeyBack = NULL;
  705. lv_obj_t *Minus = NULL;
  706. lv_obj_t *labelKey_1 = NULL, *labelKey_2 = NULL, *labelKey_3 = NULL, *labelKey_4 = NULL, *labelKey_5 = NULL;
  707. lv_obj_t *labelKey_6 = NULL, *labelKey_7 = NULL, *labelKey_8 = NULL, *labelKey_9 = NULL, *labelKey_0 = NULL;
  708. lv_obj_t *labelKeyPoint = NULL, *labelKeyConfirm = NULL, *labelKeyReset = NULL, *labelKeyBack = NULL;
  709. lv_obj_t *labelMinus = NULL;
  710. buttonValue = NULL;
  711. labelValue = NULL;
  712. if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NUMBER_KEY_UI) {
  713. disp_state_stack._disp_index++;
  714. disp_state_stack._disp_state[disp_state_stack._disp_index] = NUMBER_KEY_UI;
  715. }
  716. disp_state = NUMBER_KEY_UI;
  717. scr = lv_obj_create(NULL, NULL);
  718. lv_obj_set_style(scr, &tft_style_scr);
  719. lv_scr_load(scr);
  720. lv_obj_clean(scr);
  721. //lv_obj_t * title = lv_label_create(scr, NULL);
  722. //lv_obj_set_style(title, &tft_style_label_rel);
  723. //lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
  724. //lv_label_set_text(title, creat_title_text());
  725. lv_refr_now(lv_refr_get_disp_refreshing());
  726. buttonValue = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  727. lv_obj_set_pos(buttonValue, 92, 40); /*Set its position*/
  728. lv_obj_set_size(buttonValue, 296, 40);
  729. lv_obj_set_event_cb_mks(buttonValue, event_handler, ID_NUM_KEY1, NULL, 0);
  730. lv_btn_set_style(buttonValue, LV_BTN_STYLE_REL, &style_num_text); /*Set the button's released style*/
  731. lv_btn_set_style(buttonValue, LV_BTN_STYLE_PR, &style_num_text); /*Set the button's pressed style*/
  732. //lv_btn_set_layout(buttonValue, LV_LAYOUT_OFF);
  733. labelValue = lv_label_create(buttonValue, NULL); /*Add a label to the button*/
  734. NumberKey_1 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  735. lv_obj_set_pos(NumberKey_1, 92, 90); /*Set its position*/
  736. lv_obj_set_size(NumberKey_1, 68, 40);
  737. lv_obj_set_event_cb_mks(NumberKey_1, event_handler, ID_NUM_KEY1, NULL, 0);
  738. lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  739. lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  740. //lv_btn_set_layout(NumberKey_1, LV_LAYOUT_OFF);
  741. labelKey_1 = lv_label_create(NumberKey_1, NULL); /*Add a label to the button*/
  742. lv_label_set_text(labelKey_1, machine_menu.key_1);
  743. lv_obj_align(labelKey_1, NumberKey_1, LV_ALIGN_CENTER, 0, 0);
  744. NumberKey_2 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  745. lv_obj_set_pos(NumberKey_2, 168, 90); /*Set its position*/
  746. lv_obj_set_size(NumberKey_2, 68, 40);
  747. lv_obj_set_event_cb_mks(NumberKey_2, event_handler, ID_NUM_KEY2, NULL, 0);
  748. lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  749. lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  750. //lv_btn_set_layout(NumberKey_2, LV_LAYOUT_OFF);
  751. labelKey_2 = lv_label_create(NumberKey_2, NULL); /*Add a label to the button*/
  752. lv_label_set_text(labelKey_2, machine_menu.key_2);
  753. lv_obj_align(labelKey_2, NumberKey_2, LV_ALIGN_CENTER, 0, 0);
  754. NumberKey_3 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  755. lv_obj_set_pos(NumberKey_3, 244, 90); /*Set its position*/
  756. lv_obj_set_size(NumberKey_3, 68, 40);
  757. lv_obj_set_event_cb_mks(NumberKey_3, event_handler, ID_NUM_KEY3, NULL, 0);
  758. lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  759. lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  760. //lv_btn_set_layout(NumberKey_3, LV_LAYOUT_OFF);
  761. labelKey_3 = lv_label_create(NumberKey_3, NULL); /*Add a label to the button*/
  762. lv_label_set_text(labelKey_3, machine_menu.key_3);
  763. lv_obj_align(labelKey_3, NumberKey_3, LV_ALIGN_CENTER, 0, 0);
  764. NumberKey_4 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  765. lv_obj_set_pos(NumberKey_4, 92, 140); /*Set its position*/
  766. lv_obj_set_size(NumberKey_4, 68, 40);
  767. lv_obj_set_event_cb_mks(NumberKey_4, event_handler, ID_NUM_KEY4, NULL, 0);
  768. lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  769. lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  770. //lv_btn_set_layout(NumberKey_4, LV_LAYOUT_OFF);
  771. labelKey_4 = lv_label_create(NumberKey_4, NULL); /*Add a label to the button*/
  772. lv_label_set_text(labelKey_4, machine_menu.key_4);
  773. lv_obj_align(labelKey_4, NumberKey_4, LV_ALIGN_CENTER, 0, 0);
  774. NumberKey_5 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  775. lv_obj_set_pos(NumberKey_5, 168, 140); /*Set its position*/
  776. lv_obj_set_size(NumberKey_5, 68, 40);
  777. lv_obj_set_event_cb_mks(NumberKey_5, event_handler, ID_NUM_KEY5, NULL, 0);
  778. lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  779. lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  780. //lv_btn_set_layout(NumberKey_5, LV_LAYOUT_OFF);
  781. labelKey_5 = lv_label_create(NumberKey_5, NULL); /*Add a label to the button*/
  782. lv_label_set_text(labelKey_5, machine_menu.key_5);
  783. lv_obj_align(labelKey_5, NumberKey_5, LV_ALIGN_CENTER, 0, 0);
  784. NumberKey_6 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  785. lv_obj_set_pos(NumberKey_6, 244, 140); /*Set its position*/
  786. lv_obj_set_size(NumberKey_6, 68, 40);
  787. lv_obj_set_event_cb_mks(NumberKey_6, event_handler, ID_NUM_KEY6, NULL, 0);
  788. lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  789. lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  790. //lv_btn_set_layout(NumberKey_6, LV_LAYOUT_OFF);
  791. labelKey_6 = lv_label_create(NumberKey_6, NULL); /*Add a label to the button*/
  792. lv_label_set_text(labelKey_6, machine_menu.key_6);
  793. lv_obj_align(labelKey_6, NumberKey_6, LV_ALIGN_CENTER, 0, 0);
  794. NumberKey_7 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  795. lv_obj_set_pos(NumberKey_7, 92, 190); /*Set its position*/
  796. lv_obj_set_size(NumberKey_7, 68, 40);
  797. lv_obj_set_event_cb_mks(NumberKey_7, event_handler, ID_NUM_KEY7, NULL, 0);
  798. lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  799. lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  800. //lv_btn_set_layout(NumberKey_7, LV_LAYOUT_OFF);
  801. labelKey_7 = lv_label_create(NumberKey_7, NULL); /*Add a label to the button*/
  802. lv_label_set_text(labelKey_7, machine_menu.key_7);
  803. lv_obj_align(labelKey_7, NumberKey_7, LV_ALIGN_CENTER, 0, 0);
  804. NumberKey_8 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  805. lv_obj_set_pos(NumberKey_8, 168, 190); /*Set its position*/
  806. lv_obj_set_size(NumberKey_8, 68, 40);
  807. lv_obj_set_event_cb_mks(NumberKey_8, event_handler, ID_NUM_KEY8, NULL, 0);
  808. lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  809. lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  810. //lv_btn_set_layout(NumberKey_8, LV_LAYOUT_OFF);
  811. labelKey_8 = lv_label_create(NumberKey_8, NULL); /*Add a label to the button*/
  812. lv_label_set_text(labelKey_8, machine_menu.key_8);
  813. lv_obj_align(labelKey_8, NumberKey_8, LV_ALIGN_CENTER, 0, 0);
  814. NumberKey_9 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  815. lv_obj_set_pos(NumberKey_9, 244, 190); /*Set its position*/
  816. lv_obj_set_size(NumberKey_9, 68, 40);
  817. lv_obj_set_event_cb_mks(NumberKey_9, event_handler, ID_NUM_KEY9, NULL, 0);
  818. lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  819. lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  820. //lv_btn_set_layout(NumberKey_9, LV_LAYOUT_OFF);
  821. labelKey_9 = lv_label_create(NumberKey_9, NULL); /*Add a label to the button*/
  822. lv_label_set_text(labelKey_9, machine_menu.key_9);
  823. lv_obj_align(labelKey_9, NumberKey_9, LV_ALIGN_CENTER, 0, 0);
  824. NumberKey_0 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  825. lv_obj_set_pos(NumberKey_0, 92, 240); /*Set its position*/
  826. lv_obj_set_size(NumberKey_0, 68, 40);
  827. lv_obj_set_event_cb_mks(NumberKey_0, event_handler, ID_NUM_KEY0, NULL, 0);
  828. lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  829. lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  830. //lv_btn_set_layout(NumberKey_0, LV_LAYOUT_OFF);
  831. labelKey_0 = lv_label_create(NumberKey_0, NULL); /*Add a label to the button*/
  832. lv_label_set_text(labelKey_0, machine_menu.key_0);
  833. lv_obj_align(labelKey_0, NumberKey_0, LV_ALIGN_CENTER, 0, 0);
  834. KeyBack = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  835. lv_obj_set_pos(KeyBack, 320, 90); /*Set its position*/
  836. lv_obj_set_size(KeyBack, 68, 40);
  837. lv_obj_set_event_cb_mks(KeyBack, event_handler, ID_NUM_BACK, NULL, 0);
  838. lv_btn_set_style(KeyBack, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  839. lv_btn_set_style(KeyBack, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  840. //lv_btn_set_layout(KeyBack, LV_LAYOUT_OFF);
  841. labelKeyBack = lv_label_create(KeyBack, NULL); /*Add a label to the button*/
  842. lv_label_set_text(labelKeyBack, machine_menu.key_back);
  843. lv_obj_align(labelKeyBack, KeyBack, LV_ALIGN_CENTER, 0, 0);
  844. KeyReset = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  845. lv_obj_set_pos(KeyReset, 320, 140); /*Set its position*/
  846. lv_obj_set_size(KeyReset, 68, 40);
  847. lv_obj_set_event_cb_mks(KeyReset, event_handler, ID_NUM_RESET, NULL, 0);
  848. lv_btn_set_style(KeyReset, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  849. lv_btn_set_style(KeyReset, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  850. //lv_btn_set_layout(KeyReset, LV_LAYOUT_OFF);
  851. labelKeyReset = lv_label_create(KeyReset, NULL); /*Add a label to the button*/
  852. lv_label_set_text(labelKeyReset, machine_menu.key_reset);
  853. lv_obj_align(labelKeyReset, KeyReset, LV_ALIGN_CENTER, 0, 0);
  854. KeyConfirm = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  855. lv_obj_set_pos(KeyConfirm, 320, 190); /*Set its position*/
  856. lv_obj_set_size(KeyConfirm, 68, 90);
  857. lv_obj_set_event_cb_mks(KeyConfirm, event_handler, ID_NUM_CONFIRM, NULL, 0);
  858. lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  859. lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  860. //lv_btn_set_layout(KeyConfirm, LV_LAYOUT_OFF);
  861. labelKeyConfirm = lv_label_create(KeyConfirm, NULL); /*Add a label to the button*/
  862. lv_label_set_text(labelKeyConfirm, machine_menu.key_confirm);
  863. lv_obj_align(labelKeyConfirm, KeyConfirm, LV_ALIGN_CENTER, 0, 0);
  864. KeyPoint = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  865. lv_obj_set_pos(KeyPoint, 244, 240); /*Set its position*/
  866. lv_obj_set_size(KeyPoint, 68, 40);
  867. lv_obj_set_event_cb_mks(KeyPoint, event_handler, ID_NUM_POINT, NULL, 0);
  868. lv_btn_set_style(KeyPoint, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  869. lv_btn_set_style(KeyPoint, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  870. //lv_btn_set_layout(KeyPoint, LV_LAYOUT_OFF);
  871. labelKeyPoint = lv_label_create(KeyPoint, NULL); /*Add a label to the button*/
  872. lv_label_set_text(labelKeyPoint, machine_menu.key_point);
  873. lv_obj_align(labelKeyPoint, KeyPoint, LV_ALIGN_CENTER, 0, 0);
  874. Minus = lv_btn_create(scr, NULL); /*Add a button the current screen*/
  875. lv_obj_set_pos(Minus, 168, 240); /*Set its position*/
  876. lv_obj_set_size(Minus, 68, 40);
  877. lv_obj_set_event_cb_mks(Minus, event_handler, ID_NUM_NAGETIVE, NULL, 0);
  878. lv_btn_set_style(Minus, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
  879. lv_btn_set_style(Minus, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
  880. //lv_btn_set_layout(Minus, LV_LAYOUT_OFF);
  881. labelMinus = lv_label_create(Minus, NULL); /*Add a label to the button*/
  882. lv_label_set_text(labelMinus, machine_menu.negative);
  883. lv_obj_align(labelMinus, Minus, LV_ALIGN_CENTER, 0, 0);
  884. #if HAS_ROTARY_ENCODER
  885. if (gCfgItems.encoder_enable) {
  886. lv_group_add_obj(g, NumberKey_1);
  887. lv_group_add_obj(g, NumberKey_2);
  888. lv_group_add_obj(g, NumberKey_3);
  889. lv_group_add_obj(g, KeyBack);
  890. lv_group_add_obj(g, NumberKey_4);
  891. lv_group_add_obj(g, NumberKey_5);
  892. lv_group_add_obj(g, NumberKey_6);
  893. lv_group_add_obj(g, KeyReset);
  894. lv_group_add_obj(g, NumberKey_7);
  895. lv_group_add_obj(g, NumberKey_8);
  896. lv_group_add_obj(g, NumberKey_9);
  897. lv_group_add_obj(g, NumberKey_0);
  898. lv_group_add_obj(g, Minus);
  899. lv_group_add_obj(g, KeyPoint);
  900. lv_group_add_obj(g, KeyConfirm);
  901. }
  902. #endif
  903. disp_key_value();
  904. }
  905. void lv_clear_number_key() {
  906. #if HAS_ROTARY_ENCODER
  907. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  908. #endif
  909. lv_obj_del(scr);
  910. }
  911. #endif // HAS_TFT_LVGL_UI