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

Daniel/chromadeck/flash duo firmware backup modes #277

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions VortexEngine/VortexEngine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<ClCompile Include="src\Colors\Colorset.cpp" />
<ClCompile Include="src\Colors\ColorTypes.cpp" />
<ClCompile Include="src\Menus\MainMenu.cpp" />
<ClCompile Include="src\Modes\DuoDefaultModes.cpp" />
<ClCompile Include="src\UPDI\updi.cpp" />
<ClCompile Include="src\Wireless\IRReceiver.cpp" />
<ClCompile Include="src\Wireless\IRSender.cpp" />
Expand Down Expand Up @@ -221,6 +222,7 @@
<ClInclude Include="src\Colors\Colorset.h" />
<ClInclude Include="src\Colors\ColorTypes.h" />
<ClInclude Include="src\Menus\MainMenu.h" />
<ClInclude Include="src\Modes\DuoDefaultModes.h" />
<ClInclude Include="src\UPDI\updi.h" />
<ClInclude Include="src\Wireless\IRConfig.h" />
<ClInclude Include="src\Wireless\IRReceiver.h" />
Expand Down
6 changes: 6 additions & 0 deletions VortexEngine/VortexEngine.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@
<ClCompile Include="src\UPDI\updi.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Modes\DuoDefaultModes.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\VortexConfig.h">
Expand Down Expand Up @@ -569,5 +572,8 @@
<ClInclude Include="src\UPDI\updi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Modes\DuoDefaultModes.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
45 changes: 45 additions & 0 deletions VortexEngine/src/Leds/LedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,30 @@ enum Pair : uint8_t
// Compile-time check on the number of pairs and leds
static_assert(LED_COUNT == (PAIR_COUNT * 2), "Incorrect number of Pairs for Leds! Adjust the Led enum or Pair enum to match");

enum Radial : uint8_t
{
RADIAL_FIRST = 0,

RADIAL_0 = RADIAL_FIRST,
RADIAL_1,
RADIAL_2,
RADIAL_3,
RADIAL_4,
RADIAL_5,
RADIAL_6,
RADIAL_7,
RADIAL_8,
RADIAL_9,

RADIAL_COUNT,
RADIAL_LAST = (RADIAL_COUNT - 1),
};

static_assert(RADIAL_COUNT == (LED_COUNT / 2), "Incorrect number of Radials for Leds! Adjust the Led enum or Radial enum to match");

#define radialInner(radial) (LedPos)(LED_10 + radial)
#define radialOuter(radial) (LedPos)(LED_0 + radial)

// check if an led is even or odd
#define isEven(pos) ((pos % 2) == 0)
#define isOdd(pos) ((pos % 2) != 0)
Expand Down Expand Up @@ -280,4 +304,25 @@ inline Pair operator-(Pair &c, int b)
return (Pair)((uint32_t)c - b);
}

// Radial operators
inline Radial &operator++(Radial &c)
{
c = Radial(((uint32_t)c) + 1);
return c;
}
inline Radial operator++(Radial &c, int)
{
Radial temp = c;
++c;
return temp;
}
inline Radial operator+(Radial &c, int b)
{
return (Radial)((uint32_t)c + b);
}
inline Radial operator-(Radial &c, int b)
{
return (Radial)((uint32_t)c - b);
}

#endif
13 changes: 13 additions & 0 deletions VortexEngine/src/Leds/Leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ void Leds::setPairs(Pair first, Pair last, RGBColor col)
setRange(pairEven(first), pairOdd(last), col);
}

void Leds::setRadial(Radial radial, RGBColor col)
{
setIndex(radialInner(radial), col);
setIndex(radialOuter(radial), col);
}

void Leds::setRadials(Radial first, Radial last, RGBColor col)
{
for (Radial rad = first; rad < last; rad++) {
setRadial(rad, col);
}
}

void Leds::setRangeEvens(Pair first, Pair last, RGBColor col)
{
for (Pair pos = first; pos <= last; pos++) {
Expand Down
8 changes: 8 additions & 0 deletions VortexEngine/src/Leds/Leds.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ class Leds
static void clearPair(Pair pair) { setPair(pair, RGB_OFF); }
static void clearPairs(Pair first, Pair last) { setPairs(first, last, RGB_OFF); }

// control two LEDs on a pair, these are appropriate for use in internal pattern logic
static void setRadial(Radial radial, RGBColor col);
static void setRadials(Radial first, Radial last, RGBColor col);

// Turn off both LEDs on a pair, these are appropriate for use in internal pattern logic
static void clearRadial(Radial radial) { setRadial(radial, RGB_OFF); }
static void clearRadials(Radial first, Radial last) { setRadials(first, last, RGB_OFF); }

// Controll pair evens
static void setRangeEvens(Pair first, Pair last, RGBColor);
static void setAllEvens(RGBColor col);
Expand Down
Loading
Loading