GPS direction

Sir i am facing difficulty in understanding the following part of the code kindly guide me

dir = myGPS.gprmc_course_to(dest_latitude, dest_longitude) - myGPS.gprmc_course();
if (dir < 0) { dir += 360; }
if (dir > 180) { dir -= 360; }

It looks strange indeed. I think what is meant is

      if (dir < 0) { dir += 360; }
      if (dir > 360) { dir -= 360; } // 180 -> 360

This code maps the direction to a value between 0 and 360. It is meant to correct over- and underflow of the subtraction.

Clear ?

PS, if you post code please use the [ code] tags (by means of the button)

No sir i did not understand the code
:expressionless: