Square wave charging of lead-acid batteries