TimeAlarms Issues When Used with TFT

I'm using an Uno, 2.2 Ebay TFT (ILI9340), and 1307RTC to build a controller for my Reef aquarium. Primary functions are to act as a light timer with dimming sunrise/sunset with actinic/white LEDs and control 2 circulation pumps that create "waves". Many things to add later but this is what I'm working on for the first rev. The percentage of the PWM light signals are to be graphically displayed on the TFT along with the current time, pump states, and alarm times.

I've pretty much ironed out all of the issues except one. When I call my UpdateTime() method in the loop the time prints to the display as expected but due to how I blank the time with a black box and then rewrite it this causes annoying flashes that are not in sync with the Seconds. To remedy this I'm trying to use a repeating time alarm activated every second to call this method instead. Everything seems to be laid out similar in my sketch and coordinates with the TimeAlarms example sketch but no dice. The interrupt never fires and the text never displays. I assume that none of the alarms are working, this is just what I am focusing on for troubleshooting. Am I missing something simple or is there a deeper underlying problem?

#include <Adafruit_ILI9340.h>
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <Wire.h>  
#include <DS1307RTC.h>

#define _sclk 13
#define _miso 12
#define _mosi 11
#define _cs 4
#define _dc 3
#define _rst 2

#define f1Pin 5
#define f2Pin 6
#define actPin 9
#define whitePin 10

boolean actRise = false;
boolean whiteRise = false;
boolean whiteFade = false;
boolean actFade = false;

int maxWhite = 200; //Duty cycle at full daylight
int maxAct = 255;
int white = 100;  //Current value of PWM duty cycle
int act = 10;
long actPerc = 0;  //holds the height of the bar out of 200 pixels
long whitePerc = 0;

Adafruit_ILI9340 tft = Adafruit_ILI9340(_cs, _dc, _rst);

void setup() {
  pinMode(f1Pin, OUTPUT);                     //Oscillation pump (fan) pins
  pinMode(f2Pin, OUTPUT);
  pinMode(16, OUTPUT);                         //used to power RTC from pins
  pinMode(17, OUTPUT);
  digitalWrite(16, LOW);
  digitalWrite(17, HIGH);
  
  setSyncProvider(RTC.get);                    //Set Arduino to get time from RTC
  tft.begin();

Alarm.alarmRepeat(8,00,0, MorningAct);  // 8:00am Actinic fade in
Alarm.alarmRepeat(9,00,0, MorningWhite);  // 9:00am White fade in
Alarm.alarmRepeat(19,00,0, EveningWhite);  // 7:00pm White fade out
Alarm.alarmRepeat(22,00,0, EveningAct);     // 10:00pm White fade out
Alarm.timerRepeat(1, UpdateTime); //1 second interval for time change
Alarm.timerRepeat(15, Fade); //15 second interval for intensity change for a 60minute fade

InitDisplay();
}

void loop() {
  UpdateAct();                                    //These will later be called inside the Fade method to only update when changed
  UpdateWhite();
  delay(200);
}

void MorningAct(){                                //Boolean states to activate dimming
  actRise=true;
}

void MorningWhite(){
  whiteRise=true;
}

void EveningWhite(){
  whiteFade=true;
}

void EveningAct(){
  actFade=true;
}

void Fade() {                                      //When called checks to see if lights need to be incremented
 
  if (actRise==true) {
    act++;
    analogWrite(actPin, act);
    if (act>=maxAct) actRise=false;
  }
  
  if (whiteRise==true) {
    white++;
    analogWrite(whitePin, white);
    if (white>=maxWhite) whiteRise=false;
  }
  
  if (whiteFade==true) {
    white--;
    analogWrite(whitePin, white);
    if (white==0) whiteFade=false;
  }
  
  if (actFade==true) {
    act--;
    analogWrite(actPin, act);
    if (act==0) actFade=false;
  }
  
  if (random(0,2) == 0 ) {                    //Fan Oscillations
    digitalWrite(f1Pin, LOW);
  }
  else digitalWrite(f1Pin, HIGH);
  
  if (random(0,2) == 0 ) {
    digitalWrite(f2Pin, LOW);
  }
  else digitalWrite(f2Pin, HIGH);
 
}

void InitDisplay(){                           //Static display items such as incremental lines and labels
  tft.setRotation(3);
  tft.fillScreen(ILI9340_BLACK);
  tft.setTextColor(ILI9340_WHITE);
  tft.setCursor(15,230);
  tft.setTextSize(1);
  tft.println("Actin    White");
  tft.setCursor(235,230);
  tft.println("Tank     Food");
  for(int incr=25; incr<=225; incr=incr+20){ //hash marks for 
  tft.drawLine(50, incr, 65, incr, ILI9340_BLUE);
  tft.drawLine(265, incr, 280, incr, ILI9340_BLUE);
  }
}

void UpdateAct() {                            //Blacks out white bar graph and reprints it.
  actPerc=((long)act*200/255);
  tft.fillRect(18,20,28,200, ILI9340_BLACK);
  tft.fillRect(18,(int)(225-actPerc),28, actPerc, ILI9340_CYAN);
}

void UpdateWhite() {                          //Blacks out white bar graph and reprints it.
  whitePerc=((long)white*200/255);
  tft.fillRect(68,20,28,200, ILI9340_BLACK);
  tft.fillRect(68,(int)(225-whitePerc),28, whitePerc, ILI9340_YELLOW);
}

void UpdateTime() {                            //Blacks out old time and reprints it to display
  tft.fillRect(120,20,100,15, ILI9340_BLACK);
  tft.setTextColor(ILI9340_WHITE);
  tft.setTextSize(2);
  tft.setCursor(120,20);
  tft.print(hour());
  tft.print(":");
  tft.print(minute());
  tft.print(":");
  tft.print(second());
  
}

Thanks,
-Nick

How is the Alarm class supposed to know that time has passed? Look at the examples that come with the class, and see what delay() function they use.

I'm facepalming hard on that one. Figured I would miss something stupid. It's even more stupid because I have made the mistake before, and solved the issue. I'm not home at the moment but I'm sure alarm.delay(0) will solve the problem.

Thanks for pointing that out for me. :wink:

-Nick