most software todos done

master
Nidan 13 years ago
parent d19215d8e5
commit 4ef00556e7

12
TODO

@ -1,11 +1,11 @@
- entprellung des tasters
- limiter nur bei brownout
- auto-aus nach 2 stunden
- rasten verändern (2.5°C)
- gehäusefüße dran
- temperaturmaximum evtl reduzieren (80°C?) oderauchnicht
- beide temperaturmaxima gleich
- hochlganzpolieren
- hochglanzpolieren
done - entprellung des tasters
done - auto-aus nach 2 stunden
done - rasten verändern (2.5°C)
done - temperaturmaximum evtl reduzieren (80°C?) oderauchnicht
done - beide temperaturmaxima gleich
"Langzeittests"
- maximale temperatur

@ -13,8 +13,9 @@
#define TIMEOUT 51 /* 2 seconds */
const uint16_t LED_GREEN_TEMP = 300;
const uint16_t LED_RED_TEMP = 1000;
#define LED_GREEN_TEMP 300
//#define LED_RED_TEMP 1000
#define LED_RED_TEMP 800
#define TARGET_TEMP_MIN 300
#define TARGET_TEMP_MAX 1520
@ -36,13 +37,20 @@ uint8_t heat_power = 0; // requested heating power; 0..255
uint8_t input_state = 0;
uint8_t dev_state = 0; // whether the device is on or off
#define TOGGLE_TIMEOUT 5
#define TEN_SECONDS 256
#define ONE_MINUTE 1536
#define ONE_HOUR 92160
uint8_t toggle_timeout = 0;
uint16_t startup = TEN_SECONDS;
uint8_t eeprom_write = 0;
#define ONE_MINUTE 1536
uint16_t eeprom_clk = ONE_MINUTE;
uint32_t shutdown = 2 * (uint32_t) ONE_HOUR;
/* gray code to change lookup table, index is old state .. new state */
int8_t state_change[16] = {0, 1, -1, 0, -1, 0, 0, 1, 1, 0, 0, -1, 0, -1, 1, 0};
//int8_t state_change[16] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};
@ -51,6 +59,7 @@ int8_t state_change[16] = {0, 1, -1, 0, -1, 0, 0, 1, 1, 0, 0, -1, 0, -1, 1, 0
ISR(TIM1_OVF_vect)
{
/* timeout for displaying target temperature */
if(toggle_timeout) {toggle_timeout--;}
if(setting_timeout) {setting_timeout--;}
if(startup) {startup--;}
if(eeprom_clk) {eeprom_clk--;}
@ -59,6 +68,8 @@ ISR(TIM1_OVF_vect)
eeprom_write = 1;
eeprom_clk = ONE_MINUTE;
}
if(shutdown) {shutdown--;}
else {dev_state = 0;}
/* incremtening softpwm, toggling output if needed */
heat_pwm++;
@ -92,20 +103,24 @@ ISR(PCINT0_vect)
uint8_t diff = new_state ^ input_state;
if(!diff) {return;}
if(diff & (1 << (TAST_PIN - 1)) && new_state & (1 << (TAST_PIN - 1)))
if(!toggle_timeout && diff & (1 << (TAST_PIN - 1)) && new_state & (1 << (TAST_PIN - 1)))
{
dev_state = !dev_state;
toggle_timeout = TOGGLE_TIMEOUT;
}
int8_t change = state_change[((input_state & 3) << 2) | (new_state & 3)];
if(change)
{
target += change * 10; // 1 celsius per step
if(target < TARGET_TEMP_MIN) {target = TARGET_TEMP_MIN;}
else if(target > TARGET_TEMP_MAX) {target = TARGET_TEMP_MAX;}
target += change * 6;//0.6K * 4 per step 10; // 1 celsius per step
//if(target < TARGET_TEMP_MIN) {target = TARGET_TEMP_MIN;}
//else if(target > TARGET_TEMP_MAX) {target = TARGET_TEMP_MAX;}
if(target < LED_GREEN_TEMP) {target = LED_GREEN_TEMP;}
else if(target > LED_RED_TEMP) {target = LED_RED_TEMP;}
setting_timeout = TIMEOUT;
}
shutdown = 2 * (uint32_t) ONE_HOUR;
input_state = new_state;
}

Loading…
Cancel
Save