In a rapid-compression combustor with a freely moving piston, the efficiency of thermomechanical conversion of energy was determined in the detonation combustion regime of a stoichiometric hydrogen-air mixture under conditions close to those observed during operation of a piston engine of internal combustion in the starting regime. It is shown that this regime of heat release is characterized not only by a dramatic pressure increase in the combustion chamber, but also by its subsequent rapid decrease caused by heat transfer to the cylinder walls and partial condensation of water vapors. The intensity of these components of the thermal process depends progressively on the pressure and temperature of the combustion products, which, in turn, depend on the parameters of the mixture immediately before its ignition. However, the relative increase in combustion pressure turns out to be minimum when the ignition is initiated near the top dead center. It is also shown that the coefficient of thermomechanical conversion of energy (an analog of the indicated efficiency of an internal combustion engine) reaches the maximum value of 31% if the mixture is ignited at a time of approximately 3/4 of a period of oscillations of the piston group after the beginning of compression of an air charge.