Skip to content

Commit

Permalink
Merge branch 'master' into handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Nov 29, 2023
2 parents 9afbf6d + 2d785c4 commit 17b5d04
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 164 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
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
12 changes: 9 additions & 3 deletions VortexEngine/tests/record_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ FILE=$1
VALIDATE=$2
TESTCOUNT=$3
NUMFILES=$4
QUIET=$5

if [ "$FILE" == "" ]; then
echo "$0 <test file> <validate> <total tests>"
Expand All @@ -26,7 +27,9 @@ ARGS="$(grep "Args=" $FILE | cut -d= -f2)"
TESTNUM="$(echo $FILE | cut -d/ -f2 | cut -d_ -f1 | cut -d/ -f2)"
TESTNUM=$((10#$TESTNUM))

echo -e -n "\e[31mRecording $PROJECT ($TESTCOUNT/$NUMFILES) \e[33m[\e[97m$BRIEF\e[33m] \e[33m[\e[97m$ARGS\e[33m]...\e[0m"
if [ "$QUIET" -eq 0 ]; then
echo -e -n "\e[31mRecording $PROJECT ($TESTCOUNT/$NUMFILES) \e[33m[\e[97m$BRIEF\e[33m] \e[33m[\e[97m$ARGS\e[33m]...\e[0m"
fi
TEMP_FILE="tmp/${FILE}.out"
# Append the output of the $VORTEX command to the temp file
# NOTE: When recording the tests we don't use valgrind because
Expand All @@ -43,8 +46,11 @@ $VORTEX $ARGS --no-timestep --hex <<< $INPUT >> $TEMP_FILE
sed -i 's/\r//g' $TEMP_FILE
# Replace the original file with the modified temp file
mv $TEMP_FILE $FILE
echo -e "\e[96mOK\e[0m"
# print out colorful if in verbose
if [ "$QUIET" -eq 0 ]; then
echo -e "\e[96mOK\e[0m"
else
echo -n "."
fi
if [ "$VALIDATE" -eq 1 ]; then
$VORTEX $ARGS --no-timestep --color <<< $INPUT
echo -e "\e[31mRecorded \e[33m[\e[97m$BRIEF\e[33m] \e[33m[\e[97m$ARGS\e[33m]\e[0m"
Expand Down
18 changes: 15 additions & 3 deletions VortexEngine/tests/recordtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ VALGRIND="valgrind --quiet --leak-check=full --show-leak-kinds=all"
VORTEX="../vortex"

VALIDATE=0
QUIET=0
TODO=

declare -a REPOS
Expand All @@ -16,8 +17,11 @@ for folder in tests_*/; do
REPOS+=("$folder_name")
done

for arg in "$@"
do
for arg in "$@"; do
# -q for quiet
if [ "$arg" == "-q" ]; then
QUIET=1
fi
# -v for validate
if [ "$arg" == "-v" ]; then
VALIDATE=1
Expand Down Expand Up @@ -112,11 +116,19 @@ function record_tests() {
TESTCOUNT=0

for FILE in $FILES; do
./record_test.sh $FILE $VALIDATE $TESTCOUNT $NUMFILES &
./record_test.sh $FILE $VALIDATE $TESTCOUNT $NUMFILES $QUIET &
TESTCOUNT=$((TESTCOUNT + 1))
done

# Wait for all background jobs to finish
wait

if [ "$QUIET" -eq 1 ]; then
echo ". Complete"
fi
echo "All tests recorded successfully!"
#rm -rf tmp/$PROJECT
}

record_tests $TARGETREPO

0 comments on commit 17b5d04

Please sign in to comment.