If m_speed_pid_set_rpm is allowed to exceed foc_openloop_rpm before index is found,
then there will be a jump in torque when index is found.
If m_speed_pid_set_rpm is allowed to exceed [l_min_erpm, l_max_erpm] then there is
a wind up effect since it will take time for m_speed_pid_set_rpm to return to valid
range due to ramp limit.
Needs to be rescaled back to int for storage, 8* higher resolution so the hw can use oversampling.
BLDC can use floats for these variables, since they get changed to floats later anyway. Might as well do it earlier to make the code simpler.
Removed a bunch of ifdefs by making is_second_motor = 0 when not using dual motors.
Fixed a bug in hw.h where it wrongly defined GET_CURRENT3 when inverted shunts was selected. GET_CURRENT3 will now always be 0 by default, removing the need for a few ifdefs in the foc code.
Hw_conf can define CURRENT_CAL1,2,3 to set individual calibrations for each current sensor.
By default no calibration is used. (x1.0)
For example this is used on the A50S by looping a calibrated current using a power supply through each phase. Then the correction is saved in external eeprom to persist across firmware updates.
Tested on FOC, DC and BLDC modes.
Adds support for A200S V4.1
Move A200S V4 to its own folder.
Expose I2C for LSM6DS3 to allow other devices on the same I2C bus. (It is now setup the same as the other IMUs)
Add alternative DC Calibration routine for Low side shunt hardware with very high mosfet output capacitance. The usual calibration routine causes an offset in the current calibration at high voltage from the capacitance discharging through the motor inductance when the single phase goes low. The alternative routine switches all phases at 50% to give a clean V0 state. This routine should not be run while the motor is spinning, so automatic calibration on startup is disabled when this routine is selected.