Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard improvements #358

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2680,6 +2680,7 @@ QString Commands::faultToStr(mc_fault_code fault)
case FAULT_CODE_ENCODER_MAGNET_TOO_STRONG: return "FAULT_CODE_ENCODER_MAGNET_TOO_STRONG";
case FAULT_CODE_PHASE_FILTER: return "FAULT_CODE_PHASE_FILTER";
case FAULT_CODE_ENCODER_FAULT: return "FAULT_CODE_ENCODER_FAULT";
case FAULT_CODE_PHASE_OUTPUT_ERROR: return "FAULT_CODE_PHASE_OUTPUT_ERROR";
}

return "Unknown fault";
Expand Down
4 changes: 3 additions & 1 deletion datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ typedef enum {
FAULT_CODE_ENCODER_NO_MAGNET,
FAULT_CODE_ENCODER_MAGNET_TOO_STRONG,
FAULT_CODE_PHASE_FILTER,
FAULT_CODE_ENCODER_FAULT
FAULT_CODE_ENCODER_FAULT,
FAULT_CODE_LV_OUTPUT_FAULT,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the LV output fault also be in commands and utility?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! Will add those

FAULT_CODE_PHASE_OUTPUT_ERROR,
} mc_fault_code;

typedef enum {
Expand Down
14 changes: 11 additions & 3 deletions utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,20 +483,28 @@ QString Utility::detectAllFoc(VescInterface *vesc,
case 1: sensors = "Encoder"; break;
case 2: sensors = "Hall Sensors"; break;
default: break; }

float kv = (20.0*sqrt(3.0)) / (M_PI * p->getParamDouble("foc_motor_flux_linkage") * (double)p->getParamInt("si_motor_poles"));
float kt = 30.0 / (M_PI * kv);

return QString("VESC ID : %1\n"
"Motor current : %2 A\n"
"Motor R : %3 mΩ\n"
"Motor L : %4 µH\n"
"Motor Lq-Ld : %5 µH\n"
"Motor Flux Linkage : %6 mWb\n"
"Temp Comp : %7\n"
"Sensors : %8").
"Motor Kv : %7 RPM/V\n"
"Motor Kt : %8 Nm/A\n"
"Temp Comp : %9\n"
"Sensors : %10").
arg(ap->getParamInt("controller_id")).
arg(p->getParamDouble("l_current_max"), 0, 'f', 2).
arg(p->getParamDouble("foc_motor_r") * 1e3, 0, 'f', 2).
arg(p->getParamDouble("foc_motor_l") * 1e6, 0, 'f', 2).
arg(p->getParamDouble("foc_motor_ld_lq_diff") * 1e6, 0, 'f', 2).
arg(p->getParamDouble("foc_motor_flux_linkage") * 1e3, 0, 'f', 2).
arg(kv, 0, 'f', 2).
arg(kt, 0, 'f', 2).
arg(p->getParamBool("foc_temp_comp") ? "True" : "False").
arg(sensors);
};
Expand Down Expand Up @@ -578,7 +586,7 @@ QString Utility::detectAllFoc(VescInterface *vesc,
case -100 + FAULT_CODE_ENCODER_MAGNET_TOO_STRONG: reason = "Magnet too strong, magnet is too strong or too close to the encoder"; break;
case -100 + FAULT_CODE_PHASE_FILTER: reason = "Phase filter fault, invalid phase filter readings"; break;
case -100 + FAULT_CODE_ENCODER_FAULT: reason = "Encoder fault, check encoder connections and alignment"; break;

case -100 + FAULT_CODE_PHASE_OUTPUT_ERROR: reason = "Phase outputs shorted or disconnected, Check for damage to cables or connectors"; break;
default: reason = QString::number(resDetect); break;
}

Expand Down
Loading