Skip to content

Commit abfe1a9

Browse files
authored
Re-include color profiles
now you can select two ways of how to change color of your saber: either the Gravity Color or Color Profiles to walk you through pre-set color settings.
1 parent 90aa856 commit abfe1a9

File tree

9 files changed

+140
-15
lines changed

9 files changed

+140
-15
lines changed

Buttons.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*
44
* Created on: 21 Octber 2016
55
* author: Sebastien CAPOU (neskweek@gmail.com) and Andras Kun (kun.andras@yahoo.de)
6-
* Source : https://github.com/neskweek/LightSaberOS
6+
* Source : https://github.com/Protonerd/FX-SaberOS
7+
://github.com/neskweek/LightSaberOS
78
*/
89

910
#include "Buttons.h"
@@ -110,7 +111,11 @@ void ConfigMenuButtonEventHandler(bool SaturateColor, ButtonActionEnum ButtonAct
110111
#ifdef GRAVITY_COLOR
111112
ColorMixing(storage.sndProfile[storage.soundFont].mainColor,modification,MAX_BRIGHTNESS, SaturateColor);
112113
#else if COLOR_PROFILE
113-
114+
if (ButtonActionType==SINGLE_CLICK){
115+
confParseValue(modification, 0, 14, incrementSign);
116+
modification = value;
117+
getColorFix(modification);
118+
}
114119
#endif
115120
storage.sndProfile[storage.soundFont].mainColor.r=currentColor.r;
116121
storage.sndProfile[storage.soundFont].mainColor.g=currentColor.g;
@@ -120,15 +125,31 @@ void ConfigMenuButtonEventHandler(bool SaturateColor, ButtonActionEnum ButtonAct
120125

121126
}
122127
else if (ConfigModeSubStates==CS_CLASHCOLOR) {
123-
ColorMixing(storage.sndProfile[storage.soundFont].clashColor,modification,MAX_BRIGHTNESS, SaturateColor);
128+
#ifdef GRAVITY_COLOR
129+
ColorMixing(storage.sndProfile[storage.soundFont].clashColor,modification,MAX_BRIGHTNESS, SaturateColor);
130+
#else if COLOR_PROFILE
131+
if (ButtonActionType==SINGLE_CLICK){
132+
confParseValue(modification, 0, 14, incrementSign);
133+
modification = value;
134+
getColorFix(modification);
135+
}
136+
#endif
124137
storage.sndProfile[storage.soundFont].clashColor.r=currentColor.r;
125138
storage.sndProfile[storage.soundFont].clashColor.g=currentColor.g;
126139
storage.sndProfile[storage.soundFont].clashColor.b=currentColor.b;
127140
lightOn(ledPins, -1, currentColor, 1, NUMPIXELS/2-1);
128141
delay(50);
129142
}
130143
else if (ConfigModeSubStates==CS_BLASTCOLOR) {
131-
ColorMixing(storage.sndProfile[storage.soundFont].blasterboltColor,modification,MAX_BRIGHTNESS, SaturateColor);
144+
#ifdef GRAVITY_COLOR
145+
ColorMixing(storage.sndProfile[storage.soundFont].blasterboltColor,modification,MAX_BRIGHTNESS, SaturateColor);
146+
#else if COLOR_PROFILE
147+
if (ButtonActionType==SINGLE_CLICK){
148+
confParseValue(modification, 0, 14, incrementSign);
149+
modification = value;
150+
getColorFix(modification);
151+
}
152+
#endif
132153
storage.sndProfile[storage.soundFont].blasterboltColor.r=currentColor.r;
133154
storage.sndProfile[storage.soundFont].blasterboltColor.g=currentColor.g;
134155
storage.sndProfile[storage.soundFont].blasterboltColor.b=currentColor.b;

Buttons.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Created on: 21 Octber 2016
55
* author: Sebastien CAPOU (neskweek@gmail.com) and Andras Kun (kun.andras@yahoo.de)
6-
* Source : https://github.com/neskweek/LightSaberOS
6+
* Source : https://github.com/Protonerd/FX-SaberOS
77
*/
88
#include <Arduino.h>
99
#if not defined BUTTONS_H_

ConfigMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Config.cpp
33
*
44
* author: Sebastien CAPOU (neskweek@gmail.com) and Andras Kun (kun.andras@yahoo.de)
5-
* Source : https://github.com/neskweek/LightSaberOS
5+
* Source : https://github.com/Protonerd/FX-SaberOS
66
* Author: neskw
77
*/
88
#include "ConfigMenu.h"

ConfigMenu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Config.h
33
*
44
* author: Sebastien CAPOU (neskweek@gmail.com) and Andras Kun (kun.andras@yahoo.de)
5-
* Source : https://github.com/neskweek/LightSaberOS
5+
* Source : https://github.com/Protonerd/FX-SaberOS
66
*/
77

88
#include <Arduino.h>
@@ -25,7 +25,7 @@ enum ConfigModeSubStatesEnum {CS_SOUNDFONT, CS_FLICKERTYPE, CS_SLEEPINIT, CS_LAS
2525
enum ConfigModeSubStatesEnum {CS_SOUNDFONT, CS_SLEEPINIT, CS_FLICKERTYPE, CS_MAINCOLOR, CS_CLASHCOLOR, CS_BLASTCOLOR, CS_SWINGSENSITIVITY, CS_VOLUME, CS_LASTMEMBER, CS_BATTERYLEVEL, CS_POWERONOFFTYPE, CS_STORAGEACCESS, CS_UARTMODE}; // never delete CS_LASTMEMBER!!! Needed to calculate number of elements in the enum type!!!
2626
#endif
2727
#if defined PIXELBLADE
28-
enum ConfigModeSubStatesEnum {CS_SOUNDFONT, CS_VOLUME, CS_SWINGSENSITIVITY, CS_FLICKERTYPE, CS_MAINCOLOR, CS_CLASHCOLOR, CS_BLASTCOLOR, CS_SLEEPINIT, CS_LASTMEMBER, CS_POWERONOFFTYPE, CS_BATTERYLEVEL, CS_STORAGEACCESS, CS_UARTMODE}; // never delete CS_LASTMEMBER!!! Needed to calculate number of elements in the enum type!!!
28+
enum ConfigModeSubStatesEnum {CS_SOUNDFONT, CS_SWINGSENSITIVITY, CS_FLICKERTYPE, CS_MAINCOLOR, CS_CLASHCOLOR, CS_BLASTCOLOR, CS_SLEEPINIT, CS_LASTMEMBER, CS_VOLUME, CS_POWERONOFFTYPE, CS_BATTERYLEVEL, CS_STORAGEACCESS, CS_UARTMODE}; // never delete CS_LASTMEMBER!!! Needed to calculate number of elements in the enum type!!!
2929
#endif
3030

3131
// ====================================================================================

Config_HW.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Created on: 30 March 2017
55
* author: Andras Kun (kun.andras@yahoo.de)
6-
* Source : https://github.com/neskweek/LightSaberOS
6+
* Source : https://github.com/Protonerd/FX-SaberOS
77
* This tab contains all settings necessary to define your saber board's electronic hardware configuration
88
*/
99

Config_SW.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Created on: 30 March 2017
55
* author: Andras Kun (kun.andras@yahoo.de)
6-
* Source : https://github.com/neskweek/LightSaberOS
6+
* Source : https://github.com/Protonerd/FX-SaberOS
77
* This tab contains all settings necessary to define your saber board's electronic software configuration
88
*/
99

@@ -138,7 +138,7 @@
138138
* If instead you would like to work with pre-set color profiles (15 different, pre-defined colors)
139139
* comment out the line with GRAVITY_COLOR, which will define COLOR_PROFILE to be used.
140140
*************************************/
141-
#define GRAVITY_COLOR
141+
//#define GRAVITY_COLOR
142142
#ifndef GRAVITY_COLOR
143143
#define COLOR_PROFILE
144144
#endif

Light.cpp

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Light.cpp
33
*
44
* author: Sebastien CAPOU (neskweek@gmail.com) and Andras Kun (kun.andras@yahoo.de)lightClashEffect
5-
* Source : https://github.com/neskweek/LightSaberOS
5+
* Source : https://github.com/Protonerd/FX-SaberOS
66
*/
77
#include "Light.h"
88
#include "Config_HW.h"
@@ -932,16 +932,19 @@ void lightClashEffect(uint8_t ledPins[], cRGB color) {
932932
for (uint8_t i = 0; i <= 5; i++) {
933933
analogWrite(ledPins[i], 255);
934934
}
935+
delay(CLASH_FX_DURATION); // clash duration
935936
#endif
936937

937938
#if defined STAR_LED
938939
getColor(color);
939940
lightOn(ledPins, -1, currentColor);
941+
delay(CLASH_FX_DURATION); // clash duration
940942
#endif
941943

942944
#ifdef ADF_PIXIE_BLADE
943945
//getColor(storage.sndProfile[storage.soundFont].clashColor);
944946
lightOn(ledPins, -1, color);
947+
delay(CLASH_FX_DURATION); // clash duration
945948
#endif
946949

947950
#if defined PIXELBLADE
@@ -957,11 +960,110 @@ void lightClashEffect(uint8_t ledPins[], cRGB color) {
957960
else { // #else
958961
getColor(storage.sndProfile[storage.soundFont].clashColor);
959962
lightOn(ledPins, -1, currentColor);
963+
delay(CLASH_FX_DURATION); // clash duration
960964
} // #endif
961965
#endif
962966

963967
}
964968

969+
#ifdef COLOR_PROFILE
970+
void getColorFix(uint8_t colorID) {
971+
switch (colorID) {
972+
case 0:
973+
//Red
974+
currentColor.r = 200;
975+
currentColor.g = 0;
976+
currentColor.b = 0;
977+
break;
978+
case 1:
979+
//Yellow
980+
currentColor.r = 200;
981+
currentColor.g = 200;
982+
currentColor.b = 0;
983+
break;
984+
case 2:
985+
//Green
986+
currentColor.r = 0;
987+
currentColor.g = 200;
988+
currentColor.b = 0;
989+
break;
990+
case 3:
991+
//Aqua
992+
currentColor.r = 0;
993+
currentColor.g = 200;
994+
currentColor.b = 200;
995+
break;
996+
case 4:
997+
//Blue
998+
currentColor.r = 0;
999+
currentColor.g = 0;
1000+
currentColor.b = 200;
1001+
break;
1002+
case 5:
1003+
//Fuschia
1004+
currentColor.r = 200;
1005+
currentColor.g = 0;
1006+
currentColor.b = 200;
1007+
break;
1008+
case 6:
1009+
//DarkGrey
1010+
currentColor.r = 150;
1011+
currentColor.g = 150;
1012+
currentColor.b = 150;
1013+
break;
1014+
case 7:
1015+
//DarkOrange
1016+
currentColor.r = 200;
1017+
currentColor.g = 102;
1018+
currentColor.b = 0;
1019+
break;
1020+
case 8:
1021+
//DarkViolet
1022+
currentColor.r = 116;
1023+
currentColor.g = 0;
1024+
currentColor.b = 166;
1025+
break;
1026+
case 9:
1027+
//DodgerBlue
1028+
currentColor.r = 24;
1029+
currentColor.g = 112;
1030+
currentColor.b = 200;
1031+
break;
1032+
case 10:
1033+
//Gold
1034+
currentColor.r = 200;
1035+
currentColor.g = 168;
1036+
currentColor.b = 0;
1037+
break;
1038+
case 11:
1039+
//GoldenRod
1040+
currentColor.r = 170;
1041+
currentColor.g = 130;
1042+
currentColor.b = 24;
1043+
break;
1044+
case 12:
1045+
//Indigo
1046+
currentColor.r = 116;
1047+
currentColor.g = 0;
1048+
currentColor.b = 204;
1049+
break;
1050+
case 13:
1051+
//LightGreen
1052+
currentColor.r = 112;
1053+
currentColor.g = 186;
1054+
currentColor.b = 112;
1055+
break;
1056+
1057+
default:
1058+
// White (if enough voltage)
1059+
currentColor.r = 200;
1060+
currentColor.g = 200;
1061+
currentColor.b = 200;
1062+
break;
1063+
}
1064+
} //getColorFix
1065+
#endif
1066+
9651067
void BladeMeter (uint8_t ledPins[], int meterLevel) { //expects input of 0-100
9661068
//normalize data if to max and min if out of range
9671069
if (meterLevel <= 0) { meterLevel = 0; }

Light.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Created on: 21 Octber 2016
55
* author: Sebastien CAPOU (neskweek@gmail.com) and Andras Kun (kun.andras@yahoo.de)
6-
* Source : https://github.com/neskweek/LightSaberOS
6+
* Source : https://github.com/Protonerd/FX-SaberOS
77
*/
88

99
#if not defined LIGHT_H_
@@ -53,6 +53,8 @@ void lightClashEffect(uint8_t ledPins[], cRGB color={0,0,0});
5353
void pixelblade_KillKey_Enable();
5454
void pixelblade_KillKey_Disable();
5555

56+
void getColorFix(uint8_t colorID);
57+
5658
void FoCOn (uint8_t pin);
5759
void FoCOff (uint8_t pin);
5860

Soundfont.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
*
44
* Created on: 21 Octber 2016
55
* author: Sebastien CAPOU (neskweek@gmail.com) and Andras Kun (kun.andras@yahoo.de)
6-
* Source : https://github.com/neskweek/LightSaberOS
7-
* Description: Soundfont Config file for LightSaberOS
6+
* Source : Source : https://github.com/Protonerd/FX-SaberOS
7+
* Description: Soundfont Config file for FX-SaberOS
88
*
99
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
1010
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.

0 commit comments

Comments
 (0)