@@ -341,8 +341,7 @@ void display_process(therm_settings_t* s
// Button handler
if(SW_BTN_PRESSED) {
save_settings();
status->state = STATE_IDLE;
status->state = STATE_SETTEMPOFFSET;
}
else if(!HAL_GPIO_ReadPin(SW_UP)) {
set->temp_units = TEMP_UNITS_FAHRENHEIT;
@@ -357,6 +356,37 @@ void display_process(therm_settings_t* s
} break;
case STATE_SETTEMPOFFSET:
{
// Write text to OLED
// [ therm :: set temp offset ]
// [ g = 12 ]
ssd1306_DrawString("Thermocouple Offset", 0, 40);
ssd1306_drawlogo();
char tempstr[6];
itoa(set->temp_offset, tempstr, 10);
ssd1306_DrawString("O=", 1, 45);
ssd1306_DrawString(" ", 1, 57);
ssd1306_DrawString(tempstr, 1, 57);
ssd1306_DrawString("Press to accept", 3, 40);
else {
user_input_signed(&set->temp_offset);
// Event Handler
// N/A
case STATE_PREHEAT_BREW:
@@ -20,6 +20,21 @@ void user_input(uint16_t* to_modify)
void user_input_signed(int16_t* to_modify)
// TODO: Bounds check on int16_t
if(CHANGE_ELAPSED) {
if(!HAL_GPIO_ReadPin(SW_UP) ) {
CHANGE_RESET;
(*to_modify)++;
else if(!HAL_GPIO_ReadPin(SW_DOWN)) {
(*to_modify)--;
void init_gpio(void) {
@@ -9,6 +9,7 @@
void user_input(uint16_t* to_modify);
void user_input_signed(int16_t* to_modify);
void init_gpio(void);
#endif
@@ -206,12 +206,14 @@ void update_temp() {
status.temp += 3200;
status.temp_frac = status.temp % 100;
status.temp /= 100;
status.temp += set.temp_offset;
// Use Celsius values
else
status.temp = temp_pre * signint;
@@ -17,6 +17,7 @@ typedef struct {
uint16_t k_p;
uint16_t k_i;
uint16_t k_d;
int16_t temp_offset;
uint8_t ignore_tc_error;
int16_t setpoint_brew;
int16_t setpoint_steam;
@@ -39,6 +40,7 @@ enum state {
STATE_SETWINDUP,
STATE_SETBOOTTOBREW,
STATE_SETUNITS,
STATE_SETTEMPOFFSET,
STATE_PREHEAT_BREW,
STATE_MAINTAIN_BREW,
Status change: