mirror of
https://github.com/mattintech/pyBTMCP.git
synced 2026-07-11 13:01:53 +00:00
v1.1.2: Smooth HR variation, validation, and UI improvements
- Fix HR variation to use smooth sinusoidal algorithm instead of erratic jumps - Clamp HR values to ±3 of target (was exceeding bounds) - Add Pydantic Field validation for device values in API - Add runtime BPM validation in MCP server - Add battery slider control for HR monitor - Add distance display and reset button for treadmill - Add UI/API version display in header - Firmware: web portal improvements, battery/distance controls Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -208,6 +208,13 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
|
||||
device_id = arguments["device_id"]
|
||||
bpm = arguments["bpm"]
|
||||
|
||||
# Validate BPM range
|
||||
if not (30 <= bpm <= 220):
|
||||
return [TextContent(
|
||||
type="text",
|
||||
text=f"Error: BPM must be between 30 and 220, got {bpm}"
|
||||
)]
|
||||
|
||||
await mqtt_client.publish(
|
||||
f"ble-sim/{device_id}/set",
|
||||
json.dumps({"heart_rate": bpm})
|
||||
|
||||
Reference in New Issue
Block a user