diff --git a/display.c b/display.c --- a/display.c +++ b/display.c @@ -103,7 +103,7 @@ void display_process(therm_settings_t* s break; case 0: status->state = STATE_IDLE; - flash_erase(set); + //flash_erase(); NVIC_SystemReset(); break; @@ -133,7 +133,7 @@ void display_process(therm_settings_t* s ssd1306_drawlogo(); char tempstr[6]; - itoa(set->k_p, tempstr, 10); + itoa(set->val.k_p, tempstr, 10); ssd1306_DrawString("P=", 1, 45); ssd1306_DrawString(" ", 1, 57); ssd1306_DrawString(tempstr, 1, 57); @@ -145,7 +145,7 @@ void display_process(therm_settings_t* s status->state = STATE_SETI; } else { - user_input(&set->k_p); + user_input(&set->val.k_p); } // Event Handler @@ -162,7 +162,7 @@ void display_process(therm_settings_t* s ssd1306_drawlogo(); char tempstr[6]; - itoa(set->k_i, tempstr, 10); + itoa(set->val.k_i, tempstr, 10); ssd1306_DrawString("I=", 1, 45); ssd1306_DrawString(" ", 1, 57); ssd1306_DrawString(tempstr, 1, 57); @@ -174,7 +174,7 @@ void display_process(therm_settings_t* s status->state = STATE_SETD; } else { - user_input(&set->k_i); + user_input(&set->val.k_i); } // Event Handler @@ -191,7 +191,7 @@ void display_process(therm_settings_t* s ssd1306_drawlogo(); char tempstr[6]; - itoa(set->k_d, tempstr, 10); + itoa(set->val.k_d, tempstr, 10); ssd1306_DrawString("D=", 1, 45); ssd1306_DrawString(" ", 1, 57); ssd1306_DrawString(tempstr, 1, 57); @@ -203,7 +203,7 @@ void display_process(therm_settings_t* s status->state = STATE_SETWINDUP; } else { - user_input(&set->k_d); + user_input(&set->val.k_d); } // Event Handler @@ -220,7 +220,7 @@ void display_process(therm_settings_t* s ssd1306_drawlogo(); char tempstr[6]; - itoa(set->windup_guard, tempstr, 10); + itoa(set->val.windup_guard, tempstr, 10); ssd1306_DrawString("G=", 1, 45); ssd1306_DrawString(" ", 1, 57); ssd1306_DrawString(tempstr, 1, 57); @@ -232,7 +232,7 @@ void display_process(therm_settings_t* s status->state = STATE_SETBOOTTOBREW; } else { - user_input(&set->windup_guard); + user_input(&set->val.windup_guard); } // Event Handler @@ -250,7 +250,7 @@ void display_process(therm_settings_t* s ssd1306_DrawString("sob=", 1, 45); - if(set->boottobrew) + if(set->val.boottobrew) ssd1306_DrawString("Enabled ", 1, 70); else ssd1306_DrawString("Disabled", 1, 70); @@ -262,10 +262,10 @@ void display_process(therm_settings_t* s status->state = STATE_SETUNITS; } else if(!HAL_GPIO_ReadPin(SW_UP)) { - set->boottobrew = 1; + set->val.boottobrew = 1; } else if(!HAL_GPIO_ReadPin(SW_DOWN)) { - set->boottobrew = 0; + set->val.boottobrew = 0; } // Event Handler @@ -281,7 +281,7 @@ void display_process(therm_settings_t* s ssd1306_DrawString("Units: ", 0, 40); ssd1306_drawlogo(); - if(set->temp_units == TEMP_UNITS_FAHRENHEIT) + if(set->val.temp_units == TEMP_UNITS_FAHRENHEIT) ssd1306_DrawString("Fahrenheit", 1, 60); else ssd1306_DrawString("Celsius ", 1, 60); @@ -293,10 +293,10 @@ void display_process(therm_settings_t* s status->state = STATE_SETTEMPOFFSET; } else if(!HAL_GPIO_ReadPin(SW_UP)) { - set->temp_units = TEMP_UNITS_FAHRENHEIT; + set->val.temp_units = TEMP_UNITS_FAHRENHEIT; } else if(!HAL_GPIO_ReadPin(SW_DOWN)) { - set->temp_units = TEMP_UNITS_CELSIUS; + set->val.temp_units = TEMP_UNITS_CELSIUS; } // Event Handler @@ -314,7 +314,7 @@ void display_process(therm_settings_t* s ssd1306_drawlogo(); char tempstr[6]; - itoa(set->temp_offset, tempstr, 10); + itoa(set->val.temp_offset, tempstr, 10); ssd1306_DrawString("O=", 1, 45); ssd1306_DrawString(" ", 1, 57); ssd1306_DrawString(tempstr, 1, 57); @@ -327,7 +327,7 @@ void display_process(therm_settings_t* s status->state = STATE_IDLE; } else { - user_input_signed(&set->temp_offset); + user_input_signed(&set->val.temp_offset); } // Event Handler @@ -346,7 +346,7 @@ void display_process(therm_settings_t* s draw_setpoint(status); status->pid_enabled = 1; - status->setpoint = set->setpoint_brew; + status->setpoint = set->val.setpoint_brew; // Button handler if(SW_BTN_PRESSED) { @@ -354,7 +354,7 @@ void display_process(therm_settings_t* s status->state = STATE_IDLE; } else { - user_input(&set->setpoint_brew); + user_input(&set->val.setpoint_brew); } // Event Handler @@ -373,7 +373,7 @@ void display_process(therm_settings_t* s //ssd1306_drawlogo(); draw_setpoint(status); status->pid_enabled = 1; - status->setpoint = set->setpoint_brew; + status->setpoint = set->val.setpoint_brew; // Button handler if(SW_BTN_PRESSED) { @@ -381,7 +381,7 @@ void display_process(therm_settings_t* s status->state = STATE_IDLE; } else { - user_input(&set->setpoint_brew); + user_input(&set->val.setpoint_brew); } // Event Handler @@ -398,7 +398,7 @@ void display_process(therm_settings_t* s //ssd1306_drawlogo(); draw_setpoint(status); status->pid_enabled = 1; - status->setpoint = set->setpoint_steam; + status->setpoint = set->val.setpoint_steam; // Button handler if(SW_BTN_PRESSED) { @@ -406,7 +406,7 @@ void display_process(therm_settings_t* s save_setpoints(&set); // TODO: Check for mod } else { - user_input(&set->setpoint_steam); + user_input(&set->val.setpoint_steam); } // Event Handler @@ -425,7 +425,7 @@ void display_process(therm_settings_t* s //ssd1306_drawlogo(); draw_setpoint(status); status->pid_enabled = 1; - status->setpoint = set->setpoint_steam; + status->setpoint = set->val.setpoint_steam; // Button handler if(SW_BTN_PRESSED) { @@ -433,7 +433,7 @@ void display_process(therm_settings_t* s save_setpoints(&set); // TODO: Check for mod } else { - user_input(&set->setpoint_steam); + user_input(&set->val.setpoint_steam); } // Event Handler @@ -470,7 +470,7 @@ void display_process(therm_settings_t* s status->state = STATE_IDLE; } else if(SW_RIGHT_PRESSED) { - set->ignore_tc_error = 1; + set->val.ignore_tc_error = 1; status->state = STATE_IDLE; } // Event Handler