|
@@ -204,44 +204,44 @@ static void disp_key_value() {
|
204
|
204
|
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_1));
|
205
|
205
|
break;
|
206
|
206
|
case level_pos_x1:
|
207
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[0][0]);
|
|
207
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[0][X_AXIS]);
|
208
|
208
|
break;
|
209
|
209
|
case level_pos_y1:
|
210
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[0][1]);
|
|
210
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[0][Y_AXIS]);
|
211
|
211
|
break;
|
212
|
212
|
case level_pos_x2:
|
213
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[1][0]);
|
|
213
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[1][X_AXIS]);
|
214
|
214
|
break;
|
215
|
215
|
case level_pos_y2:
|
216
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[1][1]);
|
|
216
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[1][Y_AXIS]);
|
217
|
217
|
break;
|
218
|
218
|
case level_pos_x3:
|
219
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[2][0]);
|
|
219
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[2][X_AXIS]);
|
220
|
220
|
break;
|
221
|
221
|
case level_pos_y3:
|
222
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[2][1]);
|
|
222
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[2][Y_AXIS]);
|
223
|
223
|
break;
|
224
|
224
|
case level_pos_x4:
|
225
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[3][0]);
|
|
225
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[3][X_AXIS]);
|
226
|
226
|
break;
|
227
|
227
|
case level_pos_y4:
|
228
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[3][1]);
|
|
228
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[3][Y_AXIS]);
|
229
|
229
|
break;
|
230
|
230
|
case level_pos_x5:
|
231
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[4][0]);
|
|
231
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[4][X_AXIS]);
|
232
|
232
|
break;
|
233
|
233
|
case level_pos_y5:
|
234
|
|
- sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[4][1]);
|
|
234
|
+ sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[4][Y_AXIS]);
|
235
|
235
|
break;
|
236
|
236
|
#if HAS_BED_PROBE
|
237
|
237
|
case x_offset:
|
238
|
238
|
#if HAS_PROBE_XY_OFFSET
|
239
|
|
- sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.x, 1, 3, str_1));
|
|
239
|
+ sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.x, 1, 3, str_1));
|
240
|
240
|
#endif
|
241
|
241
|
break;
|
242
|
242
|
case y_offset:
|
243
|
243
|
#if HAS_PROBE_XY_OFFSET
|
244
|
|
- sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.y, 1, 3, str_1));
|
|
244
|
+ sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.y, 1, 3, str_1));
|
245
|
245
|
#endif
|
246
|
246
|
break;
|
247
|
247
|
case z_offset:
|
|
@@ -295,194 +295,87 @@ static void disp_key_value() {
|
295
|
295
|
}
|
296
|
296
|
|
297
|
297
|
static void set_value_confirm() {
|
298
|
|
- #if HAS_TRINAMIC_CONFIG
|
299
|
|
- uint16_t current_mA;
|
300
|
|
- #endif
|
301
|
298
|
switch (value) {
|
302
|
|
- case PrintAcceleration:
|
303
|
|
- planner.settings.acceleration = atof(key_value);
|
304
|
|
- break;
|
305
|
|
- case RetractAcceleration:
|
306
|
|
- planner.settings.retract_acceleration = atof(key_value);
|
307
|
|
- break;
|
308
|
|
- case TravelAcceleration:
|
309
|
|
- planner.settings.travel_acceleration = atof(key_value);
|
310
|
|
- break;
|
311
|
|
- case XAcceleration:
|
312
|
|
- planner.settings.max_acceleration_mm_per_s2[X_AXIS] = atof(key_value);
|
313
|
|
- break;
|
314
|
|
- case YAcceleration:
|
315
|
|
- planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = atof(key_value);
|
316
|
|
- break;
|
317
|
|
- case ZAcceleration:
|
318
|
|
- planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = atof(key_value);
|
319
|
|
- break;
|
320
|
|
- case E0Acceleration:
|
321
|
|
- planner.settings.max_acceleration_mm_per_s2[E_AXIS] = atof(key_value);
|
322
|
|
- break;
|
323
|
|
- case E1Acceleration:
|
324
|
|
- planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)] = atof(key_value);
|
325
|
|
- break;
|
326
|
|
- case XMaxFeedRate:
|
327
|
|
- planner.settings.max_feedrate_mm_s[X_AXIS] = atof(key_value);
|
328
|
|
- break;
|
329
|
|
- case YMaxFeedRate:
|
330
|
|
- planner.settings.max_feedrate_mm_s[Y_AXIS] = atof(key_value);
|
331
|
|
- break;
|
332
|
|
- case ZMaxFeedRate:
|
333
|
|
- planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value);
|
334
|
|
- break;
|
335
|
|
- case E0MaxFeedRate:
|
336
|
|
- planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value);
|
337
|
|
- break;
|
338
|
|
- case E1MaxFeedRate:
|
339
|
|
- planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value);
|
340
|
|
- break;
|
341
|
|
- case XJerk:
|
342
|
|
- #if HAS_CLASSIC_JERK
|
343
|
|
- planner.max_jerk[X_AXIS] = atof(key_value);
|
344
|
|
- #endif
|
345
|
|
- break;
|
346
|
|
- case YJerk:
|
347
|
|
- #if HAS_CLASSIC_JERK
|
348
|
|
- planner.max_jerk[Y_AXIS] = atof(key_value);
|
349
|
|
- #endif
|
350
|
|
- break;
|
351
|
|
- case ZJerk:
|
352
|
|
- #if HAS_CLASSIC_JERK
|
353
|
|
- planner.max_jerk[Z_AXIS] = atof(key_value);
|
354
|
|
- #endif
|
355
|
|
- break;
|
356
|
|
- case EJerk:
|
357
|
|
- #if HAS_CLASSIC_JERK
|
358
|
|
- planner.max_jerk[E_AXIS] = atof(key_value);
|
359
|
|
- #endif
|
360
|
|
- break;
|
361
|
|
- case Xstep:
|
362
|
|
- planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value);
|
363
|
|
- planner.refresh_positioning();
|
364
|
|
- break;
|
365
|
|
- case Ystep:
|
366
|
|
- planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value);
|
367
|
|
- planner.refresh_positioning();
|
368
|
|
- break;
|
369
|
|
- case Zstep:
|
370
|
|
- planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value);
|
371
|
|
- planner.refresh_positioning();
|
372
|
|
- break;
|
373
|
|
- case E0step:
|
374
|
|
- planner.settings.axis_steps_per_mm[E_AXIS] = atof(key_value);
|
375
|
|
- planner.refresh_positioning();
|
376
|
|
- break;
|
377
|
|
- case E1step:
|
378
|
|
- planner.settings.axis_steps_per_mm[E_AXIS_N(1)] = atof(key_value);
|
379
|
|
- planner.refresh_positioning();
|
380
|
|
- break;
|
|
299
|
+ case PrintAcceleration: planner.settings.acceleration = atof(key_value); break;
|
|
300
|
+ case RetractAcceleration: planner.settings.retract_acceleration = atof(key_value); break;
|
|
301
|
+ case TravelAcceleration: planner.settings.travel_acceleration = atof(key_value); break;
|
|
302
|
+ case XAcceleration: planner.settings.max_acceleration_mm_per_s2[X_AXIS] = atof(key_value); break;
|
|
303
|
+ case YAcceleration: planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = atof(key_value); break;
|
|
304
|
+ case ZAcceleration: planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = atof(key_value); break;
|
|
305
|
+ case E0Acceleration: planner.settings.max_acceleration_mm_per_s2[E_AXIS] = atof(key_value); break;
|
|
306
|
+ case E1Acceleration: planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)] = atof(key_value); break;
|
|
307
|
+ case XMaxFeedRate: planner.settings.max_feedrate_mm_s[X_AXIS] = atof(key_value); break;
|
|
308
|
+ case YMaxFeedRate: planner.settings.max_feedrate_mm_s[Y_AXIS] = atof(key_value); break;
|
|
309
|
+ case ZMaxFeedRate: planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value); break;
|
|
310
|
+ case E0MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value); break;
|
|
311
|
+ case E1MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value); break;
|
|
312
|
+ case XJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[X_AXIS] = atof(key_value)); break;
|
|
313
|
+ case YJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[Y_AXIS] = atof(key_value)); break;
|
|
314
|
+ case ZJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[Z_AXIS] = atof(key_value)); break;
|
|
315
|
+ case EJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[E_AXIS] = atof(key_value)); break;
|
|
316
|
+ case Xstep: planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value); planner.refresh_positioning(); break;
|
|
317
|
+ case Ystep: planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value); planner.refresh_positioning(); break;
|
|
318
|
+ case Zstep: planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value); planner.refresh_positioning(); break;
|
|
319
|
+ case E0step: planner.settings.axis_steps_per_mm[E_AXIS] = atof(key_value); planner.refresh_positioning(); break;
|
|
320
|
+ case E1step: planner.settings.axis_steps_per_mm[E_AXIS_N(1)] = atof(key_value); planner.refresh_positioning(); break;
|
381
|
321
|
case Xcurrent:
|
382
|
322
|
#if AXIS_IS_TMC(X)
|
383
|
|
- current_mA = atoi(key_value);
|
384
|
|
- stepperX.rms_current(current_mA);
|
|
323
|
+ stepperX.rms_current(atoi(key_value));
|
385
|
324
|
#endif
|
386
|
325
|
break;
|
387
|
326
|
case Ycurrent:
|
388
|
327
|
#if AXIS_IS_TMC(Y)
|
389
|
|
- current_mA = atoi(key_value);
|
390
|
|
- stepperY.rms_current(current_mA);
|
|
328
|
+ stepperY.rms_current(atoi(key_value));
|
391
|
329
|
#endif
|
392
|
330
|
break;
|
393
|
331
|
case Zcurrent:
|
394
|
332
|
#if AXIS_IS_TMC(Z)
|
395
|
|
- current_mA = atoi(key_value);
|
396
|
|
- stepperZ.rms_current(current_mA);
|
|
333
|
+ stepperZ.rms_current(atoi(key_value));
|
397
|
334
|
#endif
|
398
|
335
|
break;
|
399
|
336
|
case E0current:
|
400
|
337
|
#if AXIS_IS_TMC(E0)
|
401
|
|
- current_mA = atoi(key_value);
|
402
|
|
- stepperE0.rms_current(current_mA);
|
|
338
|
+ stepperE0.rms_current(atoi(key_value));
|
403
|
339
|
#endif
|
404
|
340
|
break;
|
405
|
341
|
case E1current:
|
406
|
342
|
#if AXIS_IS_TMC(E1)
|
407
|
|
- current_mA = atoi(key_value);
|
408
|
|
- stepperE1.rms_current(current_mA);
|
|
343
|
+ stepperE1.rms_current(atoi(key_value));
|
409
|
344
|
#endif
|
410
|
345
|
break;
|
411
|
|
- case pause_pos_x:
|
412
|
|
- gCfgItems.pausePosX = atof(key_value);
|
413
|
|
- update_spi_flash();
|
414
|
|
- break;
|
415
|
|
- case pause_pos_y:
|
416
|
|
- gCfgItems.pausePosY = atof(key_value);
|
417
|
|
- update_spi_flash();
|
418
|
|
- break;
|
419
|
|
- case pause_pos_z:
|
420
|
|
- gCfgItems.pausePosZ = atof(key_value);
|
421
|
|
- update_spi_flash();
|
422
|
|
- break;
|
423
|
|
- case level_pos_x1:
|
424
|
|
- gCfgItems.levelingPos[0][0] = atoi(key_value);
|
425
|
|
- update_spi_flash();
|
426
|
|
- break;
|
427
|
|
- case level_pos_y1:
|
428
|
|
- gCfgItems.levelingPos[0][1] = atoi(key_value);
|
429
|
|
- update_spi_flash();
|
430
|
|
- break;
|
431
|
|
- case level_pos_x2:
|
432
|
|
- gCfgItems.levelingPos[1][0] = atoi(key_value);
|
433
|
|
- update_spi_flash();
|
434
|
|
- break;
|
435
|
|
- case level_pos_y2:
|
436
|
|
- gCfgItems.levelingPos[1][1] = atoi(key_value);
|
437
|
|
- update_spi_flash();
|
438
|
|
- break;
|
439
|
|
- case level_pos_x3:
|
440
|
|
- gCfgItems.levelingPos[2][0] = atoi(key_value);
|
441
|
|
- update_spi_flash();
|
442
|
|
- break;
|
443
|
|
- case level_pos_y3:
|
444
|
|
- gCfgItems.levelingPos[2][1] = atoi(key_value);
|
445
|
|
- update_spi_flash();
|
446
|
|
- break;
|
447
|
|
- case level_pos_x4:
|
448
|
|
- gCfgItems.levelingPos[3][0] = atoi(key_value);
|
449
|
|
- update_spi_flash();
|
450
|
|
- break;
|
451
|
|
- case level_pos_y4:
|
452
|
|
- gCfgItems.levelingPos[3][1] = atoi(key_value);
|
453
|
|
- update_spi_flash();
|
454
|
|
- break;
|
455
|
|
- case level_pos_x5:
|
456
|
|
- gCfgItems.levelingPos[4][0] = atoi(key_value);
|
457
|
|
- update_spi_flash();
|
458
|
|
- break;
|
459
|
|
- case level_pos_y5:
|
460
|
|
- gCfgItems.levelingPos[4][1] = atoi(key_value);
|
461
|
|
- update_spi_flash();
|
462
|
|
- break;
|
|
346
|
+ case pause_pos_x: gCfgItems.pausePosX = atof(key_value); update_spi_flash(); break;
|
|
347
|
+ case pause_pos_y: gCfgItems.pausePosY = atof(key_value); update_spi_flash(); break;
|
|
348
|
+ case pause_pos_z: gCfgItems.pausePosZ = atof(key_value); update_spi_flash(); break;
|
|
349
|
+ case level_pos_x1: gCfgItems.trammingPos[0][X_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
350
|
+ case level_pos_y1: gCfgItems.trammingPos[0][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
351
|
+ case level_pos_x2: gCfgItems.trammingPos[1][X_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
352
|
+ case level_pos_y2: gCfgItems.trammingPos[1][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
353
|
+ case level_pos_x3: gCfgItems.trammingPos[2][X_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
354
|
+ case level_pos_y3: gCfgItems.trammingPos[2][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
355
|
+ case level_pos_x4: gCfgItems.trammingPos[3][X_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
356
|
+ case level_pos_y4: gCfgItems.trammingPos[3][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
357
|
+ case level_pos_x5: gCfgItems.trammingPos[4][X_AXIS] = atoi(key_value); update_spi_flash(); break;
|
|
358
|
+ case level_pos_y5: gCfgItems.trammingPos[4][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
|
463
|
359
|
#if HAS_BED_PROBE
|
464
|
|
- case x_offset:
|
|
360
|
+ case x_offset: {
|
465
|
361
|
#if HAS_PROBE_XY_OFFSET
|
466
|
|
- float x;
|
467
|
|
- x = atof(key_value);
|
|
362
|
+ const float x = atof(key_value);
|
468
|
363
|
if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE))
|
469
|
364
|
probe.offset.x = x;
|
470
|
365
|
#endif
|
471
|
|
- break;
|
472
|
|
- case y_offset:
|
|
366
|
+ } break;
|
|
367
|
+ case y_offset: {
|
473
|
368
|
#if HAS_PROBE_XY_OFFSET
|
474
|
|
- float y;
|
475
|
|
- y = atof(key_value);
|
|
369
|
+ const float y = atof(key_value);
|
476
|
370
|
if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE))
|
477
|
371
|
probe.offset.y = y;
|
478
|
372
|
#endif
|
479
|
|
- break;
|
480
|
|
- case z_offset:
|
481
|
|
- float z;
|
482
|
|
- z = atof(key_value);
|
|
373
|
+ } break;
|
|
374
|
+ case z_offset: {
|
|
375
|
+ const float z = atof(key_value);
|
483
|
376
|
if (WITHIN(z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
|
484
|
377
|
probe.offset.z = z;
|
485
|
|
- break;
|
|
378
|
+ } break;
|
486
|
379
|
#endif
|
487
|
380
|
case load_length:
|
488
|
381
|
gCfgItems.filamentchange_load_length = atoi(key_value);
|
|
@@ -508,26 +401,10 @@ static void set_value_confirm() {
|
508
|
401
|
gCfgItems.filament_limit_temp = atoi(key_value);
|
509
|
402
|
update_spi_flash();
|
510
|
403
|
break;
|
511
|
|
- case x_sensitivity:
|
512
|
|
- #if X_SENSORLESS
|
513
|
|
- stepperX.homing_threshold(atoi(key_value));
|
514
|
|
- #endif
|
515
|
|
- break;
|
516
|
|
- case y_sensitivity:
|
517
|
|
- #if Y_SENSORLESS
|
518
|
|
- stepperY.homing_threshold(atoi(key_value));
|
519
|
|
- #endif
|
520
|
|
- break;
|
521
|
|
- case z_sensitivity:
|
522
|
|
- #if Z_SENSORLESS
|
523
|
|
- stepperZ.homing_threshold(atoi(key_value));
|
524
|
|
- #endif
|
525
|
|
- break;
|
526
|
|
- case z2_sensitivity:
|
527
|
|
- #if Z2_SENSORLESS
|
528
|
|
- stepperZ2.homing_threshold(atoi(key_value));
|
529
|
|
- #endif
|
530
|
|
- break;
|
|
404
|
+ case x_sensitivity: TERN_(X_SENSORLESS, stepperX.homing_threshold(atoi(key_value))); break;
|
|
405
|
+ case y_sensitivity: TERN_(Y_SENSORLESS, stepperY.homing_threshold(atoi(key_value))); break;
|
|
406
|
+ case z_sensitivity: TERN_(Z_SENSORLESS, stepperZ.homing_threshold(atoi(key_value))); break;
|
|
407
|
+ case z2_sensitivity: TERN_(Z2_SENSORLESS, stepperZ2.homing_threshold(atoi(key_value))); break;
|
531
|
408
|
}
|
532
|
409
|
gcode.process_subcommands_now_P(PSTR("M500"));
|
533
|
410
|
}
|
|
@@ -535,81 +412,9 @@ static void set_value_confirm() {
|
535
|
412
|
static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
536
|
413
|
if (event != LV_EVENT_RELEASED) return;
|
537
|
414
|
switch (obj->mks_obj_id) {
|
538
|
|
- case ID_NUM_KEY1:
|
539
|
|
- if (cnt <= 10) {
|
540
|
|
- key_value[cnt] = (char)'1';
|
541
|
|
- lv_label_set_text(labelValue, key_value);
|
542
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
543
|
|
- cnt++;
|
544
|
|
- }
|
545
|
|
- break;
|
546
|
|
- case ID_NUM_KEY2:
|
547
|
|
- if (cnt <= 10) {
|
548
|
|
- key_value[cnt] = (char)'2';
|
549
|
|
- lv_label_set_text(labelValue, key_value);
|
550
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
551
|
|
- cnt++;
|
552
|
|
- }
|
553
|
|
- break;
|
554
|
|
- case ID_NUM_KEY3:
|
555
|
|
- if (cnt <= 10) {
|
556
|
|
- key_value[cnt] = (char)'3';
|
557
|
|
- lv_label_set_text(labelValue, key_value);
|
558
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
559
|
|
- cnt++;
|
560
|
|
- }
|
561
|
|
- break;
|
562
|
|
- case ID_NUM_KEY4:
|
563
|
|
- if (cnt <= 10) {
|
564
|
|
- key_value[cnt] = (char)'4';
|
565
|
|
- lv_label_set_text(labelValue, key_value);
|
566
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
567
|
|
- cnt++;
|
568
|
|
- }
|
569
|
|
- break;
|
570
|
|
- case ID_NUM_KEY5:
|
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
|
|
- break;
|
578
|
|
- case ID_NUM_KEY6:
|
579
|
|
- if (cnt <= 10) {
|
580
|
|
- key_value[cnt] = (char)'6';
|
581
|
|
- lv_label_set_text(labelValue, key_value);
|
582
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
583
|
|
- cnt++;
|
584
|
|
- }
|
585
|
|
- break;
|
586
|
|
- case ID_NUM_KEY7:
|
587
|
|
- if (cnt <= 10) {
|
588
|
|
- key_value[cnt] = (char)'7';
|
589
|
|
- lv_label_set_text(labelValue, key_value);
|
590
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
591
|
|
- cnt++;
|
592
|
|
- }
|
593
|
|
- break;
|
594
|
|
- case ID_NUM_KEY8:
|
595
|
|
- if (cnt <= 10) {
|
596
|
|
- key_value[cnt] = (char)'8';
|
597
|
|
- lv_label_set_text(labelValue, key_value);
|
598
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
599
|
|
- cnt++;
|
600
|
|
- }
|
601
|
|
- break;
|
602
|
|
- case ID_NUM_KEY9:
|
603
|
|
- if (cnt <= 10) {
|
604
|
|
- key_value[cnt] = (char)'9';
|
605
|
|
- lv_label_set_text(labelValue, key_value);
|
606
|
|
- lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
607
|
|
- cnt++;
|
608
|
|
- }
|
609
|
|
- break;
|
610
|
|
- case ID_NUM_KEY0:
|
|
415
|
+ case ID_NUM_KEY1 ... ID_NUM_KEY0:
|
611
|
416
|
if (cnt <= 10) {
|
612
|
|
- key_value[cnt] = (char)'0';
|
|
417
|
+ key_value[cnt] = (obj->mks_obj_id == ID_NUM_KEY0) ? (char)'0' : char('1' + obj->mks_obj_id - ID_NUM_KEY1);
|
613
|
418
|
lv_label_set_text(labelValue, key_value);
|
614
|
419
|
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
|
615
|
420
|
cnt++;
|
|
@@ -662,55 +467,22 @@ void lv_draw_number_key() {
|
662
|
467
|
buttonValue = lv_btn_create(scr, 92, 40, 296, 40, event_handler, ID_NUM_KEY1, &style_num_text);
|
663
|
468
|
labelValue = lv_label_create_empty(buttonValue);
|
664
|
469
|
|
665
|
|
- lv_obj_t *NumberKey_1 = lv_btn_create(scr, 92, 90, 68, 40, event_handler, ID_NUM_KEY1, &style_num_key_pre);
|
666
|
|
- lv_obj_t *labelKey_1 = lv_label_create_empty(NumberKey_1);
|
667
|
|
- lv_label_set_text(labelKey_1, machine_menu.key_1);
|
668
|
|
- lv_obj_align(labelKey_1, NumberKey_1, LV_ALIGN_CENTER, 0, 0);
|
669
|
|
-
|
670
|
|
- lv_obj_t *NumberKey_2 = lv_btn_create(scr, 168, 90, 68, 40, event_handler, ID_NUM_KEY2, &style_num_key_pre);
|
671
|
|
- lv_obj_t *labelKey_2 = lv_label_create_empty(NumberKey_2);
|
672
|
|
- lv_label_set_text(labelKey_2, machine_menu.key_2);
|
673
|
|
- lv_obj_align(labelKey_2, NumberKey_2, LV_ALIGN_CENTER, 0, 0);
|
674
|
|
-
|
675
|
|
- lv_obj_t *NumberKey_3 = lv_btn_create(scr, 244, 90, 68, 40, event_handler, ID_NUM_KEY3, &style_num_key_pre);
|
676
|
|
- lv_obj_t *labelKey_3 = lv_label_create_empty(NumberKey_3);
|
677
|
|
- lv_label_set_text(labelKey_3, machine_menu.key_3);
|
678
|
|
- lv_obj_align(labelKey_3, NumberKey_3, LV_ALIGN_CENTER, 0, 0);
|
679
|
|
-
|
680
|
|
- lv_obj_t *NumberKey_4 = lv_btn_create(scr, 92, 140, 68, 40, event_handler, ID_NUM_KEY4, &style_num_key_pre);
|
681
|
|
- lv_obj_t *labelKey_4 = lv_label_create_empty(NumberKey_4);
|
682
|
|
- lv_label_set_text(labelKey_4, machine_menu.key_4);
|
683
|
|
- lv_obj_align(labelKey_4, NumberKey_4, LV_ALIGN_CENTER, 0, 0);
|
684
|
|
-
|
685
|
|
- lv_obj_t *NumberKey_5 = lv_btn_create(scr, 168, 140, 68, 40, event_handler, ID_NUM_KEY5, &style_num_key_pre);
|
686
|
|
- lv_obj_t *labelKey_5 = lv_label_create_empty(NumberKey_5);
|
687
|
|
- lv_label_set_text(labelKey_5, machine_menu.key_5);
|
688
|
|
- lv_obj_align(labelKey_5, NumberKey_5, LV_ALIGN_CENTER, 0, 0);
|
689
|
|
-
|
690
|
|
- lv_obj_t *NumberKey_6 = lv_btn_create(scr, 244, 140, 68, 40, event_handler, ID_NUM_KEY6, &style_num_key_pre);
|
691
|
|
- lv_obj_t *labelKey_6 = lv_label_create_empty(NumberKey_6);
|
692
|
|
- lv_label_set_text(labelKey_6, machine_menu.key_6);
|
693
|
|
- lv_obj_align(labelKey_6, NumberKey_6, LV_ALIGN_CENTER, 0, 0);
|
694
|
|
-
|
695
|
|
- lv_obj_t *NumberKey_7 = lv_btn_create(scr, 92, 190, 68, 40, event_handler, ID_NUM_KEY7, &style_num_key_pre);
|
696
|
|
- lv_obj_t *labelKey_7 = lv_label_create_empty(NumberKey_7);
|
697
|
|
- lv_label_set_text(labelKey_7, machine_menu.key_7);
|
698
|
|
- lv_obj_align(labelKey_7, NumberKey_7, LV_ALIGN_CENTER, 0, 0);
|
699
|
|
-
|
700
|
|
- lv_obj_t *NumberKey_8 = lv_btn_create(scr, 168, 190, 68, 40, event_handler, ID_NUM_KEY8, &style_num_key_pre);
|
701
|
|
- lv_obj_t *labelKey_8 = lv_label_create_empty(NumberKey_8);
|
702
|
|
- lv_label_set_text(labelKey_8, machine_menu.key_8);
|
703
|
|
- lv_obj_align(labelKey_8, NumberKey_8, LV_ALIGN_CENTER, 0, 0);
|
704
|
|
-
|
705
|
|
- lv_obj_t *NumberKey_9 = lv_btn_create(scr, 244, 190, 68, 40, event_handler, ID_NUM_KEY9, &style_num_key_pre);
|
706
|
|
- lv_obj_t *labelKey_9 = lv_label_create_empty(NumberKey_9);
|
707
|
|
- lv_label_set_text(labelKey_9, machine_menu.key_9);
|
708
|
|
- lv_obj_align(labelKey_9, NumberKey_9, LV_ALIGN_CENTER, 0, 0);
|
709
|
|
-
|
710
|
|
- lv_obj_t *NumberKey_0 = lv_btn_create(scr, 92, 240, 68, 40, event_handler, ID_NUM_KEY0, &style_num_key_pre);
|
711
|
|
- lv_obj_t *labelKey_0 = lv_label_create_empty(NumberKey_0);
|
712
|
|
- lv_label_set_text(labelKey_0, machine_menu.key_0);
|
713
|
|
- lv_obj_align(labelKey_0, NumberKey_0, LV_ALIGN_CENTER, 0, 0);
|
|
470
|
+ #define DRAW_NUMBER_KEY(N,X,Y) \
|
|
471
|
+ lv_obj_t *NumberKey_##N = lv_btn_create(scr, X, Y, 68, 40, event_handler, ID_NUM_KEY##N, &style_num_key_pre); \
|
|
472
|
+ lv_obj_t *labelKey_##N = lv_label_create_empty(NumberKey_##N); \
|
|
473
|
+ lv_label_set_text(labelKey_##N, machine_menu.key_##N); \
|
|
474
|
+ lv_obj_align(labelKey_##N, NumberKey_##N, LV_ALIGN_CENTER, 0, 0)
|
|
475
|
+
|
|
476
|
+ DRAW_NUMBER_KEY(1, 92, 90);
|
|
477
|
+ DRAW_NUMBER_KEY(2, 168, 90);
|
|
478
|
+ DRAW_NUMBER_KEY(3, 244, 90);
|
|
479
|
+ DRAW_NUMBER_KEY(4, 92, 140);
|
|
480
|
+ DRAW_NUMBER_KEY(5, 168, 140);
|
|
481
|
+ DRAW_NUMBER_KEY(6, 244, 140);
|
|
482
|
+ DRAW_NUMBER_KEY(7, 92, 190);
|
|
483
|
+ DRAW_NUMBER_KEY(8, 168, 190);
|
|
484
|
+ DRAW_NUMBER_KEY(9, 244, 190);
|
|
485
|
+ DRAW_NUMBER_KEY(0, 92, 240);
|
714
|
486
|
|
715
|
487
|
lv_obj_t *KeyBack = lv_btn_create(scr, 320, 90, 68, 40, event_handler, ID_NUM_BACK, &style_num_key_pre);
|
716
|
488
|
lv_obj_t *labelKeyBack = lv_label_create_empty(KeyBack);
|