Skip to content

Commit

Permalink
make sine output filter "filterConst" a configurable value "sinefilter"
Browse files Browse the repository at this point in the history
  • Loading branch information
catphish committed Jan 10, 2023
1 parent 8867d55 commit 39f1ce0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/param_prj.h
Expand Up @@ -24,7 +24,7 @@
2. Temporary parameters (id = 0)
3. Display values
*/
//Next param id (increase when adding new parameter!): 146
//Next param id (increase when adding new parameter!): 148
//Next value Id: 2049
/* category name unit min max default id */

Expand All @@ -47,6 +47,7 @@
PARAM_ENTRY(CAT_MOTOR, udcnom, "V", 0, 1000, 0, 78 ) \
PARAM_ENTRY(CAT_MOTOR, fslipmin, "Hz", 0.3, 10, 1, 37 ) \
PARAM_ENTRY(CAT_MOTOR, fslipmax, "Hz", 0.3, 10, 3, 33 ) \
PARAM_ENTRY(CAT_MOTOR, sinefilter, "dig", 0, 10, 4, 147 ) \
PARAM_ENTRY(CAT_MOTOR, fslipconstmax,"Hz", 0, 10, 5, 100 )

#define MOTOR_PARAMETERS_FOC \
Expand Down
4 changes: 2 additions & 2 deletions src/pwmgeneration-sine.cpp
Expand Up @@ -83,8 +83,8 @@ void PwmGeneration::Run()

void PwmGeneration::SetTorquePercent(float torque)
{
const int filterConst = 4;
const float roundingError = FP_TOFLOAT((float)((1 << filterConst) - 1));
int filterConst = Param::GetInt(Param::sinefilter);
float roundingError = FP_TOFLOAT((float)((1 << filterConst) - 1));
float fslipmin = Param::GetFloat(Param::fslipmin);
float ampmin = Param::GetFloat(Param::ampmin);
float slipstart = Param::GetFloat(Param::slipstart);
Expand Down

0 comments on commit 39f1ce0

Please sign in to comment.