# HG changeset patch # User Ethan Zonca # Date 2015-01-02 23:40:21 # Node ID 7ddd50ea7e9a70b4be17fc780d14140d71d7bde3 # Parent 0ac9c0fc6e354124692ecf68d653e9afc462410a Clear screen when switching state, etc diff --git a/main.c b/main.c --- a/main.c +++ b/main.c @@ -144,6 +144,7 @@ int main(void) // Read temperature and update global temp vars int32_t temp = 0; uint8_t temp_frac = 0; +uint8_t state_resume = 0; void update_temp() { // Assert CS @@ -160,6 +161,7 @@ void update_temp() { state = STATE_TC_ERROR; } else if(temp_pre & 0b0000000000000001 && !ignore_tc_error) { + state_resume = state; state = STATE_TC_ERROR; temp = 0; temp_frac = 0; @@ -167,7 +169,10 @@ void update_temp() { else { if(state == STATE_TC_ERROR) - state = STATE_IDLE; + { + state = state_resume; + ssd1306_clearscreen(); + } uint8_t sign = temp >> 15;// top bit is sign