Current sensing for buck boost converter

baron-robert:
About the average LED current/ power supply current. I thought the power consume by the CPU and other components was negligible vs LED power (~0,7A to 3A).

Even if you ignore the current taken by the mcu and other components, and you make the simplifying assumpton of 100% efficiency, the average battery current is not the same as the average LED current unless the LED voltage and battery voltage. More specifically:

Average_led_current * led_forward_voltage = battery_voltage * battery_current * efficiency

So if the battery voltage is double the LED forward voltage, then the average LED forward current is double the battery current in the ideal case of 100% efficiency.

If the inductance is large enough, then the current through it will be more or less constant, therefore under these conditions the current through the mosfet when it is turned on equals the current through the LED when the mosfet is off. That is why I think it would be better to monitor the peak current passed by the mosfet.