Skip to content

Commit b68fedf

Browse files
committed
Add conversion command for inline
1 parent 9fcd4e5 commit b68fedf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/current_sense/InlineCurrentSense.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void InlineCurrentSense::calibrateOffsets(){
6161
offset_ic = 0;
6262
// read the adc voltage 1000 times ( arbitrary number )
6363
for (int i = 0; i < calibration_rounds; i++) {
64+
_startADC3PinConversionInline();
6465
if(_isset(pinA)) offset_ia += _readADCVoltageInline(pinA, params);
6566
if(_isset(pinB)) offset_ib += _readADCVoltageInline(pinB, params);
6667
if(_isset(pinC)) offset_ic += _readADCVoltageInline(pinC, params);
@@ -75,6 +76,7 @@ void InlineCurrentSense::calibrateOffsets(){
7576
// read all three phase currents (if possible 2 or 3)
7677
PhaseCurrent_s InlineCurrentSense::getPhaseCurrents(){
7778
PhaseCurrent_s current;
79+
_startADC3PinConversionInline();
7880
current.a = (!_isset(pinA)) ? 0 : (_readADCVoltageInline(pinA, params) - offset_ia)*gain_a;// amps
7981
current.b = (!_isset(pinB)) ? 0 : (_readADCVoltageInline(pinB, params) - offset_ib)*gain_b;// amps
8082
current.c = (!_isset(pinC)) ? 0 : (_readADCVoltageInline(pinC, params) - offset_ic)*gain_c; // amps

src/current_sense/hardware_specific/esp32/esp32_i2s_driver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ void IRAM_ATTR _startADC3PinConversionLowSide()
242242
#endif
243243
}
244244

245+
void IRAM_ATTR _startADC3PinConversionInline(){
246+
_startADC3PinConversionLowSide();
247+
}
248+
245249
// Takes the buffered adc counts and returns the coresponding float voltage for a pin.
246250
float IRAM_ATTR _readADCVoltageI2S(const int pin, const void *cs_params)
247251
{

0 commit comments

Comments
 (0)