Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Adding Fahrenheit parameter to BME280 module #17

Merged
merged 1 commit into from
Apr 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function Get-BME280Data
[string] $Mode,

[Parameter(Mandatory=$false)]
[string] $Oversampling
[string] $Oversampling,

[Parameter(Mandatory=$false)]
[switch] $Fahrenheit
)
$Device = CreateDeviceIfNotExist -Device $Device

Expand All @@ -74,6 +77,10 @@ function Get-BME280Data

[int] $TFine = Calc-T-Fine $adc_T $script:CalibrationData[$Device]
[float] $Temperature = (($TFine * 5 + 128) -shr 8) / [float]100;
if ($Fahrenheit)
{
$Temperature = $Temperature * 1.8 + 32
}

[float] $Pressure = Compensate_P $adc_P $script:CalibrationData[$Device] $TFine
$Pressure = $Pressure / 100
Expand Down