Skip to content

Commit

Permalink
Add PS4/PS5 authentication to board-led add-on (#465)
Browse files Browse the repository at this point in the history
* Add PS4/PS5 authentication to board-led add-on

* Bit of code clean-up
  • Loading branch information
arntsonl authored Aug 20, 2023
1 parent 3485c98 commit d6ec096
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions proto/enums.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ enum OnBoardLedMode
ON_BOARD_LED_MODE_OFF = 0;
ON_BOARD_LED_MODE_MODE_INDICATOR = 1;
ON_BOARD_LED_MODE_INPUT_TEST = 2;
ON_BOARD_LED_MODE_PS_AUTH = 3;
}

enum InputMode
Expand Down
10 changes: 9 additions & 1 deletion src/addons/board_led.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "addons/board_led.h"
#include "usb_driver.h" // Required to check USB state
#include "ps4_driver.h"
#include "helper.h"
#include "config.pb.h"

Expand Down Expand Up @@ -63,8 +64,15 @@ void BoardLedAddon::process() {
}
}
break;
case OnBoardLedMode::ON_BOARD_LED_MODE_PS_AUTH:
state = PS4Data::getInstance().authsent == true;
if (prevState != state) {
gpio_put(BOARD_LED_PIN, state ? 1 : 0);
}
prevState = state;
break;
case OnBoardLedMode::ON_BOARD_LED_MODE_OFF:
return;
default:
break;
}
}
1 change: 1 addition & 0 deletions www/src/Pages/AddonsConfigPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const ON_BOARD_LED_MODES = [
{ label: 'Off', value: 0 },
{ label: 'Mode Indicator', value: 1 },
{ label: 'Input Test', value: 2 },
{ label: 'PS4/5 Authentication', value: 3},
];

const DUAL_STICK_MODES = [
Expand Down

0 comments on commit d6ec096

Please sign in to comment.