#include "tank_angle.h"
#include "common.h"
#include "ads1115.h"

#define LIFT_LIMIT 165
#define MIDDLE_LIMIT 180
#define RIGHT_LIMIT 195

double tank_angle(){
    double angle=0;
    float angle_shot=ads1115_read_channel(2);
    if(angle_shot>0){  
    angle_shot=angle_shot*360/5;
    angle = round(angle_shot * 100) / 100;
    }

    return angle;
}



int angele_limit(){
	int tank_limit_angele = tank_angle();
	if(tank_limit_angele >=LIFT_LIMIT && tank_limit_angele<=MIDDLE_LIMIT) return 1;
    else if(tank_limit_angele >=MIDDLE_LIMIT && tank_limit_angele<=RIGHT_LIMIT) return 2;
	return 0;	
}