Skip to content

Commit

Permalink
Enter alarm state after preset timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
marcow1601 committed Apr 8, 2021
1 parent 464b467 commit dbcfee1
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions UniFlow-SMD-Reflow-Controller/UniFlow-SMD-Reflow-Controller.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define RELAY_WINDOW 2500
#define GFX_REFRESH_TIME 1000
#define TEMP_OFFSET 10
#define ALARM_TIMEOUT 10*60*1000 // 10 minutes in milliseconds

#define FORCERESET_EEPROM false

Expand Down Expand Up @@ -122,6 +123,7 @@ Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> indicators(2, INDICATORS);
RgbwColor orange(130, 60, 0, 0);
RgbwColor red(200, 0 , 0 , 0);
RgbwColor white(0, 0, 0, 150);
RgbwColor black(0, 0, 0, 0);

Expand All @@ -135,14 +137,26 @@ portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
volatile boolean fetchRequired = false;


/*void updateGraph(float temperature){
display.drawPixel(next_pixel_idx, map(temperature,20,250,51,0), SSD1306_WHITE);
void alarm(){

next_pixel_idx++;
digitalWrite(RELAY_PIN, LOW); // Turn off the heating element

while(true){ // can only be exited by resetting the UniFlow Controller
digitalWrite(BUZZER, HIGH);
indicators.SetPixelColor(0, white);
indicators.SetPixelColor(1, red);
indicators.Show();
delay(250);

display.display();
}*/
digitalWrite(BUZZER, LOW);
indicators.SetPixelColor(0, red);
indicators.SetPixelColor(1, white);
indicators.Show();
delay(250);

yield(); // make sure watchdog does not auto-reset the controller without user action
}
}

void enc_SW(){
encClicked = true;
Expand Down Expand Up @@ -986,8 +1000,9 @@ void loop() {
else{
digitalWrite(RELAY_PIN,LOW);
}



// Trigger alarm state if cycle takes longer than ALARM_TIMEOUT
if(millis() - startTime >= ALARM_TIMEOUT) alarm();


}

0 comments on commit dbcfee1

Please sign in to comment.