thermistor_t therm_hotend;
thermistor_t therm_hotbed;
+thermistor_t therm_spare;
button_t button;
uart_pty_t uart_pty;
int do_button_press = 0;
uart_pty_init(avr, &uart_pty);
uart_pty_connect(&uart_pty, '0');
- thermistor_init(avr, &therm_hotend, TEMP_0_PIN,
- (short*)temptable_5, sizeof(temptable_5) / sizeof(short) / 2, OVERSAMPLENR, 22.5f);
- thermistor_init(avr, &therm_hotbed, TEMP_BED_PIN,
- (short*)temptable_5, sizeof(temptable_5) / sizeof(short) / 2, OVERSAMPLENR, 22.0f);
+ thermistor_init(avr, &therm_hotend, 0,
+ (short*)temptable_5, sizeof(temptable_5) / sizeof(short) / 2, OVERSAMPLENR, 25.0f);
+ thermistor_init(avr, &therm_hotbed, 2,
+ (short*)temptable_5, sizeof(temptable_5) / sizeof(short) / 2, OVERSAMPLENR, 30.0f);
+ thermistor_init(avr, &therm_spare, 1,
+ (short*)temptable_5, sizeof(temptable_5) / sizeof(short) / 2, OVERSAMPLENR, 10.0f);
/*
* OpenGL init, can be ignored
#include "thermistor.h"
/*
- * called when a byte is send via the uart on the AVR
+ * called the ADC could use a new value
+ * The value returned is NOT in "ADC" mode, it's in millivolts
*/
static void thermistor_in_hook(struct avr_irq_t * irq, uint32_t value, void * param)
{
short *t = p->table;
for (int ei = 0; ei < p->table_entries; ei++, t += 2) {
- if (t[1] < p->current) {
- printf("%s(%2d) %.2f matches %3dC is %d adc\n", __func__, v.src,
- p->current, t[1], t[0] / p->oversampling);
- avr_raise_irq(p->irq + IRQ_TERM_ADC_VALUE_OUT, t[0] / p->oversampling);
+ if (t[1] <= p->current) {
+ // printf("%s(%2d) %.2f matches %3dC is %d adc\n", __func__, v.src,
+ // p->current, t[1], t[0] / p->oversampling);
+ avr_raise_irq(p->irq + IRQ_TERM_ADC_VALUE_OUT,
+ ((t[0] / p->oversampling) * 5000) / 0x3ff);
return;
}
}