git.droids-corp.org
/
aversive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
irrational unblocking, low speed obstacle bug and spicke pack when y too big
[aversive.git]
/
projects
/
microb2010
/
cobboard
/
main.c
diff --git
a/projects/microb2010/cobboard/main.c
b/projects/microb2010/cobboard/main.c
index
62103c8
..
ad496ca
100755
(executable)
--- a/
projects/microb2010/cobboard/main.c
+++ b/
projects/microb2010/cobboard/main.c
@@
-115,16
+115,21
@@
void bootloader(void)
void do_led_blink(__attribute__((unused)) void *dummy)
{
void do_led_blink(__attribute__((unused)) void *dummy)
{
-#if 1 /* simple blink */
- static uint8_t a=0;
+ static uint8_t a = 0;
- if(a)
- LED1_ON();
- else
- LED1_OFF();
-
- a = !a;
-#endif
+ if (cobboard.flags & DO_ERRBLOCKING) {
+ if (a & 1)
+ LED1_ON();
+ else
+ LED1_OFF();
+ }
+ else {
+ if (a & 4)
+ LED1_ON();
+ else
+ LED1_OFF();
+ }
+ a++;
}
static void main_timer_interrupt(void)
}
static void main_timer_interrupt(void)
@@
-153,7
+158,8
@@
int main(void)
memset(&gen, 0, sizeof(gen));
memset(&cobboard, 0, sizeof(cobboard));
/* cs is enabled after arm_calibrate() */
memset(&gen, 0, sizeof(gen));
memset(&cobboard, 0, sizeof(cobboard));
/* cs is enabled after arm_calibrate() */
- cobboard.flags = DO_ENCODERS | DO_POWER; // DO_BD
+ cobboard.flags = DO_ENCODERS | DO_POWER | DO_BD |
+ DO_ERRBLOCKING;
/* UART */
uart_init();
/* UART */
uart_init();
@@
-167,13
+173,17
@@
int main(void)
# error not supported
#endif
# error not supported
#endif
- //eeprom_write_byte(EEPROM_MAGIC_ADDRESS, EEPROM_MAGIC_COBBOARD);
/* check eeprom to avoid to run the bad program */
if (eeprom_read_byte(EEPROM_MAGIC_ADDRESS) !=
EEPROM_MAGIC_COBBOARD) {
/* check eeprom to avoid to run the bad program */
if (eeprom_read_byte(EEPROM_MAGIC_ADDRESS) !=
EEPROM_MAGIC_COBBOARD) {
+ int c;
sei();
sei();
- printf_P(PSTR("Bad eeprom value\r\n"));
- while(1);
+ printf_P(PSTR("Bad eeprom value ('f' to force)\r\n"));
+ c = uart_recv(CMDLINE_UART);
+ if (c == 'f')
+ eeprom_write_byte(EEPROM_MAGIC_ADDRESS, EEPROM_MAGIC_COBBOARD);
+ wait_ms(100);
+ bootloader();
}
/* LOGS */
}
/* LOGS */
@@
-183,8
+193,6
@@
int main(void)
error_register_notice(mylog);
error_register_debug(mylog);
error_register_notice(mylog);
error_register_debug(mylog);
- wait_ms(3000);
-
/* SPI + ENCODERS */
encoders_spi_init(); /* this will also init spi hardware */
/* SPI + ENCODERS */
encoders_spi_init(); /* this will also init spi hardware */
@@
-248,6
+256,8
@@
int main(void)
sei();
sei();
+ printf_P(PSTR("cobboard start\r\n"));
+
/* actuators */
actuator_init();
/* actuators */
actuator_init();
@@
-265,6
+275,9
@@
int main(void)
gen.log_level = 5;
cobboard.flags |= DO_CS;
gen.log_level = 5;
cobboard.flags |= DO_CS;
+ spickle_pack(I2C_LEFT_SIDE);
+ spickle_pack(I2C_RIGHT_SIDE);
+
state_machine();
cmdline_interact();
state_machine();
cmdline_interact();