Log cached connector temperature and ADC freshness while charging (v1.0.38)

This commit is contained in:
raduet committed 2026-10-13 14:02:52 +02:00
1 parent 10691b77f2
commit 3b04e532af
11 files changed
+9605 -9410

No files matched your search

+12
View File
@@ -9,6 +9,17 @@
static volatile uint16_t adc_dma_raw[6];
volatile ADC_ScanData_t adc_data = {0};
static volatile uint8_t adc_scan_data_ready = 0u;
static volatile uint32_t adc_scan_sample_ms;
uint32_t ADC_GetScanAgeMs(void)
{
if (!adc_scan_data_ready) {
return UINT32_MAX;
}
/* Read the ISR timestamp before now: a scan between reads cannot underflow. */
const uint32_t sample_ms = adc_scan_sample_ms;
return HAL_GetTick() - sample_ms;
}
void ADC_ScanStart(void)
{
@@ -31,6 +42,7 @@ ISR_FAST void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
adc_data.ntc2_raw = adc_dma_raw[3];
adc_data.temp_sensor_raw = adc_dma_raw[4];
adc_data.vrefint_raw = adc_dma_raw[5];
adc_scan_sample_ms = HAL_GetTick();
adc_scan_data_ready = 1u;
}