Skip to content

Commit

Permalink
Daniel/spark/wireless port from chromadeck (#267)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Unreal-Dan and LivingSynthesis authored Dec 10, 2024
1 parent c6062f7 commit 94c2759
Show file tree
Hide file tree
Showing 33 changed files with 751 additions and 249 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/spark_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,18 @@ jobs:
export VORTEX_BUILD_NUMBER=${{ needs.setup.outputs.vortex_build_number }}
export VORTEX_VERSION_NUMBER=${{ needs.setup.outputs.vortex_version_number }}
make build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: embedded firmware
path: |
- name: Zip firmware files
run: |
zip SparkFirmware.zip \
build/VortexEngine.ino.bootloader.bin \
build/VortexEngine.ino.partitions.bin \
~/.arduino15/packages/esp32/hardware/esp32/3.0.4/tools/partitions/boot_app0.bin \
build/VortexEngine.ino.bin
build/VortexEngine.ino.elf
build/VortexEngine.ino.map
- name: Archive production artifacts for deployment
- name: Archive firmware zip
uses: actions/upload-artifact@v4
with:
name: firmware-artifact
path: build/VortexEngine.ino.bin
name: spark-firmware-zip
path: SparkFirmware.zip

wasm:
needs: [setup, test, embedded]
Expand Down Expand Up @@ -130,7 +129,8 @@ jobs:
working-directory: VortexEngine/VortexLib

docs:
needs: [setup, test, embedded, wasm]
#todo: fix the depends to be setup, test, embedded, wasm
needs: [setup, test]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/spark'
steps:
Expand Down Expand Up @@ -162,15 +162,15 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: firmware-artifact
name: spark-firmware-zip
path: build
- name: Rename and Deploy Firmware
run: |
DEVICE_TYPE="spark"
VERSIONED_FILENAME="VortexEngine-${DEVICE_TYPE}-${{ needs.setup.outputs.vortex_version_number }}.bin"
mv build/VortexEngine.ino.bin build/$VERSIONED_FILENAME
VERSIONED_FILENAME="VortexEngine-${DEVICE_TYPE}-${{ needs.setup.outputs.vortex_version_number }}.zip"
mv build/SparkFirmware.zip build/$VERSIONED_FILENAME
echo "Version is ${{ needs.setup.outputs.vortex_version_number }}"
echo "Filename is is $VERSIONED_FILENAME"
echo "Filename is $VERSIONED_FILENAME"
curl -X POST \
-F "file=@build/$VERSIONED_FILENAME" \
-F "device=$DEVICE_TYPE" \
Expand Down
1 change: 0 additions & 1 deletion VortexEngine/VortexEngine.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <Arduino.h>

#include "src/VortexEngine.h"

void setup()
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/Buttons/Buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define BUTTON_PIN 47
#else
// orbit is on 7
#define BUTTON_PIN 7
#define BUTTON_PIN 5
#endif

// Since there is only one button I am just going to expose a global pointer to
Expand Down
5 changes: 5 additions & 0 deletions VortexEngine/src/Leds/LedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ inline LedPos ledmapGetNextLed(LedMap map, LedPos pos)
#define MAP_PAIR_EVEN_EVENS (MAP_PAIR_EVEN(PAIR_3) | MAP_PAIR_EVEN(PAIR_1))
#define MAP_PAIR_EVEN_ODDS (MAP_PAIR_ODD(PAIR_3) | MAP_PAIR_ODD(PAIR_1))

// bitmaps specific to Sparks
#define MAP_OPPOSITES_1 (MAP_LED(LED_0) | MAP_LED(LED_3))
#define MAP_OPPOSITES_2 (MAP_LED(LED_1) | MAP_LED(LED_4))
#define MAP_OPPOSITES_3 (MAP_LED(LED_2) | MAP_LED(LED_5))

// set a single led
inline void ledmapSetLed(LedMap &map, LedPos pos)
{
Expand Down
35 changes: 18 additions & 17 deletions VortexEngine/src/Leds/Leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
#ifdef VORTEX_EMBEDDED
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#include <FastLED.h>
#define LED_PIN 0
#if SPARK_HANDLE == 1
#define MOSFET_PIN 48
#else
#define MOSFET_PIN 18
#endif
#define LED_PIN 0
#endif

// global brightness
Expand All @@ -31,10 +26,8 @@ RGBColor Leds::m_ledColors[LED_COUNT] = { RGB_OFF };
bool Leds::init()
{
#ifdef VORTEX_EMBEDDED
FastLED.addLeds<WS2812B, LED_PIN, GRB>((CRGB *)m_ledColors, LED_COUNT);
FastLED.addLeds<WS2812B, LED_PIN, RGB>((CRGB *)m_ledColors, LED_COUNT);
FastLED.setMaxRefreshRate(0);
pinMode(MOSFET_PIN, OUTPUT);
digitalWrite(MOSFET_PIN, HIGH);
#endif
#ifdef VORTEX_LIB
Vortex::vcallbacks()->ledsInit(m_ledColors, LED_COUNT);
Expand Down Expand Up @@ -91,8 +84,10 @@ void Leds::setRangeEvens(Pair first, Pair last, RGBColor col)

void Leds::setAllEvens(RGBColor col)
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
setIndex(pairEven(pos), col);
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isEven(pos)) {
setIndex(pos, col);
}
}
}

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

void Leds::setAllOdds(RGBColor col)
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
setIndex(pairOdd(pos), col);
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isOdd(pos)) {
setIndex(pos, col);
}
}
}

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

void Leds::clearAllEvens()
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
clearIndex(pairEven(pos));
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isEven(pos)) {
clearIndex(pos);
}
}
}

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

void Leds::clearAllOdds()
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
clearIndex(pairOdd(pos));
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isOdd(pos)) {
clearIndex(pos);
}
}
}

Expand Down
17 changes: 13 additions & 4 deletions VortexEngine/src/Menus/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,27 @@ void Menu::nextBulbSelection()
// do not allow multi led to select anything else
//break;
}
m_targetLeds = MAP_LED(LED_FIRST);
m_targetLeds = MAP_LED(LED_MULTI);
break;
case MAP_LED(LED_LAST):
case MAP_LED(LED_MULTI):
m_targetLeds = MAP_PAIR_EVENS;
break;
case MAP_PAIR_EVENS:
m_targetLeds = MAP_PAIR_ODDS;
break;
case MAP_PAIR_ODDS:
m_targetLeds = MAP_LED(LED_MULTI);
m_targetLeds = MAP_OPPOSITES_1;
break;
case MAP_LED(LED_MULTI):
case MAP_OPPOSITES_1:
m_targetLeds = MAP_OPPOSITES_2;
break;
case MAP_OPPOSITES_2:
m_targetLeds = MAP_OPPOSITES_3;
break;
case MAP_OPPOSITES_3:
m_targetLeds = MAP_LED(LED_FIRST);
break;
case MAP_LED(LED_LAST):
m_targetLeds = MAP_LED_ALL;
break;
default: // LED_FIRST through LED_LAST
Expand Down
Loading

0 comments on commit 94c2759

Please sign in to comment.