/*
 * detect_errors.h
 *
 *  Created on: 4 δεκ. 2020 γ.
 *      Author: star
 */

#ifndef SRC_MYLIBS_DETECT_ERRORS_H_
#define SRC_MYLIBS_DETECT_ERRORS_H_



#define TIME_WAIT_ERROR                     20 // 2 sec
#define TIME_WAIT_ERROR_QTV                 100 // 10 sec
#define TIME_WAIT_ERROR_CHARGE_ANSWER       60 // 6 sec
#define TIME_WAIT_ERROR_IZOL                50 //5 sec //200 // 20 sec
#define TIME_WAIT_ERROR_PUMP                100 // 10 sec
#define TIME_WAIT_ERROR_FAN                 300 // 30 sec
#define TIME_WAIT_SENSOR_ROTOR_BREAK_ALL    200 // 20 sec
#define TIME_WAIT_SENSOR_ROTOR_BREAK_DIRECTION    10 // 1 sec
#define TIME_WAIT_SENSOR_ROTOR_BREAK_ONE_SENSOR   20 // 2 sec




#define MINIMAL_LEVEL_ZAD_U 27962 // 10 V

void clear_errors(void);
void clear_warnings(void);
void detect_error_all(void);
void read_plane_errors(void);
int detect_error_u_zpt_on_predzaryad(void);
int detect_error_u_in(void);
int detect_error_u_zpt_fast(void);


void detect_error_from_knopka_avaria(void);
void detect_error_ute4ka_water(void);
void detect_error_t_vipr(void);
void detect_error_power_upc(void);
void detect_error_op_pit(void);
void detect_error_p_water(void);
void detect_error_pump_2(void);
void detect_error_pump_1(void);
void detect_error_pre_ready_pump(void);
void detect_error_fan(void);
void detect_error_block_qtv_from_svu(void);

void detect_error_predohr_vipr(void);
void detect_error_qtv(void);
void detect_error_pre_charge(void);
void detect_error_block_izol(void);
void detect_error_nagrev(void);
void detect_error_ground(void);
void detect_error_block_door(void);
void detect_error_optical_bus(void);
void detect_error_sync_bus(void);
int get_status_temper_acdrive_winding(int nc);
int get_status_temper_acdrive_winding_with_limits(int nc, int alarm, int abnormal);
int get_status_temper_acdrive_bear(int nc);
int get_status_temper_acdrive_bear_with_limits(int nc, int alarm, int abnormal);
int get_status_temper_air(int nc);
int get_status_temper_air_with_limits(int nc, int alarm, int abnormal);
int get_status_temper_u(int nc);
int get_status_temper_u_with_limits(int nc, int alarm, int abnormal);
int get_status_temper_water(int nc);
int get_status_p_water_max(void);
int get_status_p_water_min(int pump_on_off);
void detect_error_t_water(void);
void detect_error_t_air(void);
void detect_error_t_u(void);
void detect_error_acdrive_winding(void);

int get_common_state_warning(void);
int get_common_state_overheat(void);
void detect_error_sensor_rotor(void);



#endif /* SRC_MYLIBS_DETECT_ERRORS_H_ */
