@@ -89,14 +89,15 @@ int main(void)
ssd1306_Init();
ssd1306_clearscreen();
// Check for problems on startup
if(clock_fail) {
//ssd1306_DrawStringBig("ERROR: Check Xtal", 2, 0);
ssd1306_DrawStringBig("XTAL ERR", 2, 0);
delay(5000);
ssd1306_DrawStringBig("NO XTAL", 2, 0);
delay(1000);
}
// Init USB
//Set_System(); // hw_config.h
Set_USBClock();
USB_Interrupts_Config();
@@ -261,15 +262,13 @@ void process()
// Only support heating (ssr_output > 0) right now
if(ssr_output > 0) {
char tempstr[6];
itoa(ssr_output, tempstr);
ssd1306_DrawString("#=", 2, 45);
ssd1306_DrawString(" ", 2, 57);
ssd1306_DrawString(tempstr, 2, 57);
ssd1306_DrawString(tempstr, 0, 90);
GPIO_SetBits(LED_STAT);
GPIO_SetBits(SSR_PIN);
last_ssr_on = ticks;
@@ -282,18 +281,17 @@ void process()
void draw_setpoint() {
char tempstr[3];
itoa_fp(temp, temp_frac, tempstr);
//ssd1306_DrawString(" ", 3, 40);
ssd1306_DrawString(tempstr, 3, 40);
ssd1306_DrawString("-> ", 3, 80);
ssd1306_DrawStringBig(tempstr, 3, 0);
ssd1306_DrawStringBig(">", 3, 74);
itoa(setpoint, tempstr);
ssd1306_DrawString(" ", 3, 95);
ssd1306_DrawString(tempstr, 3, 95);
ssd1306_DrawStringBig(" ", 3, 90);
ssd1306_DrawStringBig(tempstr, 3, 90);
uint8_t goto_mode = 2;
// State machine
uint8_t sw_btn_last = 0;
@@ -591,14 +589,14 @@ void machine()
case STATE_PREHEAT_BREW:
{
// Write text to OLED
// [ therm : preheating brew ]
// [ 30 => 120 C ]
ssd1306_DrawString("Preheating...", 0, 40);
ssd1306_drawlogo();
ssd1306_DrawString("Preheating...", 0, 0);
//ssd1306_drawlogo();
draw_setpoint();
pid_enabled = 1;
setpoint = setpoint_brew;
// Button handler
if(SW_BTN_PRESSED) {
@@ -618,14 +616,14 @@ void machine()
case STATE_MAINTAIN_BREW:
// [ therm : ready to brew ]
ssd1306_DrawString("Ready to Brew!", 0, 40);
ssd1306_DrawString("Preheated!", 0, 0);
@@ -643,14 +641,14 @@ void machine()
case STATE_PREHEAT_STEAM:
// [ therm : preheating steam ]
setpoint = setpoint_steam;
@@ -670,14 +668,14 @@ void machine()
case STATE_MAINTAIN_STEAM:
// [ therm : ready to steam ]
ssd1306_DrawString("Ready to Steam!", 0, 40);
ssd1306_DrawString("Ready to Steam!", 0, 0);
Status change: