Depends on the ECU as to how it behaves on a battery off.
As for the codes if you have a hard fault it'll be back.
Could be a multitude of causes.
If under warranty why drive in this condition just ask your dealer to collect it, if you conked out in a dangerous place you'd regret it.