Very nice! And this is still inline, correct? The accuracy of inline sensors can be greatly improved with oversampling, whereas lowside can generally only take one sample per PWM cycle due to the timing requirements. My testing on GooserCS showed best results with at least 30 microseconds of sampling time. I’m taking 32 samples per sensor during that period, and the resulting noise level is about the same as the lowside sensing on B-G431B-ESC1, 5 or 6 ADC units (out of 4096). My ACS711 sensors are very noisy without oversampling (24 ADC units typical variation, with occasional spikes far beyond that range), so with INA240 being so much better to begin with, it may be possible to get almost to sub-milliamp accuracy.
It would be nice to add oversampling to the library for inline sensors, but my code is specific to my setup, and I hate the STM32 HAL code with a passion so I certainly won’t be the one to implement it. The general approach I use is to set up the ADC to continuously cycle through the channels, sampling into a circular buffer with DMA. When it’s time to read the sensors, add up everything in the buffer, which contains the most up-to-date readings (it’s circular, so it doesn’t matter which entry was most recently written to). Compared to hardware oversampling, this allows all sensors to be sampled during a long time window rather than taking turns in shorter time windows. The number of samples per sensor is the same either way, but this gives lower latency, and better noise reduction for my sensors. You can use some hardware oversampling to reduce the size of the buffer (less CPU time to add them up), but I recommend no more than 8x.