Skip to content

Commit

Permalink
removed diagnosticsModeRequest jsoncan bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiaswong6 committed Jan 21, 2025
1 parent ee3e0ba commit b0c73d3
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 74 deletions.
3 changes: 1 addition & 2 deletions can_bus/quadruna/BMS/BMS_rx.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"Debug_CanMode",
"Debug_CellBalancing",
"Debug_ResetSoc",
"Debug_SetBSPDTestCurrent",
"Debug_CellDiagnostics"
"Debug_SetBSPDTestCurrent"
]
}
10 changes: 0 additions & 10 deletions can_bus/quadruna/Debug/Debug_tx.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,5 @@
"bits": 1
}
}
},
"CellDiagnostics": {
"msg_id": 707,
"cycle_time": 1000,
"description": "Signals ",
"signals": {
"BMSDiagnosticsRequest": {
"bits": 1
}
}
}
}
22 changes: 0 additions & 22 deletions firmware/quadruna/BMS/src/app/app_diagnosticsMode.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ void app_diagnosticsMode_calculateDiagnosticTemperatureStats(void)
}
}

void invalidateSegment(uint8_t segment)
{
for (uint8_t cell = 0; cell < 16; cell++)
{
cellVoltageSetters[segment][cell]((float)-0.1);
}
}

void app_diagnosticsMode_broadcast(void)
{
// Update all cell voltages
Expand All @@ -103,17 +95,3 @@ void app_diagnosticsMode_broadcast(void)
app_canTx_BMS_Seg3_Temp_set(segment_temps[3]);
app_canTx_BMS_Seg4_Temp_set(segment_temps[4]);
}

void app_diagnosticsMode_invalidateValues(void)
{
for (uint8_t segment = 0; segment < 5; segment++)
{
invalidateSegment(segment);
}

app_canTx_BMS_Seg0_Temp_set(-1);
app_canTx_BMS_Seg1_Temp_set(-1);
app_canTx_BMS_Seg2_Temp_set(-1);
app_canTx_BMS_Seg3_Temp_set(-1);
app_canTx_BMS_Seg4_Temp_set(-1);
}
10 changes: 1 addition & 9 deletions firmware/quadruna/BMS/src/app/states/app_allStates.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,7 @@ bool app_allStates_runOnTick100Hz(void)
app_airs_broadcast();
app_shdnLoop_broadcast();

bool diagnostics_mode_enabled = app_canRx_Debug_BMSDiagnosticsRequest_get();
if (diagnostics_mode_enabled)
{
app_diagnosticsMode_broadcast();
}
else
{
app_diagnosticsMode_invalidateValues();
}
app_diagnosticsMode_broadcast();

if (io_airs_isNegativeClosed() && io_airs_isPositiveClosed())
{
Expand Down
31 changes: 0 additions & 31 deletions firmware/quadruna/BMS/test/test_diagnosticsMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ TEST_F(BmsFaultTest, check_cell_voltage_segment0_cell0)
// Passing time to let the message transmit.
LetTimePass(1000);

// Reciving and transmitting the data.
app_canRx_Debug_BMSDiagnosticsRequest_update(true);

// Passing time to let the message transmit.
LetTimePass(1000);

Expand All @@ -41,37 +38,9 @@ TEST_F(BmsFaultTest, check_temperature_segment0)
// Passing time to let the message transmit.
LetTimePass(1000);

// Reciving and transmitting the data.
app_canRx_Debug_BMSDiagnosticsRequest_update(true);

// Passing time to let the message transmit.
LetTimePass(1000);

// Test assertion.
ASSERT_EQ(fake_temperature, app_canTx_BMS_Seg0_Temp_get());
}

TEST_F(BmsFaultTest, check_diagnostics_mode_is_off_on)
{
/**
* Test that voltage and temperature readings are negative (invalid values)
* when BMSDiagnosticsRequest is falseß
*/

// Setting up the environment.
float fake_voltage = 3.0f;
fake_io_ltc6813CellVoltages_getCellVoltage_returnsForAnyArgs(fake_voltage);

// Passing time to let the message transmit.
LetTimePass(1000);

// Reciving and transmitting the data.
app_canRx_Debug_BMSDiagnosticsRequest_update(false);

// Passing time to let the message transmit.
LetTimePass(1000);

// Test assertion.
ASSERT_EQ((float)-0.1, app_canTx_BMS_Seg0_Cell0_Voltage_get());
ASSERT_EQ(-1, app_canTx_BMS_Seg0_Temp_get());
}

0 comments on commit b0c73d3

Please sign in to comment.