diff --git a/main.c b/main.c --- a/main.c +++ b/main.c @@ -247,6 +247,20 @@ enum state { }; +void draw_setpoint() { + char tempstr[3]; + itoa_fp(temp, temp_frac, tempstr); + ssd1306_DrawString(" ", 3, 40); + ssd1306_DrawString(tempstr, 3, 40); + ssd1306_DrawString("-> ", 3, 40); + itoa(setpoint, tempstr); + ssd1306_DrawString(" ", 3, 70); + ssd1306_DrawString(tempstr, 3, 70); +} + + + + uint8_t state = STATE_IDLE; uint8_t goto_mode = 2; @@ -264,7 +278,7 @@ void machine() // [ therm :: idle ] ssd1306_DrawString("therm :: idle ", 0, 40); - char tempstr[5]; + char tempstr[6]; itoa_fp(temp, temp_frac, tempstr); ssd1306_DrawString("Temp: ", 3, 40); ssd1306_DrawString(" ", 3, 70); @@ -418,6 +432,7 @@ void machine() // [ therm : preheating brew ] // [ 30 => 120 C ] ssd1306_DrawString("Preheating...", 0, 40); + draw_setpoint(); // Button handler if(!GPIO_ReadInputDataBit(SW_BTN)) { @@ -437,7 +452,7 @@ void machine() // [ therm : ready to brew ] // [ 30 => 120 C ] ssd1306_DrawString("Ready to Brew!", 0, 40); - + draw_setpoint(); // Button handler if(!GPIO_ReadInputDataBit(SW_BTN)) { @@ -455,6 +470,7 @@ void machine() // [ therm : preheating steam ] // [ 30 => 120 C ] ssd1306_DrawString("Preheating...", 0, 40); + draw_setpoint(); // Button handler if(!GPIO_ReadInputDataBit(SW_BTN)) { @@ -474,6 +490,7 @@ void machine() // [ therm : ready to steam ] // [ 30 => 120 C ] ssd1306_DrawString("Ready to Steam!", 0, 40); + draw_setpoint(); // Button handler if(!GPIO_ReadInputDataBit(SW_BTN)) {