diff --git a/cli.cpp b/cli.cpp index d19321d4..a1ecd950 100644 --- a/cli.cpp +++ b/cli.cpp @@ -21,7 +21,6 @@ using namespace std::chrono_literals; -static ProfileManager* profile_manager; static std::string profile_save_filename = ""; enum @@ -624,7 +623,7 @@ bool OptionSize(int *current_device, int *current_zone, std::string argument, Op /*---------------------------------------------------------*\ | Save the profile | \*---------------------------------------------------------*/ - profile_manager->SaveProfile("sizes.ors"); + ResourceManager::get()->GetProfileManager()->SaveProfile("sizes.ors"); return true; } @@ -636,7 +635,7 @@ bool OptionProfile(std::string argument, std::vector &rgb_contr /*---------------------------------------------------------*\ | Attempt to load profile | \*---------------------------------------------------------*/ - if(profile_manager->LoadProfile(argument)) + if(ResourceManager::get()->GetProfileManager()->LoadProfile(argument)) { /*-----------------------------------------------------*\ | Change device mode if profile loading was successful | @@ -645,7 +644,7 @@ bool OptionProfile(std::string argument, std::vector &rgb_contr { RGBController* device = rgb_controllers[controller_idx]; - device->SetMode(device->active_mode); + device->DeviceUpdateMode(); if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED) { @@ -1209,7 +1208,7 @@ unsigned int cli_post_detection(int argc, char *argv[]) \*---------------------------------------------------------*/ if (profile_save_filename != "") { - if(profile_manager->SaveProfile(profile_save_filename)) + if(ResourceManager::get()->GetProfileManager()->SaveProfile(profile_save_filename)) { std::cout << "Profile saved successfully" << std::endl; } @@ -1227,6 +1226,8 @@ unsigned int cli_post_detection(int argc, char *argv[]) WaitWhileServerOnline(ResourceManager::get()->GetServer()); } + std::this_thread::sleep_for(1s); + exit(0); return 0;