Simple recurring loop not working

My device is a POV (persistence of vision) device. I have a custom PCB with a line of LED's spinning really fast, and creating a display. The display I have is a clock/calendar with scrolling text. I suck at programming and heavily rely on GPT to guide me along, and I'm at a point where even GPT 4 cant figure it out.
Everything works perfect...the scrolling text part of the program, where it switches from Time(), then earlybird(), then pizza(), then Covfefe(), works quite well, EXCEPT for it stops displaying after Covfefe. What I want this program to do is loop back to Time(), after Covfefe, but it wont do it properly. I can either get it to repeat covfefe over and over again, or just stop displaying after covfefe.
This part of the code seems very simple. What am I missing?


// hobbyprojects
// 15-06-2019  NanoDS3231propellerClock1.ino

#include "Wire.h"

// Function prototype

unsigned long previousMillisTime = 0; // Stores the last time 'bs' was updated


unsigned long tc, to = 0;
unsigned int j, x, nm, dl, bt;
int i, m, f, r1, r2, t, tempBs = 0;
int bs = 5;
int currentState = 0;


unsigned char b1[200], b2[200];
byte a, c, c1, c2;
char s;
bool messageFinished = false;

//int LED1 = 2;
//int LED2 = 3;
int LED3 = 4;
int LED4 = 5;
int LED5 = 6;
int LED6 = 7;
int LED7 = 8;
int LED8 = 9;
int LED9 = 10;
int LED10 = 11;
int LED11 = 12;
int LED12 = A1;
int LED13 = A2;
int LED14 = A3;
int LED15 = 3;
int LED16 = 13;

int sensorPin = 2;
int mode_key = A0;

static int timeBs = 50;

unsigned int n, propeller_posn;
unsigned long previousTime = 0;

byte hour, minute, second, Day, Date, Month, Year;
byte tempMSB, tempLSB;
int val;

const PROGMEM unsigned char font[] = {
  0x3f, 0x23, 0x23, 0x3f, 0x00, // 0
  0x01, 0x13, 0x3f, 0x03, 0x00, // 1
  0x2f, 0x2b, 0x2b, 0x3b, 0x00, // 2
  0x2b, 0x2b, 0x2b, 0x3f, 0x00, // 3
  0x39, 0x09, 0x09, 0x3f, 0x00, // 4
  0x3b, 0x2b, 0x2b, 0x2f, 0x00, // 5
  0x3f, 0x2b, 0x2b, 0x2f, 0x00, // 6
  0x21, 0x27, 0x29, 0x31, 0x00, // 7
  0x3f, 0x2b, 0x2b, 0x3f, 0x00, // 8
  0x3b, 0x2b, 0x2b, 0x3f, 0x00, // 9
  0x3F, 0x48, 0x48, 0x48, 0x3F, // A 10
  0x7F, 0x49, 0x49, 0x49, 0x36, // B 11
  0x3E, 0x41, 0x41, 0x41, 0x22, // C 12
  0x7F, 0x41, 0x41, 0x41, 0x3E, // D 13
  0x7F, 0x49, 0x49, 0x49, 0x41, // E 14
  0x7F, 0x48, 0x48, 0x40, 0x40, // F 15
  0x3E, 0x41, 0x49, 0x49, 0x2E, // G 16
  0x7F, 0x08, 0x08, 0x08, 0x7F, // H 17
  0x41, 0x41, 0x7F, 0x41, 0x41, // I 18
  0x46, 0x41, 0x41, 0x7E, 0x40, // J 19
  0x7F, 0x08, 0x08, 0x14, 0x63, // K 20
  0x7F, 0x01, 0x01, 0x01, 0x01, // L 21
  0x7F, 0x20, 0x18, 0x20, 0x7F, // M 22
  0x7F, 0x20, 0x10, 0x08, 0x7F, // N 23
  0x3E, 0x41, 0x41, 0x41, 0x3E, // O 24
  0x7F, 0x48, 0x48, 0x48, 0x30, // P 25
  0x3E, 0x41, 0x43, 0x41, 0x3E, // Q 26
  0x7F, 0x44, 0x44, 0x44, 0x3B, // R 27
  0x31, 0x49, 0x49, 0x49, 0x46, // S 28
  0x40, 0x40, 0x7F, 0x40, 0x40, // T 29
  0x7E, 0x01, 0x01, 0x01, 0x7E, // U 30
  0x7C, 0x02, 0x01, 0x02, 0x7C, // V 31
  0x7F, 0x02, 0x0C, 0x02, 0x7F, // W 32
  0x63, 0x14, 0x08, 0x14, 0x63, // X 33
  0x70, 0x08, 0x07, 0x08, 0x70, // Y 34
  0x43, 0x45, 0x49, 0x51, 0x61, // Z 35
  0x12, 0x15, 0x15, 0x15, 0x0F, // a 36
  0x7F, 0x09, 0x09, 0x09, 0x06, // b 37
  0x0E, 0x11, 0x11, 0x11, 0x09, // c 38
  0x06, 0x09, 0x09, 0x09, 0x7F, // d 39
  0x0E, 0x15, 0x15, 0x15, 0x0D, // e 40
  0x08, 0x3F, 0x48, 0x48, 0x40, // f 41
  0x36, 0x59, 0x55, 0x75, 0x46, // g 42
  0x7F, 0x08, 0x10, 0x10, 0x0F, // h 43
  0x00, 0x11, 0x5F, 0x01, 0x00, // i 44
  0x00, 0x06, 0x01, 0x01, 0x5E, // j 45
  0x7F, 0x08, 0x08, 0x14, 0x23, // k 46
  0x00, 0x41, 0x7F, 0x01, 0x00, // l 47
  0x1F, 0x10, 0x0C, 0x10, 0x1F, // m 48
  0x1F, 0x08, 0x10, 0x10, 0x0F, // n 49
  0x0E, 0x11, 0x11, 0x11, 0x0E, // o 50
  0x3F, 0x25, 0x24, 0x24, 0x18, // p 51
  0x18, 0x24, 0x24, 0x25, 0x3F, // q 52
  0x01, 0x1F, 0x09, 0x10, 0x08, // r 53
  0x09, 0x15, 0x15, 0x15, 0x12, // s 54
  0x00, 0x7E, 0x11, 0x11, 0x02, // t 55
  0x1E, 0x01, 0x01, 0x02, 0x1F, // u 56
  0x1C, 0x02, 0x01, 0x02, 0x1C, // v 57
  0x1E, 0x01, 0x06, 0x01, 0x1E, // w 58
  0x11, 0x0A, 0x04, 0x0A, 0x11, // x 59
  0x1D, 0x05, 0x05, 0x05, 0x1F, // y 60
  0x11, 0x13, 0x15, 0x19, 0x11, // z 61
  0x00, 0x00, 0x12, 0x00, 0x00, // : 62
  0x00, 0x79, 0x00, 0x79, 0x00, // !!63
  0x3F, 0x44, 0x44, 0x44, 0x7F, // А 64
  0x7F, 0x49, 0x49, 0x49, 0x46, // Б 65
  0x7F, 0x49, 0x49, 0x49, 0x36, // В 66
  0x7F, 0x40, 0x40, 0x40, 0x40, // Г 67
  0x03, 0x3E, 0x42, 0x7E, 0x03, // Д 68
  0x7F, 0x49, 0x49, 0x49, 0x41, // Е 69
  0x3F, 0x69, 0x69, 0x29, 0x21, // Ё 70
  0x63, 0x14, 0x7F, 0x14, 0x63, // Ж 71
  0x22, 0x41, 0x49, 0x49, 0x36, // З 72
  0x7F, 0x02, 0x04, 0x08, 0x7F, // И 73
  0x7F, 0x02, 0x44, 0x08, 0x7F, // Й 74
  0x7F, 0x08, 0x14, 0x22, 0x41, // К 75
  0x1F, 0x20, 0x40, 0x40, 0x7F, // Л 76
  0x7F, 0x20, 0x10, 0x20, 0x7F, // М 77
  0x7F, 0x08, 0x08, 0x08, 0x7F, // Н 78
  0x3E, 0x41, 0x41, 0x41, 0x3E, // О 79
  0x7F, 0x40, 0x40, 0x40, 0x7F, // П 80
  0x7F, 0x48, 0x48, 0x48, 0x30, // Р 81
  0x3E, 0x41, 0x41, 0x41, 0x22, // С 82
  0x40, 0x40, 0x7F, 0x40, 0x40, // Т 83
  0x72, 0x09, 0x09, 0x09, 0x7E, // У 84
  0x38, 0x44, 0x7F, 0x44, 0x38, // ф 85
  0x63, 0x14, 0x08, 0x14, 0x63, // Х 86
  0x7E, 0x02, 0x02, 0x7E, 0x03, // Ц 87
  0x70, 0x08, 0x08, 0x08, 0x7F, // Ч 88
  0x7F, 0x01, 0x3F, 0x01, 0x7F, // Ш 89
  0x7E, 0x02, 0x3E, 0x02, 0x7F, // Щ 90
  0x7F, 0x09, 0x09, 0x09, 0x06, // ъ 91
  0x7F, 0x09, 0x09, 0x06, 0x7F, // ы 92
  0x40, 0x7F, 0x09, 0x09, 0x06, // Ь 93
  0x22, 0x49, 0x49, 0x49, 0x3E, // Э 94
  0x7F, 0x08, 0x3E, 0x41, 0x3E, // Ю 95
  0x31, 0x4A, 0x4C, 0x48, 0x7F, // Я 96
  0x12, 0x15, 0x15, 0x15, 0x0F, // а 97
  0x36, 0x29, 0x49, 0x09, 0x06, // б 98
  0x1F, 0x15, 0x15, 0x15, 0x0E, // в 99
  0x1F, 0x10, 0x10, 0x10, 0x10, // г 100
  0x03, 0x3E, 0x22, 0x3E, 0x03, // д 101
  0x0E, 0x15, 0x15, 0x15, 0x1D, // е 102
  0x0E, 0x55, 0x15, 0x55, 0x1D, // ё 103
  0x1B, 0x04, 0x1F, 0x04, 0x1B, // ж 104
  0x11, 0x11, 0x15, 0x15, 0x0A, // э 105
  0x1F, 0x02, 0x04, 0x08, 0x1F, // и 106
  0x1F, 0x42, 0x04, 0x48, 0x1F, // й 107
  0x1F, 0x04, 0x04, 0x0A, 0x11, // к 108
  0x07, 0x08, 0x10, 0x10, 0x1F, // л 109
  0x1F, 0x08, 0x04, 0x08, 0x1F, // м 110
  0x1F, 0x04, 0x04, 0x04, 0x1F, // н 111
  0x0E, 0x11, 0x11, 0x11, 0x0E, // о 112
  0x1F, 0x10, 0x10, 0x10, 0x1F, // п 113
  0x1F, 0x14, 0x14, 0x14, 0x08, // р 114
  0x0E, 0x11, 0x11, 0x11, 0x11, // с 115
  0x10, 0x10, 0x1F, 0x10, 0x10, // т 116
  0x32, 0x09, 0x09, 0x09, 0x3E, // у 117
  0x08, 0x14, 0x7F, 0x14, 0x08, // ф 118
  0x11, 0x0A, 0x04, 0x0A, 0x11, // х 119
  0x1E, 0x02, 0x02, 0x1E, 0x03, // ц 120
  0x18, 0x04, 0x04, 0x04, 0x1F, // ч 121
  0x1F, 0x01, 0x1F, 0x01, 0x1F, // ш 122
  0x1E, 0x02, 0x1E, 0x02, 0x1F, // щ 123
  0x1F, 0x05, 0x05, 0x05, 0x02, // ь 124
  0x1F, 0x05, 0x05, 0x02, 0x1F, // ы 125
  0x10, 0x1F, 0x05, 0x05, 0x02, // ъ 126
  0x0A, 0x11, 0x15, 0x15, 0x0E, // э 127
  0x1F, 0x04, 0x0E, 0x11, 0x0E, // ю 128
  0x09, 0x16, 0x14, 0x14, 0x1F, // я 129
  0x00, 0x00, 0x01, 0x00, 0x00, // . 130
  0x16, 0x29, 0x29, 0x29, 0x16, // 8 (5x7) 131
  0x0C, 0x34, 0x04, 0x7f, 0x04, // 4 (5x7) 132
  0x11, 0x02, 0x04, 0x08, 0x11, // % 133
  0x14, 0x14, 0x14, 0x14, 0x00, // = 134
  0x00, 0x08, 0x1c, 0x08, 0, 00, // + 135
  0x32, 0x49, 0x49, 0x49, 0x3e, // 9 (5x7) 136
  0x00, 0x21, 0x7f, 0x01, 0x00, // 1 (5x7) 137
  0x21, 0x43, 0x45, 0x49, 0x31  // 2 (5x7) 138
};

void setup()
{
  //pinMode(LED1,OUTPUT);
  //pinMode(LED2,OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  pinMode(LED6, OUTPUT);
  pinMode(LED7, OUTPUT);
  pinMode(LED8, OUTPUT);
  pinMode(LED9, OUTPUT);
  pinMode(LED10, OUTPUT);
  pinMode(LED11, OUTPUT);
  pinMode(LED12, OUTPUT);
  pinMode(LED13, OUTPUT);
  pinMode(LED14, OUTPUT);
  pinMode(LED15, OUTPUT);
  pinMode(LED16, OUTPUT);

  pinMode(sensorPin, INPUT_PULLUP);
  pinMode(mode_key, INPUT_PULLUP);

  attachInterrupt(0, usdl, RISING);
  if (hour > 11)
    hour = hour - 12;

  Wire.begin();

  hour = 16;    // set hours
  minute = 06;  // set minutes
  second = 20;  // set seconds
  Day = 7;       // 1=Sunday, 7=Saturday
  Date = 18;     // 1 to 31
  Month = 2;
  Year = 24;

  Wire.beginTransmission(0x68);
  Wire.write(0);
  Wire.write(dec2bcd(second));
  Wire.write(dec2bcd(minute));
  Wire.write(dec2bcd(hour));
  Wire.write(dec2bcd(Day));
  Wire.write(dec2bcd(Date));
  Wire.write(dec2bcd(Month));
  Wire.write(dec2bcd(Year));
  Wire.endTransmission();

  //=========================================

  Serial.begin(57600);

}

void loop()
{

  {
    
    val = digitalRead(sensorPin);
    while (val == LOW)
    {
      val = digitalRead(sensorPin);
    }
    i = 0;
    while (i < 200)
    {
      b1[i] = 0x00;
      b2[i] = 0x00;
      i++;
    }
    r1 = 0;
    for (i = 0; i < 9; i++)
    {
      b1[r1] = 0;
      r1++;
    }
    nm = hour;
    if (nm == 0)
      nm = 12;
    nm = nm / 10;
    nm = nm % 10;
    vt();
    c1 = 0;
    b1[r1] = 0;
    r1++;
    nm = hour ;
    if (nm == 0)
      nm = 12;
    nm = nm % 10;
    vt();
    b1[r1] = 0x00;
    r1++;
    b1[r1] = 0x12;
    r1++;
    b1[r1] = 0x00;
    r1++;
    nm = minute / 10;
    nm = nm % 10;
    vt();
    b1[r1] = 0;
    r1++;
    nm = minute;
    nm = nm % 10;
    vt();
    b1[r1] = 0x00;
    r1++;
    b1[r1] = 0x12;
    r1++;
    b1[r1] = 0x00;
    r1++;
    nm = second / 10;
    nm = nm % 10;
    vt();
    b1[r1] = 0;
    r1++;
    nm = second;
    nm = nm % 10;
    vt();

    for (i = 0; i < 36; i++)
    {
      b1[r1] = 0;
      r1++;
    }




    nm = Year;
    nm = nm % 10;
    vb();
    b1[r1] = 0x00;
    r1++;

    nm = Year;
    nm = nm / 10;
    nm = nm % 10;

    vb();
    r1++;
    c1 = 0x1;
    b1[r1] = c1;
    r1++;
    c1 = 0x2;
    b1[r1] = c1;
    r1++;
    c1 = 0x4;
    b1[r1] = c1;
    r1++;
    c1 = 0x8;
    b1[r1] = c1;
    r1++;
    c1 = 0x10;// decimal point
    b1[r1] = c1;
    r1++;
    r1++;
    nm = Date;
    nm = nm % 10;
    vb();
    b1[r1] = 0;
    r1++;
    nm = Date;
    nm = nm / 10;
    nm = nm % 10;
    vb();
    b1[r1] = 0;
    r1++;
    c1 = 0x1;
    b1[r1] = c1;
    r1++;
    c1 = 0x2;
    b1[r1] = c1;
    r1++;
    c1 = 0x4;
    b1[r1] = c1;
    r1++;
    c1 = 0x8;
    b1[r1] = c1;
    r1++;
    c1 = 0x10;// decimal point
    b1[r1] = c1;
    r1++;
    b1[r1] = 0;
    r1++;
    nm = Month;
    nm = nm % 10;
    vb();
    b1[r1] = 0;
    r1++;
    nm = Month;
    nm = nm / 10;
    nm = nm % 10;
    vb();


    for (i = 0; i < 12; i++)
    {
      b1[r1] = 0;
      r1++;
    }



    typicalday();

    if ((Month == 2 && Date == 17) || (Month == 8 && Date == 6)) {
      Sdnyem();
    }
    else if (Day == 6) {
      Shabbat();
    }
    if (currentState == 0) {
      Time();
    } else if (currentState == 1) {
      earlybird();
    } else if (currentState == 2) {
      pizza();
    } else if (currentState == 3) {
      Covfefe();
    } else if (currentState == 4) {
      Time();
    }



    if (messageFinished) {
      currentState++;
      messageFinished = false; // Reset the flag for the next message
    }

    if (currentState >= 5) {
      currentState = 0; // Reset currentState to 0 after the last message
    }



    Serial.print(currentState);

    // The rest of your loop code



    bt = r1;
    r1 = 0;
    dc();
    Wire.beginTransmission(0x68);
    Wire.write(0);
    Wire.endTransmission();
    Wire.requestFrom(0x68, 7);
    second = bcd2dec(Wire.read() & 0x7f);
    minute = bcd2dec(Wire.read());
    hour = bcd2dec(Wire.read() & 0x3f);
    if (hour > 11)
      hour = hour - 12;
    Day = bcd2dec(Wire.read()); // Day of the week, 1 = Sunday, 7 = Saturday
    Date = bcd2dec(Wire.read()); // Date of the month
    Month = bcd2dec(Wire.read() & 0x1F); // Month, strip the century flag
    Year = bcd2dec(Wire.read()); // Year (assuming 21st century)

    val = digitalRead(sensorPin);
    while (val == HIGH)
    {
      val = digitalRead(sensorPin);
    }
  }
}
void displayClear()
{
  //digitalWrite(LED1,LOW);
  //digitalWrite(LED2,LOW);
  digitalWrite(LED3, LOW);
  digitalWrite(LED4, LOW);
  digitalWrite(LED5, LOW);
  digitalWrite(LED6, LOW);
  digitalWrite(LED7, LOW);
  digitalWrite(LED8, LOW);
  digitalWrite(LED9, LOW);
  digitalWrite(LED10, LOW);
  digitalWrite(LED11, LOW);
  digitalWrite(LED12, LOW);
  digitalWrite(LED13, LOW);
  digitalWrite(LED14, LOW);
  digitalWrite(LED15, LOW);
  digitalWrite(LED16, LOW);
}
byte dec2bcd(byte val)
{
  return ((val / 10 * 16) + (val % 10));
}
byte bcd2dec(byte val)
{
  return ((val / 16 * 10) + (val % 16));
}

void dc()
{
  while (r1 < bt)
  {
    c = b1[r1];
    if (c & 1)
      PORTC |= (1 << 1);
    else
      PORTC &= ~(1 << 1);
    if (c & 2)
      PORTC |= (1 << 2);
    else
      PORTC &= ~(1 << 2);
    if (c & 4)
      PORTC |= (1 << 3);
    else
      PORTC &= ~(1 << 3);
    if (c & 8)
      PORTD |= (1 << 3);
    else
      PORTD &= ~(1 << 3);
    if (c & 16)
      PORTB |= (1 << 5);
    else
      PORTB &= ~(1 << 5);

    c = b2[r1];
    if (c & 1)
      PORTD |= (1 << 6);
    else
      PORTD &= ~(1 << 6);
    if (c & 2)
      PORTD |= (1 << 7);
    else
      PORTD &= ~(1 << 7);
    if (c & 4)
      PORTB |= (1 << 0);
    else
      PORTB &= ~(1 << 0);
    if (c & 8)
      PORTB |= (1 << 1);
    else
      PORTB &= ~(1 << 1);
    if (c & 16)
      PORTB |= (1 << 2);
    else
      PORTB &= ~(1 << 2);
    if (c & 32)
      PORTB |= (1 << 3);
    else
      PORTB &= ~(1 << 3);
    if (c & 64)
      PORTB |= (1 << 4);
    else
      PORTB &= ~(1 << 4);

    delayMicroseconds(dl);
    displayClear();
    delayMicroseconds(dl * 2);
    r1++;
  }
}
void vt()
{
  j = nm * 5;
  i = 0;
  while (i <= 3)
  {
    c1 = (pgm_read_byte(&(font + j)[i]));
    c1 >>= 1;
    b1[r1] = c1;
    i++;
    r1++;
  }
}
void vb()
{
  j = nm * 5;
  i = 3;
  while (i >= 0)
  {
    c = (pgm_read_byte(&(font + j)[i]));
    s = 0;
    for (a = 0; a < 8; a++)
    {
      s <<= 1;
      s |= c & 1;
      c >>= 1;
    }
    s >>= 2;
    b1[r1] = s;
    i--;
    r1++;
  }
}
void Time() {
  static unsigned long previousMillisTime = 0; // Static variable to store the last update time
  static int timeBs = 50; // Starting position for the "TIME" text

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillisTime >= 1) {
    timeBs--; // Decrease the position every 200 milliseconds
    if (timeBs < -260) {
      messageFinished = true; // Reset timeBs to the starting position if it goes below -30
    }
    previousMillisTime = currentMillis; // Update the time for the next interval
  }

  // Display the characters at the current base position if bs is less than or equal to 50
  int tempBs = timeBs; // Temporary variable to hold the current position for displaying characters

  nm = 29; // 'Time
  bs = tempBs; // Set bs to the current position
  DisplayTimeChar();
  tempBs += 6;
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 48; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //you
  nm = 60; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 50; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 56; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //enjoy
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 49; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 45; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 50; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 60; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //wasting
  nm = 58; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 36; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 55; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 49; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 42; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //is
  nm = 44; // i
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; // s
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10;  //not
  nm = 49; // n
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 50; // o
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 55; // t
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //wasted
  nm = 58; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 36; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 55; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 39; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //time.
  nm = 55; //
  bs = tempBs; // Set bs to the current position
  DisplayTimeChar();
  tempBs += 6;
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 48; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 5;
  nm = 130; //
  bs = tempBs; //
  DisplayTimeChar();

}
void earlybird() {
  static unsigned long previousMillisTime = 0; // Static variable to store the last update time
  static int timeBs = 50; // Starting position for the "TIME" text

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillisTime >= 2) {
    timeBs--; // Decrease the position every 200 milliseconds
    if (timeBs < -325) {
      messageFinished = true; // Reset timeBs to the starting position if it goes below -30
    }
    previousMillisTime = currentMillis; // Update the time for the next interval
  }

  // Display the characters at the current base position if bs is less than or equal to 50
  int tempBs = timeBs; // Temporary variable to hold the current position for displaying characters

  nm = 29; // 'The
  bs = tempBs; // Set bs to the current position
  DisplayTimeChar();
  tempBs += 6;
  nm = 43; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //early
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 36; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 53; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 47; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 60; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //bird
  nm = 37; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 53; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 39; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //gets
  nm = 42; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 55; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //the
  nm = 55; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 43; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //chervyak
  nm = 121; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 102; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 114; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 99; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 129; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 108; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 5;
  nm = 130; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //2nd
  nm = 138; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 49; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 39; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //mouse
  nm = 48; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 50; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 56; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();


  tempBs += 10; //gets
  nm = 42; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 55; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //the
  nm = 55; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 43; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //siir
  nm = 115; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 125; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 114; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 5;
  nm = 130; //
  bs = tempBs; //
  DisplayTimeChar();

}

void pizza() {
  static unsigned long previousMillisTime = 0; // Static variable to store the last update time
  static int timeBs = 50; // Starting position for the "TIME" text

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillisTime >= 1) {
    timeBs--; // Decrease the position every 200 milliseconds
    if (timeBs < -328) {
      messageFinished = true; // Reset timeBs to the starting position if it goes below -30
    }
    previousMillisTime = currentMillis; // Update the time for the next interval
  }

  // Display the characters at the current base position if bs is less than or equal to 50
  int tempBs = timeBs; // Temporary variable to hold the current position for displaying characters

  nm = 14; // 'Every
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 57; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 53; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 60; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //pizza
  nm = 51; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 61; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 61; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 36; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //is
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //a
  nm = 36; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //personal
  nm = 51; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 53; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 50; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 49; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 36; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 47; //
  bs = tempBs; //
  DisplayTimeChar();


  tempBs += 10; //pizza
  nm = 51; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 61; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 61; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 36; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //if
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 41; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //you
  nm = 60; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 50; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 56; //
  bs = tempBs; //
  DisplayTimeChar();


  tempBs += 10; //believe
  nm = 37; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 47; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 57; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //in
  nm = 44; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 49; //
  bs = tempBs; //
  DisplayTimeChar();

  tempBs += 10; //yourself.
  nm = 60; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 50; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 56; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6; //
  nm = 53; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 54; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 40; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 47; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 6;
  nm = 41; //
  bs = tempBs; //
  DisplayTimeChar();
  tempBs += 5;
  nm = 130; //
  bs = tempBs; //
  DisplayTimeChar();

}
void Covfefe() {
  static unsigned long previousMillisTime = 0; // Static variable to store the last update time
  static int timeBs = 50; // Starting position for the "TIME" text

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillisTime >= 2) {
    timeBs--; // Decrease the position every 200 milliseconds
    if (timeBs < -50) {
      messageFinished = true; // Reset timeBs to the starting position if it goes below -30
    }
    previousMillisTime = currentMillis; // Update the time for the next interval
  }

  // Display the characters at the current base position if bs is less than or equal to 50
  int tempBs = timeBs; // Temporary variable to hold the current position for displaying characters



  tempBs += 7;
  nm = 12;
  bs = tempBs;
  DisplayTimeChar();
  tempBs += 7;
  nm = 50;
  bs = tempBs;
  DisplayTimeChar();
  tempBs += 7;
  nm = 57;
  bs = tempBs;
  DisplayTimeChar();
  tempBs += 7;
  nm = 41;
  bs = tempBs;
  DisplayTimeChar();
  tempBs += 7;
  nm = 40;
  bs = tempBs;
  DisplayTimeChar();
  tempBs += 7;
  nm = 41;
  bs = tempBs;
  DisplayTimeChar();
  tempBs += 7;
  nm = 40;
  bs = tempBs;
  DisplayTimeChar();

}
void DisplayTimeChar()
{
  if (bs > 50 || bs < 0) { // Ignore characters with a position greater than 50 or less than 0
    return;
  }

  r2 = 0;
  j = nm * 5;
  bt = 5;
  while (r2 < bt)
  {
    c1 = (pgm_read_byte(&(font + j)[r2]));
    if (bs + r2 >= 0) { // Only display the character if its position is greater than or equal to 0
      b2[bs + r2] = c1;
    }
    r2++;
  }
}

void DisplayDayChar()
{
  i = 0;
  r2 = 4;
  j = nm * 5;
  while (r2 >= 0)
  {
    c = (pgm_read_byte(&(font + j)[r2]));
    s = 0;
    for (a = 0; a < 8; a++)
    {
      s <<= 1;
      s |= c & 1;
      c >>= 1;
    }
    s = s >> 1;
    b2[i + bs] = s;
    r2--;
    i++;
  }
}
void usdl()
{
  f = 0;
  n = 0;
  tc = micros() - to;
  to = micros();
  f = 1;
  dl = tc / 550;
}

This code completely works and I understand most of it. I just dont understand why my loop isnt working, and not circing back to Time().
I use GPT to pinpoint potential problems or help me with syntax.
Long story short, I can logically follow 95% of this code, and wrote with the help of GPT. I cant seeem to understand why int currentStage is not looping back around properly.

Is this what you mean by "circle back?" My guess is currentState never becomes 4.

One of many Diaper Man's famous quotes. Such an intellect.

Correct - I cant seem to figure out why it wouldnt.

Because the condition that causes currentState to increase only occurs three times, at < -260, < -320 and < -50.

This is why ChatGPT is just a Garbage Producing Terminal...

void DisplayDayChar()
{
  i = 0;
  r2 = 4;
  j = nm * 5;
  while (r2 >= 0)
  {
    c = (pgm_read_byte(&(font + j)[r2]));
    s = 0;
    for (a = 0; a < 8; a++)
    {
      s <<= 1;
      s |= c & 1;
      c >>= 1;
    }
    s = s >> 1;
    b2[i + bs] = s;
    r2--;
    i++;
  }
}
2 Likes

that condition accurs a 4th time - after Covfefe completes as well. And I would think it would change state after Covfefe, but it doesnt.

Right before the "if" conditions that check for "currentState" insert (hard-code), "currentState = 4;" and your second call to Time(); will "only" be called.

Q: What make the Time(); happen?... A: currentState == 4

Q: What makes currentState increase? A: if (messageFinished)... currentState++;

Q: What makes messageFinished == true? A: if (timeBs < -260) (and two more: -320, -50)

Q: What makes these three values happen? A: Your turn

these values happen when currentMillis - previousMillisTime >= 2, the TimeBs steps down 1. In other words, every loop this is happening.

I dont get it man.

btw - I have no idea what motivates you to help out plebs like me... but i really appreciate it.

I thought I reset TimeBs every time there was a new currentState. In each of those functions, reset timeBs to 50, and started decreasing it with each loop until it hits the desired negative value and then change state.

I fiugured it out by resetting timeBs to 50 after messagefinished statement was declared true. Because i wasnt resetting that timeBS, it was causing an error.

Awesome. That code brings me back to Assembler. Slow reading without comments.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.