X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fmain.c;h=90e9ff1e6e7782bda0e41cee99c91f8d4a40149a;hp=98d374917e6a5500863746c62347fc1801562516;hb=9d056416278ae5d772a0fc1f7d2d11a4461fb673;hpb=6914527de2ecfef9d790740c71739e7418246b96 diff --git a/projects/microb2010/mainboard/main.c b/projects/microb2010/mainboard/main.c index 98d3749..90e9ff1 100755 --- a/projects/microb2010/mainboard/main.c +++ b/projects/microb2010/mainboard/main.c @@ -67,6 +67,7 @@ #include "actuator.h" #include "cs.h" #include "strat_base.h" +#include "strat_db.h" #include "i2c_protocol.h" /* 0 means "programmed" @@ -83,8 +84,8 @@ struct genboard gen; struct mainboard mainboard; -struct cobboard cobboard; -struct ballboard ballboard; +volatile struct cobboard cobboard; +volatile struct ballboard ballboard; #ifndef HOST_VERSION /***********************/ @@ -184,6 +185,8 @@ int main(void) memset(&mainboard, 0, sizeof(mainboard)); mainboard.flags = DO_ENCODERS | DO_CS | DO_RS | DO_POS | DO_POWER | DO_BD | DO_ERRBLOCKING; + ballboard.lcob = I2C_COB_NONE; + ballboard.rcob = I2C_COB_NONE; /* UART */ uart_init(); @@ -195,13 +198,17 @@ int main(void) fdevopen(uart1_dev_send, uart1_dev_recv); #endif - //eeprom_write_byte(EEPROM_MAGIC_ADDRESS, EEPROM_MAGIC_MAINBOARD); /* check eeprom to avoid to run the bad program */ if (eeprom_read_byte(EEPROM_MAGIC_ADDRESS) != EEPROM_MAGIC_MAINBOARD) { + int c; 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_MAINBOARD); + wait_ms(100); + bootloader(); } #endif /* ! HOST_VERSION */ @@ -289,7 +296,7 @@ int main(void) /* strat */ gen.logs[0] = E_USER_STRAT; gen.log_level = 5; - strat_reset_infos(); + strat_db_init(); /* strat-related event */ scheduler_add_periodical_event_priority(strat_event, NULL,