Merge branch 'edge' into multitool
[clinton/Smoothieware.git] / src / modules / tools / temperaturecontrol / Thermistor.h
CommitLineData
9d955060 1/*
2 this file is part of smoothie (http://smoothieware.org/). the motion control part is heavily based on grbl (https://github.com/simen/grbl).
3 smoothie is free software: you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation, either version 3 of the license, or (at your option) any later version.
4 smoothie 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.
5 you should have received a copy of the gnu general public license along with smoothie. if not, see <http://www.gnu.org/licenses/>.
6*/
7
8#ifndef thermistor_h
9#define thermistor_h
10
11#include "TempSensor.h"
12#include "RingBuffer.h"
13
67bcde10 14#define QUEUE_LEN 32
9d955060 15
16
17class Thermistor : public TempSensor
18{
19 public:
d8baddd9 20 Thermistor();
21 ~Thermistor();
22
23 // TempSensor interface.
24 void UpdateConfig(uint16_t module_checksum, uint16_t name_checksum);
9d955060 25 float get_temperature();
d8baddd9 26
9d955060 27 private:
d8baddd9 28 int new_thermistor_reading();
9d955060 29 float adc_value_to_temperature(int adc_value);
30
31 // Thermistor computation settings
32 float r0;
33 float t0;
34 int r1;
35 int r2;
36 float beta;
37 float j;
38 float k;
39
40 Pin thermistor_pin;
41
42 RingBuffer<uint16_t,QUEUE_LEN> queue; // Queue of readings
43 uint16_t median_buffer[QUEUE_LEN];
d8baddd9 44
9d955060 45};
46
47#endif