Skip to content

Commit 2ed008f

Browse files
4.0.2
1 parent 6dedb4f commit 2ed008f

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

bluepad32_files/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "framework-arduinoespressif32bluepad32",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "Arduino Wiring-based Framework for the Espressif ESP32, ESP32-S and ESP32-C series of SoCs with Bluepad32",
55
"keywords": [
66
"framework",

components/bluepad32/include/uni_hid_device.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "bt/uni_bt_conn.h"
1313
#include "controller/uni_controller.h"
14+
#include "controller/uni_controller_type.h"
1415
#include "parser/uni_hid_parser.h"
1516
#include "uni_circular_buffer.h"
1617

@@ -60,7 +61,7 @@ struct uni_hid_device_s {
6061
// TODO: Create a union of gamepad/mouse/keyboard structs
6162
// At the moment "mouse" reuses gamepad struct, but it is a hack.
6263
// Gamepad
63-
uint16_t controller_type; // type of controller. E.g: DualShock4, Switch, etc.
64+
uni_controller_type_t controller_type; // type of controller. E.g: DualShock4, Switch, etc.
6465
uni_controller_subtype_t controller_subtype; // sub-type of controller attached, used for Wii mostly
6566
uni_controller_t controller; // Data
6667

components/bluepad32/include/uni_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef UNI_VERSION_H
66
#define UNI_VERSION_H
77

8-
#define UNI_VERSION "4.0.1"
8+
#define UNI_VERSION "4.0.2"
99

1010
extern const char* uni_version;
1111

components/bluepad32/parser/uni_hid_parser_ds5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void uni_hid_parser_ds5_parse_feature_report(uni_hid_device_t* d, const uint8_t*
465465
ins->use_vibration2 = (d->product_id == DS5_EDGE_PID || ins->update_version >= DS5_FEATURE_VERSION(2, 21));
466466

467467
uni_hid_parser_ds5_device_dump(d);
468-
logi("DS5: Firmware build date: %s, %s\n", date_z, time_z);
468+
logi("\tDS5: Firmware build date: %s, %s\n", date_z, time_z);
469469

470470
ds5_request_calibration_report(d);
471471
break;
@@ -725,7 +725,7 @@ void uni_hid_parser_ds5_play_dual_rumble(struct uni_hid_device_s* d,
725725

726726
void uni_hid_parser_ds5_device_dump(uni_hid_device_t* d) {
727727
ds5_instance_t* ins = get_ds5_instance(d);
728-
logi("DS5: FW version: %#x, HW version: %#x, update version: %#x, use vibration2: %d\n", ins->fw_version,
728+
logi("\tDS5: FW version: %#x, HW version: %#x, update version: %#x, use vibration2: %d\n", ins->fw_version,
729729
ins->hw_version, ins->update_version, ins->use_vibration2);
730730
}
731731

components/bluepad32/parser/uni_hid_parser_xboxone.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,9 @@ static void xboxone_play_quad_rumble_now(struct uni_hid_device_s* d,
580580
mask |= (weak_magnitude != 0) ? XBOXONE_FF_WEAK : 0;
581581
mask |= (strong_magnitude != 0) ? XBOXONE_FF_STRONG : 0;
582582

583+
logd("xbox rumble: duration=%d, left=%d, right=%d, weak=%d, strong=%d, mask=%#x\n", duration_ms, left_trigger,
584+
right_trigger, weak_magnitude, strong_magnitude, mask);
585+
583586
// Magnitude is 0..100 so scale the 8-bit input here
584587

585588
struct xboxone_ff_report ff = {

components/bluepad32/platform/uni_platform_unijoysticle.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,8 +1686,9 @@ static void try_swap_ports(uni_hid_device_t* d) {
16861686
// - swapping between physical+virtual
16871687
// - two gamepads while both are pressing the "system" or "select" button at the same time.
16881688
uni_platform_unijoysticle_instance_t* d2_ins = uni_platform_unijoysticle_get_instance(d2);
1689-
if (d2->controller_type == UNI_CONTROLLER_CLASS_GAMEPAD && // Is it a gamepad ?
1690-
d2_ins->seat != GAMEPAD_SEAT_NONE && // ... and does it have a seat ?
1689+
1690+
if (d2->controller.klass == UNI_CONTROLLER_CLASS_GAMEPAD && // Is it a gamepad ?
1691+
d2_ins->seat != GAMEPAD_SEAT_NONE && // ... and does it have a seat ?
16911692
((d2->controller.gamepad.misc_buttons & (MISC_BUTTON_SYSTEM | MISC_BUTTON_SELECT)) ==
16921693
0) // ...without pressing "swap" ?
16931694
) {

components/bluepad32/uni_hid_device.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ void uni_hid_device_guess_controller_type_from_pid_vid(uni_hid_device_t* d) {
559559
uni_controller_type_t type = uni_guess_controller_type(d->vendor_id, d->product_id);
560560

561561
// If it fails, try to guess it from COD
562-
if (type == CONTROLLER_TYPE_Unknown) {
562+
if (type == CONTROLLER_TYPE_Unknown || type == CONTROLLER_TYPE_UnknownNonSteamController ||
563+
type == CONTROLLER_TYPE_UnknownSteamController) {
563564
logi("Device (vendor_id=0x%04x, product_id=0x%04x) not found in DB.\n", d->vendor_id, d->product_id);
564565
if (uni_hid_device_is_mouse(d)) {
565566
type = CONTROLLER_TYPE_GenericMouse;

0 commit comments

Comments
 (0)