/***************************************************************************
 *   Copyright (C) 2020 by Santiago González                               *
 *                                                                         *
 ***( see copyright.txt file at root folder )*******************************/

#pragma once

#include "datachannel.h"
#include "oscope.h"

class OscopeChannel : public DataChannel
{
        friend class Oscope;

    public:
        OscopeChannel( Oscope* oscope, QString id );
        ~OscopeChannel();

        void initialize() override;
        void updateStep() override;
        void voltChanged() override;

        void setFilter( double f ) override;

    private:
        void updateValues();

        uint64_t m_totalP;
        uint64_t m_lastMax;
        uint64_t m_numMax;       // Number of Maximum found
        uint64_t m_nCycles;
        uint64_t m_simTime;

        double m_lastValue;
        double m_freq;
        double m_mid;

        double m_maxVal;
        double m_minVal;
        double m_midVal;
        double m_dispMax;
        double m_dispMin;
        double m_ampli;
        double m_filter;

        Oscope* m_oscope;
};
