+ try:
+ nh3 = (nh3 * 56000) / (3.3 - nh3)
+ except ZeroDivisionError:
+ nh3 = 0
+
+ analog = None
+
+ if _adc_enabled:
+ if _adc_gain == MICS6814_GAIN:
+ analog = adc.get_voltage('ref/gnd')
+ else:
+ adc.set_programmable_gain(_adc_gain)
+ time.sleep(0.05)
+ analog = adc.get_voltage('ref/gnd')
+ adc.set_programmable_gain(MICS6814_GAIN)
+
+ return Mics6814Reading(ox, red, nh3, analog)