# HG changeset patch # User Ethan Zonca # Date 2015-06-01 17:18:30 # Node ID f4ef22eb5176a43762cf98bb184f79ff2badcad8 # Parent e28695e6887c4f9b6e52dd3b21cc82771b55dc81 Added support for detecting which thermocouple error occurred diff --git a/display.c b/display.c --- a/display.c +++ b/display.c @@ -498,7 +498,14 @@ void display_process(therm_settings_t* s // [ therm : ready to steam ] // [ 30 => 120 C ] ssd1306_DrawString("Error:", 0, 0); - ssd1306_DrawString("Connect thermocouple", 1, 0); + + if(status->tc_errno == 1) + ssd1306_DrawString("#1, Check Sensor", 1, 0); + else if(status->tc_errno == 4) + ssd1306_DrawString("#4, Check Sensor", 1, 0); + else + ssd1306_DrawString("#?, Unknown Error", 1, 0); + ssd1306_DrawString("Press -> to ignore", 3, 0); // Button handler diff --git a/main.c b/main.c --- a/main.c +++ b/main.c @@ -162,13 +162,15 @@ void update_temp() { if(temp_pre & 0b0000000000000010) { ssd1306_clearscreen(); - //ssd1306_DrawString("Fatal Error", 3, 35); - HAL_Delay(100); + HAL_Delay(100); // FIXME: remove? + status.tc_errno = 4; status.state = STATE_TC_ERROR; status.temp = 0; status.temp_frac = 0; } else if(temp_pre & 0b0000000000000001 && !set.ignore_tc_error) { + status.tc_errno = 1; + HAL_Delay(100); // FIXME: remove? status.state_resume = status.state; status.state = STATE_TC_ERROR; status.temp = 0; diff --git a/states.h b/states.h --- a/states.h +++ b/states.h @@ -8,6 +8,7 @@ typedef struct { uint8_t state; int32_t setpoint; uint8_t pid_enabled; + uint8_t tc_errno; } therm_status_t; typedef struct {