Midi Clock (PPQ) Wrong Math?

Nermind, my math for counting the PPQ and Beats was a bit wrong.

Here's the correct code for a very simple MIDI Clock with variable BPM and PPQ.

// Wusik.com (c) WilliamK 2010
// Serial 115200 //

boolean Started = false;
boolean badClock = false;
unsigned long startTime;
unsigned long currentTime;
unsigned long processedtime;
float BPM = 95.0f;
float PPQ = 96.0f;
float ppqtime;
float currentmicroTime;
float ppqmicroTime;
int beats = 0;
int ppqcounter = 0;

void setup() 
{
  Serial.begin(115200);
}

void loop() 
{
  if (!Started)
  {
      Started = true;
      ppqtime = 60000000.0f / (BPM*PPQ);  // (60 x 1,000,000) / (BPM*PPQ)
      Serial.print("BPM: ");
      Serial.println(BPM);
      Serial.print("PPQ: ");
      Serial.println(PPQ);
      Serial.print("Micros PPQ: ");    
      Serial.println(ppqtime);
      beats = 0;
      ppqcounter = 0;
      startTime = millis();
      ppqmicroTime = (float)micros() + ppqtime;
  }  

  currentmicroTime = (float)micros(); 
  if (currentmicroTime >= ppqmicroTime)
  {
    currentTime = millis();    
    ppqmicroTime += ppqtime;
    ppqcounter++;
    if (ppqcounter == PPQ)
    {
      ppqcounter = 0;
      beats++;
      if (beats == BPM)
      {
        processedtime = currentTime - startTime;
        Serial.println("All BPM Done!");
        Serial.print("Processed Time MS: ");        
        Serial.println(processedtime);
        BPM += 25;
        Started = false;        
      }
    }
  }
}

Here's the output from the Serial, which is 99.9% correct in terms of timing. :sunglasses:

BPM: 95.00
PPQ: 96.00
Micros PPQ: 6578.95
All BPM Done!
Processed Time MS: 60002

BPM: 120.00
PPQ: 96.00
Micros PPQ: 5208.33
All BPM Done!
Processed Time MS: 59996

BPM: 145.00
PPQ: 96.00
Micros PPQ: 4310.34
All BPM Done!
Processed Time MS: 59938

Best Regards, WilliamK