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

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