diff --git a/src/display.c b/src/display.c --- a/src/display.c +++ b/src/display.c @@ -39,15 +39,17 @@ static uint8_t reset_mode = RESET_REBOOT // Display state machine -void display_process(therm_status_t* status) +void display_process(void) { + therm_status_t* status = runtime_status(); therm_settings_t* set = flash_getsettings(); + + uint8_t state_changed = status->state != last_state; last_state = status->state; - uint8_t temp_changed = status->temp != last_temp || status->temp_frac != last_temp_frac; + uint8_t temp_changed = status->temp != last_temp; last_temp = status->temp; - last_temp_frac = status->temp_frac; uint8_t sw_btn = !HAL_GPIO_ReadPin(SW_BTN); uint8_t sw_up = !HAL_GPIO_ReadPin(SW_UP); @@ -67,7 +69,7 @@ void display_process(therm_status_t* sta if(temp_changed || state_changed) { char tempstr[6]; - itoa_fp(status->temp, status->temp_frac, tempstr); +// itoa_fp(status->temp, status->temp_frac, tempstr); ssd1306_drawstring("Temp: ", 3, 40); ssd1306_drawstring(" ", 3, 72); ssd1306_drawstring(tempstr, 3, 72); @@ -656,19 +658,18 @@ void display_process(therm_status_t* sta } -static int32_t temp_last = 43002; -static int32_t temp_frac_last = 43002; -static int32_t setpoint_last = 10023; +static float temp_last = 43002.0; +static float setpoint_last = 10023.0; // Draw current setpoint on display static void draw_setpoint(therm_status_t* status) { // FIXME: need to do this when switching modes too - if(status->temp != temp_last || status->temp_frac != temp_frac_last || trigger_drawsetpoint) { - char tempstr[3]; - itoa_fp(status->temp, status->temp_frac, tempstr); - ssd1306_drawstringbig(" ", 3, 0); - ssd1306_drawstringbig(tempstr, 3, 0); - } +// if(status->temp != temp_last || trigger_drawsetpoint) { +// char tempstr[3]; +// itoa_fp(status->temp, status->temp_frac, tempstr); +// ssd1306_drawstringbig(" ", 3, 0); +// ssd1306_drawstringbig(tempstr, 3, 0); +// } if(trigger_drawsetpoint) ssd1306_drawstringbig(">", 3, 74); @@ -683,7 +684,6 @@ static void draw_setpoint(therm_status_t trigger_drawsetpoint = 0; setpoint_last = status->setpoint; temp_last = status->temp; - temp_frac_last = status->temp_frac; } void display_startup_screen() {