diff --git a/Helios/ColorConstants.h b/Helios/ColorConstants.h index 8801d4ac..5116b49b 100644 --- a/Helios/ColorConstants.h +++ b/Helios/ColorConstants.h @@ -36,6 +36,8 @@ #define RGB_CORAL_ORANGE (uint32_t)0xFF1E00 // 255, 30, 0 #define RGB_ORANGE (uint32_t)0xFF3C00 // 255, 60, 0 #define RGB_YELLOW (uint32_t)0xFF7800 // 255, 120, 0 +#define RGB_AMBER (uint32_t)0xFF9D00 // 255, 157, 0 +#define RGB_CHARTREUSE (uint32_t)0xC4FF00 // 196, 255, 0 #define RGB_LIME_GREEN (uint32_t)0x59FF00 // 89, 255, 0 #define RGB_GREEN (uint32_t)0x00FF00 // 0, 255, 0 #define RGB_SEAFOAM (uint32_t)0x00FF3C // 0, 255, 60 @@ -49,6 +51,7 @@ #define RGB_HOT_PINK (uint32_t)0xFF00B4 // 255, 0, 180 #define RGB_MAGENTA (uint32_t)0xFF003C // 255, 0, 60 + // Helios Medium Brightness Colors #define RGB_WHITE_BRI_MEDIUM (uint32_t)0x787878 // 120 120 120 #define RGB_RED_BRI_MEDIUM (uint32_t)0x780000 // 120, 0, 0 diff --git a/Helios/Colorset.cpp b/Helios/Colorset.cpp index bad37269..abcd03ec 100644 --- a/Helios/Colorset.cpp +++ b/Helios/Colorset.cpp @@ -255,6 +255,16 @@ void Colorset::set(uint8_t index, RGBColor col) m_palette[index] = col; } +void Colorset::setAll(const RGBColor* colors, uint8_t num_colors) +{ + // First clear existing colors + clear(); + // Then set new colors up to num_colors + for (uint8_t i = 0; i < num_colors && i < NUM_COLOR_SLOTS; i++) { + set(i, colors[i]); + } +} + // skip some amount of colors void Colorset::skip(int32_t amount) { diff --git a/Helios/Colorset.h b/Helios/Colorset.h index 4c6aeafe..6f30e788 100644 --- a/Helios/Colorset.h +++ b/Helios/Colorset.h @@ -99,6 +99,9 @@ class Colorset // a slot higher than the number of colors in the colorset void set(uint8_t index, RGBColor col); + // set all colors from an array up to num_colors + void setAll(const RGBColor* colors, uint8_t num_colors); + // skip some amount of colors void skip(int32_t amount = 1); diff --git a/Helios/Helios.cpp b/Helios/Helios.cpp index f01c18b0..862b539c 100644 --- a/Helios/Helios.cpp +++ b/Helios/Helios.cpp @@ -37,6 +37,7 @@ uint8_t Helios::selected_base_quad; uint8_t Helios::selected_hue; uint8_t Helios::selected_sat; uint8_t Helios::selected_val; +RGBColor Helios::current_color_set[NUM_COLOR_SLOTS]; Pattern Helios::pat; bool Helios::keepgoing; @@ -256,12 +257,8 @@ void Helios::handle_state() case STATE_MODES: handle_state_modes(); break; - case STATE_COLOR_SELECT_SLOT: - case STATE_COLOR_SELECT_QUADRANT: - case STATE_COLOR_SELECT_HUE: - case STATE_COLOR_SELECT_SAT: - case STATE_COLOR_SELECT_VAL: - handle_state_col_select(); + case STATE_COLOR_SELECT: + handle_state_color_select(); break; case STATE_PATTERN_SELECT: handle_state_pat_select(); @@ -269,21 +266,9 @@ void Helios::handle_state() case STATE_TOGGLE_CONJURE: handle_state_toggle_flag(FLAG_CONJURE); break; - case STATE_TOGGLE_LOCK: - handle_state_toggle_flag(FLAG_LOCKED); - break; case STATE_SET_DEFAULTS: handle_state_set_defaults(); break; - case STATE_SET_GLOBAL_BRIGHTNESS: - handle_state_set_global_brightness(); - break; - case STATE_SHIFT_MODE: - handle_state_shift_mode(); - break; - case STATE_RANDOMIZE: - handle_state_randomize(); - break; #ifdef HELIOS_CLI case STATE_SLEEP: // simulate sleep in helios CLI @@ -337,8 +322,6 @@ void Helios::handle_state_modes() case 1: Led::set(0, 0x3c, 0x31); break; // Color Selection case 2: Led::set(0x3c, 0, 0x0e); break; // Pattern Selection case 3: Led::set(0x3c, 0x1c, 0); break; // Conjure Mode - case 4: Led::set(0x3c, 0x3c, 0x3c); break; // Shift Mode - case 5: Led::set(HSVColor(Time::getCurtime(), 255, 100)); break; // Randomizer } } else { if (has_flag(FLAG_LOCKED)) { @@ -351,9 +334,7 @@ void Helios::handle_state_modes() switch (magnitude) { default: case 0: Led::clear(); break; // nothing - case 1: Led::set(0x3c, 0, 0); break; // Enter Glow Lock - case 2: Led::set(0, 0x3c, 0); break; // Global Brightness - case 3: Led::set(0, 0, 0x3c); break; // Master Reset + case 1: Led::set(0, 0, 0x3c); break; // Master Reset } } } @@ -373,31 +354,9 @@ void Helios::handle_state_modes() void Helios::handle_off_menu(uint8_t mag, bool past) { - // if still locked then handle the unlocking menu which is just if mag == 5 - if (has_flag(FLAG_LOCKED)) { - switch (mag) { - case TIME_TILL_GLOW_LOCK_UNLOCK: // red lock - cur_state = STATE_TOGGLE_LOCK; - break; - default: - // just go back to sleep in hold-past off menu - enter_sleep(); - // ALWAYS RETURN AFTER SLEEP! WE WILL WAKE HERE! - } - // in this case we return either way, since we're locked - return; - } - // otherwise if not locked handle the off menu switch (mag) { case 1: // red lock - cur_state = STATE_TOGGLE_LOCK; - Led::clear(); - return; // RETURN HERE - case 2: // green global brightness - cur_state = STATE_SET_GLOBAL_BRIGHTNESS; - return; // RETURN HERE - case 3: // blue reset defaults cur_state = STATE_SET_DEFAULTS; return; //RETURN HERE default: @@ -420,7 +379,7 @@ void Helios::handle_on_menu(uint8_t mag, bool past) } break; case 1: // color select - cur_state = STATE_COLOR_SELECT_SLOT; + cur_state = STATE_COLOR_SELECT; // reset the menu selection menu_selection = 0; #if ALTERNATIVE_HSV_RGB == 1 @@ -437,257 +396,92 @@ void Helios::handle_on_menu(uint8_t mag, bool past) cur_state = STATE_TOGGLE_CONJURE; Led::clear(); break; - case 4: // shift mode down - cur_state = STATE_SHIFT_MODE; - break; - case 5: // randomizer - cur_state = STATE_RANDOMIZE; - break; default: // hold past break; } } -void Helios::handle_state_col_select() +void Helios::handle_state_color_select() { - ColorSelectOption slot_option = OPTION_NONE; - switch (cur_state) { - case STATE_COLOR_SELECT_SLOT: - // pick the target colorset slot - handle_state_col_select_slot(slot_option); - break; - case STATE_COLOR_SELECT_QUADRANT: - // pick the hue quadrant - handle_state_col_select_quadrant(); - break; - case STATE_COLOR_SELECT_HUE: - case STATE_COLOR_SELECT_SAT: - case STATE_COLOR_SELECT_VAL: - default: - // pick the hue sat or val - handle_state_col_select_hue_sat_val(); - break; - } - // get the current color - RGBColor cur = Led::get(); - cur.red /= 2; - cur.green /= 2; - cur.blue /= 2; - // this is a stupid override for when we're exiting color select - // show a white selection instead - if (slot_option != OPTION_NONE) { - cur = RGB_WHITE_BRI_LOW; - } - // show selection in all of these menus - show_selection(cur); -} - -void Helios::handle_state_col_select_slot(ColorSelectOption &out_option) -{ - Colorset &set = pat.colorset(); - uint8_t num_cols = set.numColors(); + // Array of predefined colors for the menu + static const uint32_t color_menu[NUM_COLORS] = { + RGB_OFF, + RGB_WHITE, + RGB_RED, + RGB_CORAL_ORANGE, + RGB_ORANGE, + RGB_YELLOW, + RGB_AMBER, + RGB_CHARTREUSE, + RGB_LIME_GREEN, + RGB_GREEN, + RGB_SEAFOAM, + RGB_TURQUOISE, + RGB_ICE_BLUE, + RGB_LIGHT_BLUE, + RGB_BLUE, + RGB_ROYAL_BLUE, + RGB_PURPLE, + RGB_PINK, + RGB_HOT_PINK, + RGB_MAGENTA, + }; if (Button::onShortClick()) { - // the number of menus in slot selection = all colors + exit - uint8_t num_menus = num_cols + 1; - // except if the number of colors is less than total color slots - if (num_cols < NUM_COLOR_SLOTS) { - // then we have another menu: add color - num_menus++; - } - menu_selection = (menu_selection + 1) % num_menus; + menu_selection = (menu_selection + 1) % NUM_COLORS; } - bool long_click = Button::onLongClick(); - - // Reset the color selection variables, these are the hue/sat/val that have been selected - // in the following menus, this is a weird place to reset these but it ends up being the only - // place where it can be written once and still handle all the possible cases it needs to run - selected_sat = 255; - selected_val = 255; - - if (num_cols < NUM_COLOR_SLOTS && menu_selection == num_cols) { - // add color - out_option = SELECTED_ADD; - Led::strobe(100, 100, RGB_WHITE_BRI_LOW, RGB_OFF); - if (long_click) { - selected_slot = menu_selection; - } - } else if (menu_selection == num_cols + 1 || (num_cols == NUM_COLOR_SLOTS && menu_selection == num_cols)) { - // exit - out_option = SELECTED_EXIT; - Led::strobe(60, 40, RGB_RED_BRI_LOW, RGB_OFF); - if (long_click) { -#if ALTERNATIVE_HSV_RGB == 1 - // restore hsv to rgb algorithm type, done color selection - g_hsv_rgb_alg = HSV_TO_RGB_GENERIC; -#endif - save_cur_mode(); - cur_state = STATE_MODES; - return; - } + // Show the current color + RGBColor current_color = color_menu[menu_selection]; + if (menu_selection == 0) { // Blank + Led::strobe(1, 30, RGB_OFF, RGB_WHITE_BRI_LOW); } else { - out_option = SELECTED_SLOT; - selected_slot = menu_selection; - // render current selection - RGBColor col = set.get(selected_slot); - if (col.empty()) { - Led::strobe(1, 30, RGB_OFF, RGB_WHITE_BRI_LOW); - } else { - Led::strobe(3, 30, RGB_OFF, col); - } - if (Button::holdPressing()) { - // flash red - Led::strobe(150, 150, RGB_RED_BRI_LOW, col); - } - if (Button::onHoldClick()){ - set.removeColor(selected_slot); - return; - } - } - if (long_click) { - cur_state = (State)(cur_state + 1); - // reset the menu selection - menu_selection = 0; - } -} - -struct ColorsMenuData { - uint8_t hues[4]; -}; -// array of hues for selection -static const ColorsMenuData color_menu_data[4] = { - // hue0 hue1 hue2 hue3 - // ================================================================================== - { HUE_RED, HUE_CORAL_ORANGE, HUE_ORANGE, HUE_YELLOW }, - { HUE_LIME_GREEN, HUE_GREEN, HUE_SEAFOAM, HUE_TURQUOISE }, - { HUE_ICE_BLUE, HUE_LIGHT_BLUE, HUE_BLUE, HUE_ROYAL_BLUE }, - { HUE_PURPLE, HUE_PINK, HUE_HOT_PINK, HUE_MAGENTA }, -}; - -void Helios::handle_state_col_select_quadrant() -{ - if (Button::onShortClick()) { - menu_selection = (menu_selection + 1) % NUM_MENUS_QUADRANT; + Led::set(current_color); } - uint8_t hue_quad = (menu_selection - 2) % 4; - if (menu_selection > 5) { + if (Button::onLongClick()) { + if (menu_selection == 0) { + // Add the selected color to the colorset + current_color_set[selected_slot] = RGB_OFF; + } else { + // Add the selected color to the colorset + current_color_set[selected_slot] = current_color; + } + // Increment the selected slot for next color + selected_slot++; menu_selection = 0; - } - if (Button::onLongClick()) { - // select hue/sat/val - switch (menu_selection) { - case 0: // selected blank - // add blank to set - pat.colorset().set(selected_slot, RGB_OFF); - // Return to the slot you were editing - menu_selection = selected_slot; - // go to slot selection - 1 because we will increment outside here - cur_state = STATE_COLOR_SELECT_SLOT; - // RETURN HERE - return; - case 1: // selected white - // adds white, skip hue/sat to brightness - selected_sat = 0; - menu_selection = 0; - cur_state = STATE_COLOR_SELECT_VAL; - // RETURN HERE - return; - default: // 2-5 - selected_base_quad = hue_quad; - break; + if (selected_slot >= NUM_COLOR_SLOTS) { + // Set all colors at once using the new method + pat.colorset().setAll(current_color_set, NUM_COLOR_SLOTS); + save_cur_mode(); + cur_state = STATE_MODES; + selected_slot = 0; } } - // default col1/col2 to off and white for the first two options - RGBColor col1 = RGB_OFF; - RGBColor col2; - uint16_t on_dur, off_dur; + // Show dimmed selection indicator while button is pressed + RGBColor cur = Led::get(); + cur.red /= 2; + cur.green /= 2; + cur.blue /= 2; + show_selection(cur); - switch (menu_selection) { - case 0: // Blank Option - col2 = RGB_WHITE_BRI_LOW; - on_dur = 1; - off_dur = 30; - break; - case 1: // White Option - col2 = RGB_WHITE; - on_dur = 9; - off_dur = 0; - break; - default: // Color options - col1 = HSVColor(color_menu_data[hue_quad].hues[0], 255, 255); - col2 = HSVColor(color_menu_data[hue_quad].hues[2], 255, 255); - on_dur = 500; - off_dur = 500; - break; - } - Led::strobe(on_dur, off_dur, col1, col2); - // show a white flash for the first two menus - if (menu_selection <= 1) { - show_selection(RGB_WHITE_BRI_LOW); - } else { - // dim the color for the quad menus - RGBColor cur = Led::get(); - cur.red /= 2; - cur.green /= 2; - cur.blue /= 2; - show_selection(RGB_WHITE_BRI_LOW); + // If the user is on the blank option (menu_selection == 0) and holding, flash red to indicate they can save with current colors + if (menu_selection == 0 && Button::holdPressing()) { + // flash red to indicate save action is available + Led::strobe(150, 150, RGB_RED_BRI_LOW, RGB_OFF); } - if (Button::onLongClick()) { - cur_state = (State)(cur_state + 1); - // reset the menu selection - menu_selection = 0; - } -} -void Helios::handle_state_col_select_hue_sat_val() -{ - // handle iterating to the next option - if (Button::onShortClick()) { - menu_selection = (menu_selection + 1) % NUM_MENUS_HUE_SAT_VAL; - } - // in the sat/val selection a longclick is next and hold is save but in - // the final val selection a longclick is save and there's no next - bool gotoNextMenu = Button::onLongClick(); - bool saveAndFinish = Button::onHoldClick(); - switch (cur_state) { - default: - case STATE_COLOR_SELECT_HUE: - selected_hue = color_menu_data[selected_base_quad].hues[menu_selection]; - break; - case STATE_COLOR_SELECT_SAT: - static const uint8_t saturation_values[4] = {HSV_SAT_HIGH, HSV_SAT_MEDIUM, HSV_SAT_LOW, HSV_SAT_LOWEST}; - selected_sat = saturation_values[menu_selection]; - break; - case STATE_COLOR_SELECT_VAL: - static const uint8_t hsv_values[4] = {HSV_VAL_HIGH, HSV_VAL_MEDIUM, HSV_VAL_LOW, HSV_VAL_LOWEST}; - selected_val = hsv_values[menu_selection]; - // longclick becomes save and there is no next - saveAndFinish = gotoNextMenu; - break; - } - // render current selection - Led::set(HSVColor(selected_hue, selected_sat, selected_val)); - // show the long selection flash - if (Button::holdPressing()) { - Led::strobe(150, 150, RGB_CORAL_ORANGE_SAT_LOWEST, Led::get()); - } - // check to see if we are holding to save and skip - if (saveAndFinish) { - cur_state = STATE_COLOR_SELECT_SLOT; - pat.updateColor(selected_slot, HSVColor(selected_hue, selected_sat, selected_val)); - save_cur_mode(); - // Return to the slot you were editing - menu_selection = selected_slot; - return; - } - if (gotoNextMenu) { - cur_state = (State)(cur_state + 1); - // reset the menu selection - menu_selection = 0; + if (Button::onHoldClick()) { + // If they're on the blank option and have at least one color selected, save with current colors + if (menu_selection == 0 && selected_slot > 0) { + // Set all selected colors at once + pat.colorset().setAll(current_color_set, selected_slot); + save_cur_mode(); + cur_state = STATE_MODES; + selected_slot = 0; + } } } @@ -756,73 +550,6 @@ void Helios::factory_reset() load_cur_mode(); } -void Helios::handle_state_set_global_brightness() -{ - if (Button::onShortClick()) { - menu_selection = (menu_selection + 1) % NUM_BRIGHTNESS_OPTIONS; - } - // show different levels of green for each selection - uint8_t col = 0; - uint8_t brightness = 0; - switch (menu_selection) { - case 0: - col = 0xFF; - brightness = BRIGHTNESS_HIGH; - break; - case 1: - col = 0x78; - brightness = BRIGHTNESS_MEDIUM; - break; - case 2: - col = 0x3c; - brightness = BRIGHTNESS_LOW; - break; - case 3: - col = 0x28; - brightness = BRIGHTNESS_LOWEST; - break; - } - Led::set(0, col, 0); - // when the user long clicks a selection - if (Button::onLongClick()) { - // set the brightness based on the selection - Led::setBrightness(brightness); - Storage::write_brightness(brightness); - cur_state = STATE_MODES; - } - show_selection(RGB_WHITE_BRI_LOW); -} - -void Helios::handle_state_shift_mode() -{ - uint8_t new_mode = (cur_mode > 0) ? (uint8_t)(cur_mode - 1) : (uint8_t)(NUM_MODE_SLOTS - 1); - // copy the storage from the new position into our current position - Storage::copy_slot(new_mode, cur_mode); - // point at the new position - cur_mode = new_mode; - // write out the current mode to the newly updated position - save_cur_mode(); - cur_state = STATE_MODES; -} - -void Helios::handle_state_randomize() -{ - if (Button::onShortClick()) { - Colorset &cur_set = pat.colorset(); - Random ctx(pat.crc32()); - uint8_t randVal = ctx.next8(); - cur_set.randomizeColors(ctx, (randVal + 1) % NUM_COLOR_SLOTS, Colorset::COLOR_MODE_RANDOMLY_PICK); - Patterns::make_pattern((PatternID)(randVal % PATTERN_COUNT), pat); - pat.init(); - } - if (Button::onLongClick()) { - save_cur_mode(); - cur_state = STATE_MODES; - } - pat.play(); - show_selection(RGB_WHITE_BRI_LOW); -} - void Helios::show_selection(RGBColor color) { // only show selection while pressing the button diff --git a/Helios/Helios.h b/Helios/Helios.h index 4ed325ea..6bdf7570 100644 --- a/Helios/Helios.h +++ b/Helios/Helios.h @@ -46,45 +46,22 @@ class Helios static void handle_state(); static void handle_state_modes(); - - // the slot selection returns this info for internal menu logic - enum ColorSelectOption { - OPTION_NONE = 0, - - SELECTED_ADD, - SELECTED_EXIT, - SELECTED_SLOT - }; - - static void handle_off_menu(uint8_t mag, bool past); - static void handle_on_menu(uint8_t mag, bool past); - static void handle_state_col_select(); - static void handle_state_col_select_slot(ColorSelectOption &out_option); - static void handle_state_col_select_quadrant(); - static void handle_state_col_select_hue_sat_val(); + static void handle_state_color_select(); static void handle_state_pat_select(); static void handle_state_toggle_flag(Flags flag); static void handle_state_set_defaults(); - static void handle_state_set_global_brightness(); - static void handle_state_shift_mode(); - static void handle_state_randomize(); static void show_selection(RGBColor color); static void factory_reset(); + static void handle_off_menu(uint8_t mag, bool past); + static void handle_on_menu(uint8_t mag, bool past); + enum State : uint8_t { STATE_MODES, - STATE_COLOR_SELECT_SLOT, - STATE_COLOR_SELECT_QUADRANT, - STATE_COLOR_SELECT_HUE, - STATE_COLOR_SELECT_SAT, - STATE_COLOR_SELECT_VAL, + STATE_COLOR_SELECT, STATE_PATTERN_SELECT, STATE_TOGGLE_CONJURE, - STATE_TOGGLE_LOCK, STATE_SET_DEFAULTS, - STATE_SET_GLOBAL_BRIGHTNESS, - STATE_SHIFT_MODE, - STATE_RANDOMIZE, #ifdef HELIOS_CLI STATE_SLEEP, #endif @@ -102,6 +79,7 @@ class Helios static uint8_t selected_hue; static uint8_t selected_sat; static uint8_t selected_val; + static RGBColor current_color_set[NUM_COLOR_SLOTS]; static PatternArgs default_args[6]; static Colorset default_colorsets[6]; static Pattern pat; diff --git a/Helios/HeliosConfig.h b/Helios/HeliosConfig.h index cda27691..3120131c 100644 --- a/Helios/HeliosConfig.h +++ b/Helios/HeliosConfig.h @@ -67,12 +67,17 @@ // Max Color Slots // // The number of slots in a colorset -#define NUM_COLOR_SLOTS 6 +#define NUM_COLOR_SLOTS 3 + +// Max Colors +// +// The number of colors in a colorset +#define NUM_COLORS 20 // Mode Slots // // The number of modes on the device -#define NUM_MODE_SLOTS 6 +#define NUM_MODE_SLOTS 3 // Number of Global Brightness Options // diff --git a/Helios/Patterns.cpp b/Helios/Patterns.cpp index c6fa555f..70e24c23 100644 --- a/Helios/Patterns.cpp +++ b/Helios/Patterns.cpp @@ -6,12 +6,9 @@ // define arrays of colors, you can reuse these if you have multiple // modes that use the same colorset -- these demonstrate the max amount // of colors in each set but you can absolutely list a lesser amount -static const uint32_t color_codes0[] = {RGB_RED, RGB_ORANGE, RGB_YELLOW, RGB_TURQUOISE, RGB_BLUE, RGB_PINK}; -static const uint32_t color_codes1[] = {RGB_RED, RGB_CORAL_ORANGE_SAT_MEDIUM, RGB_ORANGE, RGB_YELLOW_SAT_LOW}; -static const uint32_t color_codes2[] = {RGB_PURPLE_BRI_LOWEST, RGB_MAGENTA, RGB_HOT_PINK_SAT_MEDIUM, RGB_PINK_SAT_LOWEST}; -static const uint32_t color_codes3[] = {RGB_WHITE, RGB_BLUE_BRI_LOWEST, RGB_BLUE_BRI_LOWEST, RGB_BLUE_BRI_LOWEST, RGB_BLUE_BRI_LOWEST, RGB_BLUE_BRI_LOWEST}; -static const uint32_t color_codes4[] = {RGB_MAGENTA_BRI_LOWEST, RGB_ROYAL_BLUE_BRI_LOW, RGB_TURQUOISE, RGB_ROYAL_BLUE_BRI_LOW, RGB_MAGENTA_BRI_LOWEST, RGB_OFF}; -static const uint32_t color_codes5[] = {RGB_RED, RGB_HOT_PINK, RGB_ROYAL_BLUE, RGB_BLUE, RGB_GREEN, RGB_YELLOW}; +static const uint32_t color_codes0[] = {RGB_RED, RGB_ORANGE, RGB_WHITE}; +static const uint32_t color_codes1[] = {RGB_TURQUOISE, RGB_WHITE, RGB_BLUE}; +static const uint32_t color_codes2[] = {RGB_MAGENTA, RGB_ICE_BLUE, RGB_YELLOW}; // Define Colorset configurations for each slot struct default_colorset { @@ -22,12 +19,9 @@ struct default_colorset { // the array of colorset entries, make sure the number on the left reflects // the number of colors in the array on the right static const default_colorset default_colorsets[] = { - { 6, color_codes0 }, // 0 Lightside - { 4, color_codes1 }, // 1 Sauna - { 4, color_codes2 }, // 2 Butterfly - { 6, color_codes3 }, // 3 Freezer Burn - { 6, color_codes4 }, // 4 Ice Blade - { 6, color_codes5 }, // 5 Rainbow Glitter + { 3, color_codes0 }, // 0 Fire ball + { 3, color_codes1 }, // 1 Chilly + { 3, color_codes2 }, // 2 Printer Ink }; void Patterns::make_default(uint8_t index, Pattern &pat) @@ -37,33 +31,17 @@ void Patterns::make_default(uint8_t index, Pattern &pat) } PatternArgs args; switch (index) { - case 0: // Lightside + case 0: // Fire ball args.on_dur = 2; args.gap_dur = 40; break; - case 1: // Sauna + case 1: // Chilly args.on_dur = 1; args.off_dur = 9; break; - case 2: // Butterfly - args.on_dur = 1; - args.off_dur = 9; - args.gap_dur = 6; - args.dash_dur = 15; - break; - case 3: // Freezer Burn - args.on_dur = 1; - args.off_dur = 9; - args.dash_dur = 5; - break; - case 4: // Ice Blade + case 2: // Printer Ink args.on_dur = 3; - args.off_dur = 1; - args.gap_dur = 30; - break; - case 5: // Rainbow Glitter - args.on_dur = 1; - args.off_dur = 50; + args.off_dur = 23; break; } // assign default args @@ -80,16 +58,6 @@ void Patterns::make_pattern(PatternID id, Pattern &pat) switch (id) { default: - - case PATTERN_RIBBON: - args.on_dur = 9; // 10 for flashing pattern circles - break; - - case PATTERN_ULTRA_DOPS: - args.on_dur = 1; - args.off_dur = 3; - break; - case PATTERN_DOPS: args.on_dur = 1; args.off_dur = 9; @@ -110,22 +78,6 @@ void Patterns::make_pattern(PatternID id, Pattern &pat) args.off_dur = 23; // 21 for flashing pattern circles break; - case PATTERN_RAZOR: - args.on_dur = 3; - args.off_dur = 1; - args.gap_dur = 30; // 29 for flashing pattern circles - break; - - case PATTERN_FLARE: - args.on_dur = 2; - args.off_dur = 30; // 28 for flashing pattern circles - break; - - case PATTERN_BURST: - args.on_dur = 3; - args.off_dur = 40; // 37 for flashing pattern circles - break; - case PATTERN_GLOW: args.on_dur = 2; args.gap_dur = 40; // 39 for flashing pattern circles @@ -135,61 +87,6 @@ void Patterns::make_pattern(PatternID id, Pattern &pat) args.on_dur = 1; args.off_dur = 50; // 44 for flashing pattern circles break; - - case PATTERN_FLASH: - args.on_dur = 10; - args.off_dur = 250; // 120 for flashing pattern circles - break; - - case PATTERN_MORPH: - args.on_dur = 9; - args.blend_speed = 5; // 14 for flashing pattern circles - break; - - case PATTERN_MORPH_STROBE: - args.on_dur = 5; - args.off_dur = 8; - args.blend_speed = 10; // 19 for flashing pattern circles - break; - - case PATTERN_MORPH_STROBIE: - args.on_dur = 3; - args.off_dur = 23; - args.blend_speed = 10; // 35 for flashing pattern circles - break; - - case PATTERN_MORPH_GLOW: - args.on_dur = 1; - args.off_dur = 3; - args.gap_dur = 40; // 36 for flashing pattern circles - args.blend_speed = 30; - break; - - case PATTERN_DASH_DOPS: - args.on_dur = 1; - args.off_dur = 9; - args.gap_dur = 6; - args.dash_dur = 15; // 17 for flashing pattern circles - break; - - case PATTERN_DASH_DOT: - args.on_dur = 2; - args.off_dur = 3; - args.dash_dur = 24; // 22 for flashing pattern circles - break; - - case PATTERN_WAVE_PARTICLE: - args.on_dur = 1; - args.off_dur = 9; - args.dash_dur = 5; // 10 for flashing pattern circles - break; - - case PATTERN_LIGHTSPEED: - args.on_dur = 2; - args.off_dur = 3; - args.dash_dur = 24; // 23 for flashing pattern circles - args.blend_speed = 10; - break; } pat.setArgs(args); diff --git a/Helios/Patterns.h b/Helios/Patterns.h index a653a330..bbb4b158 100644 --- a/Helios/Patterns.h +++ b/Helios/Patterns.h @@ -18,28 +18,12 @@ enum PatternID : int8_t { // ===================================== // Strobe - PATTERN_RIBBON = PATTERN_FIRST, - PATTERN_ULTRA_DOPS, - PATTERN_DOPS, + PATTERN_DOPS = PATTERN_FIRST, PATTERN_STROBE, PATTERN_HYPNOSTROBE, PATTERN_STROBIE, - PATTERN_RAZOR, - PATTERN_FLARE, - PATTERN_BURST, PATTERN_GLOW, PATTERN_FLICKER, - PATTERN_FLASH, - // Morph - PATTERN_MORPH, - PATTERN_MORPH_STROBE, - PATTERN_MORPH_STROBIE, - PATTERN_MORPH_GLOW, - // Dash - PATTERN_DASH_DOPS, - PATTERN_DASH_DOT, - PATTERN_WAVE_PARTICLE, - PATTERN_LIGHTSPEED, // Meta pattern constants INTERNAL_PATTERNS_END, diff --git a/HeliosEmbedded/Makefile b/HeliosEmbedded/Makefile index 41308e34..30c38184 100644 --- a/HeliosEmbedded/Makefile +++ b/HeliosEmbedded/Makefile @@ -56,9 +56,9 @@ ifeq ($(OS),Windows_NT) # Windows AVRDUDE_BAUDRATE = 115200 AVRDUDE_PORT = usb else ifeq ($(OS),Darwin) - AVRDUDE_PROGRAMMER = usbtiny + AVRDUDE_PROGRAMMER = stk500v1 AVRDUDE_BAUDRATE = 19200 - AVRDUDE_PORT = usb + AVRDUDE_PORT = /dev/tty.usbmodem21401 endif AVRDUDE_FLAGS = -C$(AVRDUDE_CONF) \