Skip to content

Commit 2c2cfa3

Browse files
committed
Match API defaults and interval fallback to the public implementation
1 parent 401dacc commit 2c2cfa3

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased — Publication consistency
44

5+
- Match the API reference to actual config defaults and invalid-interval fallback;
6+
clarify that callers must serialize lifecycle updates. Implementation unchanged.
57
- Align Arduino's NimBLE dependency range with PlatformIO (`>=2.5.0 && <3.0.0`).
68
- Distinguish CI-built targets from experimental, unverified chips; retain all
79
code paths without promising on-air verification or certification.

‎docs/API.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
| --- | ---: | --- |
77
| `appleAdvertisementKeyBase64` | `""` | 28-byte Apple public advertisement key encoded as 40 Base64 characters; empty disables Apple |
88
| `googleAdvertisementEidHex` | `""` | 20-byte Google advertisement EID encoded as 40 hexadecimal characters; empty disables Google |
9-
| `advertisingIntervalMs` | `2000` | BLE interval while stationary, clamped to the controller range 20–10240 ms |
9+
| `advertisingIntervalMs` | `2000` | Stationary BLE interval: valid range 20–10240 ms; out-of-range values reset to 2000 ms, not the nearest bound |
1010
| `txPowerDbm` | `0` | Requested advertising power, mapped to the nearest ESP controller level |
1111
| `providerWindowMs` | `6000` | Requested provider window; clamped to at least three stationary advertisement intervals (and at least 1 second) |
1212
| `accelerometerEnabled` | `false` | Enables LIS3DH/LIS2DH/LIS2DH12 motion detection |
13-
| `accelerometerWire` | `&Wire` | I2C bus instance; point it to `Wire1` or another initialized bus when required |
13+
| `accelerometerWire` | `nullptr` | Null selects `Wire` when the built-in driver is enabled; pass `&Wire1` or another bus when required |
1414
| `initializeAccelerometerBus` | `true` | Calls `begin(SDA, SCL)` on the selected bus; set false if the host firmware already initialized it |
1515
| `accelerometerSda` | `8` | I2C SDA pin |
1616
| `accelerometerScl` | `9` | I2C SCL pin |
1717
| `accelerometerAddress` | `0` | `0` probes `0x18`/`0x19`; otherwise forces the supplied address |
1818
| `motionThreshold` | `320` | Motion delta threshold; raise it to reject small vibrations |
19-
| `motionIntervalMs` | `200` | BLE interval while movement is active |
19+
| `motionIntervalMs` | `200` | Motion BLE interval: valid range 20–10240 ms; out-of-range values reset to 200 ms |
2020
| `motionHoldMs` | `30000` | Time to keep the motion interval after the last detected movement |
2121
| `motionDetectedCallback` | `nullptr` | Optional no-argument callback returning true on motion; supports any external sensor or application state |
2222
| `backgroundTask` | `true` | Runs the scheduler in an internal FreeRTOS task |
@@ -88,7 +88,7 @@ when another module needs scanning, client, or GATT-server roles.
8888

8989
## Threading and ownership
9090

91-
Configuration updates are serialized by `reconfigure()`. Do not call
91+
Configuration updates stop and restart the private scheduler. Do not call
9292
`reconfigure()`, `setKeys()`, and `end()` concurrently from multiple tasks;
9393
serialize them in the host application when several configuration sources are
9494
present. The library owns legacy advertising while it is running but does not

‎test/check_metadata.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,12 @@
1818
minimum = dependency[1:]
1919
next_major = int(minimum.split(".")[0]) + 1
2020
assert properties["depends"] == f"NimBLE-Arduino (>={minimum} && <{next_major}.0.0)"
21+
22+
# Compare documented defaults with the public header, not a second value list.
23+
header = (ROOT / "src/FindMyAdv.h").read_text(encoding="utf-8")
24+
api = (ROOT / "docs/API.md").read_text(encoding="utf-8")
25+
fields = re.findall(r'^\s*(?:const char\s*\*|TwoWire\s*\*|u?int(?:8|16|32)_t|bool)\s*(\w+)\s*=\s*([^;]+);', header, re.M)
26+
for name, default in fields:
27+
assert f"| `{name}` | `{default.strip()}` |" in api, f"API default drift: {name}"
2128
print("FindMyAdv metadata: names, version, canonical URLs and dependency ranges agree")
29+
print(f"FindMyAdv API: {len(fields)} documented defaults match the public header")

0 commit comments

Comments
 (0)