Skip to content

Commit a90edce

Browse files
Fix loading profiles from command line
1 parent 72070f9 commit a90edce

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

cli.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
using namespace std::chrono_literals;
2323

24-
static ProfileManager* profile_manager;
2524
static std::string profile_save_filename = "";
2625

2726
enum
@@ -624,7 +623,7 @@ bool OptionSize(int *current_device, int *current_zone, std::string argument, Op
624623
/*---------------------------------------------------------*\
625624
| Save the profile |
626625
\*---------------------------------------------------------*/
627-
profile_manager->SaveProfile("sizes.ors");
626+
ResourceManager::get()->GetProfileManager()->SaveProfile("sizes.ors");
628627

629628
return true;
630629
}
@@ -636,7 +635,7 @@ bool OptionProfile(std::string argument, std::vector<RGBController *> &rgb_contr
636635
/*---------------------------------------------------------*\
637636
| Attempt to load profile |
638637
\*---------------------------------------------------------*/
639-
if(profile_manager->LoadProfile(argument))
638+
if(ResourceManager::get()->GetProfileManager()->LoadProfile(argument))
640639
{
641640
/*-----------------------------------------------------*\
642641
| Change device mode if profile loading was successful |
@@ -645,7 +644,7 @@ bool OptionProfile(std::string argument, std::vector<RGBController *> &rgb_contr
645644
{
646645
RGBController* device = rgb_controllers[controller_idx];
647646

648-
device->SetMode(device->active_mode);
647+
device->DeviceUpdateMode();
649648

650649
if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED)
651650
{
@@ -1209,7 +1208,7 @@ unsigned int cli_post_detection(int argc, char *argv[])
12091208
\*---------------------------------------------------------*/
12101209
if (profile_save_filename != "")
12111210
{
1212-
if(profile_manager->SaveProfile(profile_save_filename))
1211+
if(ResourceManager::get()->GetProfileManager()->SaveProfile(profile_save_filename))
12131212
{
12141213
std::cout << "Profile saved successfully" << std::endl;
12151214
}
@@ -1227,6 +1226,8 @@ unsigned int cli_post_detection(int argc, char *argv[])
12271226
WaitWhileServerOnline(ResourceManager::get()->GetServer());
12281227
}
12291228

1229+
std::this_thread::sleep_for(1s);
1230+
12301231
exit(0);
12311232

12321233
return 0;

0 commit comments

Comments
 (0)