The ignition timing is set by the electronic control system. The data for the operating modes of the engine is programmed and entered into the memory of the engine control module.
Engine parameters (crankshaft speed, load, temperature, etc.) measured by different sensors. Based on them, commands are sent to control the ignition timing to the optimal setting.