Skip to content

Commit d9126b4

Browse files
committed
Post-ESP32 cleanup.
1 parent 0de581d commit d9126b4

29 files changed

+1014
-1004
lines changed

ClientSource/Connection/MessageLogger.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
*
55
*/
66

7-
#include "Common/Microcontroller/MessageProtocol.h"
8-
#include "Common/NintendoSwitch/NintendoSwitch_Protocol_PushButtons.h"
7+
#include "Common/SerialPABotBase/SerialPABotBase_Protocol.h"
98
#include "ClientSource/Libraries/MessageConverter.h"
109
#include "BotBaseMessage.h"
1110
#include "MessageLogger.h"

ClientSource/Connection/PABotBase.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "Common/Cpp/Exceptions.h"
99
#include "Common/Cpp/PanicDump.h"
1010
#include "Common/Cpp/Concurrency/SpinPause.h"
11-
#include "Common/Microcontroller/MessageProtocol.h"
12-
#include "Common/Microcontroller/DeviceRoutines.h"
11+
#include "Common/SerialPABotBase/SerialPABotBase_Protocol.h"
12+
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_Protocol.h"
1313
#include "PABotBase.h"
1414

1515
//#include <iostream>
@@ -82,7 +82,7 @@ void PABotBase::connect(){
8282

8383
pabb_MsgAckRequest response;
8484
issue_request_and_wait(
85-
Microcontroller::DeviceRequest_seqnum_reset(), nullptr
85+
SerialPABotBase::DeviceRequest_seqnum_reset(), nullptr
8686
).convert<PABB_MSG_ACK_REQUEST>(logger(), response);
8787
}
8888
void PABotBase::stop(){
@@ -184,7 +184,7 @@ bool PABotBase::try_stop_all_commands(){
184184

185185
auto scope_check = m_sanitizer.check_scope();
186186

187-
uint64_t seqnum = try_issue_request(nullptr, Microcontroller::DeviceRequest_request_stop(), true);
187+
uint64_t seqnum = try_issue_request(nullptr, SerialPABotBase::DeviceRequest_request_stop(), true);
188188
if (seqnum != 0){
189189
clear_all_active_commands(seqnum);
190190
return true;
@@ -211,13 +211,13 @@ void PABotBase::stop_all_commands(){
211211

212212
auto scope_check = m_sanitizer.check_scope();
213213

214-
uint64_t seqnum = issue_request(nullptr, Microcontroller::DeviceRequest_request_stop(), true);
214+
uint64_t seqnum = issue_request(nullptr, SerialPABotBase::DeviceRequest_request_stop(), true);
215215
clear_all_active_commands(seqnum);
216216
}
217217
bool PABotBase::try_next_command_interrupt(){
218218
auto scope_check = m_sanitizer.check_scope();
219219

220-
uint64_t seqnum = try_issue_request(nullptr, Microcontroller::DeviceRequest_next_command_interrupt(), true);
220+
uint64_t seqnum = try_issue_request(nullptr, SerialPABotBase::DeviceRequest_next_command_interrupt(), true);
221221
if (seqnum != 0){
222222
clear_all_active_commands(seqnum);
223223
return true;
@@ -228,7 +228,7 @@ bool PABotBase::try_next_command_interrupt(){
228228
void PABotBase::next_command_interrupt(){
229229
auto scope_check = m_sanitizer.check_scope();
230230

231-
uint64_t seqnum = issue_request(nullptr, Microcontroller::DeviceRequest_next_command_interrupt(), true);
231+
uint64_t seqnum = issue_request(nullptr, SerialPABotBase::DeviceRequest_next_command_interrupt(), true);
232232
clear_all_active_commands(seqnum);
233233
}
234234
void PABotBase::clear_all_active_commands(uint64_t seqnum){
@@ -259,7 +259,7 @@ void PABotBase::clear_all_active_commands(uint64_t seqnum){
259259

260260
if (iter->second.state == AckState::NOT_ACKED){
261261
// Convert the command into a no-op request.
262-
Microcontroller::DeviceRequest_program_id request;
262+
SerialPABotBase::DeviceRequest_program_id request;
263263
BotBaseMessage message = request.message();
264264
seqnum_t seqnum_s = (seqnum_t)iter->first;
265265
memcpy(&message.body[0], &seqnum_s, sizeof(seqnum_t));

ClientSource/Connection/PABotBaseConnection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
#include "Common/CRC32.h"
8-
#include "Common/Microcontroller/MessageProtocol.h"
8+
#include "Common/SerialPABotBase/SerialPABotBase_Protocol.h"
99
#include "ClientSource/Libraries/Logging.h"
1010
#include "ClientSource/Libraries/MessageConverter.h"
1111
#include "BotBaseMessage.h"

ClientSource/Connection/PABotBaseConnection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <memory>
1818
#include <deque>
19-
#include "Common/Microcontroller/MessageProtocol.h"
19+
#include "Common/SerialPABotBase/SerialPABotBase_Protocol.h"
2020
#include "BotBase.h"
2121
#include "MessageSniffer.h"
2222
#include "StreamInterface.h"

ClientSource/Libraries/MessageConverter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
*
55
*/
66

7-
#include <set>
7+
//#include <set>
88
#include <map>
99
#include <sstream>
10-
#include "Common/Microcontroller/MessageProtocol.h"
10+
#include "Common/SerialPABotBase/SerialPABotBase_Protocol.h"
1111
#include "Common/Cpp/Exceptions.h"
12-
#include "Common/NintendoSwitch/NintendoSwitch_Protocol_PushButtons.h"
13-
#include "Common/PokemonSwSh/PokemonProgramIDs.h"
12+
//#include "Common/Microcontroller/PABotBaseIDs.h"
13+
//#include "Common/NintendoSwitch/NintendoSwitch_Protocol_PushButtons.h"
1414
#include "ClientSource/Connection/BotBaseMessage.h"
1515
#include "MessageConverter.h"
1616

Common/PokemonSwSh/PokemonSwSh_Protocol_DaySkippers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#ifdef __AVR__
1313
#include "NativePrograms/NintendoSwitch/Framework/Master.h"
1414
#endif
15-
#include "Common/Microcontroller/MessageProtocol.h"
15+
#include "Common/SerialPABotBase/SerialPABotBase_Protocol.h"
1616

1717
////////////////////////////////////////////////////////////////////////////////
1818
////////////////////////////////////////////////////////////////////////////////

Common/NintendoSwitch/NintendoSwitch_Protocol_PushButtons.h renamed to Common/SerialPABotBase/SerialPABotBase_Messages_AVR8.h

Lines changed: 50 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,50 @@
1-
/* Pokemon Automation Push Button Framework
2-
*
3-
* From: https://github.com/PokemonAutomation/
4-
*
5-
*/
6-
7-
#ifndef PokemonAutomation_NintendoSwitch_Protocol_PushButtons_H
8-
#define PokemonAutomation_NintendoSwitch_Protocol_PushButtons_H
9-
10-
//#ifdef __AVR__
11-
//#include "NativePrograms/NintendoSwitch/Framework/Master.h"
12-
//#endif
13-
#include "Common/Microcontroller/MessageProtocol.h"
14-
//#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h"
15-
16-
#if _WIN32
17-
#pragma pack(push, 1)
18-
#define PABB_PACK
19-
#else
20-
#define PABB_PACK __attribute__((packed))
21-
#endif
22-
23-
24-
#ifdef __cplusplus
25-
namespace PokemonAutomation{
26-
namespace NintendoSwitch{
27-
#endif
28-
29-
30-
31-
#define PABB_MSG_CONTROLLER_STATE 0x9f
32-
typedef struct{
33-
seqnum_t seqnum;
34-
uint16_t button;
35-
uint8_t dpad;
36-
uint8_t left_joystick_x;
37-
uint8_t left_joystick_y;
38-
uint8_t right_joystick_x;
39-
uint8_t right_joystick_y;
40-
uint8_t ticks;
41-
} PABB_PACK pabb_controller_state;
42-
43-
44-
#ifdef __cplusplus
45-
}
46-
}
47-
#endif
48-
49-
50-
#if _WIN32
51-
#pragma pack(pop)
52-
#endif
53-
54-
#endif
1+
/* SerialPABotBase Messages (AVR8)
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_SerialPABotBase_Messages_AVR8_H
8+
#define PokemonAutomation_SerialPABotBase_Messages_AVR8_H
9+
10+
#include "Common/SerialPABotBase/SerialPABotBase_Protocol.h"
11+
12+
#if _WIN32
13+
#pragma pack(push, 1)
14+
#define PABB_PACK
15+
#else
16+
#define PABB_PACK __attribute__((packed))
17+
#endif
18+
19+
20+
#ifdef __cplusplus
21+
namespace PokemonAutomation{
22+
namespace SerialPABotBase{
23+
#endif
24+
25+
26+
27+
#define PABB_MSG_CONTROLLER_STATE 0x9f
28+
typedef struct{
29+
seqnum_t seqnum;
30+
uint16_t button;
31+
uint8_t dpad;
32+
uint8_t left_joystick_x;
33+
uint8_t left_joystick_y;
34+
uint8_t right_joystick_x;
35+
uint8_t right_joystick_y;
36+
uint8_t ticks;
37+
} PABB_PACK pabb_controller_state;
38+
39+
40+
#ifdef __cplusplus
41+
}
42+
}
43+
#endif
44+
45+
46+
#if _WIN32
47+
#pragma pack(pop)
48+
#endif
49+
50+
#endif

Common/NintendoSwitch/NintendoSwitch_Protocol_ESP32.h renamed to Common/SerialPABotBase/SerialPABotBase_Messages_ESP32.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
/* ESP32 Commands
1+
/* SerialPABotBase Messages (ESP32)
22
*
33
* From: https://github.com/PokemonAutomation/
44
*
55
*/
66

7-
#ifndef PokemonAutomation_NintendoSwitch_ESP32_H
8-
#define PokemonAutomation_NintendoSwitch_ESP32_H
7+
#ifndef PokemonAutomation_SerialPABotBase_Messages_ESP32_H
8+
#define PokemonAutomation_SerialPABotBase_Messages_ESP32_H
99

10-
#include "Common/Microcontroller/MessageProtocol.h"
10+
#include "SerialPABotBase_Protocol.h"
1111

1212
#if _WIN32
1313
#pragma pack(push, 1)
@@ -20,7 +20,7 @@
2020
#ifdef __cplusplus
2121
extern "C" {
2222
namespace PokemonAutomation{
23-
namespace NintendoSwitch{
23+
namespace SerialPABotBase{
2424
#endif
2525

2626

@@ -30,7 +30,7 @@ typedef struct{
3030
uint8_t buttons[3];
3131
uint8_t left_grip[3];
3232
uint8_t right_grip[3];
33-
} ControllerColors;
33+
} NintendoSwitch_ControllerColors;
3434

3535
typedef struct{
3636
uint8_t button3;
@@ -39,11 +39,11 @@ typedef struct{
3939
uint8_t left_joystick[3];
4040
uint8_t right_joystick[3];
4141
uint8_t vibrator;
42-
} ButtonState;
42+
} NintendoSwitch_ButtonState;
4343

4444
typedef struct{
4545
uint8_t data[36];
46-
} GyroState;
46+
} NintendoSwitch_GyroState;
4747

4848

4949

@@ -53,7 +53,7 @@ typedef struct{
5353
#define PABB_MSG_ESP32_REQUEST_STATUS 0x50
5454
typedef struct{
5555
seqnum_t seqnum;
56-
} PABB_PACK pabb_esp32_request_status;
56+
} PABB_PACK pabb_Message_ESP32_RequestStatus;
5757

5858

5959
#if 0
@@ -62,7 +62,7 @@ typedef struct{
6262
seqnum_t seqnum;
6363
uint32_t controller_type;
6464
uint8_t mac_address[6];
65-
} PABB_PACK pabb_esp32_set_mac_address;
65+
} PABB_PACK pabb_Message_ESP32_SetMacAddress;
6666
#endif
6767

6868

@@ -71,31 +71,31 @@ typedef struct{
7171
typedef struct{
7272
seqnum_t seqnum;
7373
uint32_t controller_type;
74-
} PABB_PACK pabb_esp32_get_colors;
74+
} PABB_PACK pabb_Message_ESP32_GetColors;
7575

7676
#define PABB_MSG_ESP32_REQUEST_SET_COLORS 0x65
7777
typedef struct{
7878
seqnum_t seqnum;
7979
uint32_t controller_type;
80-
ControllerColors colors;
81-
} PABB_PACK pabb_esp32_set_colors;
80+
NintendoSwitch_ControllerColors colors;
81+
} PABB_PACK pabb_Message_ESP32_SetColors;
8282

8383

8484
#define PABB_MSG_ESP32_CONTROLLER_STATE_BUTTONS 0xa0
8585
typedef struct{
8686
seqnum_t seqnum;
8787
uint16_t milliseconds;
88-
ButtonState buttons;
89-
} PABB_PACK pabb_esp32_controller_state_buttons;
88+
NintendoSwitch_ButtonState buttons;
89+
} PABB_PACK pabb_Message_ESP32_CommandButtonState;
9090

9191

9292
#define PABB_MSG_ESP32_CONTROLLER_STATE_FULL 0xa1
9393
typedef struct{
9494
seqnum_t seqnum;
9595
uint16_t milliseconds;
96-
ButtonState buttons;
97-
GyroState gyro;
98-
} PABB_PACK pabb_esp32_controller_state_full;
96+
NintendoSwitch_ButtonState buttons;
97+
NintendoSwitch_GyroState gyro;
98+
} PABB_PACK pabb_Message_ESP32_CommandFullState;
9999

100100

101101

@@ -113,15 +113,15 @@ typedef struct{
113113
uint8_t right_joystick[3];
114114
uint8_t vibrator;
115115
uint8_t gyro[49 - 13];
116-
} ESP32Report0x30;
116+
} NintendoSwitch_ESP32Report0x30;
117117

118118

119119
#define PABB_MSG_ESP32_REPORT 0x9e
120120
typedef struct{
121121
seqnum_t seqnum;
122122
uint8_t ticks;
123123
bool active;
124-
ESP32Report0x30 report;
124+
NintendoSwitch_ESP32Report0x30 report;
125125
} PABB_PACK pabb_esp32_report30;
126126

127127

0 commit comments

Comments
 (0)