Cyclicities in the light variations of Luminous Blue Variables. II. R40 developing an S Doradus phase