You might refer to the HMRC helpsheet HS283
as part of this answer.
As you will read in HS283, when you calculate the gain on the disposal of a property, it is treated as having accrued evenly over the entire period of ownership. The value at the time you move out or let a property is irrelevant.
An election for a property to be treated as your main residence has to be made within two years of acquiring another. If you haven't done that, the your main residence for any period will be based on the facts.
In answer to your direct questions:
1 House 1 ceased to be your main home when you moved out unless you made an election for it to continue to be treated as such within two years of your acquiring house 2. As of now, if you sold house 1, you would qualify for an exemption from CGT for the gain covered by the period that you lived in it and for the last 36 months of ownership (last 18 months for disposals after 5 April 2014). That would cover all but about 8 months of worth of the gain. Letting relief would probably cover the rest of the gain. The longer you hold on to house 1, the greater the propotion of the gain that will be subject to CGT, though the way house prices move will impact on that.
2 Your new period of residency will be added to the previous period. It could be argued that house 2 continues to be your main home as you have only moved out due to the structural work which needs doing. However, your mathematical logic for house 1 makes sense. Letting relief is worth up to £40,000 per part owner.
I hope this helps but let me know if you have any further questions.