Browse Source

update

master
zhaohe 1 year ago
parent
commit
21bf093562
  1. 9
      components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
  2. 10
      components/step_motor_ctrl_module/step_motor_ctrl_module.hpp
  3. 11
      components/tmc/ic/ztmc5130.cpp

9
components/step_motor_ctrl_module/step_motor_ctrl_module.cpp

@ -60,6 +60,15 @@ void StepMotorCtrlModule::create_default_cfg(config_t& cfg) {
cfg.motor_look_zero_edge_speed = 100; cfg.motor_look_zero_edge_speed = 100;
cfg.motor_look_zero_edge_dec = 600; cfg.motor_look_zero_edge_dec = 600;
// cfg.motor_vstart = 2000;
// cfg.motor_a1 = ;
// cfg.motor_amax = 300;
// cfg.motor_v1 = ;
// cfg.motor_dmax = 300;
// cfg.motor_d1 = ;
// cfg.motor_vstop = 2000;
// cfg.motor_tzerowait = ;
} }
/*********************************************************************************************************************** /***********************************************************************************************************************

10
components/step_motor_ctrl_module/step_motor_ctrl_module.hpp

@ -28,6 +28,16 @@ class StepMotorCtrlModule : public ZIModule, public ZIStepMotor {
// //
int32_t motor_look_zero_edge_speed; int32_t motor_look_zero_edge_speed;
int32_t motor_look_zero_edge_dec; int32_t motor_look_zero_edge_dec;
//
int32_t motor_vstart;
int32_t motor_a1;
int32_t motor_amax;
int32_t motor_v1;
int32_t motor_dmax;
int32_t motor_d1;
int32_t motor_vstop;
int32_t motor_tzerowait;
} config_t; } config_t;
typedef struct { typedef struct {

11
components/tmc/ic/ztmc5130.cpp

@ -113,12 +113,13 @@ uint8_t TMC51X0::reset() {
writeInt(TMC5130_XTARGET, 0); writeInt(TMC5130_XTARGET, 0);
writeInt(TMC5130_XACTUAL, 0x00000000); writeInt(TMC5130_XACTUAL, 0x00000000);
writeInt(TMC5130_VACTUAL, 0x00000000); writeInt(TMC5130_VACTUAL, 0x00000000);
writeInt(TMC5130_VSTART, 100);
writeInt(TMC5130_A1, 1000);
writeInt(TMC5130_VSTART, 3000);
writeInt(TMC5130_A1, 0);
writeInt(TMC5130_V1, 0); writeInt(TMC5130_V1, 0);
writeInt(TMC5130_D1, 1000);
writeInt(TMC5130_VSTOP, 100);
writeInt(TMC5130_D1, 0);
writeInt(TMC5130_VSTOP, 3000);
writeInt(TMC5130_TZEROWAIT, 0); writeInt(TMC5130_TZEROWAIT, 0);
// TMC5130_AMAX
setAcceleration(100); setAcceleration(100);
setDeceleration(100); setDeceleration(100);
setIHOLD_IRUN(2, 10, 1); setIHOLD_IRUN(2, 10, 1);
@ -151,7 +152,7 @@ void TMC51X0::setGlobalScale(uint8_t globalscale) { //
if (globalscale == 0) { if (globalscale == 0) {
globalscale = 0; globalscale = 0;
} else if (globalscale <= 31 || globalscale >= 1) {
} else if (globalscale <= 31 && globalscale >= 1) {
globalscale = 32; globalscale = 32;
} else { } else {
globalscale = globalscale; globalscale = globalscale;

Loading…
Cancel
Save