OEM systems use an fuel mix sensor AKA Flex Fuel sensor. It's fitted in the fuel hose and measures the ethanol content. Allows any mix from 100% ethanol to 100% petrol. So it doesn't matter what fuel you can get, the ECU is told what it's using and adjusts accordingly. Normally the GM or Ford parts cost around $500, it's something like this but in bag that says Ford or GM on it -so it looks like Siemens, Ford/GM etc and the dealer all make 100% on a $60 part.
http://www.siemensvdo.com/products_s...x-fuel-sensor/
Megasquirt uses a GM part - someone is selling them cheap $50.
http://www.megamanual.com/flexfuel.htm
(Phatbob - will VEMS do this? Or have they gone too far down different paths?)
E85 likes to be very much richer for max power than petrol. It's not just a simple case of bung xx% more fuel in across the whole range. The megasquirt web page shows the ratio of petrol to E85 at stoichiometric to be 146% (1.46x the amount), for (avg) best power it's 12.5/7.65 = 163% (1.63x), injectors / pumps need sizing to met that best power demand
On a normally mapped ECU like the stock Nissan ones without spare programmable external inputs you could have 8 or 16 maps to cover the range 95-105RON. 128K rom chip(s) will do. If you could be sure of always getting 99RON octane petrol or E85 then you could use fewer maps. Using the sensor on PIC chip interface the map switching would have to be latched when the ECU is doing a memory / IO write - it's not accessing rom. Otherwise a bit of maths and a careful record of what has gone in the tank could be used for manual selection on leaving the pump. The mix won't change while driving and what's in the fuel rail will purge back to the tank during priming. Mapping sessions would need to use at least 3 fuel mixes, 100% petrol of the lowest octane you would use, 100% E85 and a 50/50 mix of the two. You can fill in the other maps as either a straight line or a parabola fitted though the 3 points.
There is a technique called "virtual octane sensor", this uses lambda, knock sensor and ion ignition detection to find the mixture and best ignition for whatever mix of fuel is used. AFAIK No aftermarket ECU is clever enough yet.
Fuel tanks very rarely contain an explosive mix of air and fuel vapour. If there is liquid fuel sloshing around in there the vapour mix is usually so rich that it's not explosive (it is at vents, the filler or any other hole - the free air dilutes the mix very close to the hole). It's when you drain the tank and there is just a small amount left in seams that it leans out to the point that it will go bang.