Compliment Baseline Update Algorithm – KBA230646

Version 2

    Author: LinglingG_46           Version: **

     

    Translation - Japanese: 補完ベースライン更新アルゴリズム – KBA230646 - Community Translated (JA)

    Question:
    How can I let the baseline track rawcount changes based on the back up signal?

    Answer:

    It is very important to change the baseline to solve the false trigger issue caused by environmental changes like temperature, humidity, and so on. If the sensor is ON, you could let the baseline track the rawcount changes.

     

    For example, let the baseline track the rawcount changes depending on the signal changes:

     

    void SetBaseline(uint8 widget, uint16 baseline)

    {

        CapSense_FLASH_WD_STRUCT const * ptrFlashWdgt;

        ptrFlashWdgt = &CapSense_dsFlash.wdgtArray[widget];

        ((CapSense_RAM_SNS_STRUCT *)ptrFlashWdgt->ptr2SnsRam)->bsln[0] = baseline;

    }

    uint16 GetDiff(uint8 widget)

    {

        uint16 diff = 0;

         

        CapSense_FLASH_WD_STRUCT const * ptrFlashWdgt;

        ptrFlashWdgt = &CapSense_dsFlash.wdgtArray[widget];

        diff = ((CapSense_RAM_SNS_STRUCT *)ptrFlashWdgt->ptr2SnsRam)->diff;

       

        return diff;

    }

    uint8 i;

    signal_backup[i] = GetDiff(i);

    /* if current signal is greater than last delta value, baseline tracking based on last delta value */

    if(GetDiff(i) >= signal_backup[i])

      {

        SetBaseline(i, (uint16)(GetBaseline(i) + (GetDiff(i) - signal_backup[i])));

    }