def normalize_angle_change(d1, d0):
    """
    Calculates the difference in degrees, taking into account 360 degree rollover.
    """
    change = d1 - d0
    if change > 180:
        change -= 360
    elif change < -180:
        change += 360
    return change