Skip to content

Commit 94c2759

Browse files
Daniel/spark/wireless port from chromadeck (#267)
* New LED pin config, breaks older prototypes * Latest Pin and Button assignment * LED select for spark, Pattern select for core * Pattern Fixes for spark, some are core * restore this file * some fixes * all the chromadeck files ported over * fixes for spark * recorded tests * added serial changes * fixes * Fixes for editor connection and serial * added serial check and fixed leds macro * fixed build for spark * Fixed serial com issue * recorded tests * fixed ino file --------- Co-authored-by: Shane Aronson <LivingSynthesis@gmail.com>
1 parent c6062f7 commit 94c2759

33 files changed

+751
-249
lines changed

.github/workflows/spark_build.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,18 @@ jobs:
8989
export VORTEX_BUILD_NUMBER=${{ needs.setup.outputs.vortex_build_number }}
9090
export VORTEX_VERSION_NUMBER=${{ needs.setup.outputs.vortex_version_number }}
9191
make build
92-
- name: Archive production artifacts
93-
uses: actions/upload-artifact@v4
94-
with:
95-
name: embedded firmware
96-
path: |
92+
- name: Zip firmware files
93+
run: |
94+
zip SparkFirmware.zip \
95+
build/VortexEngine.ino.bootloader.bin \
96+
build/VortexEngine.ino.partitions.bin \
97+
~/.arduino15/packages/esp32/hardware/esp32/3.0.4/tools/partitions/boot_app0.bin \
9798
build/VortexEngine.ino.bin
98-
build/VortexEngine.ino.elf
99-
build/VortexEngine.ino.map
100-
- name: Archive production artifacts for deployment
99+
- name: Archive firmware zip
101100
uses: actions/upload-artifact@v4
102101
with:
103-
name: firmware-artifact
104-
path: build/VortexEngine.ino.bin
102+
name: spark-firmware-zip
103+
path: SparkFirmware.zip
105104

106105
wasm:
107106
needs: [setup, test, embedded]
@@ -130,7 +129,8 @@ jobs:
130129
working-directory: VortexEngine/VortexLib
131130

132131
docs:
133-
needs: [setup, test, embedded, wasm]
132+
#todo: fix the depends to be setup, test, embedded, wasm
133+
needs: [setup, test]
134134
runs-on: ubuntu-latest
135135
if: github.ref == 'refs/heads/spark'
136136
steps:
@@ -162,15 +162,15 @@ jobs:
162162
- uses: actions/checkout@v4
163163
- uses: actions/download-artifact@v4
164164
with:
165-
name: firmware-artifact
165+
name: spark-firmware-zip
166166
path: build
167167
- name: Rename and Deploy Firmware
168168
run: |
169169
DEVICE_TYPE="spark"
170-
VERSIONED_FILENAME="VortexEngine-${DEVICE_TYPE}-${{ needs.setup.outputs.vortex_version_number }}.bin"
171-
mv build/VortexEngine.ino.bin build/$VERSIONED_FILENAME
170+
VERSIONED_FILENAME="VortexEngine-${DEVICE_TYPE}-${{ needs.setup.outputs.vortex_version_number }}.zip"
171+
mv build/SparkFirmware.zip build/$VERSIONED_FILENAME
172172
echo "Version is ${{ needs.setup.outputs.vortex_version_number }}"
173-
echo "Filename is is $VERSIONED_FILENAME"
173+
echo "Filename is $VERSIONED_FILENAME"
174174
curl -X POST \
175175
-F "file=@build/$VERSIONED_FILENAME" \
176176
-F "device=$DEVICE_TYPE" \

VortexEngine/VortexEngine.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <Arduino.h>
2-
32
#include "src/VortexEngine.h"
43

54
void setup()

VortexEngine/src/Buttons/Buttons.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define BUTTON_PIN 47
1313
#else
1414
// orbit is on 7
15-
#define BUTTON_PIN 7
15+
#define BUTTON_PIN 5
1616
#endif
1717

1818
// Since there is only one button I am just going to expose a global pointer to

VortexEngine/src/Leds/LedTypes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ inline LedPos ledmapGetNextLed(LedMap map, LedPos pos)
164164
#define MAP_PAIR_EVEN_EVENS (MAP_PAIR_EVEN(PAIR_3) | MAP_PAIR_EVEN(PAIR_1))
165165
#define MAP_PAIR_EVEN_ODDS (MAP_PAIR_ODD(PAIR_3) | MAP_PAIR_ODD(PAIR_1))
166166

167+
// bitmaps specific to Sparks
168+
#define MAP_OPPOSITES_1 (MAP_LED(LED_0) | MAP_LED(LED_3))
169+
#define MAP_OPPOSITES_2 (MAP_LED(LED_1) | MAP_LED(LED_4))
170+
#define MAP_OPPOSITES_3 (MAP_LED(LED_2) | MAP_LED(LED_5))
171+
167172
// set a single led
168173
inline void ledmapSetLed(LedMap &map, LedPos pos)
169174
{

VortexEngine/src/Leds/Leds.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
#ifdef VORTEX_EMBEDDED
1616
#pragma GCC diagnostic ignored "-Wclass-memaccess"
1717
#include <FastLED.h>
18-
#define LED_PIN 0
19-
#if SPARK_HANDLE == 1
20-
#define MOSFET_PIN 48
21-
#else
22-
#define MOSFET_PIN 18
23-
#endif
18+
#define LED_PIN 0
2419
#endif
2520

2621
// global brightness
@@ -31,10 +26,8 @@ RGBColor Leds::m_ledColors[LED_COUNT] = { RGB_OFF };
3126
bool Leds::init()
3227
{
3328
#ifdef VORTEX_EMBEDDED
34-
FastLED.addLeds<WS2812B, LED_PIN, GRB>((CRGB *)m_ledColors, LED_COUNT);
29+
FastLED.addLeds<WS2812B, LED_PIN, RGB>((CRGB *)m_ledColors, LED_COUNT);
3530
FastLED.setMaxRefreshRate(0);
36-
pinMode(MOSFET_PIN, OUTPUT);
37-
digitalWrite(MOSFET_PIN, HIGH);
3831
#endif
3932
#ifdef VORTEX_LIB
4033
Vortex::vcallbacks()->ledsInit(m_ledColors, LED_COUNT);
@@ -91,8 +84,10 @@ void Leds::setRangeEvens(Pair first, Pair last, RGBColor col)
9184

9285
void Leds::setAllEvens(RGBColor col)
9386
{
94-
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
95-
setIndex(pairEven(pos), col);
87+
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
88+
if (isEven(pos)) {
89+
setIndex(pos, col);
90+
}
9691
}
9792
}
9893

@@ -105,8 +100,10 @@ void Leds::setRangeOdds(Pair first, Pair last, RGBColor col)
105100

106101
void Leds::setAllOdds(RGBColor col)
107102
{
108-
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
109-
setIndex(pairOdd(pos), col);
103+
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
104+
if (isOdd(pos)) {
105+
setIndex(pos, col);
106+
}
110107
}
111108
}
112109

@@ -119,8 +116,10 @@ void Leds::clearRangeEvens(Pair first, Pair last)
119116

120117
void Leds::clearAllEvens()
121118
{
122-
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
123-
clearIndex(pairEven(pos));
119+
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
120+
if (isEven(pos)) {
121+
clearIndex(pos);
122+
}
124123
}
125124
}
126125

@@ -133,8 +132,10 @@ void Leds::clearRangeOdds(Pair first, Pair last)
133132

134133
void Leds::clearAllOdds()
135134
{
136-
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
137-
clearIndex(pairOdd(pos));
135+
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
136+
if (isOdd(pos)) {
137+
clearIndex(pos);
138+
}
138139
}
139140
}
140141

VortexEngine/src/Menus/Menu.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,27 @@ void Menu::nextBulbSelection()
131131
// do not allow multi led to select anything else
132132
//break;
133133
}
134-
m_targetLeds = MAP_LED(LED_FIRST);
134+
m_targetLeds = MAP_LED(LED_MULTI);
135135
break;
136-
case MAP_LED(LED_LAST):
136+
case MAP_LED(LED_MULTI):
137137
m_targetLeds = MAP_PAIR_EVENS;
138138
break;
139139
case MAP_PAIR_EVENS:
140140
m_targetLeds = MAP_PAIR_ODDS;
141141
break;
142142
case MAP_PAIR_ODDS:
143-
m_targetLeds = MAP_LED(LED_MULTI);
143+
m_targetLeds = MAP_OPPOSITES_1;
144144
break;
145-
case MAP_LED(LED_MULTI):
145+
case MAP_OPPOSITES_1:
146+
m_targetLeds = MAP_OPPOSITES_2;
147+
break;
148+
case MAP_OPPOSITES_2:
149+
m_targetLeds = MAP_OPPOSITES_3;
150+
break;
151+
case MAP_OPPOSITES_3:
152+
m_targetLeds = MAP_LED(LED_FIRST);
153+
break;
154+
case MAP_LED(LED_LAST):
146155
m_targetLeds = MAP_LED_ALL;
147156
break;
148157
default: // LED_FIRST through LED_LAST

0 commit comments

Comments
 (0)