Changeset - 74b1bacb8466
[Not reviewed]
cortex-f0
0 1 0
Ethan Zonca - 9 years ago 2015-11-28 16:25:57
ez@ethanzonca.com
Default to decent settings
1 file changed with 2 insertions and 2 deletions:
main.c
2
2
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
@@ -34,51 +34,51 @@ int main(void)
 
    gpio_init();
 
 
    // Init USB (TODO: Handle plugged/unplugged with external power)
 
    MX_USB_DEVICE_Init();
 
//    set.val.usb_plugged = 
 
 
    // USB startup delay
 
    HAL_Delay(500);
 
    HAL_GPIO_WritePin(LED_POWER, 1);
 
 
    // Enter into bootloader if up button pressed on boot
 
    if(!HAL_GPIO_ReadPin(SW_UP))
 
        bootloader_enter(); 
 
 
    // Init SPI busses
 
    spi_init();
 
 
    // Init OLED over SPI
 
    ssd1306_init();
 
    ssd1306_clearscreen();
 
   
 
    // Default settings 
 
    set.val.boottobrew = 0;
 
    set.val.temp_units = TEMP_UNITS_FAHRENHEIT;
 
    set.val.windup_guard = 200;
 
    set.val.windup_guard = 10;
 
    set.val.k_p = 10;
 
    set.val.k_i = 10;
 
    set.val.k_i = 1;
 
    set.val.k_d = 1;
 
    set.val.ignore_tc_error = 0;
 
    set.val.setpoint_brew = 70;
 
    set.val.setpoint_steam = 70;
 
 
    // Default status
 
    status.temp = 0;
 
    status.temp_frac = 0;
 
    status.state_resume = 0;
 
    status.state = STATE_IDLE;
 
    status.setpoint = 70;
 
    status.pid_enabled = 0;
 
 
    // Go to brew instead of idle if configured thusly
 
    if(set.val.boottobrew)
 
      status.state = STATE_PREHEAT; 
 
 
    // Startup screen 
 
    ssd1306_drawstring("therm v0.2", 1, 40);
 
    ssd1306_drawstring("protofusion.org/therm", 3, 0);
 
 
    HAL_Delay(1000);
 
 
    // Restore settings from flash memory
0 comments (0 inline, 0 general)