#include "status.h"

#include "controlloop.h"

uint64_t timelast = 0;
uint64_t blinkrate = 500;
bool ledstate = false;
uint32_t looptime = 0; 
uint32_t looptimelast = 0;

void initStatus(void)
{
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(115200);
  delay(500);
  Serial.println("Heat Plate controller V1");
}

void handleStatus(void)
{
  uint64_t timenow = millis();
  if(timenow - timelast > blinkrate)
  {
    timelast = timenow;
    ledstate = !ledstate;
    digitalWrite(LED_BUILTIN, ledstate);
  }

  looptime = timenow - looptimelast;
  looptimelast = timenow;
}

uint32_t getLooptime(void)
{
  return looptime;
}

double getReflowTime(void)
{
  return getProcessTime();
}