refine parameter (based on measurements)

This commit is contained in:
Peter Poetzi
2022-10-02 18:29:22 +02:00
parent 3e0ac63d64
commit 85f66fe186

View File

@ -464,15 +464,15 @@ void updateMotors()
static int16_t offsetdcl{2000};
static int16_t offsetdcr{2000};
if (offsetcount < 2000) // calibrate ADC offsets
if (offsetcount < 20000) // calibrate ADC offsets
{
offsetcount++;
offsetrl1 = (adc_buffer.rl1 + offsetrl1) / 2;
offsetrl2 = (adc_buffer.rl2 + offsetrl2) / 2;
offsetrr1 = (adc_buffer.rr1 + offsetrr1) / 2;
offsetrr2 = (adc_buffer.rr2 + offsetrr2) / 2;
offsetdcl = (adc_buffer.dcl + offsetdcl) / 2;
offsetdcr = (adc_buffer.dcr + offsetdcr) / 2;
offsetrl1 = (adc_buffer.rl1 + offsetrl1 * 9) / 10;
offsetrl2 = (adc_buffer.rl2 + offsetrl2 * 9) / 10;
offsetrr1 = (adc_buffer.rr1 + offsetrr1 * 9) / 10;
offsetrr2 = (adc_buffer.rr2 + offsetrr2 * 9) / 10;
offsetdcl = (adc_buffer.dcl + offsetdcl * 9) / 10;
offsetdcr = (adc_buffer.dcr + offsetdcr * 9) / 10;
return;
}
@ -498,8 +498,8 @@ void updateMotors()
#ifdef SHUNT_4_MILLIOHM
curL_DC *= 2.162;
curR_DC *= 2.162;
curL_DC *= 2.276;
curR_DC *= 2.276;
#endif
const bool chopL = std::abs(curL_DC) > (left.iDcMax.load() * AMPERE2BIT_CONV);