Skip to content

Commit

Permalink
Merge branch 'master' into orbit
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed May 3, 2024
2 parents 45e97ed + 2965086 commit 9f75632
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 174 deletions.
50 changes: 37 additions & 13 deletions .github/workflows/orbit_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.version }}
vortex_version_major: ${{ steps.set_version.outputs.vortex_version_major }}
vortex_version_minor: ${{ steps.set_version.outputs.vortex_version_minor }}
vortex_build_number: ${{ steps.set_version.outputs.vortex_build_number }}
vortex_version_number: ${{ steps.set_version.outputs.vortex_version_number }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -26,18 +29,25 @@ jobs:
LATEST_TAG=$(git tag --list "*${BRANCH_SUFFIX}" | sort -V | tail -n1)
if [ -z "$LATEST_TAG" ]; then
echo "No matching tags found. Setting default version."
VERSION_NUMBER="0.1"
VERSION_MAJOR="0"
VERSION_MINOR="1"
BUILD_NUMBER="0"
else
echo "Found latest tag: $LATEST_TAG"
VERSION_NUMBER=$(echo $LATEST_TAG | sed "s/${BRANCH_SUFFIX}//g")
VERSION_MAJOR=$(echo $VERSION_NUMBER | cut -d. -f1)
VERSION_MINOR=$(echo $VERSION_NUMBER | cut -d. -f2)
BUILD_NUMBER=$(git rev-list --count $LATEST_TAG..HEAD)
fi
FULL_VERSION="$VERSION_NUMBER.$BUILD_NUMBER"
echo "version=$FULL_VERSION" >> $GITHUB_OUTPUT
FULL_VERSION="$VERSION_MAJOR.$VERSION_MINOR.$BUILD_NUMBER"
echo "vortex_version_major=$VERSION_MAJOR" >> $GITHUB_OUTPUT
echo "vortex_version_minor=$VERSION_MINOR" >> $GITHUB_OUTPUT
echo "vortex_build_number=$BUILD_NUMBER" >> $GITHUB_OUTPUT
echo "vortex_version_number=$FULL_VERSION" >> $GITHUB_OUTPUT
echo "Version Number: $FULL_VERSION"
test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
Expand All @@ -47,7 +57,12 @@ jobs:
- name: Install Dependencies
run: sudo apt-get install valgrind g++ make --fix-missing
- name: Build
run: make -j
run: |
export VORTEX_VERSION_MAJOR=${{ needs.setup.outputs.vortex_version_major }}
export VORTEX_VERSION_MINOR=${{ needs.setup.outputs.vortex_version_minor }}
export VORTEX_BUILD_NUMBER=${{ needs.setup.outputs.vortex_build_number }}
export VORTEX_VERSION_NUMBER=${{ needs.setup.outputs.vortex_version_number }}
make -j
working-directory: VortexEngine
- name: Set execute permissions for test script
run: chmod +x ./runtests.sh
Expand All @@ -57,7 +72,7 @@ jobs:
working-directory: VortexEngine/tests

embedded:
needs: test
needs: [setup, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -68,7 +83,12 @@ jobs:
- name: Install Dependencies
run: make install
- name: Build Binary
run: make build
run: |
export VORTEX_VERSION_MAJOR=${{ needs.setup.outputs.vortex_version_major }}
export VORTEX_VERSION_MINOR=${{ needs.setup.outputs.vortex_version_minor }}
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:
Expand All @@ -86,7 +106,7 @@ jobs:
path: build/VortexEngine.ino.uf2

wasm:
needs: embedded
needs: [setup, test, embedded]
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
Expand All @@ -104,11 +124,15 @@ jobs:
- name: Build Webassembly
run: |
source ./emsdk/emsdk_env.sh
export VORTEX_VERSION_MAJOR=${{ needs.setup.outputs.vortex_version_major }}
export VORTEX_VERSION_MINOR=${{ needs.setup.outputs.vortex_version_minor }}
export VORTEX_BUILD_NUMBER=${{ needs.setup.outputs.vortex_build_number }}
export VORTEX_VERSION_NUMBER=${{ needs.setup.outputs.vortex_version_number }}
make -j wasm
working-directory: VortexEngine/VortexLib

docs:
needs: wasm
needs: [setup, test, embedded, wasm]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/orbit'
steps:
Expand All @@ -131,7 +155,7 @@ jobs:
git push -f origin HEAD:orbit-docs
deploy:
needs: [embedded, setup]
needs: [setup, test, embedded, wasm, docs]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/orbit'
steps:
Expand All @@ -143,14 +167,14 @@ jobs:
- name: Rename and Deploy Firmware
run: |
DEVICE_TYPE="orbit"
VERSIONED_FILENAME="VortexEngine-${DEVICE_TYPE}-${{ needs.setup.outputs.version }}.uf2"
VERSIONED_FILENAME="VortexEngine-${DEVICE_TYPE}-${{ needs.setup.outputs.vortex_version_number }}.uf2"
mv build/VortexEngine.ino.uf2 build/$VERSIONED_FILENAME
echo "Version is ${{ needs.setup.outputs.version }}"
echo "Version is ${{ needs.setup.outputs.vortex_version_number }}"
echo "Filename is is $VERSIONED_FILENAME"
curl -X POST \
-F "file=@build/$VERSIONED_FILENAME" \
-F "device=$DEVICE_TYPE" \
-F "version=${{ needs.setup.outputs.version }}" \
-F "version=${{ needs.setup.outputs.vortex_version_number }}" \
-F "category=firmware" \
-F "clientApiKey=${{ secrets.VORTEX_COMMUNITY_API_KEY }}" \
https://vortex.community/firmware/upload
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ PROJECT_NAME = VortexEngine/VortexEngine.ino
BUILD_PATH = build
CONFIG_FILE = $(HOME)/.arduino15/arduino-cli.yaml

DEFINES=\
-D VORTEX_VERSION_MAJOR=$(VORTEX_VERSION_MAJOR) \
-D VORTEX_VERSION_MINOR=$(VORTEX_VERSION_MINOR) \
-D VORTEX_BUILD_NUMBER=$(VORTEX_BUILD_NUMBER) \
-D VORTEX_VERSION_NUMBER=$(VORTEX_VERSION_NUMBER)

# Default target
all: build

Expand All @@ -32,7 +38,11 @@ install:
./rewrite_trinket_source.sh

build:
$(ARDUINO_CLI) compile --fqbn $(BOARD) $(PROJECT_NAME) --config-file $(CONFIG_FILE) --build-path $(BUILD_PATH)
$(ARDUINO_CLI) compile --fqbn $(BOARD) $(PROJECT_NAME) \
--config-file $(CONFIG_FILE) \
--build-path $(BUILD_PATH) \
--build-property compiler.cpp.extra_flags="$(DEFINES)" \
--build-property compiler.c.extra_flags="$(DEFINES)"
python3 uf2conv.py -c -b 0x2000 build/VortexEngine.ino.bin -o build/VortexEngine.ino.uf2

upload:
Expand Down
6 changes: 5 additions & 1 deletion VortexEngine/VortexLib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ endif

# compiler defines
DEFINES=\
-D VORTEX_LIB
-D VORTEX_LIB \
-D VORTEX_VERSION_MAJOR=$(VORTEX_VERSION_MAJOR) \
-D VORTEX_VERSION_MINOR=$(VORTEX_VERSION_MINOR) \
-D VORTEX_BUILD_NUMBER=$(VORTEX_BUILD_NUMBER) \
-D VORTEX_VERSION_NUMBER=$(VORTEX_VERSION_NUMBER)

# compiler include paths
INCLUDES=\
Expand Down
52 changes: 0 additions & 52 deletions VortexEngine/src/Log/ErrorBlinker.cpp

This file was deleted.

36 changes: 0 additions & 36 deletions VortexEngine/src/Log/ErrorBlinker.h

This file was deleted.

4 changes: 0 additions & 4 deletions VortexEngine/src/Log/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

#include "../VortexConfig.h"

// just self-inclode the error blinker so that anybody who includes log has
// access to the error blinker since it's only enabled in debug builds
#include "../Log/ErrorBlinker.h"

#if LOGGING_LEVEL > 0
#define INFO_LOG(msg) InfoMsg(msg)
#define INFO_LOGF(msg, ...) InfoMsg(msg, __VA_ARGS__)
Expand Down
23 changes: 0 additions & 23 deletions VortexEngine/src/Modes/Modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,28 +391,6 @@ bool Modes::unserialize(ByteStream &modesBuffer)
bool Modes::setDefaults()
{
clearModes();
#if DEMO_ALL_PATTERNS == 1
// RGB_RED, RGB_YELLOW, RGB_GREEN, RGB_CYAN, RGB_BLUE, RGB_PURPLE
PatternID default_start = PATTERN_FIRST;
PatternID default_end = PATTERN_LAST;
// add 65 randomized modes
for (int i = 0; i < 65; ++i) {
Mode tmpMode;
for (LedPos led = LED_FIRST; led < LED_COUNT; ++led) {
// create a random pattern ID from all patterns
PatternID randomPattern = (PatternID)random(PATTERN_SINGLE_FIRST, PATTERN_SINGLE_LAST);
Colorset randSet;
randSet.randomize(8);
tmpMode.setPatternAt(led, randomPattern, nullptr, &randSet);
}
// add another mode with the given pattern and colorset
if (!addMode(&tmpMode)) {
ERROR_LOG("Failed to add mode");
// return false?
}
}
DEBUG_LOGF("Added default patterns %u through %u", default_start, default_end);
#else
// add each default mode with each of the given colors
for (uint8_t i = 0; i < num_default_modes; ++i) {
const default_mode_entry &def = default_modes[i];
Expand All @@ -427,7 +405,6 @@ bool Modes::setDefaults()
addMode(&tempMode);
}
}
#endif
return true;
}

Expand Down
Loading

0 comments on commit 9f75632

Please sign in to comment.