Skip to content

docs: Harmonize wsen-hids README — add I2C address and power sections.#209

Merged
nedseb merged 9 commits intomainfrom
wsen-hids-harmonise-readme2
Mar 23, 2026
Merged

docs: Harmonize wsen-hids README — add I2C address and power sections.#209
nedseb merged 9 commits intomainfrom
wsen-hids-harmonise-readme2

Conversation

@Charly-sketch
Copy link
Copy Markdown
Contributor

Closes #197
Parent issue: #194

Add missing README sections for WSEN-HIDS driver

This PR completes the documentation by adding:

I²C Address section (default: 0x5F)
Power Management section (power_off, power_on, reboot)
Also fixes minor formatting issues in the README.

Copy link
Copy Markdown
Contributor

@nedseb nedseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonne direction générale — les ajouts (Power Management, Calibration, correction du Quick Example) sont pertinents. Quelques points à corriger :

Structure

  1. Section I²C Address — Mettre 0x5F dans un bloc python isolé est étrange. Remets-le dans le tableau des specs (comme avant) ou écris simplement "Default I²C address: 0x5F" en une ligne. La phrase "This value is defined in the driver constants." n'apporte rien, à supprimer.

Exactitude du contenu

  1. set_average() — mauvaises constantes — Les constantes listées (AVG_2, AVG_4... AVG_256) n'existent pas dans le driver. Les vraies constantes sont séparées pour température et humidité : AVG_T_2, AVG_T_4, AVG_H_2, AVG_H_4, etc. Vérifie dans const.py et corrige l'exemple.

  2. read_one_shot(timeout_ms=500) — Vérifie que 500 est bien la valeur par défaut dans le driver (DEFAULT_ONE_SHOT_TIMEOUT_MS). Si ce n'est pas le cas, utilise la bonne valeur ou retire le paramètre de l'exemple.

  3. ODR disponibles — Tu listes ODR_1_HZ, ODR_7_HZ, ODR_12_5_HZ mais il manque ODR_ONE_SHOT. Vérifie dans const.py que la liste est complète.

Méthodes manquantes

  1. device_id() — Méthode publique non documentée. Tous les drivers l'ont, elle doit apparaître dans le README.

  2. enable_bdu() — Idem, méthode publique absente du README.

Cohérence

  1. Emoji ⚠️ dans Heater Control — Les autres README harmonisés n'utilisent pas d'emoji. Remplace par **Warning:** pour rester cohérent.

  2. Section Examples — La liste mentionne "driver validation tests" alors que l'issue #187 demande de remplacer les tests par de vrais exemples. Mets à jour avec les exemples réels du dossier examples/.

  3. Trailing whitespace — Lignes 50 et 227 (après "driver constants." et "non-volatile memory.") ont des espaces en fin de ligne. Ruff ne vérifie pas le markdown mais c'est une bonne habitude.

Rappel général

Avant de soumettre, ouvre device.py et const.py et vérifie que chaque méthode publique et chaque constante exposée du driver apparaît dans le README. Un README incomplet est pire qu'un README absent — il donne une fausse impression de complétude.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the WSEN-HIDS driver README to better align with the repo’s driver documentation template and the driver’s current API surface.

Changes:

  • Simplifies/updates the “Quick Example” to use read() and a shorter I2C init.
  • Expands measurement-mode documentation (one-shot vs continuous) and adds a new “Power Management” section.
  • Updates status and calibration documentation snippets and removes some formatting noise.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/wsen-hids/README.md Outdated
Comment on lines +45 to +49
from machine import I2C, Pin
from time import sleep
from wsen_hids import WSEN_HIDS

i2c = I2C(
0,
scl=Pin(9),
sda=Pin(8),
freq=100000,
)
i2c = I2C(1)
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Quick Example, Pin is imported but no longer used after switching to i2c = I2C(1). Remove Pin from the import (or revert the example to explicitly configure scl/sda) to avoid a misleading unused import in the snippet.

Copilot uses AI. Check for mistakes.
Comment thread lib/wsen-hids/README.md
Comment on lines +109 to 110
After initialization, the sensor operates in **one-shot mode** (ODR = 00).
If `read()`, `humidity()`, or `temperature()` are called while the sensor is not in continuous mode, the driver **automatically triggers a one-shot conversion** to ensure fresh data is returned.
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Measurement behavior” text says the driver triggers a one-shot conversion whenever the sensor is “not in continuous mode”, but the implementation only triggers when the device is powered down (_ensure_data() checks the PD bit via _is_power_down()). The README should describe the actual behavior (or the code should be updated to also detect ODR=00/one-shot-active if that’s the intended contract).

Suggested change
After initialization, the sensor operates in **one-shot mode** (ODR = 00).
If `read()`, `humidity()`, or `temperature()` are called while the sensor is not in continuous mode, the driver **automatically triggers a one-shot conversion** to ensure fresh data is returned.
After initialization, the sensor is left in its default **power-down** state with one-shot operation configured (ODR = 00).
When `read()`, `humidity()`, or `temperature()` are called and the sensor is in power-down mode, the driver **automatically triggers a one-shot conversion** and waits for fresh data before returning.

Copilot uses AI. Check for mistakes.
Comment thread lib/wsen-hids/README.md

---

# Quick Example
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description/Issue #197 calls for an explicit “I²C Address” section (per the standard README template), but this README still doesn’t have an “I²C Address” heading; the address only appears in the Supported Sensor table. Add a dedicated section (e.g., documenting default 0x5F and the address= init parameter) to match the harmonized format.

Copilot uses AI. Check for mistakes.
Comment thread lib/wsen-hids/README.md
Comment on lines 149 to 155
Available output data rates:

```python
WSEN_HIDS.ODR_ONE_SHOT
WSEN_HIDS.ODR_1_HZ
WSEN_HIDS.ODR_7_HZ
WSEN_HIDS.ODR_12_5_HZ
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Available output data rates” list omits WSEN_HIDS.ODR_ONE_SHOT even though the driver exposes it as a constant. Either include it in the list or clarify that one-shot is configured via set_one_shot_mode()/read_one_shot() rather than via the ODR constants.

Copilot uses AI. Check for mistakes.
@nedseb nedseb force-pushed the wsen-hids-harmonise-readme2 branch from 85e02fe to 169169a Compare March 23, 2026 15:43
@nedseb
Copy link
Copy Markdown
Contributor

nedseb commented Mar 23, 2026

Revue des corrections de Charly + rebase sur main (conflit résolu en 169169a) :

Point demandé Statut
Section I²C Address bizarre (bloc code isolé) ✅ Supprimée, remise dans le tableau des specs
"This value is defined in driver constants" ✅ Supprimé
AVG constantes incorrectes ✅ Vérifié dans const.py — les constantes étaient correctes (AVG_2 à AVG_256 partagées pour T et H)
read_one_shot(timeout_ms) valeur par défaut ✅ Documenté (100ms par défaut)
ODR manquants ✅ ODR_ONE_SHOT ajouté
device_id() non documenté ✅ Ajouté avec description
enable_bdu() non documenté ✅ Ajouté avec description
Emoji ⚠️ dans Heater ✅ Remplacé par texte
Trailing whitespace ✅ Nettoyé
Section Examples incomplète ❌ Pas mise à jour (les exemples wsen-hids sont en cours de refonte dans #187)

Conflit de rebase résolu : suppression de la commande mpremote en fin de fichier (déjà retirée par Charly, gardée dans main). Prête à merger.

@nedseb nedseb merged commit 53d7e85 into main Mar 23, 2026
3 checks passed
@nedseb nedseb deleted the wsen-hids-harmonise-readme2 branch March 23, 2026 15:44
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: Harmonize wsen-hids README — add I2C address and power sections.

3 participants