You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
WSEN-ISDS: add support for temperature sensor
This commit is contained in:
+2
-1
@@ -3,13 +3,14 @@
|
||||
- Fri3d Camp 2024 Board: add startup light and sound
|
||||
- Fri3d Camp 2024 Board: workaround ADC2+WiFi conflict by temporarily disable WiFi to measure battery level
|
||||
- Fri3d Camp 2024 Board: improve battery monitor calibration to fix 0.1V delta
|
||||
- Fri3d Camp 2024 Board: add WSEN-ISDS 6-Axis Inertial Measurement Unit (IMU) support (including temperature)
|
||||
- API: improve and cleanup animations
|
||||
- API: SharedPreferences: add erase_all() function
|
||||
- API: add defaults handling to SharedPreferences and only save non-defaults
|
||||
- API: restore sys.path after starting app
|
||||
- API: add AudioFlinger for audio playback (i2s DAC and buzzer)
|
||||
- API: add LightsManager for multicolor LEDs
|
||||
- API: add SensorManager for IMU/accelerometers, temperature sensors etc.
|
||||
- API: add SensorManager for generic handling of IMUs and temperature sensors
|
||||
- About app: add free, used and total storage space info
|
||||
- AppStore app: remove unnecessary scrollbar over publisher's name
|
||||
- Camera app: massive overhaul!
|
||||
|
||||
@@ -35,6 +35,8 @@ class Wsen_Isds:
|
||||
_ISDS_STATUS_REG = 0x1E # Status data register
|
||||
_ISDS_WHO_AM_I = 0x0F # WHO_AM_I register
|
||||
|
||||
_REG_TEMP_OUT_L = 0x20
|
||||
|
||||
_REG_G_X_OUT_L = 0x22
|
||||
_REG_G_Y_OUT_L = 0x24
|
||||
_REG_G_Z_OUT_L = 0x26
|
||||
@@ -354,6 +356,20 @@ class Wsen_Isds:
|
||||
|
||||
return g_x, g_y, g_z
|
||||
|
||||
@property
|
||||
def temperature(self) -> float:
|
||||
temp_raw = self._read_raw_temperature()
|
||||
return ((temp_raw / 256.0) + 25.0)
|
||||
|
||||
def _read_raw_temperature(self):
|
||||
"""Read raw temperature data."""
|
||||
if not self._temp_data_ready():
|
||||
raise Exception("temp sensor data not ready")
|
||||
|
||||
raw = self.i2c.readfrom_mem(self.address, Wsen_Isds._REG_TEMP_OUT_L, 2)
|
||||
raw_temp = self._convert_from_raw(raw[0], raw[1])
|
||||
return raw_temp
|
||||
|
||||
def _read_raw_angular_velocities(self):
|
||||
"""Read raw gyroscope data."""
|
||||
if not self._gyro_data_ready():
|
||||
@@ -420,6 +436,10 @@ class Wsen_Isds:
|
||||
"""Check if gyroscope data is ready."""
|
||||
return self._get_status_reg()[1]
|
||||
|
||||
def _temp_data_ready(self):
|
||||
"""Check if accelerometer data is ready."""
|
||||
return self._get_status_reg()[2]
|
||||
|
||||
def _acc_gyro_data_ready(self):
|
||||
"""Check if both accelerometer and gyroscope data are ready."""
|
||||
status_reg = self._get_status_reg()
|
||||
|
||||
@@ -697,9 +697,7 @@ class _WsenISDSDriver(_IMUDriver):
|
||||
)
|
||||
|
||||
def read_temperature(self):
|
||||
"""Read temperature in °C (not implemented in WSEN_ISDS driver)."""
|
||||
# WSEN_ISDS has temperature sensor but not exposed in current driver
|
||||
return None
|
||||
return self.sensor.temperature
|
||||
|
||||
def calibrate_accelerometer(self, samples):
|
||||
"""Calibrate accelerometer using hardware calibration."""
|
||||
@@ -807,6 +805,15 @@ def _register_wsen_isds_sensors():
|
||||
max_range="±500 deg/s",
|
||||
resolution="0.0175 deg/s",
|
||||
power_ma=0.65
|
||||
),
|
||||
Sensor(
|
||||
name="WSEN_ISDS Temperature",
|
||||
sensor_type=TYPE_IMU_TEMPERATURE,
|
||||
vendor="Würth Elektronik",
|
||||
version=1,
|
||||
max_range="-40°C to +85°C",
|
||||
resolution="0.004°C",
|
||||
power_ma=0
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user