Skip to content

Commit

Permalink
Merge branch 'master' into handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed May 3, 2024
2 parents 55caa9d + 2965086 commit e6ccddc
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 173 deletions.
51 changes: 38 additions & 13 deletions .github/workflows/handle_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/handle'
steps:
Expand All @@ -131,7 +155,7 @@ jobs:
git push -f origin HEAD:handle-docs
deploy:
needs: [embedded, setup]
needs: [setup, test, embedded, wasm, docs]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/handle'
steps:
Expand All @@ -143,14 +167,15 @@ jobs:
- name: Rename and Deploy Firmware
run: |
DEVICE_TYPE="handle"
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
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 @@ -387,35 +387,12 @@ 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];
Colorset set(def.numColors, def.cols);
addMode(def.patternID, nullptr, &set);
}
#endif
return true;
}

Expand Down
61 changes: 17 additions & 44 deletions VortexEngine/src/VortexConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,31 @@
// The engine major version indicates the state of the save file,
// if any changes to the save format occur then the major version
// must increment so that the savefiles will not be loaded
#ifndef VORTEX_VERSION_MAJOR
#define VORTEX_VERSION_MAJOR 1
#endif

// A minor version simply indicates a bugfix or minor change that
// will not effect the save files produces by the engine. This means
// a savefile produced by 1.1 should be loadable by an engine on 1.2
// and vice versa. But an engine on 2.0 cannot share savefiles with
// either of the engines on version 1.1 or 1.2
#ifndef VORTEX_VERSION_MINOR
#define VORTEX_VERSION_MINOR 1
#endif

// The build or patch number based on the major.minor version, this is
// set by the build system using the number of commits since last version
#ifndef VORTEX_BUILD_NUMBER
#define VORTEX_BUILD_NUMBER 0
#endif

// produces a number like 1.0
#define VORTEX_VERSION_NUMBER VORTEX_VERSION_MAJOR.VORTEX_VERSION_MINOR
#ifndef VORTEX_VERSION_NUMBER
#define VORTEX_VERSION_NUMBER VORTEX_VERSION_MAJOR.VORTEX_VERSION_MINOR.VORTEX_BUILD_NUMBER
#endif

// produces a string like "1.0"
// produces a string like "1.1.0"
#define ADD_QUOTES(str) #str
#define EXPAND_AND_QUOTE(str) ADD_QUOTES(str)
#define VORTEX_VERSION EXPAND_AND_QUOTE(VORTEX_VERSION_NUMBER)
Expand All @@ -30,7 +42,7 @@

// the full name of this build for ex:
// Vortex Engine v1.0 'Igneous' (built Tue Jan 31 19:03:55 2023)
#define VORTEX_FULL_NAME "Vortex Engine v" VORTEX_VERSION " '" VORTEX_NAME "' ( built " __TIMESTAMP__ ")"
#define VORTEX_FULL_NAME "Vortex Engine v" VORTEX_VERSION " '" VORTEX_NAME "' (built " __TIMESTAMP__ ")"

// Vortex Slim
//
Expand Down Expand Up @@ -307,23 +319,6 @@
// ===================================================================
// Boolean Configurations (0 or 1)

// Fill From Thumb
//
// The ring menu will fill from the thumb if this is present, otherwise
// it will fill from the pinkie.
//
// The logic is cleaner for fill from pinkie but fill from thumb is preferred
#define FILL_FROM_THUMB 1

// Demo All Patterns
//
// The default modes that are set on the gloveset will be dynamically
// generated with one mode per pattern in the patterns list
//
// This can be used to quickly demo all possible patterns, mostly useful
// for testing and development
#define DEMO_ALL_PATTERNS 0

// Debug Allocations
//
// Tracks all memory allocations and logs them, useful for finding leaks
Expand All @@ -349,25 +344,6 @@
// the final build? I'm not sure.
#define VARIABLE_TICKRATE 0

// Error Blinker System
//
// This toggles the vortex error blinker system, this system reports
// fatal errors as a series of blinks. If an error is encountered the
// chip will only blink out the error code from there forward.
//
// Note that enabling this system takes a non-negligible amount
// of space for all of the code, it really should only be used
// for debug settings or given tiers like logging level.
//
// This is mainly useful for tracking down issues on devices that don't
// have a serial connection like the attiny. Use FATAL_ERROR(code) to
// set the error code and then the device will blink out the error
//
// for ex: red red green blue blue blue is code 213
//
// See Log/ErrorBlinker.h for details on the error codes
#define VORTEX_ERROR_BLINK 0

// Fixed LED Count
//
// Do not allow the Mode loader to dynamically load however many modes
Expand Down Expand Up @@ -592,11 +568,8 @@

#endif // VortexEditor

// When running in the test framework with demo all patterns enabled
// we should change the max patterns to the total pattern count because
// the test framework can handle the memory usage and we can't demo
// all the patterns without the increased limit
#if DEMO_ALL_PATTERNS == 1 || SERIALIZATION_TEST == 1 || COMPRESSION_TEST == 1
// When running various tests lift the max mode limit and enable logging
#if SERIALIZATION_TEST == 1 || COMPRESSION_TEST == 1
#undef MAX_MODES
#include "Patterns/Patterns.h"
#define MAX_MODES 0
Expand Down

0 comments on commit e6ccddc

Please sign in to comment.