#ifndef CONFIG_ADV_H
#define CONFIG_ADV_H

//#define BRIDGE_DEBUG  // enable bridge debugging

////////////////////////////////////////////////////////////////////////////////
//
// Modbus

#define MODBUS_CMD_WAIT                                 200
#define MODBUS_READ_WAIT                                200

#define MODBUS_R_RETRY 2    // max read queries
#define MODBUS_W_RETRY 4    // max write queries

// @todo
// - advance config validation for the settings above
// - accumulate global modbus query timeout

////////////////////////////////////////////////////////////////////////////////
//  
// Power settings

// optional current sensor to validate primary power is there
// #define POWER_CSENSOR_PRIMARY                           CONTROLLINO_A15

// optional current sensor to validate primary power is there
// #define POWER_CSENSOR_SECONDARY                         CONTROLLINO_A14

/////////////////////////////////////////////////////////////
//
// Motor load settings, this requires a current sensor or can be
// taken from the VFD's output. 

// the interval to read the current
#define MOTOR_LOAD_READ_INTERVAL                        100

// the current measured when the motor runs idle, min - max range
#define MOTOR_IDLE_LOAD_RANGE_MIN                       30
#define MOTOR_IDLE_LOAD_RANGE_MAX                       50

// the current measured when the motor is under load, min - max range
#define MOTOR_SHREDDING_LOAD_RANGE_MIN                  50
#define MOTOR_SHREDDING_LOAD_RANGE_MAX                  99

// the current measured when the motor is overloaded, min - max range
#define MOTOR_OVERLOAD_RANGE_MIN                        100
#define MOTOR_OVERLOAD_RANGE_MAX                        400

// #define MOTOR_MIN_DT                                    2500

/////////////////////////////////////////////////////////////
//
//  Bridge related
// #define STATE_RESPONSE_CODE                             1000
// #define BRIDGE_HAS_RESPONSE
/////////////////////////////////////////////////////////////
//
//  Error codes
//
#define E_MSG_OK            "Ok"

// common operating failures
#endif