From 0cb518c10d669d6f0e9b8dea80de8d7735ef670f Mon Sep 17 00:00:00 2001 From: Moritz Ruffer Date: Fri, 28 Mar 2025 16:35:39 +0100 Subject: [PATCH] changed function names --- AMS_Master_Code/Core/Inc/NTC.h | 6 +++--- .../Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AMS_Master_Code/Core/Inc/NTC.h b/AMS_Master_Code/Core/Inc/NTC.h index 8317703..b6eef11 100644 --- a/AMS_Master_Code/Core/Inc/NTC.h +++ b/AMS_Master_Code/Core/Inc/NTC.h @@ -20,7 +20,7 @@ // With R_T/R_0 and R_0 = R_T@25C // R_T/R_0 = 1 / V_REF / ADC - 1 -static inline uint16_t ntc_mv_to_celsius(int16_t adc_codes) { +static inline uint16_t ntc_adc_to_celsius(int16_t adc_codes) { // Calculate voltage from ADC int16_t adc_mV = mV_from_ADBMS6830(adc_codes); @@ -31,10 +31,10 @@ static inline uint16_t ntc_mv_to_celsius(int16_t adc_codes) { #else #include "tempTable.h" -static inline uint16_t ntc_mv_to_celsius(int16_t adc_codes) { +static inline uint16_t ntc_adc_to_celsius(int16_t adc_codes) { // Out of bounds checking --> done by OV/UV setting of the BMS? if (adc_codes < -6355 || adc_codes > 4640) { - // not really a good idea, still working on it + // should trigger overtemp, right? return -1; } return ADC2TEMP[adc_codes + 6355]; diff --git a/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c b/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c index 373fb92..2204cc6 100644 --- a/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c +++ b/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c @@ -140,7 +140,7 @@ HAL_StatusTypeDef amsAuxAndStatusMeasurement(Cell_Module (*module)[N_BMS]) { for (size_t i = 0; i < N_BMS; i++) { size_t offset = BUFFER_BMS_OFFSET(i, auxGroupSizes[group]); for (size_t j = 0; j < auxVoltagesPerGroup[group]; j++) { - (*module)[i].cellTemps[group * 3 + j] = ntc_mv_to_celsius(rxbuf[offset + j * 2] | (rxbuf[offset + j * 2 + 1] << 8)); + (*module)[i].cellTemps[group * 3 + j] = ntc_adc_to_celsius(rxbuf[offset + j * 2] | (rxbuf[offset + j * 2 + 1] << 8)); // (*module)[i].auxVoltages[group * 3 + j] = mV_from_ADBMS6830(rxbuf[offset + j * 2] | (rxbuf[offset + j * 2 + 1] << 8)); // (*module)[i].cellTemps[group * 3 + j] = ntc_mv_to_celsius((*module)[i].auxVoltages[group * 3 + j]); }