diff --git a/ProffieOS.ino b/ProffieOS.ino index 6280d159a..93ac90ca8 100644 --- a/ProffieOS.ino +++ b/ProffieOS.ino @@ -625,9 +625,13 @@ class NoLED; #include "styles/show_color.h" #include "styles/blade_shortener.h" +#include "sound/sound_library.h" + #include "modes/mode.h" #include "modes/stepped_mode.h" #include "modes/color_change_modes.h" +#include "modes/menu_list.h" +#include "modes/bool_setting.h" BladeConfig* current_config = nullptr; class BladeBase* GetPrimaryBlade() { @@ -683,6 +687,11 @@ int prop_GetBulletCount() { } #endif +class Color16 GetColorArg(int blade, int arg) { return prop.GetColorArg(blade, arg); } +void SetArg(int blade, int arg, const char* argument) { prop.SetArg(blade, arg, argument); } +void SetColorArg(int blade, int arg, Color16 color) { prop.SetColorArg(blade, arg, color); } + + #if 0 #include "scripts/test_motion_timeout.h" #warning MOTION TEST SCRIPT ACTIVE diff --git a/modes/style_argument_helpers.h b/modes/style_argument_helpers.h index ddaf1691c..e6b80fde4 100644 --- a/modes/style_argument_helpers.h +++ b/modes/style_argument_helpers.h @@ -6,35 +6,10 @@ namespace mode { int menu_current_blade = 1; int menu_current_arg = 0; -Color16 GetColorArg(int blade, int arg) { - char argspace[32]; - if (style_parser.GetArgument(current_preset_.GetStyle(blade), arg + 2, argspace)) { - char* tmp; - int r = strtol(argspace, &tmp, 0); - int g = strtol(tmp+1, &tmp, 0); - int b = strtol(tmp+1, NULL, 0); - return Color16(r,g,b); - } - return Color16(65535,0,0); -} - -void SetArg(int blade, int arg, const char* argument) { - current_preset_.SetStyle(blade, style_parser.SetArgument(current_preset_.GetStyle(blade), arg + 2, argument)); -} - -void SetColorArg(int blade, int arg, Color16 color) { - char tmp[32]; - itoa(color.r, tmp, 10); - strcat(tmp, ","); - itoa(color.g, tmp + strlen(tmp), 10); - strcat(tmp, ","); - itoa(color.b, tmp + strlen(tmp), 10); - - SetArg(menu_current_blade, menu_current_arg, tmp); - - current_preset_.Save(); -} - } // namespace mode +Color16 GetColorArg(int blade, int arg); +void SetArg(int blade, int arg, const char* argument); +void SetColorArg(int blade, int arg, Color16 color); + #endif diff --git a/props/prop_base.h b/props/prop_base.h index 44d0f3ce1..7349c5661 100644 --- a/props/prop_base.h +++ b/props/prop_base.h @@ -1714,6 +1714,36 @@ class PropBase : CommandParser, Looper, protected SaberBase, public ModeInterfac } virtual bool Event2(enum BUTTON button, EVENT event, uint32_t modifiers) = 0; + + Color16 GetColorArg(int blade, int arg) { + char argspace[32]; + if (style_parser.GetArgument(current_preset_.GetStyle(blade), arg + 2, argspace)) { + char* tmp; + int r = strtol(argspace, &tmp, 0); + int g = strtol(tmp+1, &tmp, 0); + int b = strtol(tmp+1, NULL, 0); + return Color16(r,g,b); + } + return Color16(65535,0,0); + } + + void SetArg(int blade, int arg, const char* argument) { + current_preset_.SetStyle(blade, style_parser.SetArgument(current_preset_.GetStyle(blade), arg + 2, argument)); + } + + void SetColorArg(int blade, int arg, Color16 color) { + char tmp[32]; + itoa(color.r, tmp, 10); + strcat(tmp, ","); + itoa(color.g, tmp + strlen(tmp), 10); + strcat(tmp, ","); + itoa(color.b, tmp + strlen(tmp), 10); + + SetArg(blade, arg, tmp); + + current_preset_.Save(); + } + private: bool CommonIgnition() { if (IsOn()) return false;