#pragma once

#define DEBUGLOG_DEFAULT_LOG_LEVEL_INFO

#include <DebugLog.h>
#include <RS485_Driver.h>

namespace drivers
{

    class R4DCB08
    {

    public:
        enum tempCh
        {
            T1,
            T2,
            T3,
            T4,
            T5,
            T6,
            T7,
            T8,
            T_MAX
        };

        const uint8_t maxRetries = 5;
        const uint16_t REG_TEMP = 0x0000;
        const uint16_t REG_TEMPCORR = 0x0008;

    public:
        R4DCB08(drivers::MODBUS &bus, const uint8_t address);
        ~R4DCB08();

        const float getTemp(const uint8_t ch);
        const std::vector<float> getTempAll();

        void setCorrection(std::vector<float> corr);
        std::vector<float> getCorrection();

        const uint8_t getNum();

    private:
        const uint8_t m_address;
        uint8_t m_sensors;
        MODBUS &m_bus;
    };
}
