Skip to content

Commit 0784df6

Browse files
committed
Minor refactor.
1 parent 6b9faf9 commit 0784df6

File tree

7 files changed

+17
-21
lines changed

7 files changed

+17
-21
lines changed

Common/SerialPABotBase/SerialPABotBase_Messages_ESP32.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
#ifdef __cplusplus
2121
extern "C" {
22-
namespace PokemonAutomation{
23-
namespace SerialPABotBase{
2422
#endif
2523

2624

@@ -30,7 +28,7 @@ typedef struct{
3028
uint8_t buttons[3];
3129
uint8_t left_grip[3];
3230
uint8_t right_grip[3];
33-
} NintendoSwitch_ControllerColors;
31+
} PABB_ESP32_NintendoSwitch_ControllerColors;
3432

3533
typedef struct{
3634
uint8_t button3;
@@ -39,11 +37,11 @@ typedef struct{
3937
uint8_t left_joystick[3];
4038
uint8_t right_joystick[3];
4139
uint8_t vibrator;
42-
} NintendoSwitch_ButtonState;
40+
} PABB_ESP32_NintendoSwitch_ButtonState;
4341

4442
typedef struct{
4543
uint8_t data[36];
46-
} NintendoSwitch_GyroState;
44+
} PABB_ESP32_NintendoSwitch_GyroState;
4745

4846

4947

@@ -79,25 +77,23 @@ typedef struct{
7977
typedef struct{
8078
seqnum_t seqnum;
8179
uint16_t milliseconds;
82-
NintendoSwitch_ButtonState buttons;
80+
PABB_ESP32_NintendoSwitch_ButtonState buttons;
8381
} PABB_PACK pabb_Message_ESP32_CommandButtonState;
8482

8583

8684
#define PABB_MSG_ESP32_CONTROLLER_STATE_FULL 0xa1
8785
typedef struct{
8886
seqnum_t seqnum;
8987
uint16_t milliseconds;
90-
NintendoSwitch_ButtonState buttons;
91-
NintendoSwitch_GyroState gyro;
88+
PABB_ESP32_NintendoSwitch_ButtonState buttons;
89+
PABB_ESP32_NintendoSwitch_GyroState gyro;
9290
} PABB_PACK pabb_Message_ESP32_CommandFullState;
9391

9492

9593

9694

9795
#ifdef __cplusplus
9896
}
99-
}
100-
}
10197
#endif
10298

10399

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Connection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ ControllerModeStatus SerialPABotBase_Connection::read_device_specs(
225225
desired_controller
226226
);
227227

228-
NintendoSwitch_ControllerColors colors;
228+
PABB_ESP32_NintendoSwitch_ControllerColors colors;
229229
{
230230
Color color(profile.body_color);
231231
colors.body[0] = color.red();
@@ -254,7 +254,7 @@ ControllerModeStatus SerialPABotBase_Connection::read_device_specs(
254254
m_botbase->issue_request_and_wait(
255255
MessageControllerWriteSpi(
256256
desired_controller,
257-
0x00006050, sizeof(NintendoSwitch_ControllerColors),
257+
0x00006050, sizeof(PABB_ESP32_NintendoSwitch_ControllerColors),
258258
&colors
259259
),
260260
// MessageControllerSetColors(desired_controller, colors),

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_ESP32.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class MessageControllerSetColors : public BotBaseRequest{
154154
class MessageControllerStateButtons : public BotBaseRequest{
155155
public:
156156
pabb_Message_ESP32_CommandButtonState params;
157-
MessageControllerStateButtons(uint16_t milliseconds, const NintendoSwitch_ButtonState& state)
157+
MessageControllerStateButtons(uint16_t milliseconds, const PABB_ESP32_NintendoSwitch_ButtonState& state)
158158
: BotBaseRequest(true)
159159
{
160160
params.seqnum = 0;
@@ -170,8 +170,8 @@ class MessageControllerStateFull : public BotBaseRequest{
170170
pabb_Message_ESP32_CommandFullState params;
171171
MessageControllerStateFull(
172172
uint16_t milliseconds,
173-
const NintendoSwitch_ButtonState& buttons,
174-
const NintendoSwitch_GyroState& gyro
173+
const PABB_ESP32_NintendoSwitch_ButtonState& buttons,
174+
const PABB_ESP32_NintendoSwitch_GyroState& gyro
175175
)
176176
: BotBaseRequest(true)
177177
{

SerialPrograms/Source/NintendoSwitch/Controllers/SerialPABotBase/NintendoSwitch_SerialPABotBase_WirelessController.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void SerialPABotBase_WirelessController::stop(){
6565

6666
void SerialPABotBase_WirelessController::issue_report(
6767
const Cancellable* cancellable,
68-
const SerialPABotBase::NintendoSwitch_ButtonState& buttons,
68+
const PABB_ESP32_NintendoSwitch_ButtonState& buttons,
6969
WallDuration duration
7070
){
7171
// Release the state lock since we are no longer touching state.
@@ -118,7 +118,7 @@ void SerialPABotBase_WirelessController::status_thread(){
118118
try{
119119
m_logger.log("Reading Controller Colors...");
120120

121-
using ControllerColors = SerialPABotBase::NintendoSwitch_ControllerColors;
121+
using ControllerColors = PABB_ESP32_NintendoSwitch_ControllerColors;
122122

123123
BotBaseMessage response = m_serial->issue_request_and_wait(
124124
SerialPABotBase::MessageControllerReadSpi(

SerialPrograms/Source/NintendoSwitch/Controllers/SerialPABotBase/NintendoSwitch_SerialPABotBase_WirelessController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class SerialPABotBase_WirelessController : public SerialPABotBase_Controller{
102102

103103
void issue_report(
104104
const Cancellable* cancellable,
105-
const SerialPABotBase::NintendoSwitch_ButtonState& buttons,
105+
const PABB_ESP32_NintendoSwitch_ButtonState& buttons,
106106
WallDuration duration
107107
);
108108

SerialPrograms/Source/NintendoSwitch/Controllers/SerialPABotBase/NintendoSwitch_SerialPABotBase_WirelessJoycon.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void SerialPABotBase_WirelessJoycon::issue_mash_button(
129129
void SerialPABotBase_WirelessJoycon::push_state_left_joycon(const Cancellable* cancellable, WallDuration duration){
130130
// https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_notes.md
131131

132-
SerialPABotBase::NintendoSwitch_ButtonState report{
132+
PABB_ESP32_NintendoSwitch_ButtonState report{
133133
.button3 = 0,
134134
.button4 = 0,
135135
.button5 = 0,
@@ -192,7 +192,7 @@ void SerialPABotBase_WirelessJoycon::push_state_left_joycon(const Cancellable* c
192192
void SerialPABotBase_WirelessJoycon::push_state_right_joycon(const Cancellable* cancellable, WallDuration duration){
193193
// https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_notes.md
194194

195-
SerialPABotBase::NintendoSwitch_ButtonState report{
195+
PABB_ESP32_NintendoSwitch_ButtonState report{
196196
.button3 = 0,
197197
.button4 = 0,
198198
.button5 = 0,

SerialPrograms/Source/NintendoSwitch/Controllers/SerialPABotBase/NintendoSwitch_SerialPABotBase_WirelessProController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SerialPABotBase_WirelessProController::~SerialPABotBase_WirelessProController(){
3636
void SerialPABotBase_WirelessProController::push_state(const Cancellable* cancellable, WallDuration duration){
3737
// https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_notes.md
3838

39-
SerialPABotBase::NintendoSwitch_ButtonState report{
39+
PABB_ESP32_NintendoSwitch_ButtonState report{
4040
.button3 = 0,
4141
.button4 = 0,
4242
.button5 = 0,

0 commit comments

Comments
 (0)