Manage temperature sensors.
More...
#include "temp.h"
#include <stdlib.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>
#include "arduino.h"
#include "delay.h"
#include "debug.h"
#include "sersendf.h"
#include "heater.h"
#include "config.h"
Data Structures |
struct | temp_sensor_definition_t |
| holds metadata for each temperature sensor More...
|
Defines |
#define | DEFINE_TEMP_SENSOR(name, type, pin) { (type), (pin), (HEATER_ ## name) }, |
| help build list of sensors from entries in config.h
|
Enumerations |
enum | temp_flags_enum { PRESENT,
TCOPEN,
PRESENT,
TCOPEN
} |
Functions |
void | temp_init () |
| set up temp sensors. Currently only the 'intercom' sensor needs initialisation.
|
void | temp_sensor_tick () |
| called every 10ms from clock.c - check all temp sensors that are ready for checking
|
uint8_t | temp_achieved () |
| report whether all temp sensors are reading their target temperatures used for M109 and friends
|
void | temp_set (temp_sensor_t index, uint16_t temperature) |
| specify a target temperature
|
uint16_t | temp_get (temp_sensor_t index) |
| return most recent reading for a sensor
|
void | temp_print (temp_sensor_t index) |
| send temperatures to host
|
Variables |
struct { |
temp_flags_enum temp_flags |
| flags
|
uint16_t last_read_temp |
| last received reading
|
uint16_t target_temp |
| manipulate attached heater to attempt to achieve this value
|
uint8_t temp_residency |
| how long have we been close to target temperature?
|
uint16_t next_read_time |
| how long until we can read this sensor again?
|
} | temp_sensors_runtime [NUM_TEMP_SENSORS] |
Detailed Description
Manage temperature sensors.
- Note:
- ALL temperatures are stored as 14.2 fixed point in teacup, so we have a range of 0 - 16383.75 celsius and a precision of 0.25 celsius. That includes the ThermistorTable, which is why you can't copy and paste one from other firmwares which don't do this.
Function Documentation
uint16_t temp_get |
( |
temp_sensor_t |
index ) |
|
return most recent reading for a sensor
- Parameters:
-
void temp_print |
( |
temp_sensor_t |
index ) |
|
send temperatures to host
- Parameters:
-
index | sensor value to send |
void temp_set |
( |
temp_sensor_t |
index, |
|
|
uint16_t |
temperature |
|
) |
| |
specify a target temperature
- Parameters:
-
index | sensor to set a target for |
temperature | target temperature to aim for |