char_pos=lines[1].find('t=') #individua la lettere "t"
if lines[0].strip()[-3:]=='YES': #se c'e' YES alla fine legge normalmente e ritorna temp1
tstring=lines[1][char_pos+2:]
temp_c = float(tstring)/1000
temp_c = round(temp1, 1)
if temp_c != 85: #85 indica un errore di lettura
return temp_c
else:
time.sleep(2)
char_pos=lines[1].find('t=')
tstring=lines[1][char_pos+2:]
temp_c = float(tstring)/1000
temp_c=round(temp_c, 1)
return temp_c
#se non c'e' YES (NO) ritorna 88.8 (la dir esiste ancora ma c'e' NO)
else:
return 88.8
#se lines = error (la dir e' sparita e read_temp_raw() non trova la dir e ritorna error), ritorna 99.9
else: