@@ -14,7 +14,8 @@ CO_OBJ_T* LVSS::getObjectDictionary() {
1414 return &objectDictionary[0 ];
1515}
1616
17- LVSS::LVSS (TPS2HB35BQ * powerSwitches[POWER_SWITCHES_SIZE ], IO ::GPIO & vicorFT, ACS71240 acs71240) : vicorFT(vicorFT), boardEN({0 }), acs71240(acs71240), state(State::INITIALIZATION ) {
17+ LVSS::LVSS (TPS2HB35BQ * powerSwitches[POWER_SWITCHES_SIZE ], IO ::GPIO & vicorFT, ACS71240 acs71240)
18+ : vicorFT(vicorFT), boardEN({0 }), acs71240(acs71240), state(State::INITIALIZATION ) {
1819 for (int i = 0 ; i < POWER_SWITCHES_SIZE ; i++) {
1920 this ->powerSwitches [i] = powerSwitches[i];
2021 }
@@ -43,7 +44,7 @@ void LVSS::initState() {
4344 VICOR_FAULT_ACTIVE_STATE = vicorFT.readPin ();
4445
4546 if (time::millis () >= 101 && VICOR_FAULT_ACTIVE_STATE == IO ::GPIO ::State::LOW ) {
46- state = State::IDLE ;
47+ state = State::IDLE ;
4748 isNewState = true ;
4849 }
4950}
@@ -57,49 +58,69 @@ void LVSS::runningState() {
5758 /* Assigns the VCU signal to the union bit field */
5859 this ->boardEN .val = VCUBoardSig;
5960
60- log::LOGGER .log (log::Logger::LogLevel::DEBUG , " Battery: %d\r\n HIB: %d\r\n TMS: %d\r\n HUDL: %d\r\n ACC: %d\r\n GUB: %d\r\n " , boardEN.batt , boardEN.hib , boardEN.tms , boardEN.hudl , boardEN.acc , boardEN.gub );
61+ log::LOGGER .log (log::Logger::LogLevel::DEBUG ,
62+ " Battery: %d\r\n HIB: %d\r\n TMS: %d\r\n HUDL: %d\r\n ACC: %d\r\n GUB: %d\r\n " ,
63+ boardEN.batt ,
64+ boardEN.hib ,
65+ boardEN.tms ,
66+ boardEN.hudl ,
67+ boardEN.acc ,
68+ boardEN.gub );
6169
6270 /* Turn on boards */
63- powerSwitches[0 ]->setPowerSwitchStates (boardEN.batt , boardEN.hib );// Turn on Battery and HIB
64- powerSwitches[1 ]->setPowerSwitchStates (boardEN.tms , boardEN.hudl );// Turn on TMS and HUDL
65- powerSwitches[2 ]->setPowerSwitchStates (boardEN.acc , boardEN.gub ); // Turn on Acc and GUB
71+ powerSwitches[0 ]->setPowerSwitchStates (boardEN.batt , boardEN.hib ); // Turn on Battery and HIB
72+ powerSwitches[1 ]->setPowerSwitchStates (boardEN.tms , boardEN.hudl ); // Turn on TMS and HUDL
73+ powerSwitches[2 ]->setPowerSwitchStates (boardEN.acc , boardEN.gub ); // Turn on Acc and GUB
6674
6775 /* Current Checking */
6876 PowerSwitchState.battCurrent = powerSwitches[0 ]->getCurrent (1 );
69- PowerSwitchState.tmsCurrent = powerSwitches[1 ]->getCurrent (1 );
70- PowerSwitchState.accCurrent = powerSwitches[2 ]->getCurrent (1 );
77+ PowerSwitchState.tmsCurrent = powerSwitches[1 ]->getCurrent (1 );
78+ PowerSwitchState.accCurrent = powerSwitches[2 ]->getCurrent (1 );
7179
7280 if (PowerSwitchState.battCurrent == -1 || PowerSwitchState.tmsCurrent == -1 || PowerSwitchState.accCurrent == -1 ) {
7381 log::LOGGER .log (log::Logger::LogLevel::INFO , " Power Switch Error\r\n " );
7482 switchFaultstatus = INTMAX_MIN ;
7583 }
7684
77- log::LOGGER .log (log::Logger::LogLevel::DEBUG , " Switch 0 Channel 1: %d\r\n Switch 1 Channel 1: %d\r\n Switch 2 Channel 1: %d\r\n " , PowerSwitchState.battCurrent , PowerSwitchState.tmsCurrent , PowerSwitchState.accCurrent );
85+ log::LOGGER .log (log::Logger::LogLevel::DEBUG ,
86+ " Switch 0 Channel 1: %d\r\n Switch 1 Channel 1: %d\r\n Switch 2 Channel 1: %d\r\n " ,
87+ PowerSwitchState.battCurrent ,
88+ PowerSwitchState.tmsCurrent ,
89+ PowerSwitchState.accCurrent );
7890
79- time::wait (2 );// Power switches require the ADC to wait a min of 165 micro seconds before sampling SNS pin again
91+ time::wait (2 ); // Power switches require the ADC to wait a min of 165 micro seconds before sampling SNS pin again
8092
81- PowerSwitchState.hibCurrent = powerSwitches[0 ]->getCurrent (2 );
93+ PowerSwitchState.hibCurrent = powerSwitches[0 ]->getCurrent (2 );
8294 PowerSwitchState.hudlCurrent = powerSwitches[1 ]->getCurrent (2 );
83- PowerSwitchState.gubCurrent = powerSwitches[2 ]->getCurrent (2 );
95+ PowerSwitchState.gubCurrent = powerSwitches[2 ]->getCurrent (2 );
8496
8597 if (PowerSwitchState.hibCurrent == -1 || PowerSwitchState.hudlCurrent == -1 || PowerSwitchState.gubCurrent == -1 ) {
8698 log::LOGGER .log (log::Logger::LogLevel::INFO , " Power Switch Error\r\n " );
8799 switchFaultstatus = INTMAX_MIN ;
88100 }
89101
90- log::LOGGER .log (log::Logger::LogLevel::DEBUG , " Switch 0 Channel 2: %d\r\n Switch 1 Channel 2: %d\r\n Switch 2 Channel 2: %d\r\n " , PowerSwitchState.hibCurrent , PowerSwitchState.hudlCurrent , PowerSwitchState.gubCurrent );
102+ log::LOGGER .log (log::Logger::LogLevel::DEBUG ,
103+ " Switch 0 Channel 2: %d\r\n Switch 1 Channel 2: %d\r\n Switch 2 Channel 2: %d\r\n " ,
104+ PowerSwitchState.hibCurrent ,
105+ PowerSwitchState.hudlCurrent ,
106+ PowerSwitchState.gubCurrent );
91107
92108 PowerSwitchState.switch0Temp = powerSwitches[0 ]->getTempandFault ();
93109 PowerSwitchState.switch1Temp = powerSwitches[1 ]->getTempandFault ();
94110 PowerSwitchState.switch2Temp = powerSwitches[2 ]->getTempandFault ();
95111
96- if (PowerSwitchState.switch0Temp == -1 || PowerSwitchState.switch1Temp == -1 || PowerSwitchState.switch2Temp == -1 ) {
112+ if (PowerSwitchState.switch0Temp == -1 || PowerSwitchState.switch1Temp == -1
113+ || PowerSwitchState.switch2Temp == -1 ) {
97114 log::LOGGER .log (log::Logger::LogLevel::INFO , " Power Switch Error\r\n " );
98115 switchFaultstatus = 1 ;
99116 }
100117
101- log::LOGGER .log (log::Logger::LogLevel::DEBUG , " Switch 0 Temperature: %d\r\n Switch 1 Temperature: %d\r\n Switch 2 Temperature: %d\r\n " , PowerSwitchState.switch0Temp , PowerSwitchState.switch1Temp , PowerSwitchState.switch2Temp );
118+ log::LOGGER .log (log::Logger::LogLevel::DEBUG ,
119+ " Switch 0 Temperature: %d\r\n Switch 1 Temperature: %d\r\n Switch 2 Temperature: %d\r\n " ,
120+ PowerSwitchState.switch0Temp ,
121+ PowerSwitchState.switch1Temp ,
122+ PowerSwitchState.switch2Temp );
102123
103124 log::LOGGER .log (log::Logger::LogLevel::INFO , " Vicor Current: %d\r\n " , acs71240.readCurrent ());
104125}
105- }// namespace LVSS
126+ } // namespace LVSS
0 commit comments