Changeset - bdb054218ca3
[Not reviewed]
default
0 1 0
Ethan Zonca - 10 years ago 2014-09-03 22:37:07
ez@ethanzonca.com
Remove debug output and enable boot to brew functionality
1 file changed with 5 insertions and 10 deletions:
main.c
5
10
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
@@ -42,12 +42,13 @@ enum state {
 
    STATE_PREHEAT_BREW,
 
    STATE_MAINTAIN_BREW,
 
    STATE_PREHEAT_STEAM,
 
    STATE_MAINTAIN_STEAM,
 
};
 
 
uint8_t state = STATE_IDLE;
 
 
static __IO uint32_t TimingDelay;
 
 
// Move to header file
 
void init_gpio();
 
void init_spi();
 
@@ -90,16 +91,16 @@ int main(void)
 
 
    // Startup screen 
 
    ssd1306_DrawString("therm v0.1", 1, 40);
 
    ssd1306_DrawString("protofusion.org/therm", 3, 0);
 
    delay(1500);
 
    ssd1306_clearscreen();
 
    
 
    restore_settings();
 
    delay(1500);
 
    delay(1500);
 
    ssd1306_clearscreen();
 
    if(boottobrew)
 
      state = STATE_PREHEAT_BREW; // Go to brew instead of idle if configured thusly
 
 
    GPIO_ResetBits(LED_STAT);
 
 
    // Main loop
 
    while(1)
 
    {
 
@@ -274,13 +275,12 @@ void draw_setpoint() {
 
    ssd1306_DrawString("-> ", 3, 80);
 
    itoa(setpoint, tempstr);
 
    ssd1306_DrawString("    ", 3, 95);
 
    ssd1306_DrawString(tempstr, 3, 95);
 
}
 
 
uint8_t state = STATE_IDLE;
 
uint8_t goto_mode = 2;
 
 
// State machine
 
uint8_t sw_btn_last = 0;
 
uint8_t sw_up_last = 0;
 
uint8_t sw_down_last = 0;
 
@@ -317,12 +317,13 @@ void save_settings()
 
    DATA_EEPROM_ProgramWord(EEPROM_ADDR_K_I, k_i);
 
    DATA_EEPROM_ProgramWord(EEPROM_ADDR_K_D, k_d);
 
    DATA_EEPROM_Lock();
 
 
}
 
 
// TODO: Save/restore temperature setpoint settings
 
void restore_settings()
 
{
 
    DATA_EEPROM_Unlock();
 
    while(FLASH_GetStatus()==FLASH_BUSY);
 
    boottobrew = (*(__IO uint32_t*)EEPROM_ADDR_BOOTTOBREW);
 
    
 
@@ -336,18 +337,12 @@ void restore_settings()
 
    k_i = (*(__IO uint32_t*)EEPROM_ADDR_K_I);
 
 
    while(FLASH_GetStatus()==FLASH_BUSY);
 
    k_d = (*(__IO uint32_t*)EEPROM_ADDR_K_D);
 
    
 
    DATA_EEPROM_Lock();
 
 
    char tempstr[6];
 
    itoa(windup_guard, tempstr);
 
    ssd1306_DrawString("Read: ", 3, 40);
 
    ssd1306_DrawString("    ", 3, 72);
 
    ssd1306_DrawString(tempstr, 3, 72);
 
}
 
 
void machine()
 
{
 
    uint8_t last_state = state;
 
0 comments (0 inline, 0 general)