Skip to content

Commit

Permalink
Add ForceBoard stream, stop & temperature support
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevie-Ray committed Oct 12, 2024
1 parent 0827c78 commit d66ad08
Show file tree
Hide file tree
Showing 16 changed files with 218 additions and 79 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ motherboardButton.addEventListener("click", () => {
enable it at `chrome://flags/#enable-experimental-web-platform-features`.
-[Kilter Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/kilterboard.html)
-[Entralpi](https://stevie-ray.github.io/hangtime-grip-connect/devices/entralpi.html) / Lefu Scale
- [PitchSix Force Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/forceboard.html)
- [PitchSix Force Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/forceboard.html)
- ➡️ [Climbro](https://stevie-ray.github.io/hangtime-grip-connect/devices/climbro.html)
- ➡️ [Smartboard Climbing - mySmartBoard](https://stevie-ray.github.io/hangtime-grip-connect/devices/mysmartboard.html)

Expand Down
2 changes: 1 addition & 1 deletion examples/chart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@fortawesome/free-brands-svg-icons": "^6.6.0",
"@fortawesome/free-regular-svg-icons": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@hangtime/grip-connect": "^0.5.3",
"@hangtime/grip-connect": "^0.5.4",
"chart.js": "^4.4.4"
},
"devDependencies": {
Expand Down
13 changes: 10 additions & 3 deletions examples/chart/src/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function setupDevice(massesElement: HTMLDivElement, outputElement: HTMLDi
isStreaming = false
convertFontAwesome()
connectedDevices.forEach(async (device) => {
if (device instanceof Motherboard || device instanceof Progressor) {
if (device instanceof Motherboard || device instanceof Progressor || device instanceof ForceBoard) {
await device.stop()
}
})
Expand All @@ -92,7 +92,7 @@ export function setupDevice(massesElement: HTMLDivElement, outputElement: HTMLDi
isStreaming = true
convertFontAwesome()
connectedDevices.forEach(async (device) => {
if (device instanceof Motherboard || device instanceof Progressor) {
if (device instanceof Motherboard || device instanceof Progressor || device instanceof ForceBoard) {
await device.stream()
}
})
Expand Down Expand Up @@ -291,6 +291,13 @@ export function setupDevice(massesElement: HTMLDivElement, outputElement: HTMLDi
console.log("Humidity Level:", humidityLevel)
outputElement.textContent += `Humidity Level: ${humidityLevel}\r\n`
}
const temperatureLevel = Number(await device.temperature())
if (temperatureLevel) {
const celsius = ((temperatureLevel - 32) * 5) / 9
console.log("Temperature Level Fahrenheit:", temperatureLevel.toString())
console.log("Temperature Level in Celsius:", celsius.toFixed(1))
outputElement.textContent += `Temperature Level: ${temperatureLevel.toString()}°F / ${celsius.toFixed(1)}°C\r\n`
}
}

if (device instanceof Motherboard) {
Expand All @@ -317,7 +324,7 @@ export function setupDevice(massesElement: HTMLDivElement, outputElement: HTMLDi
}

// Start streaming
if (device instanceof Motherboard || device instanceof Progressor) {
if (device instanceof Motherboard || device instanceof Progressor || device instanceof ForceBoard) {
await device.stream()
}

Expand Down
2 changes: 1 addition & 1 deletion examples/flappy-bird/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@hangtime/grip-connect": "^0.5.3"
"@hangtime/grip-connect": "^0.5.4"
},
"devDependencies": {
"typescript": "^5.6.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/kilter-board/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@hangtime/grip-connect": "^0.5.3"
"@hangtime/grip-connect": "^0.5.4"
},
"devDependencies": {
"typescript": "^5.6.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/pong/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@hangtime/grip-connect": "^0.5.3"
"@hangtime/grip-connect": "^0.5.4"
},
"devDependencies": {
"typescript": "^5.6.3",
Expand Down
130 changes: 68 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
],
"dependencies": {
"@grip-connect/docs": "*",
"@hangtime/grip-connect": "^0.5.3"
"@hangtime/grip-connect": "^0.5.4"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ motherboardButton.addEventListener("click", () => {
enable it at `chrome://flags/#enable-experimental-web-platform-features`.
-[Kilter Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/kilterboard.html)
-[Entralpi](https://stevie-ray.github.io/hangtime-grip-connect/devices/entralpi.html) / Lefu Scale
- [PitchSix Force Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/forceboard.html)
- [PitchSix Force Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/forceboard.html)
- ➡️ [Climbro](https://stevie-ray.github.io/hangtime-grip-connect/devices/climbro.html)
- ➡️ [Smartboard Climbing - mySmartBoard](https://stevie-ray.github.io/hangtime-grip-connect/devices/mysmartboard.html)

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hangtime/grip-connect",
"version": "0.5.3",
"version": "0.5.4",
"description": "Griptonite Motherboard, Tindeq Progressor, PitchSix Force Board, WHC-06, Entralpi, Climbro, mySmartBoard: Web Bluetooth API Force-Sensing strength analysis for climbers",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Loading

0 comments on commit d66ad08

Please sign in to comment.