An aerosol-generating device comprising: an air inlet ; an air outlet ; an air flow passage extending between the air inlet and the air outlet; a heating element for heating an aerosol-forming substrate ; a sensor assembly in communication with the air flow passage, the sensor assembly being configured to measure one or both of a flow rate and a pressure level within the air flow passage; and a controller coupled to the sensor assembly and configured to control a supply of power to the heating element , wherein the controller is further configured to receive data from the sensor assembly and determine when a user puffs on the aerosol-generating device and record the time at which each puff starts and the time at which each puff ends, and wherein the amount of power supplied to the heating element for a given puff is dependent on the length of time between the start of said given puff and the end of the puff immediately preceding said given puff, such that: the controller is configured to: instigate the supply of a first amount of power to the heating element for a first length of time between the start of a given puff and the end of the puff immediately preceding said given puff; and instigate the supply of a second amount of power to the heating element for a second length of time between the start of a given puff and the end of the puff immediately preceding said given puff; and wherein the first length of time is greater than the second length of time, and the first amount of power is greater than the second amount of power, and wherein the controller is further configured to adjust the amount of power supplied for said given puff based on the period of time which has elapsed between two or more of the preceding puffs. an air inlet ; an air outlet ; an air flow passage extending between the air inlet and the air outlet; a heating element for heating an aerosol-forming substrate ; a sensor assembly in communication with the air flow passage, the sensor assembly being configured to measure one or both of a flow rate and a pressure level within the air flow passage; and a controller coupled to the sensor assembly and configured to control a supply of power to the heating element , wherein the controller is further configured to receive data from the sensor assembly and determine when a user puffs on the aerosol-generating device and record the time at which each puff starts and the time at which each puff ends, and wherein the amount of power supplied to the heating element for a given puff is dependent on the length of time between the start of said given puff and the end of the puff immediately preceding said given puff, such that: the controller is configured to: instigate the supply of a first amount of power to the heating element for a first length of time between the start of a given puff and the end of the puff immediately preceding said given puff; and instigate the supply of a second amount of power to the heating element for a second length of time between the start of a given puff and the end of the puff immediately preceding said given puff; and instigate the supply of a first amount of power to the heating element for a first length of time between the start of a given puff and the end of the puff immediately preceding said given puff; and instigate the supply of a second amount of power to the heating element for a second length of time between the start of a given puff and the end of the puff immediately preceding said given puff; and wherein the first length of time is greater than the second length of time, and the first amount of power is greater than the second amount of power, and wherein the controller is further configured to adjust the amount of power supplied for said given puff based on the period of time which has elapsed between two or more of the preceding puffs. <EOS>