diff --git a/VortexEngine/VortexEngine.vcxproj b/VortexEngine/VortexEngine.vcxproj
index 4190dac366..5a5b577cca 100644
--- a/VortexEngine/VortexEngine.vcxproj
+++ b/VortexEngine/VortexEngine.vcxproj
@@ -179,7 +179,7 @@
-
+
@@ -251,7 +251,7 @@
-
+
diff --git a/VortexEngine/VortexEngine.vcxproj.filters b/VortexEngine/VortexEngine.vcxproj.filters
index 913b0d84e7..9bbf08e6d4 100644
--- a/VortexEngine/VortexEngine.vcxproj.filters
+++ b/VortexEngine/VortexEngine.vcxproj.filters
@@ -240,7 +240,7 @@
Source Files\Patterns\Multi
-
+
Source Files\Patterns\Multi
@@ -452,7 +452,7 @@
Header Files\Patterns\Multi
-
+
Header Files\Patterns\Multi
diff --git a/VortexEngine/VortexLib/VortexLib.cpp b/VortexEngine/VortexLib/VortexLib.cpp
index da41e8ca20..21fed2b193 100644
--- a/VortexEngine/VortexLib/VortexLib.cpp
+++ b/VortexEngine/VortexLib/VortexLib.cpp
@@ -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
diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp
index a86be8a50e..f5e75c7635 100644
--- a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp
+++ b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp
@@ -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);
diff --git a/VortexEngine/src/Patterns/Multi/MateriaPattern.cpp b/VortexEngine/src/Patterns/Multi/MateriaPattern.cpp
deleted file mode 100644
index 3d9c6b18a3..0000000000
--- a/VortexEngine/src/Patterns/Multi/MateriaPattern.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "MateriaPattern.h"
-
-#include "../../Serial/ByteStream.h"
-#include "../../Time/TimeControl.h"
-#include "../../Leds/Leds.h"
-#include "../../Log/Log.h"
-
-MateriaPattern::MateriaPattern(const PatternArgs &args) :
- MultiLedPattern(args),
- m_onDuration1(0),
- m_offDuration1(0),
- m_onDuration2(0),
- m_offDuration2(0),
- m_stepSpeed(0),
- m_stepTimer(),
- m_ledMap(0),
- m_switch(false)
-{
- m_patternID = PATTERN_MATERIA;
- REGISTER_ARG(m_onDuration1);
- REGISTER_ARG(m_offDuration1);
- REGISTER_ARG(m_onDuration2);
- REGISTER_ARG(m_offDuration2);
- REGISTER_ARG(m_stepSpeed);
- setArgs(args);
-}
-
-MateriaPattern::~MateriaPattern()
-{
-}
-
-// init the pattern to initial state
-void MateriaPattern::init()
-{
- MultiLedPattern::init();
-
- // start on index 1
- m_colorset.setCurIndex(1);
- // reset the blink timer entirely
- m_blinkTimer1.reset();
- // dops timing
- m_blinkTimer1.addAlarm(m_onDuration1);
- m_blinkTimer1.addAlarm(m_offDuration1);
- // start the blink timer from the next frame
- m_blinkTimer1.start();
-
- // reset the blink timer entirely
- m_blinkTimer2.reset();
- // dops timing
- m_blinkTimer2.addAlarm(m_onDuration2);
- m_blinkTimer2.addAlarm(m_offDuration2);
- // start the blink timer from the next frame
- m_blinkTimer2.start();
-
- // reset and add alarm
- m_stepTimer.reset();
- m_stepTimer.addAlarm(m_stepSpeed * 100);
- m_stepTimer.start();
-
- // map of the Thumb, Index, Ring, and Pinkie Tops
- m_ledMap = MAP_LED(LED_9) | MAP_LED(LED_7) | MAP_LED(LED_3) | MAP_LED(LED_1);
-
- //Set the middle top to solid color 0
- Leds::setIndex(LED_5, m_colorset.get(0));
-}
-
-// pure virtual must override the play function
-void MateriaPattern::play()
-{
- // get next color on stepTimer alarm, skip color 0
- if (m_stepTimer.alarm() == 0) {
- m_colorset.getNext();
- if (m_colorset.curIndex() == 0) {
- m_colorset.getNext();
- }
- }
- switch (m_blinkTimer1.alarm()) {
- case -1: // just break and still run post-step
- break;
- case 0: // turn on the leds for given mapping
- m_switch = !m_switch;
- // alternate between showing the current and next color
- if (m_switch) {
- // if this is the last color of the set, skip color 0 (color 0 is for Middle top only)
- if (m_colorset.curIndex() != m_colorset.numColors() - 1) {
- Leds::setAllEvens(m_colorset.peekNext());
- } else {
- Leds::setAllEvens(m_colorset.peek(2));
- }
- }
- else {
- Leds::setAllEvens(m_colorset.cur());
- }
- break;
- case 1: // turn off the leds
- Leds::clearAllEvens();
- break;
- }
-
- switch (m_blinkTimer2.alarm()) {
- case -1: // just break and still run post-step
- break;
- case 0: // turn on the leds for given mapping
- Leds::setMap(m_ledMap, m_colorset.cur());
- break;
- case 1: // turn off the leds
- Leds::clearMap(m_ledMap);
- break;
- }
- }
diff --git a/VortexEngine/src/Patterns/Multi/MateriaPattern.h b/VortexEngine/src/Patterns/Multi/MateriaPattern.h
deleted file mode 100644
index 2c87343ba4..0000000000
--- a/VortexEngine/src/Patterns/Multi/MateriaPattern.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef MATERIA_PATTERN_H
-#define MATERIA_PATTERN_H
-
-#include "MultiLedPattern.h"
-
-#include "../../Time/Timings.h"
-#include "../../Time/Timer.h"
-#include "../../Leds/LedTypes.h"
-
-class MateriaPattern : public MultiLedPattern
-{
-public:
- MateriaPattern(const PatternArgs &args);
- virtual ~MateriaPattern();
-
- // init the pattern to initial state
- virtual void init() override;
-
- // pure virtual must override the play function
- virtual void play() override;
-
-private:
- // blink durations
- uint8_t m_onDuration1;
- uint8_t m_offDuration1;
- uint8_t m_onDuration2;
- uint8_t m_offDuration2;
- // the speed for the step timer
- uint8_t m_stepSpeed;
- // the step timer
- Timer m_blinkTimer1;
- Timer m_blinkTimer2;
- Timer m_stepTimer;
-
- LedMap m_ledMap;
-
- bool m_switch;
-};
-#endif
diff --git a/VortexEngine/src/Patterns/Multi/VortexPattern.cpp b/VortexEngine/src/Patterns/Multi/VortexPattern.cpp
new file mode 100644
index 0000000000..b879687b11
--- /dev/null
+++ b/VortexEngine/src/Patterns/Multi/VortexPattern.cpp
@@ -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();
+ }
+}
diff --git a/VortexEngine/src/Patterns/Multi/VortexPattern.h b/VortexEngine/src/Patterns/Multi/VortexPattern.h
new file mode 100644
index 0000000000..38b261c8ab
--- /dev/null
+++ b/VortexEngine/src/Patterns/Multi/VortexPattern.h
@@ -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
diff --git a/VortexEngine/src/Patterns/PatternBuilder.cpp b/VortexEngine/src/Patterns/PatternBuilder.cpp
index 2d174d062d..8579af9880 100644
--- a/VortexEngine/src/Patterns/PatternBuilder.cpp
+++ b/VortexEngine/src/Patterns/PatternBuilder.cpp
@@ -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"
@@ -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
@@ -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
diff --git a/VortexEngine/src/Patterns/Patterns.h b/VortexEngine/src/Patterns/Patterns.h
index e9af6d8c8a..65f3b90bb7 100644
--- a/VortexEngine/src/Patterns/Patterns.h
+++ b/VortexEngine/src/Patterns/Patterns.h
@@ -89,7 +89,7 @@ enum PatternID : int8_t
PATTERN_BOUNCE,
PATTERN_SPLITSTROBIE,
PATTERN_BACKSTROBE,
- PATTERN_MATERIA,
+ PATTERN_VORTEX,
// ADD NEW MULTI LED PATTERNS HERE
diff --git a/VortexEngine/tests/record_test.sh b/VortexEngine/tests/record_test.sh
index 27feccf73a..a83dc7a0e3 100644
--- a/VortexEngine/tests/record_test.sh
+++ b/VortexEngine/tests/record_test.sh
@@ -6,6 +6,7 @@ FILE=$1
VALIDATE=$2
TESTCOUNT=$3
NUMFILES=$4
+QUIET=$5
if [ "$FILE" == "" ]; then
echo "$0 "
@@ -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
@@ -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"
diff --git a/VortexEngine/tests/recordtests.sh b/VortexEngine/tests/recordtests.sh
index 9d89628cb2..78694cf0d6 100644
--- a/VortexEngine/tests/recordtests.sh
+++ b/VortexEngine/tests/recordtests.sh
@@ -4,6 +4,7 @@ VALGRIND="valgrind --quiet --leak-check=full --show-leak-kinds=all"
VORTEX="../vortex"
VALIDATE=0
+QUIET=0
TODO=
declare -a REPOS
@@ -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
@@ -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
+