diff --git a/src/temp_sensor.c b/src/temp_sensor.c index 6c65ad7..df3c0f4 100644 --- a/src/temp_sensor.c +++ b/src/temp_sensor.c @@ -7,7 +7,7 @@ #include #include -#define ADC_NUM_CHANNELS 2 +#define ADC_NUM_CHANNELS 1 static volatile int16_t adc_values[ADC_NUM_CHANNELS]; static fxp_t m_temperature_internal = 0; @@ -49,7 +49,7 @@ static fxp_t calc_temperature_ntc(uint16_t adc_val) // note: all resistor values in kΩ! The factor 1000 is removed from the numbers! static const fxp_t ln_r_ntc_nom = 252323; // ln(47 kΩ) converted to fxp_t with 16 fractional bits static const fxp_t r1 = FXP_FROM_INT(10); - static const fxp_t b_constant = FXP_FROM_INT(4125); + static const fxp_t b_constant = FXP_FROM_INT(4450); static const fxp_t ntc_temp_nom_inv = 220; // 1/(273.15+25) * 2**16 static const fxp_t celsius2kelvin = 17901158; // (273.15) * 2**16 @@ -76,7 +76,7 @@ void temp_sensor_init(void) { uint8_t channels[ADC_NUM_CHANNELS] = { 0, // The NTC is connected to ADC_IN0 - ADC_CHANNEL_TEMP // Temperature sensor + //ADC_CHANNEL_TEMP // Temperature sensor }; // Prepare the ADC @@ -101,7 +101,7 @@ void temp_sensor_init(void) // configure DMA for ADC //nvic_enable_irq(NVIC_DMA1_CHANNEL1_IRQ); - //dma_channel_reset(DMA1, DMA_CHANNEL1); + dma_channel_reset(DMA1, DMA_CHANNEL1); dma_set_priority(DMA1, DMA_CHANNEL1, DMA_CCR_PL_LOW); dma_set_memory_size(DMA1, DMA_CHANNEL1, DMA_CCR_MSIZE_16BIT); dma_set_peripheral_size(DMA1, DMA_CHANNEL1, DMA_CCR_PSIZE_16BIT); @@ -136,7 +136,7 @@ bool temp_sensor_has_new_values(void) // calculate temperature values and cache them. m_temperature_ntc = calc_temperature_ntc(adc_values[0]); - m_temperature_internal = calc_temperature(adc_values[1]); + //m_temperature_internal = calc_temperature(adc_values[1]); return true; } else { return false;