Purbright_Esp32_PlatformIO/Purbright_Esp32_PlatformIO/main.cpp
void TasktoAccumulateSensorData(void *pvParameters)
{
  PIR *pir = new PIR;
  AccumulateData *accumulatedData = new AccumulateData;
  Pump *pump = new Pump;
  Buttons *buttons = new Buttons;

  Serial.print("Application Tasks running on core ");
  Serial.println(xPortGetCoreID());

  for (;;)
  {
    if (millis() - lastMillis >= 5000)
    {
      lastMillis = millis(); // get ready for the next iteration
      pump->checkTurnOffPump();
      checkTurnOffSettings();
      accumulatedData->InitAccumulateDataJson();
    }
    pir->SetupMainLoop();  // Setup the main loop for the PIR sensor
    pump->SetupMainLoop(); // Setup the main loop for the pump
    buttons->ButtonLoop(); // Setup the main loop for the buttons

    // Automatic Functionality
    if ((S_OnOff == true) && (S_Menu == false) && (S_ManAut == true))
    {
      pump->Automatic();
    }

    // Manual Functionality
    if ((S_OnOff == true) && (S_Menu == false) && (S_ManAut == false))
    {
      pump->Manual();
    }
  }
  delete pir;
  delete pump;
  delete buttons;
  delete accumulatedData;
}
/******************************************************************************
 * Function: Task to accumulate sensor data run application logic
 * Description: This function assigns the application loop to a task in freeRTOS.
 * Parameters: void *pvPparameters
 * Return: None
 ******************************************************************************/
Task to accumulate sensor data run application logic
Description: This function assigns the application loop to a task in freeRTOS.
Parameters: void *pvPparameters
Return: None
Task to accumulate sensor data run application logic Description : This function assigns the application loop to a task in freeRTOS . Parameters : void * pvPparameters Return : None
void TasktoAccumulateSensorData(void *pvParameters)
{
  PIR *pir = new PIR;
  AccumulateData *accumulatedData = new AccumulateData;
  Pump *pump = new Pump;
  Buttons *buttons = new Buttons;
  Serial.print("Application Tasks running on core ");
  Serial.println(xPortGetCoreID());
  for (;;)
  {
    if (millis() - lastMillis >= 5000)
    {
      lastMillis = millis(); 
      pump->checkTurnOffPump();
      checkTurnOffSettings();
      accumulatedData->InitAccumulateDataJson();
    }
    pir->SetupMainLoop();  
    pump->SetupMainLoop(); 
    buttons->ButtonLoop(); 
    if ((S_OnOff == true) && (S_Menu == false) && (S_ManAut == true))
    {
      pump->Automatic();
    }
    if ((S_OnOff == true) && (S_Menu == false) && (S_ManAut == false))
    {
      pump->Manual();
    }
  }
  delete pir;
  delete pump;
  delete buttons;
  delete accumulatedData;
}
void TasktoAccumulateSensorData ( void * pvParameters ) { PIR * pir = new PIR ; AccumulateData * accumulatedData = new AccumulateData ; Pump * pump = new Pump ; Buttons * buttons = new Buttons ; Serial . print ( " " ) ; Serial . println ( xPortGetCoreID ( ) ) ; for ( ; ; ) { if ( millis ( ) - lastMillis >= 5000 ) { lastMillis = millis ( ) ; pump -> checkTurnOffPump ( ) ; checkTurnOffSettings ( ) ; accumulatedData -> InitAccumulateDataJson ( ) ; } pir -> SetupMainLoop ( ) ; pump -> SetupMainLoop ( ) ; buttons -> ButtonLoop ( ) ; if ( ( S_OnOff == true ) && ( S_Menu == false ) && ( S_ManAut == true ) ) { pump -> Automatic ( ) ; } if ( ( S_OnOff == true ) && ( S_Menu == false ) && ( S_ManAut == false ) ) { pump -> Manual ( ) ; } } delete pir ; delete pump ; delete buttons ; delete accumulatedData ; }
Function: Task to accumulate sensor data run application logic
 Description: This function assigns the application loop to a task in freeRTOS.
Function : Task to accumulate sensor data run application logic Description : This function assigns the application loop to a task in freeRTOS .
// get ready for the next iteration // Setup the main loop for the PIR sensor // Setup the main loop for the pump // Setup the main loop for the buttons // Automatic Functionality // Manual Functionality