|
|
|
|
@ -10,7 +10,7 @@
|
|
|
|
|
#define FET0_PIN 0
|
|
|
|
|
#define FET1_PIN 1
|
|
|
|
|
|
|
|
|
|
#define TIMEOUT 255
|
|
|
|
|
#define TIMEOUT 51 /* 2 seconds */
|
|
|
|
|
|
|
|
|
|
const uint16_t LED_GREEN_TEMP = 300;
|
|
|
|
|
const uint16_t LED_RED_TEMP = 1200;
|
|
|
|
|
@ -171,8 +171,9 @@ void adc_init(void)
|
|
|
|
|
|
|
|
|
|
void heat_init(void)
|
|
|
|
|
{
|
|
|
|
|
TCCR1B = (1 << CS12) | (1 << CS10);/* prescaler / 1024 */
|
|
|
|
|
TCCR1B = (1 << WGM12) | (1 << CS10);/* some mode allowing to set timer TOP, no prescaler */
|
|
|
|
|
TIMSK1 = (1 << TOIE1);/* interupt on overflow */
|
|
|
|
|
OCR1A = 39063;
|
|
|
|
|
/* insert loading of heat setting here */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -204,7 +205,18 @@ int main(void)
|
|
|
|
|
temperature = linearize_temp(adc_sum);
|
|
|
|
|
adc_sum = 0;
|
|
|
|
|
adc_pos = 0;
|
|
|
|
|
heat_output = control_output();
|
|
|
|
|
if(dev_state)
|
|
|
|
|
{
|
|
|
|
|
heat_output = control_output();
|
|
|
|
|
heat_on[0] = 0;
|
|
|
|
|
heat_on[1] = 128;
|
|
|
|
|
heat_off[0] = heat_output;
|
|
|
|
|
heat_off[1] = heat_output + 128;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
heat_on[0] = heat_on[1] = heat_off[0] = heat_off[1] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|