Custom Sensor help - AMS_AS5048B - Magnetic Rotary Encorder

Good Morning,

I’m trying to create a custom sensor in ESPHome. I’ve included the .h and .cpp files from a github repository located at: GitHub - sosandroid/AMS_AS5048B: Arduino Lib for AMS AS5048B I2C - 14-bit magnetic rotary position sensor.

I THINK I have all of the stuff figured out except for how to pull a variable from the .h or .cpp files. My goal is to use this sensor as a wind vane. In the .cpp I see something that could be of some use. Starting at line 486 until 501, I see this:

double AMS_AS5048B::convertAngle(int unit, double angle) {

	// convert raw sensor reading into angle unit

	double angleConv;

	switch (unit) {
		case U_RAW:
			//Sensor raw measurement
			angleConv = angle;
			break;
		case U_TRN:
			//full turn ratio
			angleConv = (angle / AS5048B_RESOLUTION);
			break;
		case U_DEG:
			//degree
			angleConv = (angle / AS5048B_RESOLUTION) * 360.0;
			break;

How do I grab the output from angleConv - U_DEG?

Sorry if this is a beginner question, I’m a Network Engineer by trade, so I don’t do much programming.

Thank you!!!

Thanks… trust me… I’ve been all over that document.

I got it!!! More to come when I finalize stuff…