/*
 * params_bsu.h
 *
 *  Created on: 14 февр. 2020 г.
 *      Author: yura
 */

#ifndef SRC_MAIN_PARAMS_BSU_H_
#define SRC_MAIN_PARAMS_BSU_H_

#include "iq_values_norma_f.h"
#include "iq_values_norma_iu.h"
#include "iq_values_norma_oborot.h"



#define TKAK_23550  1
#define TKAK_EDRK   2


#define TKAK_VERSION    TKAK_23550
//#define TKAK_VERSION    TKAK_EDRK


// для 23550_sp2
#define TK_DEAD_TIME_NS         25000 //25.0 //40.0
#define TK_ACKN_TIME_NS         2200
#define TK_MIN_TIME_NS	        25000 //80.0 //35.0 // 15.0 //40.0
#define TK_SOFT_OFF_TIME_NS     20000 //25.0 //40.0

#define DIV_TIME_TK_SOFT_OFF    20 // 20 nsec -> 1 bit
#define DIV_TIME_TK_DEAD        640 //0.16 // 160 nsec -> 1 bit
#define DIV_TIME_TK_MIN         640 //0.16 // 160 nsec -> 1 bit

#define DIV_TIME_TK_ACKN        20 // 20 nsec -> 1 bit


// для эдрк sp2

#define TK_DEAD_TIME_MKS    25.0 //40.0
#define TK_ACKN_TIME_MKS    2.2
#define TK_MIN_TIME_MKS	    25.0 // 15.0 //40.0
#define DIV_TIME_TK	        0.4 // 0.16


#define MAX_READ_SBUS	    1 //10


#if (_FLOOR6==1)
// tkak
#define TKAK0_OFF_PROTECT	1
#define TKAK1_OFF_PROTECT	1
#define TKAK2_OFF_PROTECT	1
#define TKAK3_OFF_PROTECT	1
#define IN0_OFF_PROTECT     1
#define IN1_OFF_PROTECT     1
#define OUT0_OFF_PROTECT    1

#else
// tkak
#define TKAK0_OFF_PROTECT   0
#define TKAK1_OFF_PROTECT   0
#define TKAK2_OFF_PROTECT   0
#define TKAK3_OFF_PROTECT   0
#define IN0_OFF_PROTECT     0
#define IN1_OFF_PROTECT     0
#define OUT0_OFF_PROTECT    0
#endif

// запрет на выход ШИМа на оптику
#define TK_DISABLE_OUTPUT_A1   0
#define TK_DISABLE_OUTPUT_B1   0
#define TK_DISABLE_OUTPUT_C1   0

#define TK_DISABLE_OUTPUT_A2   0
#define TK_DISABLE_OUTPUT_B2   0
#define TK_DISABLE_OUTPUT_C2   0

//////////////////////

#define ENABLE_ROTOR_SENSOR_ZERO_SIGNAL 0
#define ENABLE_ROTOR_SENSOR_1_PM67		1
#define ENABLE_ROTOR_SENSOR_2_PM67		0

#define ENABLE_ROTOR_SENSOR_1_PBUS       0//1
#define ENABLE_ROTOR_SENSOR_2_PBUS       0//1


#if (ENABLE_ROTOR_SENSOR_1_PM67==1 && ENABLE_ROTOR_SENSOR_2_PM67==0)
// проброс 1-го датчика на вход 2-го
#define ENABLE_COMBO_SENSOR_1_TO_2	1
#define ENABLE_COMBO_SENSOR_2_TO_1  0
#endif

#if (ENABLE_ROTOR_SENSOR_1_PM67==0 && ENABLE_ROTOR_SENSOR_2_PM67==1)
// проброс 2-го датчика на вход 1-го
#define ENABLE_COMBO_SENSOR_2_TO_1	1
#define ENABLE_COMBO_SENSOR_1_TO_2  0
#endif



#if (ENABLE_ROTOR_SENSOR_1_PM67==1 && ENABLE_ROTOR_SENSOR_2_PM67==1)

#define ENABLE_COMBO_SENSOR_1	0
#define ENABLE_COMBO_SENSOR_1	0

#endif


#define ROTOR_SENSOR_IMPULSES_PER_ROTATE	4096 // 1024 // кол-во импульсов на 1 оборот с датчика




/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////



#endif /* SRC_MAIN_PARAMS_BSU_H_ */
