changed function names
This commit is contained in:
parent
de68618667
commit
0cb518c10d
@ -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];
|
||||
|
@ -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]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user