Skip to content

Commit 1a72b0e

Browse files
committed
Do not print reps errors during adm, count and report at end.
1 parent 6d827ec commit 1a72b0e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

prawn_do/prawn_do.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ int main(){
539539
// reset do_cmd_count to start_address
540540
do_cmd_count = start_addr * 2;
541541

542+
uint32_t reps_error_count = 0;
543+
uint32_t last_reps_error_idx = 0;
544+
542545
// It takes 6 bytes to describe an instruction: 2 bytes for values, 4 bytes for time
543546
uint32_t inst_per_buffer = SERIAL_BUFFER_SIZE / 6;
544547
// In this loop, we read nearly full serial buffers and load them into do_cmds.
@@ -553,7 +556,9 @@ int main(){
553556
| (serial_buf[6*i+3] << 8)
554557
| serial_buf[6*i+2]);
555558
if(reps < 5 && reps != 0){
556-
fast_serial_printf("Reps must be 0 or greater than 4, got %x\r\n", reps);
559+
reps_error_count++;
560+
last_reps_error_idx = (do_cmd_count + 1) / 2;
561+
reps = 0;
557562
}
558563
if(reps != 0){
559564
reps -= 4;
@@ -577,7 +582,9 @@ int main(){
577582
| (serial_buf[6*i+3] << 8)
578583
| serial_buf[6*i+2]);
579584
if(reps < 5 && reps != 0){
580-
fast_serial_printf("Reps must be 0 or greater than 4, got %x\r\n", reps);
585+
reps_error_count++;
586+
last_reps_error_idx = (do_cmd_count + 1) / 2;
587+
reps = 0;
581588
}
582589
if(reps != 0){
583590
reps -= 4;
@@ -587,7 +594,12 @@ int main(){
587594
}
588595
}
589596

590-
fast_serial_printf("ok\r\n");
597+
if(reps_error_count > 0){
598+
fast_serial_printf("Invalid number of reps in %d instructions, most recent error at instruction %d. Setting reps to zero for these instructions.\r\n", reps_error_count, last_reps_error_idx);
599+
}
600+
else{
601+
fast_serial_printf("ok\r\n");
602+
}
591603
}
592604
// Dump command: print the currently loaded buffered outputs
593605
else if(strncmp(serial_buf, "dmp", 3) == 0){

0 commit comments

Comments
 (0)