GithubHelp home page GithubHelp logo

Comments (15)

jvpernis avatar jvpernis commented on August 15, 2024

Hi, don't worry, I'm actually quite happy to know someone's working with the library!

This one should be quite simple, as I see your logs stating the Task Watchdog has been triggered. This is some kind of timer that limits how long a task is allowed to run. If a task exceeds this limit, the watchdog thinks the software got stuck, and will (usually) reset the software in hopes it doesn't happen again.

Now this is actually a fault in my example code:

while (!ps3IsConnected());

This code snippet literally blocks the task from continuing until the PS3 controller has been connected.

To remedy this behavior, you could either:

#include "freertos/task.h"
while (!ps3IsConnected()){
    vTaskDelay(10 / portTICK_PERIOD_MS);
}

Again, I'm not able to compile this at the moment to test this for you, but I will try to update the example code this week.

from esp32-ps3.

blooop avatar blooop commented on August 15, 2024

Thanks, that fixes the watchdog, but the code still doesn't connect. Did I set up the Bluetooth address correctly?

from esp32-ps3.

jvpernis avatar jvpernis commented on August 15, 2024

It looks like your code should work just fine. You could try to set the MAC address even before calling nvs_flash_init().

I also vaguely remember having to reverse the MAC address written to the PS3 controller, so you could try that too:

  • MAC on ESP32: b4:e6:2d:ee:7b:fd
  • MAC on PS3: fd:7b:ee:2d:e6:b4

If that's the case I will update the README accordingly.

Also note, whenever you connect the PS3 controller with your PS3 to charge, it will also overwrite the stored MAC address.

from esp32-ps3.

blooop avatar blooop commented on August 15, 2024

That has not worked I'm afraid. Is there any debug info I can print to see what is going wrong?

from esp32-ps3.

ItsMeAhmed avatar ItsMeAhmed commented on August 15, 2024

Hi, I am facing the same issue here, tried all mentioned solutions but the controller is still not connecting.

from esp32-ps3.

jvpernis avatar jvpernis commented on August 15, 2024

I think I have just found the catch to this issue, which is something I completely forgot I ever configured.

At the start of the program, we are assigning a new base MAC address. From the IDF documentation about it we can learn that this base address is taken to generate a different MAC address for WiFi, Bluetooth and Ethernet.

To get the bluetooth MAC address, you have to add 2 to the last byte of your base MAC address:

  • MAC on ESP32: b4:e6:2d:ee:7b:fd
  • MAC on PS3: b4:e6:2d:ee:7b:ff

Please let me know if this works! I'll then add this info to the README as well.

from esp32-ps3.

ItsMeAhmed avatar ItsMeAhmed commented on August 15, 2024

It finally worked!! ,, excellent job @jvpernis
make_monitor

from esp32-ps3.

blooop avatar blooop commented on August 15, 2024

It works!

Thanks for all the help!

For future reference, if my last two characters were :ff would it roll over to f1?

from esp32-ps3.

ItsMeAhmed avatar ItsMeAhmed commented on August 15, 2024

here is the code i used ,,,

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "ps3.h"
#include "nvs_flash.h" 


void controller_event_cb( ps3_t ps3, ps3_event_t event )
{

    if ( event.button_down.cross )
        printf("The user started pressing the X button\n");

    if ( event.button_up.cross )
        printf("The user released the X button\n");
}

void app_main()
{
    printf("Hello world!\n");
    uint8_t new_mac[8] = {0x30,0xae,0xa4,0xbf,0x5b,0x7e}; //the address on the controller is 30:AE:A4:BF:5B:80
    esp_base_mac_addr_set(new_mac);
    nvs_flash_init();

    ps3SetEventCallback(controller_event_cb);
    ps3Init();
    while (!ps3IsConnected()){
    vTaskDelay(10 / portTICK_PERIOD_MS);
	}
}

from esp32-ps3.

ItsMeAhmed avatar ItsMeAhmed commented on August 15, 2024

It works!

Thanks for all the help!

For future reference, if my last two characters were :ff would it roll over to f1?

maybe it'll carry over to the next digit,, 30:AE:A4:BF:5B:ff + 2 = 30:AE:A4:BF:5C:01 ?

from esp32-ps3.

blooop avatar blooop commented on August 15, 2024

Ah yes of course, I forgot to increment in the binary representation.

For reference my code is almost identical except I don't set the base mac address and just set the controller to the hardcoded mac address +2.

from esp32-ps3.

jvpernis avatar jvpernis commented on August 15, 2024

It works!

Nice!

For future reference, if my last two characters were :ff would it roll over to f1?

That is actually a really interesting question! According to the source code, it appears that just the last byte (i.e. the last two hexadecimal characters) will be affected, and it would simply rollover to 01.

I just tested it and indeed, I could connect with the following MAC:

  • MAC on ESP32: 01:02:03:04:05:ff
  • MAC on PS3: 01:02:03:04:05:01

from esp32-ps3.

jvpernis avatar jvpernis commented on August 15, 2024

Hi!

I wanted to let you know that I updated the code snipped in the README to include the vTaskDelay function in order to prevent the Task Watchdog from triggering.

I also created a function ps3SetBluetoothMacAddress, which can be used to set the Bluetooth MAC address identical as the one stored in the PS3 controller. You no longer have to apply a +2 operation to the latest byte, as the new function does this for you.

from esp32-ps3.

blooop avatar blooop commented on August 15, 2024

great, thanks. I was going to write that function :)

from esp32-ps3.

jvpernis avatar jvpernis commented on August 15, 2024

I'll be closing this issue, as I believe the problems described have been resolved. Please feel free to reopen the issue if you disagree with this conclusion!

from esp32-ps3.

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.