add max tried count, fixed gpio pin