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

correcting_units #2

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
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
20 changes: 15 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
# SPDX-FileCopyrightText: 2023 Jose D. Montoya
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense

repos:
- repo: https://github.com/python/black
rev: 23.3.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
args:
- --fix=lf
- repo: https://github.com/pycqa/pylint
rev: v2.17.4
rev: v3.3.1
hooks:
- id: pylint
name: pylint (library code)
types: [python]
args:
- --disable=consider-using-f-string
exclude: "^(docs/|examples/|tests/)"
exclude: "^(docs/|examples/|tests/|setup.py$)"
- id: pylint
name: pylint (example code)
description: Run pylint rules on "examples/*.py" files
types: [python]
files: "^examples/"
args:
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
- id: pylint
name: pylint (test code)
description: Run pylint rules on "tests/*.py" files
types: [python]
files: "^tests/"
args:
- --disable=missing-docstring,consider-using-f-string,duplicate-code
8 changes: 5 additions & 3 deletions bmi160.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
GYRO_RANGE_2000,
)

STANDARD_GRAVITY = 9.80665


class BMI160:
"""Driver for the BMI160 Sensor connected over I2C.
Expand Down Expand Up @@ -459,9 +461,9 @@ def acceleration(self) -> Tuple[int, int, int]:
"""
factor = self.acceleration_scale[self.acceleration_range]

x = self._acc_data_x / factor
y = self._acc_data_y / factor
z = self._acc_data_z / factor
x = self._acc_data_x / factor * STANDARD_GRAVITY
y = self._acc_data_y / factor * STANDARD_GRAVITY
z = self._acc_data_z / factor * STANDARD_GRAVITY
return x, y, z

def power_mode_status(self) -> None:
Expand Down
Loading