forked from ewowi/StarBase
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Live scripts test - disabled by default
enable: include STARBASE_USERMOD_LIVE in pio.ini Add octo.sc LedEffects, LedModEffects - add LiveScriptEffect UserModLive - add LEDs specific code
- Loading branch information
1 parent
7540833
commit 1bb19f6
Showing
4 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
//import memset | ||
//save_reg | ||
define PI 3.1415926535 | ||
define speed 1 | ||
define nb_branches 5 | ||
uint8_t C_X ; | ||
uint8_t C_Y; | ||
uint8_t mapp; | ||
uint8_t rMapRadius[NUM_LEDS]; | ||
uint8_t rMapAngle[NUM_LEDS]; | ||
uint32_t t; //=speed | ||
|
||
void setup() | ||
{ | ||
C_X = width / 2; | ||
C_Y = height / 2; | ||
mapp = 255 / width; | ||
for (int x = -C_X; x < C_X + (width % 2); x++) { | ||
for (int y = -C_Y; y < C_Y + (height % 2); y++) { | ||
|
||
float h=128*(atan2(y, x)/PI); | ||
rMapAngle[(x + C_X) *height+y + C_Y]= (int)(h); | ||
h=hypot(x,y)*mapp; | ||
rMapRadius[(x + C_X)*height +y + C_Y] = (int)(h); //thanks Sutaburosu | ||
} | ||
} | ||
} | ||
|
||
|
||
void loop() { | ||
|
||
// memset(leds, 0, width * height * 3); | ||
for (uint8_t x = 0; x < width; x++) { | ||
for (uint8_t y = 0; y < height; y++) { | ||
uint8_t angle = rMapAngle[x*height+y]; | ||
uint8_t radius = rMapRadius[x*height+y]; | ||
|
||
// leds[y*panel_width+x] = hsv(t + radius, 255, sin8(t*4+sin8(t * 4 - radius)+angle*nb_branches)); | ||
// int h=sin8(t*4+sin8(t * 4 - radius)+angle*nb_branches); | ||
// leds[y*panel_width+x] = hsv(t + radius, 255, h); | ||
|
||
sPC(y*panel_width+x, hsv(t + radius, 255, sin8(t*4+sin8(t * 4 - radius)+angle*nb_branches))); | ||
} | ||
} | ||
t=t+speed; | ||
//delay(16); | ||
} | ||
|
||
void main() { | ||
resetStat(); | ||
setup(); | ||
while (2>1) { | ||
loop(); | ||
show(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters