tps/test: test00 change the printed values to the real ones

parent 5fcb80b4
......@@ -137,6 +137,11 @@ class ADC_AD7997:
def adc_value(value) :
return str(2.495 * (0x3FF & (value >> 2)) / 1024); # 10 bits
def adc_convert_to_real_value (nr_value, value) :
ratio = {'8': 0.6666, '7': 0.1666, '6': 0.52381};
return str(float(value) / ratio[str(nr_value)])
def main (default_directory='.'):
......@@ -166,17 +171,17 @@ def main (default_directory='.'):
value1 = adc_value(adc.rd_reg16(0x80));
# Check the values of the ADC.
if(float(value8) < 1.61) or (float(value8) > 1.73) :
raise TpsError ("Error in VS_VADJ, value x=" + value8 + ". x > 1.73 V or x < 1.61 V")
print "VS_VADJ = " + value8
if(float(value8) < 1.58) or (float(value8) > 1.75) :
raise TpsError ("Error in VS_VADJ (2.5V) measured "+ adc_convert_to_real_value(8, value8) + "V.")
print "VS_VADJ = " + adc_convert_to_real_value(8, value8)
if(float(value7) < 1.90) or (float(value7) > 2.11):
raise TpsError ("Error in VS_P12V_x, value x=" + value7 + ". x< 1.90 V or x > 2.11 V")
print "VS_P12V_x = " + value7
if(float(value7) < 1.88) or (float(value7) > 2.13):
raise TpsError ("Error in VS_P12V_x (12V) measured "+ adc_convert_to_real_value(7, value7) + "V.")
print "VS_P12V_x = " + adc_convert_to_real_value(7, value7)
if(float(value6) < 1.66) or (float(value6) > 1.80):
raise TpsError ("Error in VS_P3V3_x, value x=" + value6 + ". x < 1.66 V or x > 1.80 V")
print "VS_P3V3_x = " + value6
if(float(value6) < 1.64) or (float(value6) > 1.82):
raise TpsError ("Error in VS_P3V3_x (3.3V) measured "+ adc_convert_to_real_value(6, value6) + "V.")
print "VS_P3V3_x = " + adc_convert_to_real_value(6, value6)
if __name__ == '__main__' :
main();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment