Skip to content

Commit dc51797

Browse files
committed
FEAT fix merge bugs
1 parent 48d38d3 commit dc51797

File tree

9 files changed

+23
-28
lines changed

9 files changed

+23
-28
lines changed

src/current_sense/LowsideCurrentSense.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ void LowsideCurrentSense::calibrateOffsets(){
4343
_delay(1);
4444
}
4545
// calculate the mean offsets
46-
offset_ia = offset_ia / 1000.0f;
47-
offset_ib = offset_ib / 1000.0f;
48-
if(_isset(pinC)) offset_ic = offset_ic / 1000.0f;
46+
offset_ia = offset_ia / calibration_rounds;
47+
offset_ib = offset_ib / calibration_rounds;
48+
if(_isset(pinC)) offset_ic = offset_ic / calibration_rounds;
4949
}
5050

5151
// read all three phase currents (if possible 2 or 3)
52+
PhaseCurrent_s LowsideCurrentSense::getPhaseCurrents(){
5253
PhaseCurrent_s current;
5354
_startADC3PinConversionLowSide();
5455
current.a = lpf_a(_readADCVoltageLowSide(pinA) - offset_ia)*gain_a;// amps

src/current_sense/hardware_specific/atmega_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328PB__)
44

5-
#define _ADC_VOLTAGE 5.0
6-
#define _ADC_RESOLUTION 1024.0
5+
#define _ADC_VOLTAGE 5.0f
6+
#define _ADC_RESOLUTION 1024.0f
77

88
// adc counts to voltage conversion ratio
99
// some optimizing for faster execution

src/current_sense/hardware_specific/due_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#if defined(__arm__) && defined(__SAM3X8E__)
44

5-
#define _ADC_VOLTAGE 3.3
6-
#define _ADC_RESOLUTION 1024.0
5+
#define _ADC_VOLTAGE 3.3f
6+
#define _ADC_RESOLUTION 1024.0f
77

88
// adc counts to voltage conversion ratio
99
// some optimizing for faster execution

src/current_sense/hardware_specific/esp32_mcu.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ float _readADCVoltageLowSide(const int pin){
3535
return raw_adc * _ADC_CONV;
3636
}
3737

38-
<<<<<<< HEAD
39-
void _startADC3PinConversionLowSide(){
40-
41-
}
42-
43-
=======
44-
>>>>>>> dev
4538
// function reading an ADC value and returning the read voltage
4639
void _configureADCLowSide(const int pinA,const int pinB,const int pinC){
4740
_pinA = pinA;

src/current_sense/hardware_specific/generic_mcu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// function reading an ADC value and returning the read voltage
44
__attribute__((weak)) float _readADCVoltageInline(const int pinA){
55
uint32_t raw_adc = analogRead(pinA);
6-
return raw_adc * 5.0/1024;
6+
return raw_adc * 5.0f/1024.0f;
77
}
88

99
// function reading an ADC value and returning the read voltage

src/current_sense/hardware_specific/samd21_mcu.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@ void _configureADCLowSide(const int pinA,const int pinB,const int pinC)
1919
{
2020
_pinA = pinA;
2121
_pinB = pinB;
22+
_pinC = pinC;
23+
freeRunning = true;
24+
instance.init(pinA, pinB, pinC);
25+
26+
}
2227
void _startADC3PinConversionLowSide()
2328
{
2429
instance.startADCScan();
2530
}
2631
/**
2732
* function reading an ADC value and returning the read voltage
28-
<<<<<<< HEAD
29-
*
30-
=======
3133
*
34+
* @param pinA - the arduino pin to be read (it has to be ADC pin)
35+
*/
3236
float _readADCVoltageLowSide(const int pinA)
37+
{
3338
instance.readResults(a, b, c);
34-
<<<<<<< HEAD
35-
36-
=======
3739

38-
>>>>>>> dev
3940
if(pinA == _pinA)
4041
return instance.toVolts(a);
4142
if(pinA == _pinB)

src/current_sense/hardware_specific/samd_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#if defined(_SAMD21_)||defined(_SAMD51_)||defined(_SAME51_)
44

5-
#define _ADC_VOLTAGE 3.3
6-
#define _ADC_RESOLUTION 1024.0
5+
#define _ADC_VOLTAGE 3.3f
6+
#define _ADC_RESOLUTION 1024.0f
77

88
// adc counts to voltage conversion ratio
99
// some optimizing for faster execution

src/current_sense/hardware_specific/stm32_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#if defined(_STM32_DEF_)
55

6-
#define _ADC_VOLTAGE 3.3
7-
#define _ADC_RESOLUTION 1024.0
6+
#define _ADC_VOLTAGE 3.3f
7+
#define _ADC_RESOLUTION 1024.0f
88

99
// adc counts to voltage conversion ratio
1010
// some optimizing for faster execution

src/current_sense/hardware_specific/teensy_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#if defined(__arm__) && defined(CORE_TEENSY)
44

5-
#define _ADC_VOLTAGE 3.3
6-
#define _ADC_RESOLUTION 1024.0
5+
#define _ADC_VOLTAGE 3.3f
6+
#define _ADC_RESOLUTION 1024.0f
77

88
// adc counts to voltage conversion ratio
99
// some optimizing for faster execution

0 commit comments

Comments
 (0)