Device Drivers/HEG_WIFI_BLE_Feather/HEG.h
void core_program(bool doNoiseReduction)
{
    ticks0++;
    if (adcEnabled == false)
    {
      startADS();
    }
    if (SEND_DUMMY_VALUE != true)
    {
      if (currentMicros - sampleMicros >= sampleRate)
      {
        // read the analog in value
        readADC();
        //Voltage = (adc0 * bits2mv);

        // print the results to the Serial Monitor:
        if (DEBUG_ADC == true)
        {
          Serial.print("ADC Value: ");
          Serial.println(adc0);
          if(USE_BT == true) {
            if (SerialBT.hasClient()) {
              SerialBT.print("ADC Value: ");
              SerialBT.println(adc0);
            }
          }
          //Serial.println("\tVoltage: ");
          //Serial.println(Voltage,7);
        }
        else
        {
          //check_signal();
          if((GET_BASELINE == true)){
            if (signalDetermined == false)
            { // GET BASELINE
              get_baseline();
            }
            else
            { // GET RATIO
              get_ratio();
            }
          }
          else{ // GET RATIO
            get_ratio();
          }
        }
        sampleMicros = currentMicros;
      }
      if (currentMicros - LEDMicros >= ledRate)
      { 
        switch_LEDs(RED, IR); 
      }
      /*
      if(ADC_ERR_CAUGHT == true){
          return;
      }*/
      adcAvg += adc0;
      adcTicks++;
    }
  //DEBUG_ESP32
  if (DEBUG_ESP32 == true)
  {
    if (USE_USB == true)
    {
      Serial.println("Heap after core_program cycle: ");
      Serial.println(ESP.getFreeHeap());
    }
    if (USE_BT == true)
    {
      if(SerialBT.hasClient()){
        SerialBT.println("Heap after core_program cycle: ");
        SerialBT.println(ESP.getFreeHeap());
      }
    }
  }
}
// Core loop for HEG sampling.
Core loop for HEG sampling.
Core loop for HEG sampling .
void core_program(bool doNoiseReduction)
{
    ticks0++;
    if (adcEnabled == false)
    {
      startADS();
    }
    if (SEND_DUMMY_VALUE != true)
    {
      if (currentMicros - sampleMicros >= sampleRate)
      {
        readADC();
        if (DEBUG_ADC == true)
        {
          Serial.print("ADC Value: ");
          Serial.println(adc0);
          if(USE_BT == true) {
            if (SerialBT.hasClient()) {
              SerialBT.print("ADC Value: ");
              SerialBT.println(adc0);
            }
          }
        }
        else
        {
          if((GET_BASELINE == true)){
            if (signalDetermined == false)
            { 
              get_baseline();
            }
            else
            { 
              get_ratio();
            }
          }
          else{ 
            get_ratio();
          }
        }
        sampleMicros = currentMicros;
      }
      if (currentMicros - LEDMicros >= ledRate)
      { 
        switch_LEDs(RED, IR); 
      }
      adcAvg += adc0;
      adcTicks++;
    }
  if (DEBUG_ESP32 == true)
  {
    if (USE_USB == true)
    {
      Serial.println("Heap after core_program cycle: ");
      Serial.println(ESP.getFreeHeap());
    }
    if (USE_BT == true)
    {
      if(SerialBT.hasClient()){
        SerialBT.println("Heap after core_program cycle: ");
        SerialBT.println(ESP.getFreeHeap());
      }
    }
  }
}
void core_program ( bool doNoiseReduction ) { ticks0 ++ ; if ( adcEnabled == false ) { startADS ( ) ; } if ( SEND_DUMMY_VALUE != true ) { if ( currentMicros - sampleMicros >= sampleRate ) { readADC ( ) ; if ( DEBUG_ADC == true ) { Serial . print ( " " ) ; Serial . println ( adc0 ) ; if ( USE_BT == true ) { if ( SerialBT . hasClient ( ) ) { SerialBT . print ( " " ) ; SerialBT . println ( adc0 ) ; } } } else { if ( ( GET_BASELINE == true ) ) { if ( signalDetermined == false ) { get_baseline ( ) ; } else { get_ratio ( ) ; } } else { get_ratio ( ) ; } } sampleMicros = currentMicros ; } if ( currentMicros - LEDMicros >= ledRate ) { switch_LEDs ( RED , IR ) ; } adcAvg += adc0 ; adcTicks ++ ; } if ( DEBUG_ESP32 == true ) { if ( USE_USB == true ) { Serial . println ( " " ) ; Serial . println ( ESP . getFreeHeap ( ) ) ; } if ( USE_BT == true ) { if ( SerialBT . hasClient ( ) ) { SerialBT . println ( " " ) ; SerialBT . println ( ESP . getFreeHeap ( ) ) ; } } } }
Core loop for HEG sampling.
Core loop for HEG sampling .
// read the analog in value //Voltage = (adc0 * bits2mv); // print the results to the Serial Monitor: //Serial.println("\tVoltage: "); //Serial.println(Voltage,7); //check_signal(); // GET BASELINE // GET RATIO // GET RATIO /*
      if(ADC_ERR_CAUGHT == true){
          return;
      }*/ //DEBUG_ESP32