|
@@ -74,8 +74,9 @@
|
74
|
74
|
#define IFSD(A,B) (B)
|
75
|
75
|
#endif
|
76
|
76
|
|
77
|
|
-#if HAS_TRINAMIC && HAS_LCD_MENU
|
|
77
|
+#if HAS_TRINAMIC
|
78
|
78
|
#include "../../feature/tmc_util.h"
|
|
79
|
+ #include "../../module/stepper_indirection.h"
|
79
|
80
|
#endif
|
80
|
81
|
|
81
|
82
|
#include "ui_api.h"
|
|
@@ -339,6 +340,122 @@ namespace ExtUI {
|
339
|
340
|
return !thermalManager.tooColdToExtrude(extruder - E0);
|
340
|
341
|
}
|
341
|
342
|
|
|
343
|
+ #if HAS_SOFTWARE_ENDSTOPS
|
|
344
|
+ bool getSoftEndstopState() {
|
|
345
|
+ return soft_endstops_enabled;
|
|
346
|
+ }
|
|
347
|
+
|
|
348
|
+ void setSoftEndstopState(const bool value) {
|
|
349
|
+ soft_endstops_enabled = value;
|
|
350
|
+ }
|
|
351
|
+ #endif
|
|
352
|
+
|
|
353
|
+ #if HAS_TRINAMIC
|
|
354
|
+ float getAxisCurrent_mA(const axis_t axis) {
|
|
355
|
+ switch (axis) {
|
|
356
|
+ #if AXIS_IS_TMC(X)
|
|
357
|
+ case X: return stepperX.getMilliamps();
|
|
358
|
+ #endif
|
|
359
|
+ #if AXIS_IS_TMC(Y)
|
|
360
|
+ case Y: return stepperY.getMilliamps();
|
|
361
|
+ #endif
|
|
362
|
+ #if AXIS_IS_TMC(Z)
|
|
363
|
+ case Z: return stepperZ.getMilliamps();
|
|
364
|
+ #endif
|
|
365
|
+ default: return NAN;
|
|
366
|
+ };
|
|
367
|
+ }
|
|
368
|
+
|
|
369
|
+ float getAxisCurrent_mA(const extruder_t extruder) {
|
|
370
|
+ switch (extruder) {
|
|
371
|
+ #if AXIS_IS_TMC(E0)
|
|
372
|
+ case E0: return stepperE0.getMilliamps();
|
|
373
|
+ #endif
|
|
374
|
+ #if AXIS_IS_TMC(E1)
|
|
375
|
+ case E1: return stepperE1.getMilliamps();
|
|
376
|
+ #endif
|
|
377
|
+ #if AXIS_IS_TMC(E2)
|
|
378
|
+ case E2: return stepperE2.getMilliamps();
|
|
379
|
+ #endif
|
|
380
|
+ #if AXIS_IS_TMC(E3)
|
|
381
|
+ case E3: return stepperE3.getMilliamps();
|
|
382
|
+ #endif
|
|
383
|
+ #if AXIS_IS_TMC(E4)
|
|
384
|
+ case E4: return stepperE4.getMilliamps();
|
|
385
|
+ #endif
|
|
386
|
+ #if AXIS_IS_TMC(E5)
|
|
387
|
+ case E5: return stepperE5.getMilliamps();
|
|
388
|
+ #endif
|
|
389
|
+ default: return NAN;
|
|
390
|
+ };
|
|
391
|
+ }
|
|
392
|
+
|
|
393
|
+ void setAxisCurrent_mA(const float mA, const axis_t axis) {
|
|
394
|
+ switch (axis) {
|
|
395
|
+ #if AXIS_IS_TMC(X)
|
|
396
|
+ case X: stepperX.rms_current(clamp(mA, 500, 1500)); break;
|
|
397
|
+ #endif
|
|
398
|
+ #if AXIS_IS_TMC(Y)
|
|
399
|
+ case Y: stepperY.rms_current(clamp(mA, 500, 1500)); break;
|
|
400
|
+ #endif
|
|
401
|
+ #if AXIS_IS_TMC(Z)
|
|
402
|
+ case Z: stepperZ.rms_current(clamp(mA, 500, 1500)); break;
|
|
403
|
+ #endif
|
|
404
|
+ };
|
|
405
|
+ }
|
|
406
|
+
|
|
407
|
+ void setAxisCurrent_mA(const float mA, const extruder_t extruder) {
|
|
408
|
+ switch (extruder) {
|
|
409
|
+ #if AXIS_IS_TMC(E0)
|
|
410
|
+ case E0: stepperE0.rms_current(clamp(mA, 500, 1500)); break;
|
|
411
|
+ #endif
|
|
412
|
+ #if AXIS_IS_TMC(E1)
|
|
413
|
+ case E1: stepperE1.rms_current(clamp(mA, 500, 1500)); break;
|
|
414
|
+ #endif
|
|
415
|
+ #if AXIS_IS_TMC(E2)
|
|
416
|
+ case E2: stepperE2.rms_current(clamp(mA, 500, 1500)); break;
|
|
417
|
+ #endif
|
|
418
|
+ #if AXIS_IS_TMC(E3)
|
|
419
|
+ case E3: stepperE3.rms_current(clamp(mA, 500, 1500)); break;
|
|
420
|
+ #endif
|
|
421
|
+ #if AXIS_IS_TMC(E4)
|
|
422
|
+ case E4: stepperE4.rms_current(clamp(mA, 500, 1500)); break;
|
|
423
|
+ #endif
|
|
424
|
+ #if AXIS_IS_TMC(E5)
|
|
425
|
+ case E5: stepperE5.rms_current(clamp(mA, 500, 1500)); break;
|
|
426
|
+ #endif
|
|
427
|
+ };
|
|
428
|
+ }
|
|
429
|
+
|
|
430
|
+ int getTMCBumpSensitivity(const axis_t axis) {
|
|
431
|
+ switch (axis) {
|
|
432
|
+ #if X_SENSORLESS && AXIS_HAS_STALLGUARD(X)
|
|
433
|
+ case X: return stepperX.sgt();
|
|
434
|
+ #endif
|
|
435
|
+ #if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y)
|
|
436
|
+ case Y: return stepperY.sgt();
|
|
437
|
+ #endif
|
|
438
|
+ #if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z)
|
|
439
|
+ case Z: return stepperZ.sgt();
|
|
440
|
+ #endif
|
|
441
|
+ }
|
|
442
|
+ }
|
|
443
|
+
|
|
444
|
+ void setTMCBumpSensitivity(const float value, const axis_t axis) {
|
|
445
|
+ switch (axis) {
|
|
446
|
+ #if X_SENSORLESS && AXIS_HAS_STALLGUARD(X)
|
|
447
|
+ case X: stepperX.sgt(clamp(value, -64, 63)); break;
|
|
448
|
+ #endif
|
|
449
|
+ #if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y)
|
|
450
|
+ case Y: stepperY.sgt(clamp(value, -64, 63)); break;
|
|
451
|
+ #endif
|
|
452
|
+ #if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z)
|
|
453
|
+ case Z: stepperZ.sgt(clamp(value, -64, 63)); break;
|
|
454
|
+ #endif
|
|
455
|
+ }
|
|
456
|
+ }
|
|
457
|
+ #endif
|
|
458
|
+
|
342
|
459
|
float getAxisSteps_per_mm(const axis_t axis) {
|
343
|
460
|
return planner.settings.axis_steps_per_mm[axis];
|
344
|
461
|
}
|
|
@@ -787,10 +904,6 @@ void MarlinUI::init() {
|
787
|
904
|
SET_INPUT_PULLUP(SD_DETECT_PIN);
|
788
|
905
|
#endif
|
789
|
906
|
|
790
|
|
- #if HAS_TRINAMIC && HAS_LCD_MENU
|
791
|
|
- init_tmc_section();
|
792
|
|
- #endif
|
793
|
|
-
|
794
|
907
|
ExtUI::onStartup();
|
795
|
908
|
}
|
796
|
909
|
|