Skip to content

Commit b383505

Browse files
committed
Changes for testing, just ip and commenting stuff
1 parent ebe2c3d commit b383505

4 files changed

Lines changed: 33 additions & 29 deletions

File tree

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"source": "probe",
2121
"decoders": [{ "type": "console", "label": "ITM", "port": 0 }]
2222
},
23-
"preLaunchTask": "CMake: build"
23+
"preLaunchTask": "CMake: build",
24+
"stm32cubeprogrammer":"/home/danielcanto/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin",
2425
},
2526
{
2627
"type": "cortex-debug",

Core/Inc/HVSCU/Board.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ struct ProtectionManagerHandle {
3131

3232
// Turn the STLIB into a class
3333
struct STLIBHandle {
34-
STLIBHandle(string mac = "00:80:e1:00:00:00", string ip = "192.168.1.4",
34+
STLIBHandle(string mac = "00:80:e1:00:00:00", string ip = "192.168.2.16",
3535
string subnet_mask = "255.255.0.0",
36-
string gateway = "192.168.1.1",
36+
string gateway = "192.168.2.1",
3737
UART::Peripheral& printf_peripheral = UART::uart2) {
3838
STLIB::start(mac, ip, subnet_mask, gateway, printf_peripheral);
3939
}

Core/Src/HVSCU/Actuators/Contactors.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ Contactors::Contactors(Pin &ess_discharge_pin, Pin &discharge_pin,
8585
},
8686
State::Open);
8787

88-
contactors_state.add_enter_action([&]() { close_charging_circuit(); },
88+
contactors_state.add_enter_action([&]() {
89+
close_charging_circuit(); },
8990
State::Charging);
9091

9192
contactors_state.add_enter_action(
@@ -177,9 +178,9 @@ void Contactors::close_high_voltage_circuit() {
177178
}
178179

179180
void Contactors::charge(float target_voltage) {
180-
if (get_state() != State::Open && get_state() != State::Charged &&
181-
get_state() != State::Charging)
182-
return;
181+
// if (get_state() != State::Open && get_state() != State::Charged &&
182+
// get_state() != State::Charging)
183+
// return;
183184

184185
charge_voltage = target_voltage;
185186
charge_request_received = true;

Core/Src/HVSCU/Board.cpp

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Board::Board()
2020
can(),
2121
stlib("00:80:e1:00:02:16",
2222
HVSCU::Communication::Ethernet::local_ip.string_address,
23-
"255.255.255.0", "192.168.2.1"),
23+
"255.255.0.0", "192.168.2.1"),
2424
ethernet(
2525
&can.module_can.system.total_voltage_volts, &state_of_charge,
2626
can.module_can.system.all_cells_voltage[0],
@@ -53,8 +53,8 @@ Board::Board()
5353
read_sensors_1khz = true;
5454
});
5555

56-
Time::register_low_precision_alarm(
57-
1, [&]() { protection_manager.update_low_frequency(); });
56+
// Time::register_low_precision_alarm(
57+
// 1, [&]() { protection_manager.update_low_frequency(); });
5858
}
5959

6060
void Board::update() {
@@ -90,29 +90,29 @@ void Board::update() {
9090
ess_voltage = can.module_can.system.total_voltage_volts;
9191
state_of_charge = ess_voltage * 100.0f / MAX_ESS_VOLTAGE;
9292
for (uint8_t i = 0; i < 3; i++) {
93-
if (*can.module_can.system.all_module_voltage[0][i] >= 148.8f) {
94-
ProtectionManager::fault_and_propagate();
95-
break;
96-
}
93+
// if (*can.module_can.system.all_module_voltage[0][i] >= 148.8f) {
94+
// ProtectionManager::fault_and_propagate();
95+
// break;
96+
// }
9797

98-
if (*can.module_can.system.all_max_temperature[0][i] >= 60.0) {
99-
ProtectionManager::fault_and_propagate();
100-
break;
101-
}
98+
// if (*can.module_can.system.all_max_temperature[0][i] >= 60.0) {
99+
// ProtectionManager::fault_and_propagate();
100+
// break;
101+
// }
102102

103-
if (*can.module_can.system.all_min_temperature[0][i] <= 5.5) {
104-
ProtectionManager::fault_and_propagate();
105-
break;
106-
}
103+
// if (*can.module_can.system.all_min_temperature[0][i] <= 5.5) {
104+
// ProtectionManager::fault_and_propagate();
105+
// break;
106+
// }
107107

108108
bool protection_triggered = false;
109-
for (uint8_t j = 0; j < 48; j++) {
110-
if (*can.module_can.system.all_cells_voltage[0][i][j] >= 3.1f) {
111-
ProtectionManager::fault_and_propagate();
112-
protection_triggered = true;
113-
break;
114-
}
115-
}
109+
// for (uint8_t j = 0; j < 48; j++) {
110+
// if (*can.module_can.system.all_cells_voltage[0][i][j] >= 3.1f) {
111+
// ProtectionManager::fault_and_propagate();
112+
// protection_triggered = true;
113+
// break;
114+
// }
115+
// }
116116
if (protection_triggered) break;
117117
}
118118

@@ -130,7 +130,9 @@ void Board::update() {
130130
imd_fault = imd.ever_got_ok && *imd.get_ok_state() == PinState::OFF;
131131
protection_manager.update_high_frequency();
132132
general_state_machine.check_transitions();
133+
[[maybe_unused]] Actuators::Contactors::State pruebas = *(contactors.get_state_pointer());
133134
stlib.update();
135+
134136
}
135137

136138
void Board::update_connecting() {}

0 commit comments

Comments
 (0)