diff --git a/Grbl_Esp32/spindle_control.cpp b/Grbl_Esp32/spindle_control.cpp
index 1886983..4b36600 100644
--- a/Grbl_Esp32/spindle_control.cpp
+++ b/Grbl_Esp32/spindle_control.cpp
@@ -111,6 +111,11 @@ uint32_t spindle_compute_pwm_value(float rpm)
// Compute intermediate PWM value with linear spindle speed model.
// NOTE: A nonlinear model could be installed here, if required, but keep it VERY light-weight.
sys.spindle_speed = rpm;
+#if defined __has_include
+ #if __has_include("spindle_curve.h")
+ #include "spindle_curve.h"
+ #endif
+#endif
pwm_value = floor((rpm-settings.rpm_min)*pwm_gradient) + SPINDLE_PWM_MIN_VALUE;
}
return(pwm_value);
@@ -169,4 +174,3 @@ void spindle_set_enable(bool enable)
#endif
#endif
}
-
示例用户 spindle_curve.h(不包含在托管源中)。
//optional user customisation of spindle PWM curve
//needs consistent settings.rpm_min and settings.rpm_max
//use block to make vars private
{
// static long spdcuri[]={0,24000,1000000};
// static float spdcurm[]={0,1,0};
// static long spdcurb[]={0,0,24000};
static long spdcuri[]={1000,3360,5760,24000,1000000};
static float spdcurm[]={0,0.1412,0.325,0.8872,0};
static float spdcurb[]={0,1013,382,-2592,24000};
int i;
for(i=0;i<sizeof(spdcuri)/sizeof(spdcuri[0]);i++){
if(rpm<spdcuri[i]){
rpm=spdcurm[i]*rpm+spdcurb[i];
break;
}
}
}
请描述您希望实现的功能
提供有条件地包含用户源文件 spindle_curve.h 以重新计算 rpm 以线性化响应。
为什么您认为这会改进 Grbl_ESP32?
允许用户在不接触托管源模块的情况下进行修改
这个功能会出现在很多用户面前吗?
大概。
示例用户 spindle_curve.h(不包含在托管源中)。
测试和工作。
欧文