While my personal opinion is he should not have been charged my guess is there are also complicating factors. Complicating factors in this case, why was the home targeted and was the gun and ammo properly/legally stored. If it was well it is almost impossible to use it in such a situation (time wise). So was the guy expecting something and was at the ready.... just happened to be cleaning the gun type of thing. It was under the pillow... or whatever.
Sadly though, this is the logic of the legal system, person gets charged for defending themselves and they get found not-guilty they say the system works....except for the huge cost (money and otherwise) to the person that was charged!
Not in this case (gun fight) but legally IMO the best tool for self defence in your home is a fire extinguisher. Can be used as a stand off weapon and can be swung, no reason not to have one at hand (fires)... Using a knife, gun, baseball bat or other "weapon", etc. will likely get some sort of charge as it comes back to why did you have "that weapon" at hand.... were you playing baseball in your bedroom?