Skip to content

Commit 9476dab

Browse files
author
Tom
committed
bug fix in setup command
setup command is not working properly without a space after each ",". Added commands: debug: to enable/disable debugging mode settings: to display current settings
1 parent c8d6ca8 commit 9476dab

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

main.c

+22-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void setup_ledstring(char * args){
224224
ledstring.channel[1].brightness=atoi(value);
225225
}
226226
}
227-
args++;
227+
//args++;
228228
}
229229
}
230230

@@ -239,6 +239,22 @@ void setup_ledstring(char * args){
239239

240240
}
241241

242+
//prints channel settings
243+
void print_settings(){
244+
printf("Frequency: %d.\n",ledstring.freq);
245+
printf("DMA num: %d.\n",ledstring.dmanum);
246+
printf("Channel 1:\n");
247+
printf(" GPIO: %d\n", ledstring.channel[0].gpionum);
248+
printf(" Invert: %d\n",ledstring.channel[0].invert);
249+
printf(" Count: %d\n",ledstring.channel[0].count);
250+
printf(" Brightness: %d\n",ledstring.channel[0].brightness);
251+
printf("Channel 2:\n");
252+
printf(" GPIO: %d\n", ledstring.channel[1].gpionum);
253+
printf(" Invert: %d\n",ledstring.channel[1].invert);
254+
printf(" Count: %d\n",ledstring.channel[1].count);
255+
printf(" Brightness: %d\n",ledstring.channel[1].brightness);
256+
}
257+
242258
//sends the buffer to the leds
243259
//render <channel>,0,AABBCCDDEEFF...
244260
//optional the colors for leds:
@@ -612,6 +628,11 @@ void execute_command(char * command_line){
612628
if (thread_running==0 && mode==MODE_TCP) init_thread(arg);
613629
}else if (strcmp(command, "setup")==0){
614630
setup_ledstring(arg);
631+
}else if (strcmp(command, "settings")==0){
632+
print_settings();
633+
}else if (strcmp(command, "debug")==0){
634+
if (debug) debug=0;
635+
else debug=1;
615636
}else if (strcmp(command, "exit")==0){
616637
printf("Exiting.\n");
617638
exit_program=1;

test_2_channels.txt

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
setup channels=2,channel_1_gpio=18,channel_2_gpio=13,channel_1_count=5,channel_2_count=5
2+
rainbow 1
3+
rainbow 2
4+
brightness 1,32
5+
brightness 2,32
6+
render 1
7+
render 2
8+
do
9+
do
10+
rotate 1
11+
rotate 2
12+
render 1
13+
render 2
14+
delay 100
15+
loop 5
16+
17+
do
18+
rotate 1,1,2
19+
rotate 2,1,2
20+
render 2
21+
render 1
22+
delay 100
23+
loop 5
24+
loop

0 commit comments

Comments
 (0)