Skip to content

Commit e6f8b17

Browse files
GitHub BuildGitHub Build
authored andcommitted
Applied Formatting Changes During GitHub Build
1 parent 00eec29 commit e6f8b17

9 files changed

Lines changed: 54 additions & 50 deletions

File tree

include/LVSS.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#ifndef _LVSS_
22
#define _LVSS_
33

4+
#include <LVSS.hpp>
45
#include <core/dev/LCD.hpp>
56
#include <core/io/CANOpenMacros.hpp>
67
#include <core/io/CANopen.hpp>
78
#include <core/utils/log.hpp>
8-
#include <LVSS.hpp>
99
#include <cstdio>
1010
#include <cstring>
1111
#include <dev/ACS71240.hpp>

include/dev/ACS71240.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class ACS71240 {
3030

3131
private:
3232
/** ADC instance for getting input voltage */
33-
int16_t adcVoltage = 3300; // ADC voltage in millivolts
34-
int16_t sensitivity = 44; // millivolts / amp
35-
int16_t scaledCurrent = 180; // Sensitivity multiplied by ADC resolution (4096 * 0.044)
36-
int16_t avgAdcCount = 1970; // Background Noise
33+
int16_t adcVoltage = 3300; // ADC voltage in millivolts
34+
int16_t sensitivity = 44; // millivolts / amp
35+
int16_t scaledCurrent = 180; // Sensitivity multiplied by ADC resolution (4096 * 0.044)
36+
int16_t avgAdcCount = 1970; // Background Noise
3737
io::ADC& ADC;
3838
};
3939

include/dev/TPS2HB35BQ.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ class TPS2HB35BQ {
110110
uint32_t icl = 9000; // Current Limit Value in milliamps
111111
int32_t TemperatureLimit = 135000; // Temperature Limit of 135 C in millicelsius
112112

113-
static constexpr uint32_t adcVoltage = 3300; // ADC Voltage
114-
static constexpr uint32_t dIsnst = 11; // Coefficient 0.011 mA/C in microamps
115-
static constexpr uint32_t resistanceOnJunctionTemp = 25000; // 25 C in millicelsius
116-
static constexpr uint32_t adcResolution = 4096; // 25 C in millicelsius
113+
static constexpr uint32_t adcVoltage = 3300; // ADC Voltage
114+
static constexpr uint32_t dIsnst = 11; // Coefficient 0.011 mA/C in microamps
115+
static constexpr uint32_t resistanceOnJunctionTemp = 25000; // 25 C in millicelsius
116+
static constexpr uint32_t adcResolution = 4096; // 25 C in millicelsius
117117

118118
/**
119119
* Controls the diagnostic enable pin

src/LVSS.cpp

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -79,36 +79,37 @@ void LVSS::runningState() {
7979

8080
if (PowerSwitchState.battCurrent == INTMAX_MIN) {
8181
PowerSwitchFaults.battCurrentFault = 1;
82-
boardEN.batt = 0;
82+
boardEN.batt = 0;
8383
powerSwitches[0]->setLatch(TPS2HB35BQ::LATCHED);
8484
powerSwitches[0]->setPowerSwitchStates(boardEN.batt, boardEN.hib);
8585
}
8686

8787
if (PowerSwitchState.tmsCurrent == INTMAX_MIN) {
8888
PowerSwitchFaults.tmsCurrentFault = 1;
89-
boardEN.tms = 0;
89+
boardEN.tms = 0;
9090
powerSwitches[1]->setLatch(TPS2HB35BQ::LATCHED);
9191
powerSwitches[1]->setPowerSwitchStates(boardEN.tms, boardEN.hudl);
9292
}
9393

9494
if (PowerSwitchState.accCurrent == INTMAX_MIN) {
9595
PowerSwitchFaults.accCurrentFault = 1;
96-
boardEN.acc = 0;
96+
boardEN.acc = 0;
9797
powerSwitches[2]->setLatch(TPS2HB35BQ::LATCHED);
9898
powerSwitches[2]->setPowerSwitchStates(boardEN.acc, boardEN.gub);
9999
}
100100

101101
log::LOGGER.log(log::Logger::LogLevel::INFO,
102-
"Power Switch Channel 1 Current Fault Status\r\nBattery: %d\r\nTMS: %d\r\nAcc: %d\r\n",
103-
PowerSwitchFaults.battCurrentFault,
104-
PowerSwitchFaults.tmsCurrentFault,
105-
PowerSwitchFaults.accCurrentFault);
106-
107-
log::LOGGER.log(log::Logger::LogLevel::DEBUG,
108-
"Switch 0 Channel 1 Current: %d\r\nSwitch 1 Channel 1 Current: %d\r\nSwitch 2 Channel 1 Current: %d\r\n",
109-
PowerSwitchState.battCurrent,
110-
PowerSwitchState.tmsCurrent,
111-
PowerSwitchState.accCurrent);
102+
"Power Switch Channel 1 Current Fault Status\r\nBattery: %d\r\nTMS: %d\r\nAcc: %d\r\n",
103+
PowerSwitchFaults.battCurrentFault,
104+
PowerSwitchFaults.tmsCurrentFault,
105+
PowerSwitchFaults.accCurrentFault);
106+
107+
log::LOGGER.log(
108+
log::Logger::LogLevel::DEBUG,
109+
"Switch 0 Channel 1 Current: %d\r\nSwitch 1 Channel 1 Current: %d\r\nSwitch 2 Channel 1 Current: %d\r\n",
110+
PowerSwitchState.battCurrent,
111+
PowerSwitchState.tmsCurrent,
112+
PowerSwitchState.accCurrent);
112113

113114
time::wait(2); // Power switches require the ADC to wait a min of 165 micro seconds before sampling SNS pin again
114115

@@ -118,7 +119,7 @@ void LVSS::runningState() {
118119

119120
if (PowerSwitchState.hibCurrent == INTMAX_MIN) {
120121
PowerSwitchFaults.hibCurrentFault = 1;
121-
boardEN.hib = 0;
122+
boardEN.hib = 0;
122123
powerSwitches[0]->setLatch(TPS2HB35BQ::LATCHED);
123124
powerSwitches[0]->setPowerSwitchStates(boardEN.batt, boardEN.hib);
124125
}
@@ -132,55 +133,57 @@ void LVSS::runningState() {
132133

133134
if (PowerSwitchState.gubCurrent == INTMAX_MIN) {
134135
PowerSwitchFaults.gubCurrentFault = 1;
135-
boardEN.gub = 0;
136+
boardEN.gub = 0;
136137
powerSwitches[2]->setLatch(TPS2HB35BQ::LATCHED);
137138
powerSwitches[2]->setPowerSwitchStates(boardEN.acc, boardEN.gub);
138139
}
139140

140141
log::LOGGER.log(log::Logger::LogLevel::INFO,
141-
"Power Switch Channel 2 Current Fault Status\r\nHIB: %d\r\nHUDL: %d\r\nGUB: %d\r\n", PowerSwitchFaults.hibCurrentFault,
142-
PowerSwitchFaults.hudlCurrentFault,
143-
PowerSwitchFaults.gubCurrentFault);
144-
145-
log::LOGGER.log(log::Logger::LogLevel::DEBUG,
146-
"Switch 0 Channel 2 Current: %d\r\nSwitch 1 Channel 2 Current: %d\r\nSwitch 2 Channel 2 Current: %d\r\n",
147-
PowerSwitchState.hibCurrent,
148-
PowerSwitchState.hudlCurrent,
149-
PowerSwitchState.gubCurrent);
142+
"Power Switch Channel 2 Current Fault Status\r\nHIB: %d\r\nHUDL: %d\r\nGUB: %d\r\n",
143+
PowerSwitchFaults.hibCurrentFault,
144+
PowerSwitchFaults.hudlCurrentFault,
145+
PowerSwitchFaults.gubCurrentFault);
146+
147+
log::LOGGER.log(
148+
log::Logger::LogLevel::DEBUG,
149+
"Switch 0 Channel 2 Current: %d\r\nSwitch 1 Channel 2 Current: %d\r\nSwitch 2 Channel 2 Current: %d\r\n",
150+
PowerSwitchState.hibCurrent,
151+
PowerSwitchState.hudlCurrent,
152+
PowerSwitchState.gubCurrent);
150153

151154
PowerSwitchState.switch0Temp = powerSwitches[0]->getTemperature();
152155
PowerSwitchState.switch1Temp = powerSwitches[1]->getTemperature();
153156
PowerSwitchState.switch2Temp = powerSwitches[2]->getTemperature();
154157

155158
if (PowerSwitchState.switch0Temp == INTMAX_MIN) {
156159
PowerSwitchFaults.switch0TempFault = 1;
157-
boardEN.batt = 0;
158-
boardEN.hib = 0;
160+
boardEN.batt = 0;
161+
boardEN.hib = 0;
159162
powerSwitches[0]->setLatch(TPS2HB35BQ::LATCHED);
160163
powerSwitches[0]->setPowerSwitchStates(boardEN.batt, boardEN.hib);
161164
}
162165

163166
if (PowerSwitchState.switch1Temp == INTMAX_MIN) {
164167
PowerSwitchFaults.switch1TempFault = 1;
165-
boardEN.tms = 0;
166-
boardEN.hudl = 0;
168+
boardEN.tms = 0;
169+
boardEN.hudl = 0;
167170
powerSwitches[1]->setLatch(TPS2HB35BQ::LATCHED);
168171
powerSwitches[1]->setPowerSwitchStates(boardEN.tms, boardEN.hudl);
169172
}
170173

171174
if (PowerSwitchState.switch2Temp == INTMAX_MIN) {
172175
PowerSwitchFaults.switch2TempFault = 1;
173-
boardEN.gub = 0;
174-
boardEN.acc = 0;
176+
boardEN.gub = 0;
177+
boardEN.acc = 0;
175178
powerSwitches[2]->setLatch(TPS2HB35BQ::LATCHED);
176179
powerSwitches[2]->setPowerSwitchStates(boardEN.acc, boardEN.gub);
177180
}
178181

179182
log::LOGGER.log(log::Logger::LogLevel::INFO,
180-
"Power Switch Temperature Fault Status\r\nSwitch 0: %d\r\nSwitch 1: %d\r\nSwitch 2: %d\r\n",
181-
PowerSwitchFaults.switch0TempFault,
182-
PowerSwitchFaults.switch1TempFault,
183-
PowerSwitchFaults.switch2TempFault);
183+
"Power Switch Temperature Fault Status\r\nSwitch 0: %d\r\nSwitch 1: %d\r\nSwitch 2: %d\r\n",
184+
PowerSwitchFaults.switch0TempFault,
185+
PowerSwitchFaults.switch1TempFault,
186+
PowerSwitchFaults.switch2TempFault);
184187

185188
log::LOGGER.log(log::Logger::LogLevel::DEBUG,
186189
"Switch 0 Temperature: %d\r\nSwitch 1 Temperature: %d\r\nSwitch 2 Temperature: %d\r\n",

src/dev/ACS71240.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace LVSS {
44

5-
ACS71240::ACS71240(io::ADC& adc0) : ADC(adc0) {}
5+
ACS71240::ACS71240(io::ADC& adc0) : ADC(adc0) {}
66

77
uint16_t ACS71240::readCurrent() {
88
// Gets adcCounts from adc

src/dev/TPS2HB35BQ.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ uint32_t TPS2HB35BQ::getCurrentAndFault(uint8_t channelSelect) {
8888

8989
/* volts = (ADC Counts * 3300 kilovolts) / 4096 */
9090
uint32_t milliVolts = (counts * adcVoltage) / adcResolution; // Turn ADC counts into milli volts
91-
uint32_t microAmps = (milliVolts * 1000) / rsns; // Turn milli volts into micro amps
91+
uint32_t microAmps = (milliVolts * 1000) / rsns; // Turn milli volts into micro amps
9292

9393
/* If current is greater than the current limit latch the sns pin */
9494
if (microAmps >= icl) {
@@ -110,10 +110,11 @@ int32_t TPS2HB35BQ::getTemperature() {
110110
}
111111

112112
uint32_t milliVolts = (counts * adcVoltage) / adcResolution; // Turn ADC counts into milli volts
113-
int32_t microAmps = (milliVolts * 1000) / rsns; // Turn milli volts into micro amps
113+
int32_t microAmps = (milliVolts * 1000) / rsns; // Turn milli volts into micro amps
114114

115115
/* ( Isns (mA) - 0.85 mA ) / (dIsnst/dT) + 25 celsius */
116-
int32_t milliCelsius = (microAmps - 850) / dIsnst + resistanceOnJunctionTemp; // Returns temperature in milli celsius
116+
int32_t milliCelsius =
117+
(microAmps - 850) / dIsnst + resistanceOnJunctionTemp; // Returns temperature in milli celsius
117118

118119
if (milliCelsius >= TemperatureLimit) {
119120
return INTMAX_MIN;

targets/REV3-ACS71240/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* LVSS using the ACS71240 IC.
44
*/
55

6+
#include <LVSS.hpp>
67
#include <core/io/UART.hpp>
78
#include <core/io/pin.hpp>
89
#include <core/manager.hpp>
910
#include <core/utils/log.hpp>
1011
#include <core/utils/time.hpp>
11-
#include <LVSS.hpp>
1212

1313
namespace IO = core::io;
1414
namespace DEV = core::dev;

targets/REV3-LVSS/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* temperature, and fault status for each board and Vicor.
77
*/
88

9+
#include <LVSS.hpp>
910
#include <core/io/CANopen.hpp>
1011
#include <core/io/GPIO.hpp>
1112
#include <core/io/UART.hpp>
1213
#include <core/io/pin.hpp>
1314
#include <core/manager.hpp>
1415
#include <core/utils/log.hpp>
15-
#include <LVSS.hpp>
1616

1717
namespace io = core::io;
1818
namespace dev = core::dev;

targets/REV3-TPS2HB35BQ/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* This is a basic sample to show the functionality of the LVSS power switches.
33
*/
44

5+
#include <LVSS.hpp>
56
#include <core/io/CANopen.hpp>
67
#include <core/io/GPIO.hpp>
78
#include <core/io/UART.hpp>
89
#include <core/io/pin.hpp>
910
#include <core/manager.hpp>
1011
#include <core/utils/log.hpp>
11-
#include <LVSS.hpp>
1212

1313
namespace io = core::io;
1414
namespace dev = core::dev;

0 commit comments

Comments
 (0)