i think you can check if new angle is smaller than 0
then add 180 + new angle = you will get number in positive;
example: your new angle is -175 then put new variable newAngle = -175;
then compare if new number is less than 0 ;
if it is true call a function and add newAngle with 180 you will get 185 and store in whatever variable you want.