01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_adc.c
@@ -304,7 +304,7 @@
    uint32_t u32TempReg = 0;
    float temp_param_k = (m_adc_opt.chip_info >= 0x20) ? (m_adc_opt.ft_version >= 6 ? m_adc_opt.adc_temp_k : 0.35) : -0.69; // t = k * (v - vFT) + tFT
    float voltage = 0;
    float temp_voltage_arr[128];
    float temp_voltage_arr[32];
    // Enable ADC channel 9
    ADC_Open(ADCx, ADC_CHEN_CH9_TMP_Msk);
@@ -328,7 +328,7 @@
    }
    // Start sampling
    for (int i = 0; i < 128; i++) {
    for (int i = 0; i < 32; i++) {
        ADC_StartConvert(ADCx);
        // Wait for sampling done
        while (!ADC_IsDataValid(ADCx)) {
@@ -342,11 +342,11 @@
    ADC_PowerDown(ADCx);
    // Filter out largest 8 and smallest 8 data and calculate average value
    bubble_sort_float(temp_voltage_arr, 128);
    for (int i = 8; i < 120; i++) {
    bubble_sort_float(temp_voltage_arr, 32);
    for (int i = 4; i < 28; i++) {
        voltage += temp_voltage_arr[i];
    }
    voltage /= 112;
    voltage /= 24;
    // Calculate and return current temp by formula: t = k * (v - vFT) + tFT - tDelta
    return temp_param_k * (voltage - (double)m_adc_opt.adc_temp_volt / 10.0) + (double)m_adc_opt.current_temp_value / 100.0