Git Product home page Git Product logo

Comments (8)

ricardoquesada avatar ricardoquesada commented on May 30, 2024

Perhaps there is a way to ping the "db" (how strong the signal is)... and report that feature.

A "ping" or "keep alive" also, but I don't know whether Bluetooth has that feature

from bluepad32.

RC0D3 avatar RC0D3 commented on May 30, 2024

Yeah... I have a car with xbox controller, works as well, but when disconnect, by code of Bluepad32 have a timeout of 20s, then if I'm pressing to accelerate and lose connection, my car continue forward movement and crash in any obstacle :/
I try to find some way to do that manually but don't have how, no true feedback from bluepad.

from bluepad32.

ricardoquesada avatar ricardoquesada commented on May 30, 2024

yes, I should provide a way (assuming it is possible) that the controller might be out-of-range soon... I need to investigate it a bit more

from bluepad32.

ricardoquesada avatar ricardoquesada commented on May 30, 2024

@JoeSc @RC0D3

I recommend using something like this:

in your main loop, you should receive a "gampad event" almost everyframe.
if you don't receive an event in 250ms, then either:

  • no new events were received (buttons/axis are not being pressed)
  • or the gamepad was disconnected/outside the range

in any of those cases, just turn off the motors, etc.

from bluepad32.

JochenKr avatar JochenKr commented on May 30, 2024

Hi,
I'm facing a similar issue using 8bitdo Controller.
Can you explain more specific how to implement such a "gamepad event" flag which could be used to react on?
thx

from bluepad32.

ricardoquesada avatar ricardoquesada commented on May 30, 2024

@JochenKr See this comment. It explains how to use it: #42 (comment)

from bluepad32.

JochenKr avatar JochenKr commented on May 30, 2024

Thanks. Tried it and it improves the situation a lot. Still I need to add some delay like 2s, because the response from update() seems to be often false. But this should be good enough for my case

from bluepad32.

ricardoquesada avatar ricardoquesada commented on May 30, 2024

I didn't understand the delay that you need to add.

Take a look at the updated Sketch to learn how to use correctly:

https://github.com/ricardoquesada/esp32-arduino-lib-builder/blob/release/v4.4/bluepad32_files/libraries/Bluepad32_ESP32/examples/Controller/Controller.ino

search for hasData and update in that file... those are the two new functions added.

from bluepad32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.