diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index bccee4bbf7..1cd656403c 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -8,6 +8,34 @@ on: workflow_dispatch: # manual trigger jobs: + setup: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.set_version.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetches all history for all branches and tags + - name: Determine Version and Build Number + id: set_version + run: | + # Fetch all tags + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + # Get the latest tag that matches the branch suffix + LATEST_TAG=$(git tag --list | grep -E "^[[:digit:]]+\.[[:digit:]]+\$" | sort -V | tail -n1) + if [ -z "$LATEST_TAG" ]; then + echo "No matching tags found. Setting default version." + VERSION_NUMBER="0.1" + BUILD_NUMBER="0" + else + echo "Found latest tag: $LATEST_TAG" + VERSION_NUMBER=$LATEST_TAG + BUILD_NUMBER=$(git rev-list --count $LATEST_TAG..HEAD) + fi + FULL_VERSION="$VERSION_NUMBER.$BUILD_NUMBER" + echo "version=$FULL_VERSION" >> $GITHUB_OUTPUT + echo "Version Number: $FULL_VERSION" + test: runs-on: ubuntu-latest steps: @@ -18,7 +46,9 @@ jobs: - name: Install Dependencies run: sudo apt-get install valgrind g++ make --fix-missing - name: Build - run: make -j + run: | + VORTEX_BUILD_NUMBER=${{ needs.setup.outputs.version }} + make -j working-directory: VortexEngine - name: Set execute permissions for test script run: chmod +x ./runtests.sh @@ -46,6 +76,7 @@ jobs: - name: Build Webassembly run: | source ./emsdk/emsdk_env.sh + VORTEX_BUILD_NUMBER=${{ needs.setup.outputs.version }} make -j wasm working-directory: VortexEngine/VortexLib diff --git a/VortexEngine/src/Log/ErrorBlinker.cpp b/VortexEngine/src/Log/ErrorBlinker.cpp deleted file mode 100644 index bf6ea1f3f5..0000000000 --- a/VortexEngine/src/Log/ErrorBlinker.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "ErrorBlinker.h" - -#if VORTEX_ERROR_BLINK == 1 - -#include "../Leds/Leds.h" - -#include - -static uint16_t g_error = ERROR_NONE; - -void setError(uint16_t err) -{ - if (g_error != ERROR_NONE) { - // do not overwrite errors, the first error gets precedent - return; - } - g_error = err; -} - -uint16_t getError() -{ - return g_error; -} - -void blinkError() -{ - // this is so bad ugh it blinks r -> g -> b for the error code like - // error 231 is 2 reds, 3 greens, 1 blue - if (g_error == ERROR_NONE) { - return; - } - uint8_t errOnes = (g_error % 10); - uint8_t errTens = ((g_error - errOnes) % 100) / 10; - uint8_t errHunds = (g_error - (errTens + errOnes)) / 100; - Leds::setIndex(LED_1, RGBColor(40, 40, 40)); - const uint8_t msWait = 500; - for (uint8_t i = 0; i < errHunds; ++i) { - Leds::setIndex(LED_0, RGBColor(255, 0, 0)); Leds::update(); delay(msWait); - Leds::clearIndex(LED_0); Leds::update(); delay(msWait); - } - for (uint8_t i = 0; i < errTens; ++i) { - Leds::setIndex(LED_0, RGBColor(0, 255, 0)); Leds::update(); delay(msWait); - Leds::clearIndex(LED_0); Leds::update(); delay(msWait); - } - for (uint8_t i = 0; i < errOnes; ++i) { - Leds::setIndex(LED_0, RGBColor(0, 0, 255)); Leds::update(); delay(msWait); - Leds::clearIndex(LED_0); Leds::update(); delay(msWait); - } - delay(msWait); -} - -#endif diff --git a/VortexEngine/src/Log/ErrorBlinker.h b/VortexEngine/src/Log/ErrorBlinker.h deleted file mode 100644 index 164099c0e8..0000000000 --- a/VortexEngine/src/Log/ErrorBlinker.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include - -#include "../VortexConfig.h" - -// These error codes follow a pattern when blinked -// The hundreds column is the number of r blinks -// The tens column is the number of g blinks -// The ones column is the number of b blinks -// There is a gray space after each round of blinks -#define ERROR_NONE 0 - - // For example this would just be 'B' (1 blink) -#define ERROR_EXAMPLE1 1 - // this would be "R R G G G B" -#define ERROR_EXAMPLE2 231 - -#if VORTEX_ERROR_BLINK == 0 - -// normal builds don't do anything -#define FATAL_ERROR(err) - -#else - -// set an error code and blink it -#define FATAL_ERROR(err) setError(err); - -// set an error code -void setError(uint16_t err); -// fetch the current error code -uint16_t getError(); -// blink the current error -void blinkError(); - -#endif diff --git a/VortexEngine/src/Log/Log.h b/VortexEngine/src/Log/Log.h index 5977ec8442..52bb5f7786 100644 --- a/VortexEngine/src/Log/Log.h +++ b/VortexEngine/src/Log/Log.h @@ -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__) diff --git a/VortexEngine/src/Modes/Modes.cpp b/VortexEngine/src/Modes/Modes.cpp index 7d6b41f1ae..35ccea1751 100644 --- a/VortexEngine/src/Modes/Modes.cpp +++ b/VortexEngine/src/Modes/Modes.cpp @@ -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; } diff --git a/VortexEngine/src/VortexConfig.h b/VortexEngine/src/VortexConfig.h index 643ba26fae..8237bb5391 100644 --- a/VortexEngine/src/VortexConfig.h +++ b/VortexEngine/src/VortexConfig.h @@ -16,10 +16,16 @@ // either of the engines on version 1.1 or 1.2 #define VORTEX_VERSION_MINOR 1 +// 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 +#define VORTEX_VERSION_NUMBER VORTEX_VERSION_MAJOR.VORTEX_VERSION_MINOR.VORTEX_BUILD_NUMBER -// 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) @@ -30,7 +36,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 // @@ -307,23 +313,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 @@ -349,25 +338,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 @@ -592,11 +562,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