Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tx_buffer Variable Unneded #31

Open
kb1lqd opened this issue Oct 24, 2016 · 0 comments
Open

tx_buffer Variable Unneded #31

kb1lqd opened this issue Oct 24, 2016 · 0 comments

Comments

@kb1lqd
Copy link
Contributor

kb1lqd commented Oct 24, 2016

In rf.c the variable tx_buffer[] was defined as a global variable and was moved into the only function that used it when documenting the code. Inspection shows that this buffer is only used as a copy to then again copy into the Transmit() function. The tx_buffer[] operations could be completely removed likely and directly copy into the Transmit() function.

void radio_tx(unsigned char *buffer, unsigned char buffer_len){
    unsigned char tx_buffer[62];
    unsigned char i;
    //BUG: Doesn't check for buffer size too long...
    for(i=0;i<buffer_len;i++){
        tx_buffer[i] = buffer[i];
    }
    for(i=buffer_len;i<TX_PACKET_LEN;i++){
        tx_buffer[i] = 0xff;
    }

    Transmit((unsigned char *)tx_buffer, TX_PACKET_LEN);

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant