diff --git a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp index 4626d17..ed9995f 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp +++ b/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_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 = ; } /*********************************************************************************************************************** diff --git a/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp b/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp index 6691699..6a1c203 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp +++ b/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_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; typedef struct { diff --git a/components/tmc/ic/ztmc5130.cpp b/components/tmc/ic/ztmc5130.cpp index 0a6370e..d6247e6 100644 --- a/components/tmc/ic/ztmc5130.cpp +++ b/components/tmc/ic/ztmc5130.cpp @@ -113,12 +113,13 @@ uint8_t TMC51X0::reset() { writeInt(TMC5130_XTARGET, 0); writeInt(TMC5130_XACTUAL, 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_D1, 1000); - writeInt(TMC5130_VSTOP, 100); + writeInt(TMC5130_D1, 0); + writeInt(TMC5130_VSTOP, 3000); writeInt(TMC5130_TZEROWAIT, 0); + // TMC5130_AMAX setAcceleration(100); setDeceleration(100); setIHOLD_IRUN(2, 10, 1); @@ -151,7 +152,7 @@ void TMC51X0::setGlobalScale(uint8_t globalscale) { // if (globalscale == 0) { globalscale = 0; - } else if (globalscale <= 31 || globalscale >= 1) { + } else if (globalscale <= 31 && globalscale >= 1) { globalscale = 32; } else { globalscale = globalscale;