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

Fwxv 999 warrenxu 103 hw #232

Closed
wants to merge 9 commits into from
Closed

Fwxv 999 warrenxu 103 hw #232

wants to merge 9 commits into from

Conversation

warren-xu
Copy link

fw 102 tasks

}
TASK(task2, TASK_STACK_512) {
LOG_DEBUG("Task 2 initialized!\n");
const char outstr[ITEM_SZ];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should initialize your array like so
const char outstr[ITEM_SZ] = {};

uint32_t receive = 0;
while (true) {
// Your code goes here
ret = queue_receive(&s_queue1, &receive, 1000);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This &receive, doesn't really make sense. You're trying to put the item you receive in receive, but the receive size is only 4 bytes, while the item size is 6 bytes

uint32_t to_send = 0;
while (true) {
// Your code goes here
ret = queue_send(&s_queue1, s_list[to_send], 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to use &s_list[to_send] because this function takes in the address of the value you want to send, not the value itself

LOG_DEBUG("write to queue failed\n");
}
delay_ms(100);
++to_send;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about when to_send is greater than 5? What happens then?

delay_ms(100);
++to_send;
if (to_send >= 5) {
ret = STATUS_CODE_OUT_OF_RANGE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just use % QUEUE_LEN. That'll just go back to the first item

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

Successfully merging this pull request may close these issues.

3 participants