EFeru / hoverboard-firmware-hack-FOC

With Field Oriented Control (FOC)
GNU General Public License v3.0
1.11k stars 926 forks source link

Speed Variable Type #92

Closed bekirbostanci closed 4 years ago

bekirbostanci commented 4 years ago

Hi I use usart3 for get wheel speeds and I can get values. But values are rpm integer (I don't know unit but I tested and I guess unit is rpm) so that resolution is not very precise. Can I change wheel speed variable type integer to double or meter/sec and how can I change in the firmware ?

Thank you for answers @EmanuelFeru

bekirbostanci commented 4 years ago

In bldc.c file get motor output values but speed line commentted. I didnt find this line equivalent in the repo

    /* Get motor outputs here */
    ur            = rtY_Right.DC_phaA;
    vr            = rtY_Right.DC_phaB;
    wr            = rtY_Right.DC_phaC;
 // errCodeRight  = rtY_Right.z_errCode;
 // motSpeedRight = rtY_Right.n_mot;
 // motAngleRight = rtY_Right.a_elecAngle;

Also I found n_mot equivalent in BLDC_controller.c file.

  /* Outport: '<Root>/n_mot' incorporates:
   *  DataTypeConversion: '<S1>/Data Type Conversion1'
   */
  rtY->n_mot = (int16_T)(rtb_Switch2_k >> 4);

why you are shift the rtb_switch2_k 4 bit I dont understand that part