Skip to content

Commit

Permalink
Daniel/core/multi led audit1 (#142)
Browse files Browse the repository at this point in the history
* fixed multi-led stuff and renamed materia to vortex

* fixed default mode on jest

* how to solve vortex on other devices

* Dynamic version of Vortex Pattern for all devices

* fixed default

* adjusted

---------

Co-authored-by: Shane Aronson <[email protected]>
  • Loading branch information
Unreal-Dan and LivingSynthesis authored Nov 29, 2023
1 parent 5bb5436 commit 6cb8b17
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 159 deletions.
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
2 changes: 1 addition & 1 deletion VortexEngine/VortexLib/VortexLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ string Vortex::patternToString(PatternID id)
"hueshift", "theater_chase", "chaser", "zigzag", "zipfade", "drip",
"dripmorph", "crossdops", "doublestrobe", "meteor", "sparkletrace",
"vortexwipe", "warp", "warpworm", "snowball", "lighthouse", "pulsish",
"fill", "bounce", "splitstrobie", "backstrobe", "materia",
"fill", "bounce", "splitstrobie", "backstrobe", "vortex",
};
if (sizeof(patternNames) / sizeof(patternNames[0]) != PATTERN_COUNT) {
// if you see this it means the list of strings above is not equal to
Expand Down
2 changes: 2 additions & 0 deletions VortexEngine/src/Menus/MenuList/PatternSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ void PatternSelect::onShortClick()
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
2 changes: 1 addition & 1 deletion VortexEngine/src/Modes/DefaultModes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const default_mode_entry default_modes[MAX_MODES] = {
}
},
{
PATTERN_MATERIA, 4, {
PATTERN_VORTEX, 4, {
0xAA0055,
0x7070C5,
0x0A0013,
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.

48 changes: 48 additions & 0 deletions VortexEngine/src/Patterns/Multi/VortexPattern.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "VortexPattern.h"

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

// add 1 to prevent the middle point from being led 0
#define MIDDLE_POINT ((LED_COUNT + 1) / 2)

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()
{
// Sets an LED at opposite ends of the strip and progresses towards the center
Leds::setIndex((LedPos)m_progress, m_colorset.peekNext());
Leds::setIndex((LedPos)(LED_LAST - m_progress), m_colorset.peekNext());
}

void VortexPattern::poststep()
{
// step till the middle point
m_progress = (m_progress + 1) % MIDDLE_POINT;
// each cycle progress to the next color
if (m_progress == 0) {
m_colorset.getNext();
}
}
26 changes: 26 additions & 0 deletions VortexEngine/src/Patterns/Multi/VortexPattern.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef VORTEX_PATTERN_H
#define VORTEX_PATTERN_H

#include "BlinkStepPattern.h"

#include "../../Time/Timings.h"

class VortexPattern : public BlinkStepPattern
{
public:
VortexPattern(const PatternArgs& args);
virtual ~VortexPattern();

// init the pattern to initial state
virtual void init() override;

protected:
virtual void blinkOn() override;
virtual void poststep() override;

private:
// how much the fill has progressed
uint8_t m_progress;
};

#endif
6 changes: 3 additions & 3 deletions VortexEngine/src/Patterns/PatternBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "Multi/PulsishPattern.h"
#include "Multi/BouncePattern.h"
#include "Multi/BackStrobePattern.h"
#include "Multi/MateriaPattern.h"
#include "Multi/VortexPattern.h"

#include "Single/SingleLedPattern.h"
#include "Single/BasicPattern.h"
Expand Down Expand Up @@ -185,7 +185,7 @@ PatternArgs PatternBuilder::getDefaultArgs(PatternID id)
case PATTERN_BOUNCE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 200, 10);
case PATTERN_SPLITSTROBIE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 0, 16, 3, 10, PATTERN_DOPS, PATTERN_STROBIE);
case PATTERN_BACKSTROBE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 0, HYPERSTROBE_ON_DURATION, HYPERSTROBE_OFF_DURATION, 10, PATTERN_DOPS, PATTERN_HYPERSTROBE);
case PATTERN_MATERIA: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 3, 35, 80);
case PATTERN_VORTEX: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 130);
case PATTERN_NONE: break;
default: break;
#else
Expand Down Expand Up @@ -273,7 +273,7 @@ Pattern *PatternBuilder::generate(PatternID id, const PatternArgs *userArgs)
case PATTERN_BOUNCE: return new BouncePattern(args);
case PATTERN_SPLITSTROBIE:
case PATTERN_BACKSTROBE: return new BackStrobePattern(args);
case PATTERN_MATERIA: return new MateriaPattern(args);
case PATTERN_VORTEX: return new VortexPattern(args);
case PATTERN_NONE: return nullptr;
#else
// in vortex slim just use basic pattern for all multi led
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/Patterns/Patterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ enum PatternID : int8_t
PATTERN_BOUNCE,
PATTERN_SPLITSTROBIE,
PATTERN_BACKSTROBE,
PATTERN_MATERIA,
PATTERN_VORTEX,

// ADD NEW MULTI LED PATTERNS HERE

Expand Down

0 comments on commit 6cb8b17

Please sign in to comment.