Skip to content

Commit 396dd6d

Browse files
committed
Migrate SV, and PLA programs to TimeDurationOption.
1 parent 8464bdc commit 396dd6d

27 files changed

+82
-128
lines changed

SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_SerialPABotBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ std::string SwitchController_SerialPABotBase_Descriptor::display_name() const{
7070
return "";
7171
}
7272
return m_port.portName().toStdString() + " - " + m_port.description().toStdString();
73-
// return "Serial (PABotBase): " + m_port.portName().toStdString() + " - " + m_port.description().toStdString();;
73+
// return "Wired Controller - Serial (PABotBase): " + m_port.portName().toStdString() + " - " + m_port.description().toStdString();;
7474
}
7575
void SwitchController_SerialPABotBase_Descriptor::load_json(const JsonValue& json){
7676
const std::string* name = json.to_string();

SerialPrograms/Source/PokemonHome/PokemonHome_Settings.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,7 @@ GameSettings& GameSettings::instance(){
2222
}
2323
GameSettings::GameSettings()
2424
: BatchOption(LockMode::LOCK_WHILE_RUNNING)
25-
// : m_start_game_timings("<font size=4><b>Start Game Timings:</b></font>")
26-
// // , START_GAME_MASH(
27-
// // "<b>1. Start Game Mash:</b><br>Mash A for this long to start the game.",
28-
// // TICKS_PER_SECOND,
29-
// // "2 * TICKS_PER_SECOND"
30-
// // )
31-
// // , START_GAME_WAIT(
32-
// // "<b>2. Start Game Wait:</b><br>Wait this long for the game to load.",
33-
// // TICKS_PER_SECOND,
34-
// // "40 * TICKS_PER_SECOND"
35-
// // )
36-
// // , ENTER_GAME_MASH(
37-
// // "<b>3. Enter Game Mash:</b><br>Mash A for this long to enter the game.",
38-
// // TICKS_PER_SECOND,
39-
// // "5 * TICKS_PER_SECOND"
40-
// // )
41-
// // , ENTER_GAME_WAIT(
42-
// // "<b>4. Enter Game Wait:</b><br>Wait this long for the game to enter the overworld.",
43-
// // TICKS_PER_SECOND,
44-
// // "40 * TICKS_PER_SECOND"
45-
// // )
4625
{
47-
// PA_ADD_STATIC(m_start_game_timings);
48-
// PA_ADD_OPTION(START_GAME_MASH);
49-
// PA_ADD_OPTION(START_GAME_WAIT);
50-
// PA_ADD_OPTION(ENTER_GAME_MASH);
51-
// PA_ADD_OPTION(ENTER_GAME_WAIT);
5226
}
5327

5428

SerialPrograms/Source/PokemonHome/PokemonHome_Settings.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
#ifndef PokemonAutomation_PokemonHome_Settings_H
88
#define PokemonAutomation_PokemonHome_Settings_H
99

10-
#include "Common/Cpp/Options/StaticTextOption.h"
11-
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
12-
#include "Common/Cpp/Options/FloatingPointOption.h"
13-
#include "Common/Cpp/Options/TimeExpressionOption.h"
1410
#include "CommonFramework/Panels/SettingsPanel.h"
1511

1612
namespace PokemonAutomation{
@@ -23,11 +19,6 @@ class GameSettings : public BatchOption{
2319
public:
2420
static GameSettings& instance();
2521

26-
// SectionDividerOption m_start_game_timings;
27-
// TimeExpressionOption<uint16_t> START_GAME_MASH;
28-
// TimeExpressionOption<uint16_t> START_GAME_WAIT;
29-
// TimeExpressionOption<uint16_t> ENTER_GAME_MASH;
30-
// TimeExpressionOption<uint16_t> ENTER_GAME_WAIT;
3122
};
3223

3324

SerialPrograms/Source/PokemonHome/Programs/PokemonHome_GenerateNameOCR.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ GenerateNameOCRData::GenerateNameOCRData()
4242
PokemonNameReader::instance().languages(),
4343
LockMode::LOCK_WHILE_RUNNING
4444
)
45-
, DELAY(
45+
, DELAY0(
4646
"<b>Delay Between Each Iteration:</b>",
4747
LockMode::LOCK_WHILE_RUNNING,
48-
TICKS_PER_SECOND,
49-
"30"
48+
"240ms"
5049
)
5150
{
5251
PA_ADD_OPTION(LANGUAGE);
53-
PA_ADD_OPTION(DELAY);
52+
PA_ADD_OPTION(DELAY0);
5453

5554
}
5655

@@ -91,7 +90,7 @@ void GenerateNameOCRData::program(SingleSwitchProgramEnvironment& env, SwitchCon
9190
path += ".png";
9291
image.save(path);
9392

94-
pbf_press_dpad(context, DPAD_RIGHT, 10, DELAY);
93+
pbf_press_dpad(context, DPAD_RIGHT, 80ms, DELAY0);
9594

9695
OCR::StringMatchResult result = PokemonNameReader::instance().read_substring(
9796
env.console, LANGUAGE, image,

SerialPrograms/Source/PokemonHome/Programs/PokemonHome_GenerateNameOCR.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#ifndef PokemonAutomation_PokemonHome_GenerateNameOCR_H
88
#define PokemonAutomation_PokemonHome_GenerateNameOCR_H
99

10-
#include "Common/Cpp/Options/TimeExpressionOption.h"
10+
#include "Common/Cpp/Options/TimeDurationOption.h"
1111
#include "CommonTools/Options/LanguageOCROption.h"
1212
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
1313

@@ -32,7 +32,7 @@ class GenerateNameOCRData : public SingleSwitchProgramInstance{
3232

3333
private:
3434
OCR::LanguageOCROption LANGUAGE;
35-
TimeExpressionOption<uint16_t> DELAY;
35+
MillisecondsOption DELAY0;
3636
};
3737

3838

SerialPrograms/Source/PokemonLA/Options/PokemonLA_ShinyDetectedAction.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ShinyRequiresAudioText::ShinyRequiresAudioText()
3434

3535
ShinyDetectedActionOption::ShinyDetectedActionOption(
3636
std::string label, std::string description,
37-
std::string default_delay_ticks,
37+
std::string default_delay,
3838
ShinyDetectedAction default_action
3939
)
4040
: GroupOption(std::move(label), LockMode::LOCK_WHILE_RUNNING)
@@ -51,13 +51,12 @@ ShinyDetectedActionOption::ShinyDetectedActionOption(
5151
)
5252
// , STOP_PROGRAM("<b>Stop Program:</b><br>Stop program and go Home if it hears a shiny.", true)
5353
// , TAKE_VIDEO("<b>Take Video:</b><br>Take a video if a shiny is heard.", true)
54-
, SCREENSHOT_DELAY(
54+
, SCREENSHOT_DELAY0(
5555
"<b>Screenshot Delay:</b><br>"
5656
"Align the camera, then wait this long before taking a screenshot + video of the shiny.<br>"
5757
"Set to zero to skip this. Don't set this too large or the shiny may run away!",
5858
LockMode::LOCK_WHILE_RUNNING,
59-
TICKS_PER_SECOND,
60-
std::move(default_delay_ticks)
59+
std::move(default_delay)
6160
)
6261
, NOTIFICATIONS(this->label(), true, true, ImageAttachmentMode::JPG, {"Notifs", "Showcase"})
6362
{
@@ -67,7 +66,7 @@ ShinyDetectedActionOption::ShinyDetectedActionOption(
6766
PA_ADD_OPTION(ACTION);
6867
// PA_ADD_OPTION(STOP_PROGRAM);
6968
// PA_ADD_OPTION(TAKE_VIDEO);
70-
PA_ADD_OPTION(SCREENSHOT_DELAY);
69+
PA_ADD_OPTION(SCREENSHOT_DELAY0);
7170
}
7271
bool ShinyDetectedActionOption::stop_on_shiny() const{
7372
return ACTION != ShinyDetectedAction::IGNORE;
@@ -127,7 +126,7 @@ void on_shiny_sound(
127126
embeds.emplace_back("Detection Results:", ss.str());
128127

129128
// pbf_press_button(context, BUTTON_ZL, 20, options.SCREENSHOT_DELAY);
130-
pbf_mash_button(context, BUTTON_ZL, options.SCREENSHOT_DELAY);
129+
pbf_mash_button(context, BUTTON_ZL, options.SCREENSHOT_DELAY0);
131130
context.wait_for_all_requests();
132131

133132
send_program_notification(
@@ -154,7 +153,7 @@ void on_match_found(
154153
){
155154
std::vector<std::pair<std::string, std::string>> embeds;
156155

157-
pbf_mash_button(context, BUTTON_ZL, options.SCREENSHOT_DELAY);
156+
pbf_mash_button(context, BUTTON_ZL, options.SCREENSHOT_DELAY0);
158157
context.wait_for_all_requests();
159158

160159
send_program_notification(

SerialPrograms/Source/PokemonLA/Options/PokemonLA_ShinyDetectedAction.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "Common/Cpp/Options/StaticTextOption.h"
1111
#include "Common/Cpp/Options/EnumDropdownOption.h"
12-
#include "Common/Cpp/Options/TimeExpressionOption.h"
12+
#include "Common/Cpp/Options/TimeDurationOption.h"
1313
#include "Common/Cpp/Options/GroupOption.h"
1414
#include "CommonFramework/Notifications/EventNotificationOption.h"
1515
#include "CommonFramework/Tools/VideoStream.h"
@@ -52,7 +52,7 @@ class ShinyDetectedActionOption : public GroupOption{
5252
public:
5353
ShinyDetectedActionOption(
5454
std::string label, std::string description,
55-
std::string default_delay_ticks,
55+
std::string default_delay,
5656
ShinyDetectedAction default_action = ShinyDetectedAction::TAKE_VIDEO_STOP_PROGRAM
5757
);
5858

@@ -62,7 +62,7 @@ class ShinyDetectedActionOption : public GroupOption{
6262
EnumDropdownOption<ShinyDetectedAction> ACTION;
6363
// BooleanCheckBoxOption STOP_PROGRAM;
6464
// BooleanCheckBoxOption TAKE_VIDEO;
65-
TimeExpressionOption<uint16_t> SCREENSHOT_DELAY;
65+
MillisecondsOption SCREENSHOT_DELAY0;
6666
EventNotificationOption NOTIFICATIONS;
6767
};
6868

SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ LeapGrinder::LeapGrinder()
112112
, SHINY_DETECTED_ENROUTE(
113113
"Enroute Shiny Action",
114114
"This applies if a shiny is detected while enroute to destination.",
115-
"0 * TICKS_PER_SECOND"
115+
"0ms"
116116
)
117117
, MATCH_DETECTED_OPTIONS(
118118
"Match Action",
119119
"What to do when the leaping Pokemon matches the *Stop On*.",
120-
"0 * TICKS_PER_SECOND"
120+
"0ms"
121121
)
122122
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
123123
, NOTIFICATIONS({

SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ std::unique_ptr<StatsTracker> NuggetFarmerHighlands_Descriptor::make_stats() con
7474

7575

7676
NuggetFarmerHighlands::NuggetFarmerHighlands()
77-
: SHINY_DETECTED("Shiny Detected Action", "", "2 * TICKS_PER_SECOND")
77+
: SHINY_DETECTED("Shiny Detected Action", "", "2000ms")
7878
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
7979
, NOTIFICATIONS({
8080
&NOTIFICATION_STATUS,

SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ RamanasCombeeFinder:: RamanasCombeeFinder()
8484
, SHINY_DETECTED_ENROUTE(
8585
"Enroute Shiny Action",
8686
"This applies if a shiny is detected while traveling in the overworld.",
87-
"0 * TICKS_PER_SECOND"
87+
"0ms"
8888
)
8989
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
9090
, NOTIFICATIONS({

SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ BurmyFinder::BurmyFinder()
9999
, SHINY_DETECTED_ENROUTE(
100100
"Enroute Shiny Action",
101101
"This applies if a shiny is detected while traveling in the overworld.",
102-
"0 * TICKS_PER_SECOND"
102+
"0ms"
103103
)
104104
, MATCH_DETECTED_OPTIONS(
105-
"Match Action",
106-
"What to do when a Burmy is found that matches the \"Stop On\" parameter.",
107-
"0 * TICKS_PER_SECOND")
105+
"Match Action",
106+
"What to do when a Burmy is found that matches the \"Stop On\" parameter.",
107+
"0ms"
108+
)
108109
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
109110
, NOTIFICATIONS({
110111
&NOTIFICATION_STATUS,

SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ CrobatFinder::CrobatFinder()
6464
: SHINY_DETECTED_ENROUTE(
6565
"Enroute Shiny Action",
6666
"This applies if you are still traveling to the Crobat.",
67-
"2 * TICKS_PER_SECOND"
67+
"2000ms"
6868
)
6969
, SHINY_DETECTED_DESTINATION(
7070
"Destination Shiny Action",
7171
"This applies if you are near the Crobat.",
72-
"2 * TICKS_PER_SECOND"
72+
"2000ms"
7373
)
7474
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
7575
, NOTIFICATIONS({

SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,21 @@ std::unique_ptr<StatsTracker> FroslassFinder_Descriptor::make_stats() const{
6363

6464

6565
FroslassFinder::FroslassFinder()
66-
: DASH_DURATION(
66+
: DASH_DURATION0(
6767
"<b>Braviary dash duration:</b><br>"
6868
"How many ticks for Braviary to dash to reach the hole.",
6969
LockMode::LOCK_WHILE_RUNNING,
70-
TICKS_PER_SECOND,
71-
"986"
70+
"7888"
7271
)
7372
, SHINY_DETECTED_ENROUTE(
7473
"Enroute Shiny Action",
7574
"This applies if a shiny is detected while enroute to the cave. (Does not ignore Misdreavus and Glalie)",
76-
"0 * TICKS_PER_SECOND"
75+
"0ms"
7776
)
7877
, SHINY_DETECTED_DESTINATION(
7978
"Destination Shiny Action",
8079
"This applies if a shiny is detected at or near Froslass.",
81-
"0 * TICKS_PER_SECOND"
80+
"0ms"
8281
)
8382
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
8483
, NOTIFICATIONS({
@@ -91,7 +90,7 @@ FroslassFinder::FroslassFinder()
9190
})
9291
{
9392
PA_ADD_STATIC(SHINY_REQUIRES_AUDIO);
94-
PA_ADD_OPTION(DASH_DURATION);
93+
PA_ADD_OPTION(DASH_DURATION0);
9594
PA_ADD_OPTION(SHINY_DETECTED_ENROUTE);
9695
PA_ADD_OPTION(SHINY_DETECTED_DESTINATION);
9796
PA_ADD_OPTION(NOTIFICATIONS);
@@ -133,7 +132,7 @@ void FroslassFinder::run_iteration(SingleSwitchProgramEnvironment& env, SwitchCo
133132
// Route to cave entrance
134133
pbf_press_button(context, BUTTON_B, (uint16_t)(2 * TICKS_PER_SECOND), 10); //Get some distance from the moutain
135134
pbf_press_button(context, BUTTON_Y, (uint16_t)(4 * TICKS_PER_SECOND), 10); //Descend
136-
pbf_press_button(context, BUTTON_B, DASH_DURATION, 10); //Reach to the cave entrance
135+
pbf_press_button(context, BUTTON_B, DASH_DURATION0, 80ms); //Reach to the cave entrance
137136
pbf_wait(context, (uint16_t)(0.5 * TICKS_PER_SECOND));
138137
pbf_press_button(context, BUTTON_PLUS, 10,10);
139138
pbf_wait(context, (uint16_t)(1.1 * TICKS_PER_SECOND));

SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
#ifndef PokemonAutomation_PokemonLA_FroslassFinder_H
88
#define PokemonAutomation_PokemonLA_FroslassFinder_H
99

10-
#include "Common/Cpp/Options/TimeExpressionOption.h"
10+
#include "Common/Cpp/Options/TimeDurationOption.h"
1111
#include "CommonFramework/Notifications/EventNotificationsTable.h"
1212
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
1313
#include "PokemonLA/Options/PokemonLA_ShinyDetectedAction.h"
14-
#include "PokemonLA/Inference/PokemonLA_MountDetector.h"
15-
#include "PokemonLA/Inference/PokemonLA_UnderAttackDetector.h"
1614

1715
namespace PokemonAutomation{
1816
namespace NintendoSwitch{
@@ -39,7 +37,7 @@ class FroslassFinder : public SingleSwitchProgramInstance{
3937

4038
ShinyRequiresAudioText SHINY_REQUIRES_AUDIO;
4139

42-
TimeExpressionOption<uint16_t> DASH_DURATION;
40+
MillisecondsOption DASH_DURATION0;
4341

4442
ShinyDetectedActionOption SHINY_DETECTED_ENROUTE;
4543
ShinyDetectedActionOption SHINY_DETECTED_DESTINATION;

SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ GalladeFinder::GalladeFinder()
6262
: SHINY_DETECTED_ENROUTE(
6363
"Enroute Shiny Action",
6464
"This applies if you are still traveling to the Gallade.",
65-
"0 * TICKS_PER_SECOND"
65+
"0ms"
6666
)
6767
, SHINY_DETECTED_DESTINATION(
6868
"Destination Shiny Action",
6969
"This applies if you are near the Gallade.",
70-
"0 * TICKS_PER_SECOND"
70+
"0ms"
7171
)
7272
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
7373
, NOTIFICATIONS({

0 commit comments

Comments
 (0)