
I connected my LPG fuel tank sensor to my ESP32 in my Car.
I had already done this in my house control system with my local water tank at home, but now I have to do all the calculations inside of the car ESP.
First I have two values from the sensor at my ADS1115 connected and working with the ESP32:
Empty tank = 11760
Full tank = 25452
All other levels are in between these two values.
So I need to convert this into 0% till 100%
And if a value is higher or lower as the max and min value, the ESP should still show(display) and send (controller) only 0% or 100%
So no -4% or 107% Level as long my fuel tank is not physical change the shape

And IF my fuel tank is changing the shape, i have other problems then my sensor values

and since my fuel tank is a lot more shaking as my local water tank at home I need to avarage the sensor value.
My idea would be:
- getting sensor data every 10 seconds and store 10 of it it inside of the ESP32.
- Deleting the highest and the lowest value.
- summery all 8 values and divide it by 8.
send value to controller every 100 seconds and repeat procedure.
Or a continues solution, if you have a better solution in mind ?
So first question would be : Doable ?
second question: How ?

Thank you for your help and have a great day !

Sascha