An algorithm which permits a smoke detector to maintain a constant sensitivity setting by adjusting for environmental contaminants and other factors