Skip to content

Commit

Permalink
all gifs added, changeable brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
andyh0913 committed Mar 19, 2019
1 parent 2a1720c commit 542ba69
Show file tree
Hide file tree
Showing 56 changed files with 73 additions and 73 deletions.
36 changes: 21 additions & 15 deletions control_7688/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ mraa::Spi spi(SPI_PORT);

bool light[16];

unsigned int num_ws = 5;
unsigned int num_led[] = {88,96,60,36,36};


int main() {
#ifdef USE_INTERNAL_PWM
Expand Down Expand Up @@ -67,25 +70,28 @@ int main() {
id %= 16;
light[id] = !light[id];
}
unsigned int num_ws = 5;
unsigned int num_led[] = {88,96,60,36,36};
for(unsigned int i=0;i<num_ws;i++){
spi.writeByte( (uint8_t)(63) ); // start byte
spi.writeByte( (uint8_t)(i) ); // i-th gif
for (unsigned int j=0;j<num_led[i];j++){
if (id == -1){
spi.writeByte( 0 );
spi.writeByte( 0 );
spi.writeByte( 1 );
if (id == -1){
for(unsigned int i=0;i<num_ws;i++){
spi.writeByte( (uint8_t)(63) ); // start byte
spi.writeByte( (uint8_t)(i) ); // i-th gif
for (unsigned int j=0;j<num_led[i];j++){
spi.writeByte( (uint8_t)(6) );
spi.writeByte( (uint8_t)(6) );
spi.writeByte( (uint8_t)(6) );
}
else{
spi.writeByte( 0 );
spi.writeByte( 0 );
spi.writeByte( 0 );
}
}
else{
for(unsigned int i=0;i<num_ws;i++){
spi.writeByte( (uint8_t)(63) ); // start byte
spi.writeByte( (uint8_t)(i) ); // i-th gif
for (unsigned int j=0;j<num_led[i];j++){
spi.writeByte( (uint8_t)(0) );
spi.writeByte( (uint8_t)(0) );
spi.writeByte( (uint8_t)(0) );
}
}
}
}

return 0;
}
6 changes: 3 additions & 3 deletions control_7688/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ int main(int argc, char** argv) {
time_ok = true;
}

int max_length = anim[0].size() - 20;
int max_length = anim[0].size() - 23;
int limit_length = anim[0].size();

int last_frame = -1;
Expand All @@ -311,7 +311,7 @@ int main(int argc, char** argv) {
}

int current_frame = (int)(tm*10);
if(tm < 0 || current_frame > limit_length){
if(tm < 0 || current_frame >= limit_length){
for(unsigned int i=0;i<num_ws;i++){
spi.writeByte( (uint8_t)(63) ); // start byte
spi.writeByte( (uint8_t)(i) ); // i-th gif
Expand All @@ -323,7 +323,7 @@ int main(int argc, char** argv) {
}
}
else if(current_frame > last_frame){
if(current_frame > max_length){
if(current_frame >= max_length){
// change max light
for(unsigned int i=0;i<anim.size();i++){
spi.writeByte( (uint8_t)(62) ); // start byte
Expand Down
38 changes: 20 additions & 18 deletions control_7688/led_arduino/led_arduino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

int NUM_LEDS[] = {88,96,60,36,36};
int LED_DT[] = {5, 6, 7, 8, 9};
int prev_time = 0;
//unsigned long prev_time = 0;

volatile boolean received;
volatile byte Slavereceived,Slavesend;

uint8_t max_bright = 64;
struct CRGB* ws[NUM_WS];
//struct CRGB leds[NUM_LEDS];
int led_counter = 0;
Expand All @@ -22,6 +21,7 @@ int rgb[3];

int wsid = -1;
bool check_wsid = false;
bool is_bright = false;

void setup() {
for (int i=0;i<NUM_WS;i++){
Expand All @@ -34,35 +34,37 @@ void setup() {
LEDS.addLeds<LED_TYPE, 9, COLOR_ORDER>(ws[4], NUM_LEDS[4]);

// LEDS.addLeds<LED_TYPE, LED_DT, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(max_bright);
FastLED.setBrightness(5);
//pinMode(MISO,OUTPUT); //Sets MISO as OUTPUT (Have to Send data to Master IN
SPCR |= _BV(SPE); //Turn on SPI in Slave Mode
received = false;
SPI.attachInterrupt(); //Interuupt ON is set for SPI commnucation
SPI.attachInterrupt(); //Interrupt ON is set for SPI commnucation
// pinMode(13,OUTPUT);
Serial.begin(2000000);
prev_time = millis();
}

ISR (SPI_STC_vect) //Interrrput routine function
ISR (SPI_STC_vect) //Inerrrput routine function
{
Slavereceived = SPDR; // Value received from master if store in variable slavereceived
received = true; //Sets received as True
}

void loop() {
if (millis()-prev_time>1000){
for(int i = 0;i < NUM_WS;i++){
for(int j = 0;j < NUM_LEDS[i]; j++){
ws[i][j].setRGB(0,0,0);
}
}
FastLED.show();
prev_time = millis();
}
if(received == true){
prev_time = millis();
if(Slavereceived == 63){ // start byte
if(is_bright){
FastLED.setBrightness(5);
is_bright = false;
}
rgb_counter = 0;
led_counter = 0;
check_wsid = true;
}
else if(Slavereceived == 62){
if(!is_bright){
FastLED.setBrightness(60);
is_bright = true;
}
rgb_counter = 0;
led_counter = 0;
check_wsid = true;
Expand All @@ -76,7 +78,7 @@ void loop() {
rgb[rgb_counter] = 0;
}
else{
rgb[rgb_counter] = (Slavereceived+1) << 2;
rgb[rgb_counter] = (Slavereceived+2) << 2;
}
rgb_counter++;
}
Expand All @@ -85,7 +87,7 @@ void loop() {
rgb[rgb_counter] = 0;
}
else{
rgb[rgb_counter] = (Slavereceived+1) << 2;
rgb[rgb_counter] = (Slavereceived+2) << 2;
}
rgb_counter = 0;
ws[wsid][led_counter].setRGB(rgb[0], rgb[1], rgb[2]);
Expand Down
2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws0.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws1.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws3.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws4.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws5.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws6.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion control_7688/led_gen/data_ws7.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions control_7688/led_gen/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
print ("Find " + filename)
frames = np.array([np.array(frame.copy().convert('RGB').getdata(),dtype=np.uint8).reshape(frame.size[1],frame.size[0],3) for frame in ImageSequence.Iterator(img)])
if j == 1: # shoulder is vertical
frames = np.concatenate([frames[:,:,0:4,:],frames[:,:,12:16,:]],axis=2)
frames = frames.transpose(0,2,1,3)
for a in range(frames.shape[0]):
for b in range(1,frames.shape[1],2):
frames[a][b] = np.flip(frames[a][b], 0)
frames_list = np.right_shift(frames,2).reshape(frames.shape[0], -1, 3)
if i >= 8 and j == 0:
frames_list = np.concatenate([frames_list,np.zeros([frames.shape[0],88-frames.shape[1],3],dtype=np.int)],axis=1)
q = np.where(frames_list <= 2)
#if i >= 8 and j == 0:
# frames_list = np.concatenate([frames_list,np.zeros([frames.shape[0],88-frames.shape[1],3],dtype=np.int)],axis=1)
p = np.where(frames_list <= 2)
w = np.where(frames_list > 2)
frames_list[p] = 0
frames_list[w] -= 2
Expand Down
Binary file modified control_7688/led_gen/gifs/0_0.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/0_1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/0_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/0_3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/0_4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified control_7688/led_gen/gifs/1_0.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/1_1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/1_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/1_3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/1_4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified control_7688/led_gen/gifs/2_0.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/2_1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/2_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/2_3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/2_4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified control_7688/led_gen/gifs/3_0.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/3_1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/3_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/3_3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/3_4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified control_7688/led_gen/gifs/4_0.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/4_1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/4_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/4_3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added control_7688/led_gen/gifs/4_4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified control_7688/led_gen/gifs/5_0.gif
Binary file added control_7688/led_gen/gifs/5_1.gif
Binary file added control_7688/led_gen/gifs/5_2.gif
Binary file added control_7688/led_gen/gifs/5_3.gif
Binary file added control_7688/led_gen/gifs/5_4.gif
Binary file modified control_7688/led_gen/gifs/6_0.gif
Binary file added control_7688/led_gen/gifs/6_1.gif
Binary file added control_7688/led_gen/gifs/6_2.gif
Binary file added control_7688/led_gen/gifs/6_3.gif
Binary file added control_7688/led_gen/gifs/6_4.gif
Binary file modified control_7688/led_gen/gifs/7_0.gif
Binary file added control_7688/led_gen/gifs/7_1.gif
Binary file added control_7688/led_gen/gifs/7_2.gif
Binary file added control_7688/led_gen/gifs/7_3.gif
Binary file added control_7688/led_gen/gifs/7_4.gif
Binary file added control_7688/upload/[email protected]
Binary file not shown.
Binary file added control_7688/upload/[email protected]
Binary file not shown.
6 changes: 3 additions & 3 deletions editor/translate_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def bbf2sec(bbf):
if len(tokens) >= 3:
a, b = tokens[2].split('/')
frac = float(a) / float(b)
if bar <= 41 :
if bar < 41 :
sec = ( bar * 4 + beat + frac ) * SEC_BEAT_1
elif bar <= 64 :
elif bar < 64 :
sec = 82.00 + ((bar-41)*4+beat+frac) * SEC_BEAT_2
elif bar <= 86:
elif bar < 86:
sec = 118.80 + ((bar-64)*4+beat+frac) * SEC_BEAT_3
else :
sec = 160.05 + ((bar-86)*4+beat+frac) * SEC_BEAT_4
Expand Down
37 changes: 14 additions & 23 deletions editor/tron.in
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
69-1 70-1 2357ABCDEFGHIJKLMNOP

70-1-1/4 70-2-3/4 6ABCDEFGHIJKLMNOP
70-2 70-2-3/4 123457ABCDEFGHIJKLMNOP
70-2 70-3 123457ABCDEFGHIJKLMNOP

70-3 71-2 0ABCDEFGHIJKLMNOP
71-2-1/8 73-2 4ABCDEFGHIJKLMNOP
Expand Down Expand Up @@ -542,28 +542,17 @@
82-4-11/12 86-1 12ABCDEFGHIJKLMN
84-1 86-1 126OP
85-1 87-1 6ABCDEFGHIJKLMNOP
87-1 87-1-3/4 2N FO
87-1-1/4 87-2 2M FO
87-1-2/4 87-2-1/4 5N FO
87-1-3/4 87-2-2/4 5M FO
87-2 87-2-3/4 0N FO
87-2-1/4 87-3 0M FO
87-2-2/4 87-3-1/4 0N FO
87-2-3/4 87-3-2/4 5M FO
87-3 87-3-3/4 5N FO
87-3-1/4 87-4 2M FO
87-3-2/4 87-4 2N FO
87-1 87-1-3/4 1M FO
87-1-1/4 87-2 1N FO
87-1-2/4 87-2-1/4 7M FO
87-1-3/4 87-2-2/4 7N FO
87-2 87-2-3/4 3M FO
87-2-1/4 87-3 3N FO
87-2-2/4 87-3-1/4 3M FO
87-2-3/4 87-3-2/4 7N FO
87-3 87-3-3/4 7M FO
87-3-1/4 87-4 1N FO
87-3-2/4 87-4 1M FO
87-1 87-1-8/11 2N+1M FO
87-1-4/11 87-2-1/11 2M+1N FO
87-1-8/11 87-2-5/11 5N+7M FO
87-2-1/11 87-2-9/11 5M+7N FO
87-2-5/11 87-3-2/11 0N+3M FO
87-2-9/11 87-3-6/11 0M+3N FO
87-3-2/11 87-3-10/11 0N+3M FO
87-3-6/11 87-4-3/11 5M+7N FO
87-3-10/11 87-4-7/11 5N+7M FO
87-4-3/11 88-1 2M+1N FO
87-4-7/11 88-1-4/11 2N+1M FO
88-1 88-1-3/5 4MN
88-1-3/5 88-2 4LMN
88-2 88-2-2/5 4BCDEFGHIJKLMNOP
Expand Down Expand Up @@ -679,6 +668,8 @@
118-3 118-4 5134ABCDEFGHIJKLMNOP
118-4 119-1 05134ABCDEFGHIJKLMNOP
119-1 120-4 205134ABCDEFGHIJKLMNOP
119-3 120-4 6ABCDEFGHIJKLMNOP




0 comments on commit 542ba69

Please sign in to comment.