Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed multi led patterns in pattern select #139

Merged
merged 52 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
bc96d49
fixed multi led patterns in pattern select
Unreal-Dan Nov 17, 2023
d334449
restored these
Unreal-Dan Nov 17, 2023
f626b9e
minor fix
Unreal-Dan Nov 17, 2023
7389367
Changed saving to work off preview mode
LivingSynthesis Nov 17, 2023
a250fdf
Chaser pattern for orbit
LivingSynthesis Nov 17, 2023
a3e0281
Finished Dynamic Chaser Pattern
LivingSynthesis Nov 18, 2023
f937792
Ensures at least 1 Chaser for Chaser pattern
LivingSynthesis Nov 18, 2023
cfc76c2
Fixes to several patterns
LivingSynthesis Nov 18, 2023
c7c9f1d
Substituted Materia for Vortex, needs renaming
LivingSynthesis Nov 18, 2023
b5d50ea
Renamed Materia to Vortex
LivingSynthesis Nov 18, 2023
9c43498
Upated Materia to Vortex
LivingSynthesis Nov 18, 2023
b1d8b18
Small fixes to comments an types
LivingSynthesis Nov 19, 2023
344e449
fixed random function call ordering
Unreal-Dan Nov 22, 2023
e945187
added a comment
Unreal-Dan Nov 22, 2023
6641d42
minor fixes
Unreal-Dan Nov 22, 2023
2cbcb90
Explicit random call order
LivingSynthesis Nov 22, 2023
f8ceb45
Merge branch 'shane/core/random_call_ordering' into daniel/orbit/mult…
LivingSynthesis Nov 22, 2023
e66bfc1
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
Unreal-Dan Nov 24, 2023
fb3c52d
fixed multi-led stuff and renamed materia to vortex
Unreal-Dan Nov 24, 2023
9ae30d7
fixed default mode on jest
Unreal-Dan Nov 24, 2023
e11d81d
how to solve vortex on other devices
Unreal-Dan Nov 24, 2023
28b5924
Dynamic version of Vortex Pattern for all devices
LivingSynthesis Nov 28, 2023
cc2ddc9
Merge branch 'daniel/core/multi_led_audit1' into daniel/orbit/multi_l…
LivingSynthesis Nov 29, 2023
bebaa9e
Mutliled pattern args for orbit
LivingSynthesis Nov 29, 2023
b1736fe
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
LivingSynthesis Nov 30, 2023
cbf7026
missed this before woops
LivingSynthesis Nov 30, 2023
82d1558
Orbit variants for some patterns
LivingSynthesis Nov 30, 2023
4b902a0
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
Unreal-Dan Nov 30, 2023
34c0c50
recorded tests
Unreal-Dan Nov 30, 2023
b2035ed
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
Unreal-Dan Nov 30, 2023
9aaecad
fixed sequenced patterns
Unreal-Dan Nov 30, 2023
72a02c1
sequencer fix
Unreal-Dan Nov 30, 2023
01eb151
Fixed deleted default
LivingSynthesis Nov 30, 2023
dce3797
Silly comma, tricks are for kids
LivingSynthesis Nov 30, 2023
6d930fc
adjusted led typing for ring even odd
Unreal-Dan Dec 1, 2023
568f805
Merge branch 'daniel/orbit/multi_led_pattern_select_fix' of https://g…
Unreal-Dan Dec 1, 2023
a33b5da
adjusted blend code
Unreal-Dan Dec 1, 2023
d8ed3b3
removed unused var
Unreal-Dan Dec 1, 2023
69877e1
began pattern expansion for multiled randomizer
LivingSynthesis Dec 1, 2023
751207c
Merge branch 'daniel/orbit/multi_led_pattern_select_fix' of https://g…
LivingSynthesis Dec 1, 2023
acedd21
Added colors to the multi randomize thingy
LivingSynthesis Dec 2, 2023
a4a5746
Finished MutliLed randomize and fixed a bug
LivingSynthesis Dec 5, 2023
9bfc4a6
Fixes for HueShift
LivingSynthesis Dec 5, 2023
3677f0f
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
Unreal-Dan Dec 6, 2023
90975c4
Added support for 2nd button exit, orbit only
LivingSynthesis Dec 7, 2023
a843462
Merge branch 'daniel/orbit/multi_led_pattern_select_fix' of https://g…
LivingSynthesis Dec 7, 2023
6d50cbc
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
Unreal-Dan Dec 8, 2023
f1eb7ad
Cleaned up HueShiftPattern
LivingSynthesis Dec 8, 2023
00b57fe
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
Unreal-Dan Dec 8, 2023
9041103
Merge branch 'orbit' into daniel/orbit/multi_led_pattern_select_fix
Unreal-Dan Dec 8, 2023
faa9a7e
Reverted randomizer
Unreal-Dan Dec 8, 2023
f3b91f2
recorded tests
Unreal-Dan Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions VortexEngine/VortexEngine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<ClCompile Include="src\Patterns\Multi\HueShiftPattern.cpp" />
<ClCompile Include="src\Patterns\Multi\CompoundPattern.cpp" />
<ClCompile Include="src\Patterns\Multi\LighthousePattern.cpp" />
<ClCompile Include="src\Patterns\Multi\MateriaPattern.cpp" />
<ClCompile Include="src\Patterns\Multi\VortexPattern.cpp" />
<ClCompile Include="src\Patterns\Multi\MeteorPattern.cpp" />
<ClCompile Include="src\Patterns\Multi\MultiLedPattern.cpp" />
<ClCompile Include="src\Patterns\Multi\PulsishPattern.cpp" />
Expand Down Expand Up @@ -251,7 +251,7 @@
<ClInclude Include="src\Patterns\Multi\HueShiftPattern.h" />
<ClInclude Include="src\Patterns\Multi\CompoundPattern.h" />
<ClInclude Include="src\Patterns\Multi\LighthousePattern.h" />
<ClInclude Include="src\Patterns\Multi\MateriaPattern.h" />
<ClInclude Include="src\Patterns\Multi\VortexPattern.h" />
<ClInclude Include="src\Patterns\Multi\MeteorPattern.h" />
<ClInclude Include="src\Patterns\Multi\MultiLedPattern.h" />
<ClInclude Include="src\Patterns\Multi\PulsishPattern.h" />
Expand Down
4 changes: 2 additions & 2 deletions VortexEngine/VortexEngine.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
<ClCompile Include="src\Patterns\Multi\LighthousePattern.cpp">
<Filter>Source Files\Patterns\Multi</Filter>
</ClCompile>
<ClCompile Include="src\Patterns\Multi\MateriaPattern.cpp">
<ClCompile Include="src\Patterns\Multi\VortexPattern.cpp">
<Filter>Source Files\Patterns\Multi</Filter>
</ClCompile>
<ClCompile Include="src\Patterns\Multi\MeteorPattern.cpp">
Expand Down Expand Up @@ -452,7 +452,7 @@
<ClInclude Include="src\Patterns\Multi\LighthousePattern.h">
<Filter>Header Files\Patterns\Multi</Filter>
</ClInclude>
<ClInclude Include="src\Patterns\Multi\MateriaPattern.h">
<ClInclude Include="src\Patterns\Multi\VortexPattern.h">
<Filter>Header Files\Patterns\Multi</Filter>
</ClInclude>
<ClInclude Include="src\Patterns\Multi\MeteorPattern.h">
Expand Down
16 changes: 8 additions & 8 deletions VortexEngine/src/Menus/MenuList/PatternSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ void PatternSelect::nextPattern()
if (isMultiLedPatternID(newID)) {
m_previewMode.setPattern(newID);
} else {
// TODO: clear multi a better way
m_previewMode.setPatternMap(m_targetLeds, newID);
m_previewMode.clearPattern(LED_MULTI);
}
m_previewMode.init();
DEBUG_LOGF("Iterated to pattern id %d", newID);
Expand Down Expand Up @@ -174,7 +176,9 @@ void PatternSelect::previousPattern()
if (isMultiLedPatternID(newID)) {
m_previewMode.setPattern(newID);
} else {
// TODO: clear multi a better way
m_previewMode.setPatternMap(m_targetLeds, newID);
m_previewMode.clearPattern(LED_MULTI);
}
m_previewMode.init();
DEBUG_LOGF("Iterated to pattern id %d", newID);
Expand All @@ -199,14 +203,10 @@ void PatternSelect::onLongClick()
break;
case STATE_PICK_PATTERN:
// need to save the new pattern if it's different from current
needsSave = (cur->getPatternID() != m_newPatternID);
// store the new pattern in the mode
cur->setPattern(m_newPatternID);
cur->init();
DEBUG_LOGF("Saving pattern %u", m_newPatternID);
// go back to beginning for next time
m_state = STATE_PICK_LIST;
// done in the pattern select menu
needsSave = (cur->getPatternID() != m_previewMode.getPatternID());
// update the current mode with the new pattern
Modes::updateCurMode(&m_previewMode);
// then done here, save if the mode was different
leaveMenu(needsSave);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/Patterns/Multi/CrossDopsPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void CrossDopsPattern::init()
{
BlinkStepPattern::init();
// Alternating evens and odds mapping of leds to turn on/off
m_ledMap = MAP_PAIR_EVENS;
m_ledMap = MAP_LINE_1;
// start colorset at index 0 so cur() works
m_colorset.setCurIndex(0);
}
Expand Down
6 changes: 3 additions & 3 deletions VortexEngine/src/Patterns/Multi/FillPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ void FillPattern::init()

void FillPattern::blinkOn()
{
Leds::setQuadrants(QUADRANT_FIRST, (Quadrant)m_progress, m_colorset.peekNext());
Leds::setQuadrants((Quadrant)m_progress, QUADRANT_LAST, m_colorset.cur());
Leds::setRange(LED_FIRST, LedPos(m_progress * (LED_COUNT / 4)), m_colorset.peekNext());
Leds::setRange(LedPos(LED_COUNT / 4), LED_LAST, m_colorset.cur());
}

void FillPattern::poststep()
{
m_progress = (m_progress + 1) % PAIR_COUNT;
m_progress = (m_progress + 1) % 4;
if (m_progress == 0) {
m_colorset.getNext();
}
Expand Down
110 changes: 0 additions & 110 deletions VortexEngine/src/Patterns/Multi/MateriaPattern.cpp

This file was deleted.

39 changes: 0 additions & 39 deletions VortexEngine/src/Patterns/Multi/MateriaPattern.h

This file was deleted.

10 changes: 6 additions & 4 deletions VortexEngine/src/Patterns/Multi/MeteorPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ void MeteorPattern::blinkOff()

void MeteorPattern::poststep()
{
// when a new meteor is created it is incerted into the stash so the blinking pattern is not interrupted
LedPos target = (LedPos)m_randCtx.next8(LED_FIRST, LED_LAST);
RGBColor col = m_colorset.getNext();
m_stash.setIndex(target, col);
for (int meteorCount = 0; meteorCount < (LED_COUNT / 2); ++meteorCount) {
LivingSynthesis marked this conversation as resolved.
Show resolved Hide resolved
// when a new meteor is created it is incerted into the stash so the blinking pattern is not interrupted
LedPos target = (LedPos)m_randCtx.next8(LED_FIRST, LED_LAST);
RGBColor col = m_colorset.getNext();
m_stash.setIndex(target, col);
}
}
40 changes: 21 additions & 19 deletions VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
#include "ChaserPattern.h"

// This controlls the ratio of chaser dots to LED_COUNT. Default 1 chaser per 7 LEDs. Range: 1-LED_COUNT.
LivingSynthesis marked this conversation as resolved.
Show resolved Hide resolved
#define CHASER_RATIO 7


// This pattern aims to be a demonstration of the sequencer.
// There are always many ways to implement a pattern, it's best
// to choose the method that is most suitable for the pattern.
ChaserPattern::ChaserPattern(const PatternArgs &args) :
SequencedPattern(args)
{
setArgs(args);

// Makes sure there is at least 1 chaser
uint32_t numChasers = LED_COUNT / CHASER_RATIO;
if (!numChasers) {
numChasers = 1;
}
// set the pattern ID
//m_patternID = PATTERN_CHASER;
// There are 8 steps in the chaser, so iterate 8 times and generate
// There are LED_COUNT steps in the chaser, so iterate LED_COUNT times and generate
// a pattern map for each step. A colorset map can also be applied
// to override certain colors for specific steps, but that's not
// what is being done here
for (uint8_t i = 0; i < 8; ++i) {
// Each step all fingers are dops except for one, so start with a
// Pattern Map that has dops on all fingers. A Pattern Map will map
for (uint8_t i = 0; i < LED_COUNT; ++i) {
// Each step all LEDs are dops except for one, so start with a
// Pattern Map that has dops on all LEDs. A Pattern Map will map
// a Pattern ID to each LED on the device, then we will override a
// different entry each step with the Pattern ID for Solid0.
PatternMap patMap(PATTERN_DOPS);
// Override a single finger in the pattern map with the Solid0 pattern
// Override a single LED in the pattern map with the Solid0 pattern
// which will use the 0th color from the colorset as the solid color.
// An LedMap is a bitmap that indicates which leds are turned on or off
// at any given time. This will generate an Led Map based on the current
// step index like this:
//
// step -> finger index -> target leds -> LedMap
// -----------------------------------------------------
// 0 0 0, 1 00 00 00 00 11
// 1 1 2, 3 00 00 00 11 00
// 2 2 4, 5 00 00 11 00 00
// 3 3 6, 7 00 11 00 00 00
// 4 4 8, 9 11 00 00 00 00
// 5 3 6, 7 00 11 00 00 00
// 6 2 4, 5 00 00 11 00 00
// 7 1 2, 3 00 00 00 11 00
LedMap overrideLeds = 0; //MAP_PAIR((Pair)((i < 5) ? i : (8 - i)));
LedMap overrideLeds = MAP_LED_NONE;
// This creates an led map with 1 chaser per CHASER_RATIO (default 7) leds in LED_COUNT
for (int chaserCount = 0; chaserCount < numChasers; ++chaserCount) {
LivingSynthesis marked this conversation as resolved.
Show resolved Hide resolved
overrideLeds |= MAP_LED((i + (chaserCount * CHASER_RATIO)) % LED_COUNT);
}
// Then this API is used to override specific positions in the Pattern Map
// with a different pattern ID, we use the Led Map generated above to tell
// setPatternAt() which indices to override with Solid0
patMap.setPatternAt(PATTERN_SOLID, overrideLeds);
// Then finally we add this pattern mapping to the sequence in a new step
// that will last 300ms, this means all 8 steps will be 300ms each.
// that will last 300ms, this means all LED_COUNT steps will be 300ms each.
// The last parameter of addStep() is omitted, that parameter could be used
// to override the colorset for specific Leds on any given step. Since it
// is omitted that means this pattern will use whichever colorset is chosen
Expand Down
41 changes: 41 additions & 0 deletions VortexEngine/src/Patterns/Multi/VortexPattern.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "VortexPattern.h"

#include "../../Serial/ByteStream.h"
#include "../../Time/TimeControl.h"
#include "../../Leds/Leds.h"
#include "../../Log/Log.h"

VortexPattern::VortexPattern(const PatternArgs& args) :
BlinkStepPattern(args),
m_progress(0)
{
m_patternID = PATTERN_VORTEXWIPE;
setArgs(args);
}

VortexPattern::~VortexPattern()
{
}

// init the pattern to initial state
void VortexPattern::init()
{
BlinkStepPattern::init();
// reset progress
m_progress = 0;
// start colorset at index 0 so cur() works
m_colorset.setCurIndex(0);
}

void VortexPattern::blinkOn()
{
Leds::setRing((Ring)(RING_LAST - m_progress), m_colorset.peekNext());
}

void VortexPattern::poststep()
{
m_progress = (m_progress + 1) % RING_COUNT;
if (RING_COUNT - m_progress == RING_LAST) {
m_colorset.getNext();
}
}
Loading