Sub humid_temp
Try
'get inside temp from humid sensor
Dim readbyte(2) As Byte
Dim writebyte(1) As Byte
writebyte(0)=0xe3 'read temp register
'chip address,7bit,write,bytes,result,bytes,pause)
Main.twi.WriteRead("htemp",64,False,writebyte,1,readbyte,3,0)
Catch
common.note_trouble("Sensors humid_temp")
get_temp
End Try
If Main.parms.logs Then Log("humid temp end")
End Sub
Sub htemp_done(noerror As Boolean, success As Boolean, writebyte() As Byte, readbyte() As Byte)
If noerror Then
If success Then
Dim partial=(Bit.ShiftLeft(Bit.And(readbyte(0),0xff),8)+Bit.And(readbyte(1),0xfc)) As Int
temp2=NumberFormat2(-46.85+(175.72*(partial/65536)),1,2,2,False)
'get humidity from humid sensor
Dim readbyte(2) As Byte
Dim writebyte(1) As Byte
writebyte(0)=0xe5 'read temp register
Main.twi.WriteRead("hhumid",64,False,writebyte,1,readbyte,3,0)
Else
Log("htemp_done error "&noerror&" "&success)
get_temp
End If
Else
common.note_trouble("Sensors htemp_done ERROR ")
get_temp
End If
If Main.parms.logs Then Log("htemp_done end")
End Sub