After the computer has been without power for a time (1hour or more) it will need to re-optimize it's settings. The relearning takes about 20min of driving. During this time the computer re-optimizes for your location(altitude, temp, fuel quality, etc.) and your driving style. If your computer has thrown some error codes, a mechanic will normally clear the codes using a OBDII reader and then drive it for 10-15 mins to see what are the current codes are if any. Many tempory faults can cause codes to be thrown, water in the gas, bad gas, Running the car on empty and sucking air, plugged air filter, leaking egr valve, etc.
At no time should it take 500 miles, 20 miles tops. contact local law enforcement and state licensing.