From 5530e84dbb9bcbffe1d391bff78158b496ba2b1d Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 20:31:18 -0800 Subject: [PATCH 01/11] cleaned up some space and refined some things --- ColorConstants.h | 57 +++++++------------- Colorset.cpp | 9 +++- Colortypes.cpp | 47 ----------------- Colortypes.h | 13 +---- Helios.cpp | 132 +++++++++++++++++------------------------------ HeliosConfig.h | 24 ++++----- 6 files changed, 86 insertions(+), 196 deletions(-) diff --git a/ColorConstants.h b/ColorConstants.h index 10a0c459..1ce7335e 100644 --- a/ColorConstants.h +++ b/ColorConstants.h @@ -9,42 +9,25 @@ // Engine // Pre-defined hue values -#define HSV_HUE_RED 0 -#define HSV_HUE_CORAL_ORANGE 5 -#define HSV_HUE_ORANGE 10 -#define HSV_HUE_YELLOW 20 - -#define HSV_HUE_LIME_GREEN 70 -#define HSV_HUE_GREEN 85 -#define HSV_HUE_SEAFOAM 95 -#define HSV_HUE_TURQUOISE 120 - -#define HSV_HUE_ICE_BLUE 142 -#define HSV_HUE_LIGHT_BLUE 158 -#define HSV_HUE_BLUE 170 -#define HSV_HUE_ROYAL_BLUE 175 - -#define HSV_HUE_PURPLE 192 -#define HSV_HUE_PINK 205 -#define HSV_HUE_HOT_PINK 225 -#define HSV_HUE_MAGENTA 245 - -// if this bit is present it's an HSV constant -#define HSV_BIT ((uint32_t)1 << 31) - -// produce a DWORD HSV constant -#define HSV(h, s, v) (HSV_BIT | ((uint32_t)h << 16) | ((uint32_t)s << 8) | (uint32_t)v) - -// Pre defined hex HSV values -#define HSV_WHITE HSV_BIT | (uint32_t)0x00006E // 0 0 110 -#define HSV_BLUE HSV_BIT | (uint32_t)0xA0FF6E // 160 255 110 -#define HSV_YELLOW HSV_BIT | (uint32_t)0x3CFF6E // 60 255 110 -#define HSV_RED HSV_BIT | (uint32_t)0x00FF6E // 0 255 110 -#define HSV_GREEN HSV_BIT | (uint32_t)0x55FF6E // 85 255 110 -#define HSV_CYAN HSV_BIT | (uint32_t)0x78FF6E // 120 255 110 -#define HSV_PURPLE HSV_BIT | (uint32_t)0xD4FF6E // 212 255 110 -#define HSV_ORANGE HSV_BIT | (uint32_t)0x14FF6E // 20 255 110 -#define HSV_OFF HSV_BIT | (uint32_t)0x000000 // 0 0 0 +#define HUE_RED 0 +#define HUE_CORAL_ORANGE 5 +#define HUE_ORANGE 10 +#define HUE_YELLOW 20 + +#define HUE_LIME_GREEN 70 +#define HUE_GREEN 85 +#define HUE_SEAFOAM 95 +#define HUE_TURQUOISE 120 + +#define HUE_ICE_BLUE 142 +#define HUE_LIGHT_BLUE 158 +#define HUE_BLUE 170 +#define HUE_ROYAL_BLUE 175 + +#define HUE_PURPLE 192 +#define HUE_PINK 205 +#define HUE_HOT_PINK 225 +#define HUE_MAGENTA 245 // Helios Colors #define RGB_OFF (uint32_t)0x000000 // 0 0 0 @@ -175,4 +158,4 @@ #define RGB_PURPLE_SAT_LOWEST (uint32_t)0xBF7DFF // 191, 125, 255 #define RGB_PINK_SAT_LOWEST (uint32_t)0xE87DFF // 232, 125, 255 #define RGB_HOT_PINK_SAT_LOWEST (uint32_t)0xFF7DD8 // 255, 125, 216 -#define RGB_MAGENTA_SAT_LOWEST (uint32_t)0xFF7D9B // 255, 125, 155 \ No newline at end of file +#define RGB_MAGENTA_SAT_LOWEST (uint32_t)0xFF7D9B // 255, 125, 155 diff --git a/Colorset.cpp b/Colorset.cpp index bc5387fc..ec9c35c3 100644 --- a/Colorset.cpp +++ b/Colorset.cpp @@ -179,9 +179,14 @@ void Colorset::randomize(Random &ctx, uint8_t numColors) numColors = ctx.next8(2, NUM_COLOR_SLOTS); } ValueStyle valStyle = (ValueStyle)ctx.next8(0, VAL_STYLE_COUNT); - for (uint8_t i = 0; i < numColors; ++i) { - addColorWithValueStyle(ctx, ctx.next8(), ctx.next8(), valStyle, numColors, i); + // do not put the next8() calls inside arguments, the order functions in + // arguments are called is undefined behaviour and it's important that + // these are called in the right order otherwise different platforms will + // behave differently when performing this randomization + uint8_t sat = ctx.next8(); + uint8_t hue = ctx.next8(); + addColorWithValueStyle(ctx, hue, sat, valStyle, numColors, i); } } diff --git a/Colortypes.cpp b/Colortypes.cpp index 576fd190..b800ed63 100644 --- a/Colortypes.cpp +++ b/Colortypes.cpp @@ -26,35 +26,12 @@ HSVColor::HSVColor(uint32_t dwVal) : // assignment from uint32_t HSVColor &HSVColor::operator=(const uint32_t &rhs) { - // check for the HSV bit! - if (!(rhs & HSV_BIT)) { - // IT'S NOT AN HSV DWORD!! - *this = RGBColor(rhs); - return *this; - } hue = ((rhs >> 16) & 0xFF); sat = ((rhs >> 8) & 0xFF); val = (rhs & 0xFF); return *this; } -// copy construction -HSVColor::HSVColor(const HSVColor &rhs) -{ - hue = rhs.hue; - sat = rhs.sat; - val = rhs.val; -} - -// assignment operator -HSVColor &HSVColor::operator=(const HSVColor &rhs) -{ - hue = rhs.hue; - sat = rhs.sat; - val = rhs.val; - return *this; -} - // construction/assignment from RGB HSVColor::HSVColor(const RGBColor &rhs) { @@ -114,36 +91,12 @@ RGBColor::RGBColor(uint32_t dwVal) : // assignment from uint32_t RGBColor &RGBColor::operator=(const uint32_t &rhs) { - // check for the HSV bit! - if ((rhs & HSV_BIT) != 0) { - // IT'S NOT AN RGB DWORD!! - *this = HSVColor(rhs); - return *this; - } - red = ((rhs >> 16) & 0xFF); green = ((rhs >> 8) & 0xFF); blue = (rhs & 0xFF); return *this; } -// copy construction -RGBColor::RGBColor(const RGBColor &rhs) -{ - red = rhs.red; - green = rhs.green; - blue = rhs.blue; -} - -// assignment operator -RGBColor &RGBColor::operator=(const RGBColor &rhs) -{ - red = rhs.red; - green = rhs.green; - blue = rhs.blue; - return *this; -} - RGBColor::RGBColor(const HSVColor &rhs) { *this = rhs; diff --git a/Colortypes.h b/Colortypes.h index 9cf2605e..bd088cc6 100644 --- a/Colortypes.h +++ b/Colortypes.h @@ -31,10 +31,6 @@ class HSVColor HSVColor(uint32_t dwVal); HSVColor &operator=(const uint32_t &rhs); - // copy/assignment construction - HSVColor(const HSVColor &rhs); - HSVColor &operator=(const HSVColor &rhs); - // construction/assignment from RGB HSVColor(const RGBColor &rhs); HSVColor &operator=(const RGBColor &rhs); @@ -46,7 +42,7 @@ class HSVColor bool empty() const; void clear(); - uint32_t raw() const { return HSV_BIT | ((uint32_t)hue << 16) | ((uint32_t)sat << 8) | (uint32_t)val; } + uint32_t raw() const { return ((uint32_t)hue << 16) | ((uint32_t)sat << 8) | (uint32_t)val; } // public members uint8_t hue; @@ -64,11 +60,6 @@ class RGBColor RGBColor(uint32_t dwVal); RGBColor &operator=(const uint32_t &rhs); - // copy/assignment construction - RGBColor(const RGBColor &rhs); - RGBColor &operator=(const RGBColor &rhs); - - // construction/assignment from HSV RGBColor(const HSVColor &rhs); RGBColor &operator=(const HSVColor &rhs); @@ -80,8 +71,6 @@ class RGBColor void clear(); RGBColor adjustBrightness(uint8_t fadeBy); - void serialize(ByteStream &buffer) const; - void unserialize(ByteStream &buffer); uint32_t raw() const { return ((uint32_t)red << 16) | ((uint32_t)green << 8) | (uint32_t)blue; } diff --git a/Helios.cpp b/Helios.cpp index 172c4a28..81129b11 100644 --- a/Helios.cpp +++ b/Helios.cpp @@ -204,8 +204,7 @@ void Helios::handle_state() handle_state_shift_mode(); break; case STATE_RANDOMIZE: - // TODO: Commented out because for space - // handle_state_randomize(); + handle_state_randomize(); break; #ifdef HELIOS_CLI case STATE_SLEEP: @@ -258,22 +257,34 @@ void Helios::handle_state_modes() return; } - // check for lock and go back to sleep - if (has_flag(FLAG_LOCKED) && hasReleased && !Button::onRelease()) { - enter_sleep(); - return; - } - - if (!has_flag(FLAG_LOCKED) && hasReleased) { - // just play the current mode - pat.play(); - } - // check how long the button is held uint16_t holdDur = (uint16_t)Button::holdDuration(); // calculate a magnitude which corresponds to how many times past the MENU_HOLD_TIME // the user has held the button, so 0 means haven't held fully past one yet, etc uint8_t magnitude = (uint8_t)(holdDur / MENU_HOLD_TIME); + + // check for lock and go back to sleep + if (has_flag(FLAG_LOCKED)) { + // if the button is released and it wasn't released this tick then go to sleep + // Wait for the button to not be released this tick because it's possible to + // pick up the button releasing and wakeup the device again instantly + if (hasReleased && !Button::onRelease()) { + enter_sleep(); + } else if (magnitude == 5) { + // otherwise if they have held for 5 Seconds to Exit Lock + // then show a low red flash to show they have hit the threshold + Led::set(RGB_RED_BRI_LOW); + } else { + // otherwise the rest of the time just turn off the led + Led::clear(); + } + return; + } else if (hasReleased) { + // otherwise if we're not locked, and we have released the led + // then just play the current mode + pat.play(); + } + // whether the user has held the button longer than a short click bool heldPast = (holdDur > SHORT_CLICK_THRESHOLD); // if the button is held for at least 1 second @@ -281,60 +292,21 @@ void Helios::handle_state_modes() // if the button has been released before then show the on menu if (hasReleased) { switch (magnitude) { - case 0: - Led::clear(); - break; - case 1: // Color Selection - Led::set(RGB_TURQUOISE_BRI_LOW); - break; - case 2: // Pattern Selection - Led::set(RGB_MAGENTA_BRI_LOW); - break; - case 3: // Conjure Mode - Led::set(RGB_YELLOW_BRI_LOW); - break; - case 4: // Shift Mode - Led::set(RGB_WHITE_BRI_LOW); - break; - case 5: // Randomizer - Led::set(HSVColor(Time::getCurtime(), 255, 180)); - break; - default: - Led::clear(); - break; + case 0: Led::clear(); break; // Turn off + case 1: Led::set(RGB_TURQUOISE_BRI_LOW); break; // Color Selection + case 2: Led::set(RGB_MAGENTA_BRI_LOW); break; // Pattern Selection + case 3: Led::set(RGB_YELLOW_BRI_LOW); break; // Conjure Mode + case 4: Led::set(RGB_WHITE_BRI_LOW); break; // Shift Mode + case 5: Led::set(HSVColor(Time::getCurtime(), 255, 180)); break; // Randomizer + default: Led::clear(); break; // hold past } } else { - // Hold for 5 Seconds to Exit Lock - if (has_flag(FLAG_LOCKED)) { - switch (magnitude) { - case 0: - Led::clear(); - break; - case 5: // Exit Lock - Led::set(RGB_RED_BRI_LOW); - break; - default: - Led::clear(); - break; - } - } else { - switch (magnitude) { - case 0: - Led::clear(); - break; - case 1: // Enter Glow Lock - Led::set(RGB_RED_BRI_LOW); - break; - case 2: // Master Reset - Led::set(RGB_BLUE_BRI_LOW); - break; - case 3: // Global Brightness - Led::set(RGB_GREEN_BRI_LOW); - break; - default: - Led::clear(); - break; - } + switch (magnitude) { + case 0: Led::clear(); break; // nothing + case 1: Led::set(RGB_RED_BRI_LOW); break; // Enter Glow Lock + case 2: Led::set(RGB_BLUE_BRI_LOW); break; // Master Reset + case 3: Led::set(RGB_GREEN_BRI_LOW); break; // Global Brightness + default: Led::clear(); break; // hold past } } } @@ -535,12 +507,12 @@ struct ColorsMenuData { }; // array of hues for selection static const ColorsMenuData color_menu_data[4] = { - // hue0 hue1 hue2 hue3 + // hue0 hue1 hue2 hue3 // ================================================================================== - { HSV_HUE_RED, HSV_HUE_CORAL_ORANGE, HSV_HUE_ORANGE, HSV_HUE_YELLOW }, - { HSV_HUE_LIME_GREEN, HSV_HUE_GREEN, HSV_HUE_SEAFOAM, HSV_HUE_TURQUOISE }, - { HSV_HUE_ICE_BLUE, HSV_HUE_LIGHT_BLUE, HSV_HUE_BLUE, HSV_HUE_ROYAL_BLUE }, - { HSV_HUE_PURPLE, HSV_HUE_PINK, HSV_HUE_HOT_PINK, HSV_HUE_MAGENTA }, + { HUE_RED, HUE_CORAL_ORANGE, HUE_ORANGE, HUE_YELLOW }, + { HUE_LIME_GREEN, HUE_GREEN, HUE_SEAFOAM, HUE_TURQUOISE }, + { HUE_ICE_BLUE, HUE_LIGHT_BLUE, HUE_BLUE, HUE_ROYAL_BLUE }, + { HUE_PURPLE, HUE_PINK, HUE_HOT_PINK, HUE_MAGENTA }, }; bool Helios::handle_state_col_select_quadrant() @@ -618,7 +590,7 @@ bool Helios::handle_state_col_select_sat() if (menu_selection > 3) { menu_selection = 3; } - uint8_t saturation_values[4] = {HSV_SAT_HIGH, HSV_SAT_MEDIUM, HSV_SAT_LOW, HSV_SAT_LOWEST}; + static const uint8_t saturation_values[4] = {HSV_SAT_HIGH, HSV_SAT_MEDIUM, HSV_SAT_LOW, HSV_SAT_LOWEST}; uint8_t sat = saturation_values[menu_selection]; // use the nice hue to rgb rainbow @@ -636,8 +608,8 @@ bool Helios::handle_state_col_select_val() if (menu_selection > 3) { menu_selection = 3; } - uint8_t brightness_values[4] = {HSV_BRI_HIGH, HSV_BRI_MEDIUM, HSV_BRI_LOW, HSV_BRI_LOWEST}; - uint8_t val = brightness_values[menu_selection]; + static const uint8_t hsv_values[4] = {HSV_VAL_HIGH, HSV_VAL_MEDIUM, HSV_VAL_LOW, HSV_VAL_LOWEST}; + uint8_t val = hsv_values[menu_selection]; RGBColor targetCol = HSVColor(selected_hue, selected_sat, val); // use the nice hue to rgb rainbow @@ -728,18 +700,8 @@ void Helios::handle_state_set_global_brightness() } // when the user long clicks a selection if (Button::onLongClick()) { - // set the brightness based on the selection - switch (menu_selection) { - case 0: - Led::setBrightness(BRIGHTNESS_HIGH); - break; - case 1: - Led::setBrightness(BRIGHNESS_MEDIUM); - break; - case 2: - Led::setBrightness(BRIGHNESS_LOW); - break; - } + // set the brightness based on the selection * the brightness step amount + Led::setBrightness(menu_selection * BRIGHTNESS_STEP); cur_state = STATE_MODES; } show_selection(RGB_WHITE_BRI_LOW); diff --git a/HeliosConfig.h b/HeliosConfig.h index 31e75f66..b0ea6060 100644 --- a/HeliosConfig.h +++ b/HeliosConfig.h @@ -61,23 +61,21 @@ // Brightness Options // -// These are the four options available in the global brightness menu -// There is only four options, be careful not to go too low -#define BRIGHTNESS_HIGH 255 -#define BRIGHNESS_MEDIUM 170 -#define BRIGHNESS_LOW 85 +// There are three brightness options, the lowest is equal to this value, +// the middle is 2x this value, and the highest is 3x this value +#define BRIGHTNESS_STEP 85 // Pre-defined saturation values -#define HSV_SAT_HIGH 255 -#define HSV_SAT_MEDIUM 220 -#define HSV_SAT_LOW 190 -#define HSV_SAT_LOWEST 160 +#define HSV_SAT_HIGH 255 +#define HSV_SAT_MEDIUM 220 +#define HSV_SAT_LOW 190 +#define HSV_SAT_LOWEST 160 // Pre-defined brightness values -#define HSV_BRI_HIGH 255 -#define HSV_BRI_MEDIUM 120 -#define HSV_BRI_LOW 60 -#define HSV_BRI_LOWEST 10 +#define HSV_VAL_HIGH 255 +#define HSV_VAL_MEDIUM 120 +#define HSV_VAL_LOW 60 +#define HSV_VAL_LOWEST 10 // ============================================================================ // Storage Constants From 11d5f52f36ac5dde82add4faed64c4a6887eec91 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 20:43:38 -0800 Subject: [PATCH 02/11] added workflow and test script --- .github/workflows/build.yml | 51 +++++++++++++++++++++++++++++++++++++ tests/runtests.sh | 3 +++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 tests/runtests.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..0b10ae08 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,51 @@ +name: Duo Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: # manual trigger + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout current repository + uses: actions/checkout@v3 + - name: Update Package Lists + run: sudo apt-get update + - name: Install Dependencies + run: sudo apt-get install valgrind g++ make --fix-missing + - name: Build + run: make -j + working-directory: HeliosCLI + - name: Set execute permissions for test script + run: chmod +x ./runtests.sh + working-directory: tests + - name: Run general tests + run: ./runtests.sh + working-directory: tests + + embedded: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install Dependencies + run: make install + - name: Build Binary + run: make build + - name: Archive production artifacts + uses: actions/upload-artifact@v3 + with: + name: embedded firmware + path: | + helios.bin + helios.elf + helios.map + helios.hex diff --git a/tests/runtests.sh b/tests/runtests.sh new file mode 100644 index 00000000..4242cbc8 --- /dev/null +++ b/tests/runtests.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Success! All tests completed successfully" From 90292ba4c449149498fec0bb0b02a18a01826d05 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 20:44:54 -0800 Subject: [PATCH 03/11] fixed bad include --- Colorset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Colorset.h b/Colorset.h index 534ab9ca..a17e49c7 100644 --- a/Colorset.h +++ b/Colorset.h @@ -1,7 +1,7 @@ #ifndef COLORSET_H #define COLORSET_H -#include "ColorTypes.h" +#include "Colortypes.h" #include "HeliosConfig.h" From 710d4744e77befb3742f253861f4d2a9c53e27e6 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 20:47:31 -0800 Subject: [PATCH 04/11] fix bad include --- Colortypes.cpp | 2 +- Led.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Colortypes.cpp b/Colortypes.cpp index b800ed63..6c965ca5 100644 --- a/Colortypes.cpp +++ b/Colortypes.cpp @@ -1,4 +1,4 @@ -#include "ColorTypes.h" +#include "Colortypes.h" #if ALTERNATIVE_HSV_RGB == 1 // global hsv to rgb algorithm selector diff --git a/Led.h b/Led.h index 86514942..16d96191 100644 --- a/Led.h +++ b/Led.h @@ -3,7 +3,7 @@ #include -#include "ColorTypes.h" +#include "Colortypes.h" class Led { From 34a00459fe3895c6e71a7f21c1536b71623c0ff3 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 20:49:20 -0800 Subject: [PATCH 05/11] minor fix --- Colorset.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Colorset.cpp b/Colorset.cpp index ec9c35c3..d9f103fb 100644 --- a/Colorset.cpp +++ b/Colorset.cpp @@ -77,7 +77,7 @@ void Colorset::init(RGBColor c1, RGBColor c2, RGBColor c3, RGBColor c4, void Colorset::clear() { - memset(m_palette, 0, sizeof(m_palette)); + memset((void *)m_palette, 0, sizeof(m_palette)); m_numColors = 0; resetIndex(); } From 3a17c20994c0b51a4d7c6d162c7f53458904c6ae Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 21:00:23 -0800 Subject: [PATCH 06/11] Fixed makefile to work on other systems --- Makefile | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 17e81639..cf162ad6 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,44 @@ -BINDIR=/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ -AVRDUDEDIR=/usr/local/bin/ - -CC = ${BINDIR}/avr-g++ -LD = ${BINDIR}/avr-g++ -OBJCOPY = ${BINDIR}/avr-objcopy -v -AR = ${BINDIR}/avr-gcc-ar -SIZE = ${BINDIR}/avr-size -OBJDUMP = ${BINDIR}/avr-objdump -NM = ${BINDIR}/avr-nm -AVRDUDE = ${AVRDUDEDIR}/avrdude +ifneq ($(OS),Windows_NT) + OS = $(shell uname -s) +endif + +ifeq ($(OS),Windows_NT) # Windows + BINDIR="C:/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/" + AVRDUDEDIR="$(shell echo "$$LOCALAPPDATA")/Arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18/bin" + PYTHON="$(shell echo "$$LOCALAPPDATA")/Arduino15/packages/megaTinyCore/tools/python3/3.7.2-post1/python3" + PYPROG="$(shell echo "$$LOCALAPPDATA")/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.5/tools/prog.py" + DEVICE_DIR="C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.10.348/gcc/dev/attiny85" + INCLUDE_DIR="C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.10.348/include/" +else ifeq ($(OS),Linux) + BINDIR=~/atmel_setup/avr8-gnu-toolchain-linux_x86_64/bin/ + DEVICE_DIR=~/atmel_setup/gcc/dev/attiny85 + INCLUDE_DIR=~/atmel_setup/include/ +else ifeq ($(OS),Darwin) + BINDIR=/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ +else + # ??? unknown OS +endif + +CC = ${BINDIR}avr-g++ +LD = ${BINDIR}avr-g++ +OBJCOPY = ${BINDIR}avr-objcopy -v +AR = ${BINDIR}avr-gcc-ar +SIZE = ${BINDIR}avr-size +OBJDUMP = ${BINDIR}avr-objdump +NM = ${BINDIR}avr-nm +AVRDUDE = ${AVRDUDEDIR}avrdude AVRDUDE_CONF = avrdude.conf -AVRDUDE_PORT = /dev/tty.usbmodem1423201 AVRDUDE_PROGRAMMER = stk500v1 AVRDUDE_BAUDRATE = 19200 AVRDUDE_CHIP = attiny85 +ifeq ($(OS),Windows_NT) # Windows + AVRDUDE_PORT = COM12 +else ifeq ($(OS),Darwin) + AVRDUDE_PORT = /dev/tty.usbmodem1423201 +endif + AVRDUDE_FLAGS = -C$(AVRDUDE_CONF) \ -p$(AVRDUDE_CHIP) \ -c$(AVRDUDE_PROGRAMMER) \ @@ -56,7 +79,12 @@ LDFLAGS = -g \ -Wl,--gc-sections \ -mrelax \ -lm \ - -mmcu=$(AVRDUDE_CHIP) \ + -mmcu=$(AVRDUDE_CHIP) + +ifeq ($(OS),Windows_NT) # Windows + CFLAGS+=-B $(DEVICE_DIR) + LDFLAGS+=-B $(DEVICE_DIR) +endif INCLUDES=\ -I $(INCLUDE_DIR) \ @@ -81,6 +109,7 @@ DFILES = $(SRCS:.cpp=.d) TARGET = helios all: $(TARGET).hex + @echo Detected Operating System: $(detected_OS) $(OBJDUMP) --disassemble --source --line-numbers --demangle --section=.text $(TARGET).elf > $(TARGET).lst $(NM) --numeric-sort --line-numbers --demangle --print-size --format=s $(TARGET).elf > $(TARGET).map chmod +x avrsize.sh From 01eeab01902b50a9b7484901c4342a16c2017a3b Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 21:04:46 -0800 Subject: [PATCH 07/11] minor fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cf162ad6..35f69898 100644 --- a/Makefile +++ b/Makefile @@ -109,7 +109,7 @@ DFILES = $(SRCS:.cpp=.d) TARGET = helios all: $(TARGET).hex - @echo Detected Operating System: $(detected_OS) + @echo Detected Operating System: $(OS) $(OBJDUMP) --disassemble --source --line-numbers --demangle --section=.text $(TARGET).elf > $(TARGET).lst $(NM) --numeric-sort --line-numbers --demangle --print-size --format=s $(TARGET).elf > $(TARGET).map chmod +x avrsize.sh From 9ac9afeef64a3c7db92ac1bd08e4ba6ad91c83e0 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 21:21:16 -0800 Subject: [PATCH 08/11] added avrsize script --- avrsize.sh | 92 +++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/avrsize.sh b/avrsize.sh index 7a2c9de0..38ed2edc 100755 --- a/avrsize.sh +++ b/avrsize.sh @@ -1,46 +1,46 @@ -#!/bin/bash - -# need megatinycore installed for this - -if [ "$(uname -o)" == "Msys" ]; then - AVR_SIZE="C:/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/avr-size.exe" -else - AVR_SIZE="${HOME}/atmel_setup/avr8-gnu-toolchain-linux_x86_64/bin/avr-size" -fi - -# Replace this with the path to your .elf file -ELF_FILE=$1 - -if [ "$ELF_FILE" == "" ]; then - echo "Please specify a file: $0 " - exit 1 -fi - -# Constants for program storage and dynamic memory size -PROGRAM_STORAGE=8192 -DYNAMIC_MEMORY=512 - -# Run avr-size and parse the output -if [ "$(uname -o)" == "Msys" ]; then - OUTPUT=$("$AVR_SIZE" -A $ELF_FILE) -else - OUTPUT=$($AVR_SIZE -A $ELF_FILE) -fi - -# Extract sizes of .text, .data, .rodata, and .bss sections -TEXT_SIZE=$(echo "$OUTPUT" | grep -E '\.text' | awk '{print $2}') -DATA_SIZE=$(echo "$OUTPUT" | grep -E '\.data' | awk '{print $2}') -RODATA_SIZE=$(echo "$OUTPUT" | grep -E '\.rodata' | awk '{print $2}') -BSS_SIZE=$(echo "$OUTPUT" | grep -E '\.bss' | awk '{print $2}') - -# Calculate used program storage and dynamic memory -PROGRAM_STORAGE_USED=$((TEXT_SIZE + DATA_SIZE + RODATA_SIZE)) -DYNAMIC_MEMORY_USED=$((DATA_SIZE + BSS_SIZE)) - -# Calculate percentages -PROGRAM_STORAGE_PERCENT=$(awk -v used="$PROGRAM_STORAGE_USED" -v total="$PROGRAM_STORAGE" 'BEGIN { printf("%.2f", used / total * 100) }') -DYNAMIC_MEMORY_PERCENT=$(awk -v used="$DYNAMIC_MEMORY_USED" -v total="$DYNAMIC_MEMORY" 'BEGIN { printf("%.2f", used / total * 100) }') - -# Display the results -echo "Sketch uses $PROGRAM_STORAGE_USED bytes ($PROGRAM_STORAGE_PERCENT%) of program storage space. Maximum is $PROGRAM_STORAGE bytes. (Hex: $(printf '%x' $PROGRAM_STORAGE_USED)/$(printf '%x' $PROGRAM_STORAGE))" -echo "Global variables use $DYNAMIC_MEMORY_USED bytes ($DYNAMIC_MEMORY_PERCENT%) of dynamic memory, leaving $(($DYNAMIC_MEMORY - $DYNAMIC_MEMORY_USED)) bytes for local variables. Maximum is $DYNAMIC_MEMORY bytes. (Hex: $(printf '%x' $DYNAMIC_MEMORY_USED)/$(printf '%x' $DYNAMIC_MEMORY))" +#!/bin/bash + +# need megatinycore installed for this + +if [ "$(uname -o)" == "Msys" ]; then + AVR_SIZE="C:/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/avr-size.exe" +else + AVR_SIZE="${HOME}/atmel_setup/avr8-gnu-toolchain-linux_x86_64/bin/avr-size" +fi + +# Replace this with the path to your .elf file +ELF_FILE=$1 + +if [ "$ELF_FILE" == "" ]; then + echo "Please specify a file: $0 " + exit 1 +fi + +# Constants for program storage and dynamic memory size +PROGRAM_STORAGE=8192 +DYNAMIC_MEMORY=512 + +# Run avr-size and parse the output +if [ "$(uname -o)" == "Msys" ]; then + OUTPUT=$("$AVR_SIZE" -A $ELF_FILE) +else + OUTPUT=$($AVR_SIZE -A $ELF_FILE) +fi + +# Extract sizes of .text, .data, .rodata, and .bss sections +TEXT_SIZE=$(echo "$OUTPUT" | grep -E '\.text' | awk '{print $2}') +DATA_SIZE=$(echo "$OUTPUT" | grep -E '\.data' | awk '{print $2}') +RODATA_SIZE=$(echo "$OUTPUT" | grep -E '\.rodata' | awk '{print $2}') +BSS_SIZE=$(echo "$OUTPUT" | grep -E '\.bss' | awk '{print $2}') + +# Calculate used program storage and dynamic memory +PROGRAM_STORAGE_USED=$((TEXT_SIZE + DATA_SIZE + RODATA_SIZE)) +DYNAMIC_MEMORY_USED=$((DATA_SIZE + BSS_SIZE)) + +# Calculate percentages +PROGRAM_STORAGE_PERCENT=$(awk -v used="$PROGRAM_STORAGE_USED" -v total="$PROGRAM_STORAGE" 'BEGIN { printf("%.2f", used / total * 100) }') +DYNAMIC_MEMORY_PERCENT=$(awk -v used="$DYNAMIC_MEMORY_USED" -v total="$DYNAMIC_MEMORY" 'BEGIN { printf("%.2f", used / total * 100) }') + +# Display the results +echo "Sketch uses $PROGRAM_STORAGE_USED bytes ($PROGRAM_STORAGE_PERCENT%) of program storage space. Maximum is $PROGRAM_STORAGE bytes. (Hex: $(printf '%x' $PROGRAM_STORAGE_USED)/$(printf '%x' $PROGRAM_STORAGE))" +echo "Global variables use $DYNAMIC_MEMORY_USED bytes ($DYNAMIC_MEMORY_PERCENT%) of dynamic memory, leaving $(($DYNAMIC_MEMORY - $DYNAMIC_MEMORY_USED)) bytes for local variables. Maximum is $DYNAMIC_MEMORY bytes. (Hex: $(printf '%x' $DYNAMIC_MEMORY_USED)/$(printf '%x' $DYNAMIC_MEMORY))" From 28e9b4f168c67677a4ad131de652620dec299de0 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 3 Jan 2024 22:22:24 -0800 Subject: [PATCH 09/11] build name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b10ae08..503f28c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Duo Build +name: Helios Build on: push: From 3f733b3dbe8f7479b236e2abf8f6ee94fea0771c Mon Sep 17 00:00:00 2001 From: Kurt LaVacque Date: Thu, 4 Jan 2024 17:24:52 -0600 Subject: [PATCH 10/11] Fixed avrsize --- avrsize.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avrsize.sh b/avrsize.sh index 38ed2edc..7a1692f4 100755 --- a/avrsize.sh +++ b/avrsize.sh @@ -5,7 +5,7 @@ if [ "$(uname -o)" == "Msys" ]; then AVR_SIZE="C:/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/avr-size.exe" else - AVR_SIZE="${HOME}/atmel_setup/avr8-gnu-toolchain-linux_x86_64/bin/avr-size" + AVR_SIZE="/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-size" fi # Replace this with the path to your .elf file From 12402c114d4f98e52c55ba1323fb92e5651d0d64 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 4 Jan 2024 15:39:21 -0800 Subject: [PATCH 11/11] fixes for script and formatting --- ColorConstants.h | 264 +++++++++++++++++++++++------------------------ avrsize.sh | 9 +- 2 files changed, 140 insertions(+), 133 deletions(-) diff --git a/ColorConstants.h b/ColorConstants.h index 1ce7335e..8801d4ac 100644 --- a/ColorConstants.h +++ b/ColorConstants.h @@ -9,153 +9,153 @@ // Engine // Pre-defined hue values -#define HUE_RED 0 -#define HUE_CORAL_ORANGE 5 -#define HUE_ORANGE 10 -#define HUE_YELLOW 20 +#define HUE_RED 0 +#define HUE_CORAL_ORANGE 5 +#define HUE_ORANGE 10 +#define HUE_YELLOW 20 -#define HUE_LIME_GREEN 70 -#define HUE_GREEN 85 -#define HUE_SEAFOAM 95 -#define HUE_TURQUOISE 120 +#define HUE_LIME_GREEN 70 +#define HUE_GREEN 85 +#define HUE_SEAFOAM 95 +#define HUE_TURQUOISE 120 -#define HUE_ICE_BLUE 142 -#define HUE_LIGHT_BLUE 158 -#define HUE_BLUE 170 -#define HUE_ROYAL_BLUE 175 +#define HUE_ICE_BLUE 142 +#define HUE_LIGHT_BLUE 158 +#define HUE_BLUE 170 +#define HUE_ROYAL_BLUE 175 -#define HUE_PURPLE 192 -#define HUE_PINK 205 -#define HUE_HOT_PINK 225 -#define HUE_MAGENTA 245 +#define HUE_PURPLE 192 +#define HUE_PINK 205 +#define HUE_HOT_PINK 225 +#define HUE_MAGENTA 245 // Helios Colors -#define RGB_OFF (uint32_t)0x000000 // 0 0 0 -#define RGB_WHITE (uint32_t)0xFFFFFF // 255 255 255 -#define RGB_RED (uint32_t)0xFF0000 // 255, 0, 0 +#define RGB_OFF (uint32_t)0x000000 // 0 0 0 +#define RGB_WHITE (uint32_t)0xFFFFFF // 255 255 255 +#define RGB_RED (uint32_t)0xFF0000 // 255, 0, 0 #define RGB_CORAL_ORANGE (uint32_t)0xFF1E00 // 255, 30, 0 -#define RGB_ORANGE (uint32_t)0xFF3C00 // 255, 60, 0 -#define RGB_YELLOW (uint32_t)0xFF7800 // 255, 120, 0 -#define RGB_LIME_GREEN (uint32_t)0x59FF00 // 89, 255, 0 -#define RGB_GREEN (uint32_t)0x00FF00 // 0, 255, 0 -#define RGB_SEAFOAM (uint32_t)0x00FF3C // 0, 255, 60 -#define RGB_TURQUOISE (uint32_t)0x00FFD1 // 0, 255, 209 -#define RGB_ICE_BLUE (uint32_t)0x00A7FF // 0, 167, 255 -#define RGB_LIGHT_BLUE (uint32_t)0x0047FF // 0, 71, 255 -#define RGB_BLUE (uint32_t)0x0000FF // 0, 0, 255 -#define RGB_ROYAL_BLUE (uint32_t)0x1D00FF // 29, 0, 255 -#define RGB_PURPLE (uint32_t)0x8300FF // 131, 0, 255 -#define RGB_PINK (uint32_t)0xD200FF // 210, 0, 255 -#define RGB_HOT_PINK (uint32_t)0xFF00B4 // 255, 0, 180 -#define RGB_MAGENTA (uint32_t)0xFF003C // 255, 0, 60 +#define RGB_ORANGE (uint32_t)0xFF3C00 // 255, 60, 0 +#define RGB_YELLOW (uint32_t)0xFF7800 // 255, 120, 0 +#define RGB_LIME_GREEN (uint32_t)0x59FF00 // 89, 255, 0 +#define RGB_GREEN (uint32_t)0x00FF00 // 0, 255, 0 +#define RGB_SEAFOAM (uint32_t)0x00FF3C // 0, 255, 60 +#define RGB_TURQUOISE (uint32_t)0x00FFD1 // 0, 255, 209 +#define RGB_ICE_BLUE (uint32_t)0x00A7FF // 0, 167, 255 +#define RGB_LIGHT_BLUE (uint32_t)0x0047FF // 0, 71, 255 +#define RGB_BLUE (uint32_t)0x0000FF // 0, 0, 255 +#define RGB_ROYAL_BLUE (uint32_t)0x1D00FF // 29, 0, 255 +#define RGB_PURPLE (uint32_t)0x8300FF // 131, 0, 255 +#define RGB_PINK (uint32_t)0xD200FF // 210, 0, 255 +#define RGB_HOT_PINK (uint32_t)0xFF00B4 // 255, 0, 180 +#define RGB_MAGENTA (uint32_t)0xFF003C // 255, 0, 60 // Helios Medium Brightness Colors -#define RGB_WHITE_BRI_MEDIUM (uint32_t)0x787878 // 120 120 120 -#define RGB_RED_BRI_MEDIUM (uint32_t)0x780000 // 120, 0, 0 -#define RGB_CORAL_ORANGE_BRI_MEDIUM (uint32_t)0x780E00 // 120, 14, 0 -#define RGB_ORANGE_BRI_MEDIUM (uint32_t)0x781C00 // 120, 28, 0 -#define RGB_YELLOW_BRI_MEDIUM (uint32_t)0x783800 // 120, 56, 0 -#define RGB_LIME_GREEN_BRI_MEDIUM (uint32_t)0x297800 // 41, 120, 0 -#define RGB_GREEN_BRI_MEDIUM (uint32_t)0x007800 // 0, 120, 0 -#define RGB_SEAFOAM_BRI_MEDIUM (uint32_t)0x00781C // 0, 120, 28 -#define RGB_TURQUOISE_BRI_MEDIUM (uint32_t)0x007862 // 0, 120, 98 -#define RGB_ICE_BLUE_BRI_MEDIUM (uint32_t)0x004E78 // 0, 78, 120 -#define RGB_LIGHT_BLUE_BRI_MEDIUM (uint32_t)0x002178 // 0, 33, 120 -#define RGB_BLUE_BRI_MEDIUM (uint32_t)0x000078 // 0, 0, 120 -#define RGB_ROYAL_BLUE_BRI_MEDIUM (uint32_t)0x0D0078 // 13, 0, 120 -#define RGB_PURPLE_BRI_MEDIUM (uint32_t)0x3D0078 // 61, 0, 120 -#define RGB_PINK_BRI_MEDIUM (uint32_t)0x620078 // 98, 0, 120 -#define RGB_HOT_PINK_BRI_MEDIUM (uint32_t)0x780054 // 120, 0, 84 -#define RGB_MAGENTA_BRI_MEDIUM (uint32_t)0x78001C // 120, 0, 28 +#define RGB_WHITE_BRI_MEDIUM (uint32_t)0x787878 // 120 120 120 +#define RGB_RED_BRI_MEDIUM (uint32_t)0x780000 // 120, 0, 0 +#define RGB_CORAL_ORANGE_BRI_MEDIUM (uint32_t)0x780E00 // 120, 14, 0 +#define RGB_ORANGE_BRI_MEDIUM (uint32_t)0x781C00 // 120, 28, 0 +#define RGB_YELLOW_BRI_MEDIUM (uint32_t)0x783800 // 120, 56, 0 +#define RGB_LIME_GREEN_BRI_MEDIUM (uint32_t)0x297800 // 41, 120, 0 +#define RGB_GREEN_BRI_MEDIUM (uint32_t)0x007800 // 0, 120, 0 +#define RGB_SEAFOAM_BRI_MEDIUM (uint32_t)0x00781C // 0, 120, 28 +#define RGB_TURQUOISE_BRI_MEDIUM (uint32_t)0x007862 // 0, 120, 98 +#define RGB_ICE_BLUE_BRI_MEDIUM (uint32_t)0x004E78 // 0, 78, 120 +#define RGB_LIGHT_BLUE_BRI_MEDIUM (uint32_t)0x002178 // 0, 33, 120 +#define RGB_BLUE_BRI_MEDIUM (uint32_t)0x000078 // 0, 0, 120 +#define RGB_ROYAL_BLUE_BRI_MEDIUM (uint32_t)0x0D0078 // 13, 0, 120 +#define RGB_PURPLE_BRI_MEDIUM (uint32_t)0x3D0078 // 61, 0, 120 +#define RGB_PINK_BRI_MEDIUM (uint32_t)0x620078 // 98, 0, 120 +#define RGB_HOT_PINK_BRI_MEDIUM (uint32_t)0x780054 // 120, 0, 84 +#define RGB_MAGENTA_BRI_MEDIUM (uint32_t)0x78001C // 120, 0, 28 // Helios Low Brightness Colors -#define RGB_WHITE_BRI_LOW (uint32_t)0x3C3C3C // 60 60 60 -#define RGB_RED_BRI_LOW (uint32_t)0x3C0000 // 60, 0, 0 -#define RGB_CORAL_ORANGE_BRI_LOW (uint32_t)0x3C0700 // 60, 7, 0 -#define RGB_ORANGE_BRI_LOW (uint32_t)0x3C0E00 // 60, 14, 0 -#define RGB_YELLOW_BRI_LOW (uint32_t)0x3C1C00 // 60, 28, 0 -#define RGB_LIME_GREEN_BRI_LOW (uint32_t)0x143C00 // 20, 60, 0 -#define RGB_GREEN_BRI_LOW (uint32_t)0x003C00 // 0, 60, 0 -#define RGB_SEAFOAM_BRI_LOW (uint32_t)0x003C0E // 0, 60, 14 -#define RGB_TURQUOISE_BRI_LOW (uint32_t)0x003C31 // 0, 60, 49 -#define RGB_ICE_BLUE_BRI_LOW (uint32_t)0x00273C // 0, 39, 60 -#define RGB_LIGHT_BLUE_BRI_LOW (uint32_t)0x00103C // 0, 16, 60 -#define RGB_BLUE_BRI_LOW (uint32_t)0x00003C // 0, 0, 60 -#define RGB_ROYAL_BLUE_BRI_LOW (uint32_t)0x06003C // 6, 0, 60 -#define RGB_PURPLE_BRI_LOW (uint32_t)0x1E003C // 30, 0, 60 -#define RGB_PINK_BRI_LOW (uint32_t)0x31003C // 49, 0, 60 -#define RGB_HOT_PINK_BRI_LOW (uint32_t)0x3C002A // 60, 0, 42 -#define RGB_MAGENTA_BRI_LOW (uint32_t)0x3C000E // 60, 0, 14 +#define RGB_WHITE_BRI_LOW (uint32_t)0x3C3C3C // 60 60 60 +#define RGB_RED_BRI_LOW (uint32_t)0x3C0000 // 60, 0, 0 +#define RGB_CORAL_ORANGE_BRI_LOW (uint32_t)0x3C0700 // 60, 7, 0 +#define RGB_ORANGE_BRI_LOW (uint32_t)0x3C0E00 // 60, 14, 0 +#define RGB_YELLOW_BRI_LOW (uint32_t)0x3C1C00 // 60, 28, 0 +#define RGB_LIME_GREEN_BRI_LOW (uint32_t)0x143C00 // 20, 60, 0 +#define RGB_GREEN_BRI_LOW (uint32_t)0x003C00 // 0, 60, 0 +#define RGB_SEAFOAM_BRI_LOW (uint32_t)0x003C0E // 0, 60, 14 +#define RGB_TURQUOISE_BRI_LOW (uint32_t)0x003C31 // 0, 60, 49 +#define RGB_ICE_BLUE_BRI_LOW (uint32_t)0x00273C // 0, 39, 60 +#define RGB_LIGHT_BLUE_BRI_LOW (uint32_t)0x00103C // 0, 16, 60 +#define RGB_BLUE_BRI_LOW (uint32_t)0x00003C // 0, 0, 60 +#define RGB_ROYAL_BLUE_BRI_LOW (uint32_t)0x06003C // 6, 0, 60 +#define RGB_PURPLE_BRI_LOW (uint32_t)0x1E003C // 30, 0, 60 +#define RGB_PINK_BRI_LOW (uint32_t)0x31003C // 49, 0, 60 +#define RGB_HOT_PINK_BRI_LOW (uint32_t)0x3C002A // 60, 0, 42 +#define RGB_MAGENTA_BRI_LOW (uint32_t)0x3C000E // 60, 0, 14 // Helios Lowest Brightness Colors -#define RGB_WHITE_BRI_LOWEST (uint32_t)0x0A0A0A // 10 10 10 -#define RGB_RED_BRI_LOWEST (uint32_t)0x0A0000 // 10, 0, 0 -#define RGB_CORAL_ORANGE_BRI_LOWEST (uint32_t)0x0A0100 // 10, 1, 0 -#define RGB_ORANGE_BRI_LOWEST (uint32_t)0x0A0200 // 10, 2, 0 -#define RGB_YELLOW_BRI_LOWEST (uint32_t)0x0A0400 // 10, 4, 0 -#define RGB_LIME_GREEN_BRI_LOWEST (uint32_t)0x030A00 // 3, 10, 0 -#define RGB_GREEN_BRI_LOWEST (uint32_t)0x000A00 // 0, 10, 0 -#define RGB_SEAFOAM_BRI_LOWEST (uint32_t)0x000A02 // 0, 10, 2 -#define RGB_TURQUOISE_BRI_LOWEST (uint32_t)0x000A08 // 0, 10, 8 -#define RGB_ICE_BLUE_BRI_LOWEST (uint32_t)0x00060A // 0, 6, 10 -#define RGB_LIGHT_BLUE_BRI_LOWEST (uint32_t)0x00020A // 0, 2, 10 -#define RGB_BLUE_BRI_LOWEST (uint32_t)0x00000A // 0, 0, 10 -#define RGB_ROYAL_BLUE_BRI_LOWEST (uint32_t)0x01000A // 1, 0, 10 -#define RGB_PURPLE_BRI_LOWEST (uint32_t)0x05000A // 5, 0, 10 -#define RGB_PINK_BRI_LOWEST (uint32_t)0x08000A // 8, 0, 10 -#define RGB_HOT_PINK_BRI_LOWEST (uint32_t)0x0A0007 // 10, 0, 7 -#define RGB_MAGENTA_BRI_LOWEST (uint32_t)0x0A0002 // 10, 0, 2 +#define RGB_WHITE_BRI_LOWEST (uint32_t)0x0A0A0A // 10 10 10 +#define RGB_RED_BRI_LOWEST (uint32_t)0x0A0000 // 10, 0, 0 +#define RGB_CORAL_ORANGE_BRI_LOWEST (uint32_t)0x0A0100 // 10, 1, 0 +#define RGB_ORANGE_BRI_LOWEST (uint32_t)0x0A0200 // 10, 2, 0 +#define RGB_YELLOW_BRI_LOWEST (uint32_t)0x0A0400 // 10, 4, 0 +#define RGB_LIME_GREEN_BRI_LOWEST (uint32_t)0x030A00 // 3, 10, 0 +#define RGB_GREEN_BRI_LOWEST (uint32_t)0x000A00 // 0, 10, 0 +#define RGB_SEAFOAM_BRI_LOWEST (uint32_t)0x000A02 // 0, 10, 2 +#define RGB_TURQUOISE_BRI_LOWEST (uint32_t)0x000A08 // 0, 10, 8 +#define RGB_ICE_BLUE_BRI_LOWEST (uint32_t)0x00060A // 0, 6, 10 +#define RGB_LIGHT_BLUE_BRI_LOWEST (uint32_t)0x00020A // 0, 2, 10 +#define RGB_BLUE_BRI_LOWEST (uint32_t)0x00000A // 0, 0, 10 +#define RGB_ROYAL_BLUE_BRI_LOWEST (uint32_t)0x01000A // 1, 0, 10 +#define RGB_PURPLE_BRI_LOWEST (uint32_t)0x05000A // 5, 0, 10 +#define RGB_PINK_BRI_LOWEST (uint32_t)0x08000A // 8, 0, 10 +#define RGB_HOT_PINK_BRI_LOWEST (uint32_t)0x0A0007 // 10, 0, 7 +#define RGB_MAGENTA_BRI_LOWEST (uint32_t)0x0A0002 // 10, 0, 2 // Helios Medium Saturation Colors -#define RGB_RED_SAT_MEDIUM (uint32_t)0xFF2222 // 255, 34, 34 -#define RGB_CORAL_ORANGE_SAT_MEDIUM (uint32_t)0xFF3C22 // 255, 60, 34 -#define RGB_ORANGE_SAT_MEDIUM (uint32_t)0xFF5622 // 255, 86, 34 -#define RGB_YELLOW_SAT_MEDIUM (uint32_t)0xFF8A22 // 255, 138, 34 -#define RGB_LIME_GREEN_SAT_MEDIUM (uint32_t)0x6FFF22 // 111, 255, 34 -#define RGB_GREEN_SAT_MEDIUM (uint32_t)0x22FF22 // 34, 255, 34 -#define RGB_SEAFOAM_SAT_MEDIUM (uint32_t)0x22FF56 // 34, 255, 86 -#define RGB_TURQUOISE_SAT_MEDIUM (uint32_t)0x22FFD7 // 34, 255, 215 -#define RGB_ICE_BLUE_SAT_MEDIUM (uint32_t)0x22B3FF // 34, 179, 255 -#define RGB_LIGHT_BLUE_SAT_MEDIUM (uint32_t)0x2260FF // 34, 96, 255 -#define RGB_BLUE_SAT_MEDIUM (uint32_t)0x2222FF // 34, 34, 255 -#define RGB_ROYAL_BLUE_SAT_MEDIUM (uint32_t)0x3C22FF // 60, 34, 255 -#define RGB_PURPLE_SAT_MEDIUM (uint32_t)0x9422FF // 148, 34, 255 -#define RGB_PINK_SAT_MEDIUM (uint32_t)0xD822FF // 216, 34, 255 -#define RGB_HOT_PINK_SAT_MEDIUM (uint32_t)0xFF22BE // 255, 34, 190 -#define RGB_MAGENTA_SAT_MEDIUM (uint32_t)0xFF2256 // 255, 34, 86 +#define RGB_RED_SAT_MEDIUM (uint32_t)0xFF2222 // 255, 34, 34 +#define RGB_CORAL_ORANGE_SAT_MEDIUM (uint32_t)0xFF3C22 // 255, 60, 34 +#define RGB_ORANGE_SAT_MEDIUM (uint32_t)0xFF5622 // 255, 86, 34 +#define RGB_YELLOW_SAT_MEDIUM (uint32_t)0xFF8A22 // 255, 138, 34 +#define RGB_LIME_GREEN_SAT_MEDIUM (uint32_t)0x6FFF22 // 111, 255, 34 +#define RGB_GREEN_SAT_MEDIUM (uint32_t)0x22FF22 // 34, 255, 34 +#define RGB_SEAFOAM_SAT_MEDIUM (uint32_t)0x22FF56 // 34, 255, 86 +#define RGB_TURQUOISE_SAT_MEDIUM (uint32_t)0x22FFD7 // 34, 255, 215 +#define RGB_ICE_BLUE_SAT_MEDIUM (uint32_t)0x22B3FF // 34, 179, 255 +#define RGB_LIGHT_BLUE_SAT_MEDIUM (uint32_t)0x2260FF // 34, 96, 255 +#define RGB_BLUE_SAT_MEDIUM (uint32_t)0x2222FF // 34, 34, 255 +#define RGB_ROYAL_BLUE_SAT_MEDIUM (uint32_t)0x3C22FF // 60, 34, 255 +#define RGB_PURPLE_SAT_MEDIUM (uint32_t)0x9422FF // 148, 34, 255 +#define RGB_PINK_SAT_MEDIUM (uint32_t)0xD822FF // 216, 34, 255 +#define RGB_HOT_PINK_SAT_MEDIUM (uint32_t)0xFF22BE // 255, 34, 190 +#define RGB_MAGENTA_SAT_MEDIUM (uint32_t)0xFF2256 // 255, 34, 86 // Helios Low Saturation Colors -#define RGB_RED_SAT_LOW (uint32_t)0xFF5555 // 255, 85, 85 -#define RGB_CORAL_ORANGE_SAT_LOW (uint32_t)0xFF6955 // 255, 105, 85 -#define RGB_ORANGE_SAT_LOW (uint32_t)0xFF7D55 // 255, 125, 85 -#define RGB_YELLOW_SAT_LOW (uint32_t)0xFFA555 // 255, 165, 85 -#define RGB_LIME_GREEN_SAT_LOW (uint32_t)0x90FF55 // 144, 255, 85 -#define RGB_GREEN_SAT_LOW (uint32_t)0x55FF55 // 85, 255, 85 -#define RGB_SEAFOAM_SAT_LOW (uint32_t)0x55FF7D // 85, 255, 125 -#define RGB_TURQUOISE_SAT_LOW (uint32_t)0x55FFE0 // 85, 255, 224 -#define RGB_ICE_BLUE_SAT_LOW (uint32_t)0x55C4FF // 85, 196, 255 -#define RGB_LIGHT_BLUE_SAT_LOW (uint32_t)0x5584FF // 85, 132, 255 -#define RGB_BLUE_SAT_LOW (uint32_t)0x5555FF // 85, 85, 255 -#define RGB_ROYAL_BLUE_SAT_LOW (uint32_t)0x6855FF // 104, 85, 255 -#define RGB_PURPLE_SAT_LOW (uint32_t)0xAC55FF // 172, 85, 255 -#define RGB_PINK_SAT_LOW (uint32_t)0xE055FF // 224, 85, 255 -#define RGB_HOT_PINK_SAT_LOW (uint32_t)0xFF55CD // 255, 85, 205 -#define RGB_MAGENTA_SAT_LOW (uint32_t)0xFF557D // 255, 85, 125 +#define RGB_RED_SAT_LOW (uint32_t)0xFF5555 // 255, 85, 85 +#define RGB_CORAL_ORANGE_SAT_LOW (uint32_t)0xFF6955 // 255, 105, 85 +#define RGB_ORANGE_SAT_LOW (uint32_t)0xFF7D55 // 255, 125, 85 +#define RGB_YELLOW_SAT_LOW (uint32_t)0xFFA555 // 255, 165, 85 +#define RGB_LIME_GREEN_SAT_LOW (uint32_t)0x90FF55 // 144, 255, 85 +#define RGB_GREEN_SAT_LOW (uint32_t)0x55FF55 // 85, 255, 85 +#define RGB_SEAFOAM_SAT_LOW (uint32_t)0x55FF7D // 85, 255, 125 +#define RGB_TURQUOISE_SAT_LOW (uint32_t)0x55FFE0 // 85, 255, 224 +#define RGB_ICE_BLUE_SAT_LOW (uint32_t)0x55C4FF // 85, 196, 255 +#define RGB_LIGHT_BLUE_SAT_LOW (uint32_t)0x5584FF // 85, 132, 255 +#define RGB_BLUE_SAT_LOW (uint32_t)0x5555FF // 85, 85, 255 +#define RGB_ROYAL_BLUE_SAT_LOW (uint32_t)0x6855FF // 104, 85, 255 +#define RGB_PURPLE_SAT_LOW (uint32_t)0xAC55FF // 172, 85, 255 +#define RGB_PINK_SAT_LOW (uint32_t)0xE055FF // 224, 85, 255 +#define RGB_HOT_PINK_SAT_LOW (uint32_t)0xFF55CD // 255, 85, 205 +#define RGB_MAGENTA_SAT_LOW (uint32_t)0xFF557D // 255, 85, 125 // Helios Lowest Saturation Colors -#define RGB_RED_SAT_LOWEST (uint32_t)0xFF7D7D // 255, 125, 125 -#define RGB_CORAL_ORANGE_SAT_LOWEST (uint32_t)0xFF8C7D // 255, 140, 125 -#define RGB_ORANGE_SAT_LOWEST (uint32_t)0xFF9B7D // 255, 155, 125 -#define RGB_YELLOW_SAT_LOWEST (uint32_t)0xFFBA7D // 255, 186, 125 -#define RGB_LIME_GREEN_SAT_LOWEST (uint32_t)0xAAFF7D // 170, 255, 125 -#define RGB_GREEN_SAT_LOWEST (uint32_t)0x7DFF7D // 125, 255, 125 -#define RGB_SEAFOAM_SAT_LOWEST (uint32_t)0x7DFF9B // 125, 255, 155 -#define RGB_TURQUOISE_SAT_LOWEST (uint32_t)0x7DFFE7 // 125, 255, 231 -#define RGB_ICE_BLUE_SAT_LOWEST (uint32_t)0x7DD2FF // 125, 210, 255 -#define RGB_LIGHT_BLUE_SAT_LOWEST (uint32_t)0x7DA1FF // 125, 161, 255 -#define RGB_BLUE_SAT_LOWEST (uint32_t)0x7D7DFF // 125, 125, 255 -#define RGB_ROYAL_BLUE_SAT_LOWEST (uint32_t)0x8B7DFF // 139, 125, 255 -#define RGB_PURPLE_SAT_LOWEST (uint32_t)0xBF7DFF // 191, 125, 255 -#define RGB_PINK_SAT_LOWEST (uint32_t)0xE87DFF // 232, 125, 255 -#define RGB_HOT_PINK_SAT_LOWEST (uint32_t)0xFF7DD8 // 255, 125, 216 -#define RGB_MAGENTA_SAT_LOWEST (uint32_t)0xFF7D9B // 255, 125, 155 +#define RGB_RED_SAT_LOWEST (uint32_t)0xFF7D7D // 255, 125, 125 +#define RGB_CORAL_ORANGE_SAT_LOWEST (uint32_t)0xFF8C7D // 255, 140, 125 +#define RGB_ORANGE_SAT_LOWEST (uint32_t)0xFF9B7D // 255, 155, 125 +#define RGB_YELLOW_SAT_LOWEST (uint32_t)0xFFBA7D // 255, 186, 125 +#define RGB_LIME_GREEN_SAT_LOWEST (uint32_t)0xAAFF7D // 170, 255, 125 +#define RGB_GREEN_SAT_LOWEST (uint32_t)0x7DFF7D // 125, 255, 125 +#define RGB_SEAFOAM_SAT_LOWEST (uint32_t)0x7DFF9B // 125, 255, 155 +#define RGB_TURQUOISE_SAT_LOWEST (uint32_t)0x7DFFE7 // 125, 255, 231 +#define RGB_ICE_BLUE_SAT_LOWEST (uint32_t)0x7DD2FF // 125, 210, 255 +#define RGB_LIGHT_BLUE_SAT_LOWEST (uint32_t)0x7DA1FF // 125, 161, 255 +#define RGB_BLUE_SAT_LOWEST (uint32_t)0x7D7DFF // 125, 125, 255 +#define RGB_ROYAL_BLUE_SAT_LOWEST (uint32_t)0x8B7DFF // 139, 125, 255 +#define RGB_PURPLE_SAT_LOWEST (uint32_t)0xBF7DFF // 191, 125, 255 +#define RGB_PINK_SAT_LOWEST (uint32_t)0xE87DFF // 232, 125, 255 +#define RGB_HOT_PINK_SAT_LOWEST (uint32_t)0xFF7DD8 // 255, 125, 216 +#define RGB_MAGENTA_SAT_LOWEST (uint32_t)0xFF7D9B // 255, 125, 155 diff --git a/avrsize.sh b/avrsize.sh index 7a1692f4..ad283ca1 100755 --- a/avrsize.sh +++ b/avrsize.sh @@ -2,12 +2,19 @@ # need megatinycore installed for this -if [ "$(uname -o)" == "Msys" ]; then +if [ "$OS" == "Windows_NT" ]; then AVR_SIZE="C:/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/avr-size.exe" +elif [ "$(uname -s)" == "Linux" ]; then + AVR_SIZE="${HOME}/atmel_setup/avr8-gnu-toolchain-linux_x86_64/bin/avr-size" else AVR_SIZE="/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-size" fi +if [ ! -x $AVR_SIZE ]; then + echo "Could not find avr-size program" + exit 1 +fi + # Replace this with the path to your .elf file ELF_FILE=$1