FFBeast Wheel WebHID API
    Preparing search index...

    FFBeast Wheel WebHID API

    Build Status Documentation NPM Version License

    TypeScript library for configuring and controlling FFBeast force feedback wheel controllers from the browser over WebHID. It is a port of FFBeast's C++ API, which is kept in reference-cpp.

    • Read effect, hardware, GPIO, ADC and license settings, and write individual settings
    • Receive the wheel position and torque in real time
    • Send direct force feedback control
    • Save settings, reboot, reset the wheel center, switch to DFU mode and activate the firmware
    npm i @shubham0x13/ffbeast-wheel-webhid-api
    
    import { SettingField, WheelApi } from "@shubham0x13/ffbeast-wheel-webhid-api";

    const wheel = new WheelApi();

    wheel.on("deviceConnected", async () => {
    const settings = await wheel.readAllSettings();
    console.log("Motion range:", settings.effects.motionRange);

    await wheel.sendSetting(SettingField.MotionRange, 0, 900);
    });

    wheel.on("stateReceived", (state) => {
    console.log("Position:", state.positionDegrees);
    console.log("Torque:", state.torqueNormalized);
    });

    // Reconnect to a previously authorized wheel without a prompt.
    const reconnected = await wheel.tryAutoConnect();

    // Otherwise, open the browser's device picker from a user action.
    if (!reconnected) {
    connectButton.addEventListener("click", () => {
    wheel.connect().catch(console.error);
    });
    }

    // Later, for example when the page or component unmounts.
    // destroy() also disconnects.
    await wheel.destroy();

    The API reference covers every method, event, setting and type. Release notes are in CHANGELOG.md.

    • An FFBeast wheel controller
    • A page served over HTTPS or from localhost (WebHID requires a secure context)
    • A browser with WebHID support:
    Browser Supported
    Chrome, Brave, Edge and other Chromium-based (desktop) Yes
    Firefox No
    Safari No

    Issues and pull requests are welcome. See CONTRIBUTING.md for development instructions.

    This project is licensed under the MIT License.