Electronic control for diesel engines