Skip to content

Commit 11f8a99

Browse files
committed
Add option to toggle ESP32 reconnect support.
1 parent 2204035 commit 11f8a99

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

SerialPrograms/Source/Controllers/ControllerSelectorWidget.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//#include "CommonFramework/GlobalSettingsPanel.h"
1111
#include "Controllers/ControllerTypeStrings.h"
1212
#include "ControllerSelectorWidget.h"
13+
#include "NintendoSwitch/NintendoSwitch_Settings.h"
1314

1415
#include "SerialPABotBase/SerialPABotBase_SelectorWidget.h"
1516
#include "NintendoSwitch/Controllers/SysbotBase/SysbotBase_SelectorWidget.h"
@@ -71,10 +72,13 @@ ControllerSelectorWidget::ControllerSelectorWidget(QWidget& parent, ControllerSe
7172
m_status_text->setText(QString::fromStdString(session.status_text()));
7273

7374
m_reset_button = new QPushButton("Reset Ctrl.", this);
75+
#if 1
7476
m_reset_button->setToolTip(
7577
"<b>Click:</b> Reset the controller.<br><br>"
76-
"<b>Shift+Click:</b> Reset and clear the controller of any state. This will unpair it with any hosts it may be connected to."
78+
"<b>Shift+Click:</b> Reset and clear the controller of any state. "
79+
"For controllers save pairing state, this will unpair it with any hosts it may be connected to."
7780
);
81+
#endif
7882
serial_row->addWidget(m_reset_button, 1);
7983

8084
bool options_locked = session.options_locked();
@@ -120,7 +124,6 @@ ControllerSelectorWidget::ControllerSelectorWidget(QWidget& parent, ControllerSe
120124
m_reset_button, &QPushButton::clicked,
121125
this, [this](bool){
122126
bool shift_held = QGuiApplication::keyboardModifiers() & Qt::ShiftModifier;
123-
// cout << "shift = " << shift_held << endl;
124127
m_session.reset(shift_held);
125128
}
126129
);

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_PostConnectActions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ void run_post_connect_actions_ESP32(
175175
default:;
176176
}
177177

178+
if (!NintendoSwitch::ConsoleSettings::instance().ENABLE_ESP32_RECONNECT){
179+
clear_settings = true;
180+
}
181+
178182
uint32_t native_controller_id = controller_type_to_id(desired_controller);
179183
if (clear_settings){
180184
botbase.issue_request_and_wait(

SerialPrograms/Source/NintendoSwitch/NintendoSwitch_Settings.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ ConsoleSettings::ConsoleSettings()
104104
LockMode::LOCK_WHILE_RUNNING,
105105
false
106106
)
107+
, ENABLE_ESP32_RECONNECT(
108+
"<b>Enable ESP32 Wireless Reconnect:</b><br>"
109+
"<font color=\"orange\">This is a buggy feature that when enabled will:</font><br>"
110+
" 1. Allow an ESP32 controller to reconnect to the previously paired Switch when switching to it from another controller.<br>"
111+
" 2. Clicking \"Reset Ctrl.\" will soft-reset the controller and attempt to reconnect to the same Switch it is already paired with.<br>"
112+
" 3. SHIFT-clicking \"Reset Ctrl.\" will clear the pairing state and begin pairing again. "
113+
"This will allow it to pair with a different Switch as well as clearing any MAC address bans on the current Switch.<br>"
114+
"<font color=\"red\">As of this writing, this feature works perfectly on the Switch 2, but is broken on the Switch 1.</font>",
115+
LockMode::LOCK_WHILE_RUNNING,
116+
false
117+
)
107118
, ENABLE_SBB3_PINGS(
108119
"<b>Enable sys-botbase 3 Pings:</b><br>"
109120
"Use sys-botbase's ping command for latency measurement instead of \"getVersion\".",
@@ -129,6 +140,7 @@ ConsoleSettings::ConsoleSettings()
129140
PA_ADD_OPTION(START_GAME_INTERNET_CHECK_DELAY0);
130141
PA_ADD_OPTION(TOLERATE_SYSTEM_UPDATE_MENU_FAST);
131142
PA_ADD_OPTION(TOLERATE_SYSTEM_UPDATE_MENU_SLOW);
143+
PA_ADD_OPTION(ENABLE_ESP32_RECONNECT);
132144
PA_ADD_OPTION(ENABLE_SBB3_PINGS);
133145
PA_ADD_OPTION(ENABLE_SBB3_LOGGING);
134146
PA_ADD_OPTION(TIMING_OPTIONS);

SerialPrograms/Source/NintendoSwitch/NintendoSwitch_Settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ConsoleSettings : public BatchOption{
4949
BooleanCheckBoxOption TOLERATE_SYSTEM_UPDATE_MENU_FAST;
5050
BooleanCheckBoxOption TOLERATE_SYSTEM_UPDATE_MENU_SLOW;
5151

52+
BooleanCheckBoxOption ENABLE_ESP32_RECONNECT;
5253
BooleanCheckBoxOption ENABLE_SBB3_PINGS;
5354
BooleanCheckBoxOption ENABLE_SBB3_LOGGING;
5455

0 commit comments

Comments
 (0)