Skip to content

Commit 0505c73

Browse files
committed
kv rating to the commander
1 parent 046e0fb commit 0505c73

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/communication/Commander.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,23 @@ void Commander::motor(FOCMotor* motor, char* user_command) {
212212
}
213213
break;
214214
case CMD_RESIST:
215-
// enable/disable
216215
printVerbose(F("R phase: "));
217216
if(!GET){
218217
motor->phase_resistance = value;
219-
if(motor->torque_controller==TorqueControlType::voltage){
220-
motor->voltage_limit = motor->current_limit*value;
218+
if(motor->torque_controller==TorqueControlType::voltage)
221219
motor->PID_velocity.limit= motor->current_limit;
222-
}
223220
}
224221
if(_isset(motor->phase_resistance)) println(motor->phase_resistance);
225222
else println(0);
226223
break;
224+
case CMD_KV_RATING:
225+
printVerbose(F("Motor KV: "));
226+
if(!GET){
227+
motor->K_bemf = 1.0f/value;
228+
}
229+
if(_isset(motor->K_bemf)) println(1.0f/motor->K_bemf);
230+
else println(0);
231+
break;
227232
case CMD_SENSOR:
228233
// Sensor zero offset
229234
printVerbose(F("Sensor | "));

src/communication/commands.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define CMD_SENSOR 'S' //!< sensor offsets
1616
#define CMD_MONITOR 'M' //!< monitoring
1717
#define CMD_RESIST 'R' //!< motor phase resistance
18+
#define CMD_KV_RATING 'K' //!< motor kv rating
1819
#define CMD_PWMMOD 'W' //!< pwm modulation
1920

2021
// commander configuration

0 commit comments

Comments
 (0)