Skip to content

ncp #6

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
22 changes: 12 additions & 10 deletions ball_detect/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,19 @@ void sendc(uint8_t ch) {

ISR(USART_RX_vect) {
PORTD ^= 1 << 3;
uint32_t modulo, position;
uint8_t read_char = UDR0, i, j;
uint32_t now = 0, small = 9999999, index = 0;
uint8_t read_char = UDR0, j, message = 0;
if(read_char == my_address) {
for(j = 2; j >= 0; j--) {
modulo = vision_result[j];
position = 1000000;
for(i = 0; i < 7; i++) {
sendc((modulo / position) % 10);
modulo %= position;
position /= 10;
for(j = 0; j < 3; j++) {
if(small > vision_result[j]) {
small = vision_result[j];
now = vision_result[j];
index = j;
}
}
message = (index << 6);
message |= now/(2 << 7);
sendc(message);
}
}

Expand All @@ -107,7 +108,8 @@ ISR(PCINT0_vect) {
starts_of_pulses[ct] = TCNT1;
} else {
ends_of_pulses[ct] = TCNT1;
lenghts_of_pulses[ct] = abs(ends_of_pulses[ct] - starts_of_pulses[ct]);
lenghts_of_pulses[ct] = abs(ends_of_pulses[ct] -
starts_of_pulses[ct]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This line looks terrible with hard tabs. Please set ts=8 noet and align it that way using spaces as well.

}
}
}
Expand Down