Add deactivated PT1000 measurement as error flag, startcode for calibration routine

This commit is contained in:
2020-02-15 01:04:40 +01:00
parent b497537a78
commit 5a00950589
8 changed files with 228 additions and 36 deletions

View File

@@ -39,7 +39,7 @@
*/
#define ADC_PT1000_UPPER_WATCHDOG 4000U
enum adc_pt1000_error {ADC_PT1000_NO_ERR= 0, ADC_PT1000_WATCHDOG_ERROR=(1UL<<0), ADC_PT1000_OVERFLOW=(1UL<<1)};
enum adc_pt1000_error {ADC_PT1000_NO_ERR= 0, ADC_PT1000_WATCHDOG_ERROR=(1UL<<0), ADC_PT1000_OVERFLOW=(1UL<<1), ADC_PT1000_INACTIVE = (1UL<<2)};
/**
* @brief This function sets up the ADC measurement fo the external PT1000 temperature sensor
@@ -102,16 +102,12 @@ int adc_pt1000_get_current_resistance(float *resistance);
/**
* @brief Stream the raw ADC data to an array in memory.
*
* Streaming is done using DMA2 Stream0.
* This function is used for gathering fullspeed sampling data for external interfaces or calibration
*
* @param adc_array Array to stream data to
* @param length Amount of data points to be measured
* @param flag_to_set This flag is set to 1 once the data has been measured and is transferred. A negative value indicates an error
* @return 0 if measurement could be started
*/
int adc_pt1000_stream_raw_value_to_memory(float *adc_array, uint32_t length, volatile uint8_t *flag_to_set);
int adc_pt1000_stream_raw_value_to_memory(volatile float *adc_array, uint32_t length, volatile int *flag_to_set);
void adc_pt1000_convert_raw_value_array_to_resistance(float *resistance_dest, float *raw_source, uint32_t count);

View File

@@ -0,0 +1,32 @@
/* Reflow Oven Controller
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* GDSII-Converter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CALIBRATION_H__
#define __CALIBRATION_H__
#define CALIBRATION_MAX_STDDEV_OHM 1.0f
#include <stdint.h>
void calibration_calculate(float low_measured, float low_setpoint, float high_measured, float high_setpoint,
float *sens_deviation, float *sens_corrected_offset);
int calibration_acquire_data(float *mu, float *sigma, uint32_t count);
#endif /* __CALIBRATION_H__ */