Program or hardware lag?

The obvious bug is here:

  if (millis() % tMil == 0 && !triStr) {

millis() does NOT generate every consecutive value, occasionally it skips
a value. So such a test will fail every so often.

That code will also fail when millis() wraps round.

This is how its done:

unsigned long prev_t = 0L ;

...

  if (millis () - prev_t >= tMil)  // subtract before compare so always works
  {
    prev_t += tMil ;  // advance prev_t for next time.
    if (!triStr)
    {
      ...