From c74b24196bc63b8e51c8662b689f75748963f093 Mon Sep 17 00:00:00 2001 From: JPOSADA202020 Date: Mon, 2 Dec 2024 21:39:12 -0500 Subject: [PATCH] correcting_units --- .pre-commit-config.yaml | 20 +++++++++++++++----- bmi160.py | 8 +++++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d000ade..c0e8ede 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,27 +1,30 @@ -# 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 @@ -29,3 +32,10 @@ repos: 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 diff --git a/bmi160.py b/bmi160.py index 1a6d181..dfeb29d 100644 --- a/bmi160.py +++ b/bmi160.py @@ -155,6 +155,8 @@ GYRO_RANGE_2000, ) +STANDARD_GRAVITY = 9.80665 + class BMI160: """Driver for the BMI160 Sensor connected over I2C. @@ -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: