Last active
June 27, 2022 13:37
-
-
Save hatsunea/087d47fe69ccd2b8312c65e77536f000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal float CalcPressureHectopascals() | |
{ | |
return this.CalcPressure() / 100; | |
} | |
internal float CalcPressure() | |
{ | |
// データを取得 | |
var data = this.ReadToPressure(Register.PRESS_TXD); | |
var pRaw = (int)(System.Buffers.Binary.BinaryPrimitives.ReadUInt32BigEndian(data) - Math.Pow(2, 23)); | |
data = this.ReadToPressure(Register.TEMP_TXD); | |
var tRaw = (int)(System.Buffers.Binary.BinaryPrimitives.ReadUInt32BigEndian(data) - Math.Pow(2, 23)); | |
// 温度補正 | |
var tInt = ConvTx02e(tRaw); | |
var pInt = Pressure02e(pRaw, tInt); | |
return (float)pInt / 16.0f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment