2020-04-20 21:16:39 +02:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
* The Reflow Oven Control Firmware 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 the reflow oven controller project.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __OVEN_DRIVER_H__
|
|
|
|
#define __OVEN_DRIVER_H__
|
|
|
|
|
2020-05-05 18:55:55 +02:00
|
|
|
#include <stdint.h>
|
2020-06-13 23:23:59 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <reflow-controller/pid-controller.h>
|
|
|
|
|
2020-06-14 19:09:59 +02:00
|
|
|
enum oven_pid_error_report {
|
|
|
|
OVEN_PID_NO_ERROR = 0,
|
|
|
|
OVEN_PID_ERR_PT1000_ADC_WATCHDOG = (1<<0),
|
|
|
|
OVEN_PID_ERR_PT1000_ADC_OFF = (1<<1),
|
|
|
|
OVEN_PID_ERR_PT1000_OTHER = (1<<2),
|
|
|
|
OVEN_PID_ERR_VREF_TOL = (1<<3),
|
|
|
|
OVEN_PID_ERR_OVERTEMP = (1<<4),
|
|
|
|
};
|
|
|
|
|
|
|
|
struct oven_pid_errors {
|
|
|
|
bool generic_error;
|
|
|
|
bool pt1000_adc_watchdog;
|
|
|
|
bool pt1000_adc_off;
|
|
|
|
bool pt1000_other;
|
|
|
|
bool vref_tol;
|
|
|
|
bool controller_overtemp;
|
|
|
|
};
|
|
|
|
|
2020-06-13 23:23:59 +02:00
|
|
|
struct oven_pid_status {
|
|
|
|
bool active;
|
2020-06-14 23:36:49 +02:00
|
|
|
bool error_set;
|
2020-06-14 19:09:59 +02:00
|
|
|
struct oven_pid_errors error_flags;
|
2020-06-13 23:23:59 +02:00
|
|
|
float target_temp;
|
|
|
|
float current_temp;
|
|
|
|
uint64_t timestamp_last_run;
|
|
|
|
};
|
2020-05-05 18:55:55 +02:00
|
|
|
|
|
|
|
void oven_driver_init(void);
|
|
|
|
|
|
|
|
void oven_driver_set_power(uint8_t power);
|
|
|
|
|
2020-05-10 23:13:03 +02:00
|
|
|
void oven_driver_disable(void);
|
|
|
|
|
2020-06-14 23:36:49 +02:00
|
|
|
void oven_pid_ack_errors(void);
|
|
|
|
|
2020-06-13 23:23:59 +02:00
|
|
|
void oven_pid_init(struct pid_controller *controller_to_copy);
|
|
|
|
|
2020-06-14 19:09:59 +02:00
|
|
|
void oven_pid_handle(float target_temp);
|
2020-06-13 23:23:59 +02:00
|
|
|
|
|
|
|
void oven_pid_stop();
|
|
|
|
|
2020-06-14 19:09:59 +02:00
|
|
|
void oven_pid_report_error(enum oven_pid_error_report report);
|
2020-06-13 23:23:59 +02:00
|
|
|
|
|
|
|
const struct oven_pid_status *oven_pid_get_status(void);
|
|
|
|
|
2020-04-20 21:16:39 +02:00
|
|
|
#endif /* __OVEN_DRIVER_H__ */
|