SmoothDriving/main.c
void WaitForIntersectionSync()
{
	bool intersectionSynced = false;
	#if DEBUG
	char temp[15];
	#endif
	while(!intersectionSynced)
	{
		gpsPoint currentLocation = locationBuffer.prevLocations[0];
		
		intersection nearestIntersection = LoadNearestIntersection(currentLocation.lat, currentLocation.lng);
		gpsPoint intersectionLocation = { .lat = nearestIntersection.lat, .lng = nearestIntersection.lng };

		if(75 > DistanceBetweenPoints(currentLocation, intersectionLocation) &&
			!CurrentlyMoving())
		{
			DeleteIntersection(&currentIntersection);
			currentIntersection = nearestIntersection;
			LoadLinkedIntersections((intersection *)&currentIntersection);
			syncTime = currentTime;
			lastIntersectionChangeTime = currentTime;
			intersectionSynced = true;
		}
		else
			DeleteIntersection(&nearestIntersection);
		_delay_ms(4000);
	}
}
/**
    The WaitForIntersectionSync() function waits for the user to stop at an intersection, then sets the sync time.
 */
The WaitForIntersectionSync() function waits for the user to stop at an intersection, then sets the sync time.
The WaitForIntersectionSync () function waits for the user to stop at an intersection then sets the sync time .
void WaitForIntersectionSync()
{
	bool intersectionSynced = false;
	#if DEBUG
	char temp[15];
	#endif
	while(!intersectionSynced)
	{
		gpsPoint currentLocation = locationBuffer.prevLocations[0];
		intersection nearestIntersection = LoadNearestIntersection(currentLocation.lat, currentLocation.lng);
		gpsPoint intersectionLocation = { .lat = nearestIntersection.lat, .lng = nearestIntersection.lng };
		if(75 > DistanceBetweenPoints(currentLocation, intersectionLocation) &&
			!CurrentlyMoving())
		{
			DeleteIntersection(&currentIntersection);
			currentIntersection = nearestIntersection;
			LoadLinkedIntersections((intersection *)&currentIntersection);
			syncTime = currentTime;
			lastIntersectionChangeTime = currentTime;
			intersectionSynced = true;
		}
		else
			DeleteIntersection(&nearestIntersection);
		_delay_ms(4000);
	}
}
void WaitForIntersectionSync ( ) { bool intersectionSynced = false ; #if DEBUG char temp [ 15 ] ; #endif while ( ! intersectionSynced ) { gpsPoint currentLocation = locationBuffer . prevLocations [ 0 ] ; intersection nearestIntersection = LoadNearestIntersection ( currentLocation . lat , currentLocation . lng ) ; gpsPoint intersectionLocation = { . lat = nearestIntersection . lat , . lng = nearestIntersection . lng } ; if ( 75 > DistanceBetweenPoints ( currentLocation , intersectionLocation ) && ! CurrentlyMoving ( ) ) { DeleteIntersection ( & currentIntersection ) ; currentIntersection = nearestIntersection ; LoadLinkedIntersections ( ( intersection * ) & currentIntersection ) ; syncTime = currentTime ; lastIntersectionChangeTime = currentTime ; intersectionSynced = true ; } else DeleteIntersection ( & nearestIntersection ) ; _delay_ms ( 4000 ) ; } }
The WaitForIntersectionSync() function waits for the user to stop at an intersection, then sets the sync time.
The WaitForIntersectionSync () function waits for the user to stop at an intersection then sets the sync time .