[tuxdroid-svn] r485 - firmware/tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-09-06 07:24:37
|
Author: jaguarondi Date: 2007-09-06 09:24:35 +0200 (Thu, 06 Sep 2007) New Revision: 485 Modified: firmware/tuxcore/trunk/global.c firmware/tuxcore/trunk/global.h firmware/tuxcore/trunk/main.c firmware/tuxcore/trunk/parser.c firmware/tuxcore/trunk/standalone.c Log: * Cleanup: removed all production test related stuff. The test_mode variable is now only used for the remote mode, so I renamed it remote_mode. Modified: firmware/tuxcore/trunk/global.c =================================================================== --- firmware/tuxcore/trunk/global.c 2007-09-05 15:24:47 UTC (rev 484) +++ firmware/tuxcore/trunk/global.c 2007-09-06 07:24:35 UTC (rev 485) @@ -28,9 +28,10 @@ /* * Standalone behavior */ +/* remote mode to control tux from the remote control, XXX to be replaced with + * a better approach from the standalone behavior */ +uint8_t remote_mode = 0; -uint8_t test_mode = BT_NO_TEST; /* normal mode */ - /* * General global registers */ Modified: firmware/tuxcore/trunk/global.h =================================================================== --- firmware/tuxcore/trunk/global.h 2007-09-05 15:24:47 UTC (rev 484) +++ firmware/tuxcore/trunk/global.h 2007-09-06 07:24:35 UTC (rev 485) @@ -322,7 +322,7 @@ * Standalone behavior */ -extern uint8_t test_mode; /* normal mode */ +extern uint8_t remote_mode; /* normal mode */ /* * General global registers @@ -375,7 +375,6 @@ * Test modes */ -#define mb_test_condition (PINC & _BV(PC2)) #define sigout_set turnLeftLedOn #define sigout_unset turnLeftLedOff #define sigin_ini() {LED_PT &= ~LED_R_MK; LED_DDR &= ~LED_R_MK;} /* used as signal input */ Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2007-09-05 15:24:47 UTC (rev 484) +++ firmware/tuxcore/trunk/main.c 2007-09-06 07:24:35 UTC (rev 485) @@ -147,10 +147,6 @@ */ int main(void) { - /* Prod tests condition check to enter mainboard test mode */ - if (mb_test_condition) - test_mode = BT_MBTEST; - /* I/O initialization */ initPosSwitches(); initMotors(); @@ -162,7 +158,7 @@ /* I2C communication initialization */ i2cCommunicationInit(); - /* Enables IR receiver */ + /* Enable IR receiver */ irGetRC5(); /* @@ -199,37 +195,6 @@ /* Wait for standalone actions to be done. */ if ((cond_flags.sleep == COND_SLEEP) && !event_timer) sleep(); - - /* - * Test and debug functions - */ - /* IR test procedure */ - // { - // while(1) - // { - // for (i=0; i<200;i++) _delay_ms (8); - // irSendRC5(0x1F,0x3F); - // } - // } - /* LDR test procedure */ - // { - // while(1) - // { - // for (i=0; i<200;i++) _delay_ms (8); - // getLight(); - // } - // } - -#if (TEST_CHARGER) - /* Test of the charger - * Use eyes LED's to indicate charger status */ - { - if (gStatus.sw & GSTATUS_CHARGER_MK) - turnLedsOff(); - else - turnLedsOn(); - } -#endif } } Modified: firmware/tuxcore/trunk/parser.c =================================================================== --- firmware/tuxcore/trunk/parser.c 2007-09-05 15:24:47 UTC (rev 484) +++ firmware/tuxcore/trunk/parser.c 2007-09-06 07:24:35 UTC (rev 485) @@ -194,20 +194,6 @@ return; } - /* Test modes */ - else if (command[0] == TEST_MODE_CMD) - { - if (!audioIntBufIdx) - { - for (i = 0; i < 3; i++) /* forwards the command to the audio CPU */ - audioIntBuf[i] = command[i]; - audioIntBufIdx = 3; - } - /* and switch to test mode */ - test_mode = command[1]; /* tuxcore test mode is the first parameter */ - return; - } - /* Version */ else if (command[0] == INFO_TUXCORE_CMD) { Modified: firmware/tuxcore/trunk/standalone.c =================================================================== --- firmware/tuxcore/trunk/standalone.c 2007-09-05 15:24:47 UTC (rev 484) +++ firmware/tuxcore/trunk/standalone.c 2007-09-06 07:24:35 UTC (rev 485) @@ -205,19 +205,14 @@ else setLeds(led_backup); - if ((!test_mode) || (test_mode == BT_REMOTE)) + /* Disable spinning when plugged */ + if ((gStatus.sw & GSTATUS_POWERPLUGSW_MK)) { - /* Disable spinning when plugged */ - if ((gStatus.sw & GSTATUS_POWERPLUGSW_MK)) - { - stopSpin(); /* flush the spinning commands */ - spinPosCnt = 0; - } - - /* Charging start notification */ + stopSpin(); /* flush the spinning commands */ + spinPosCnt = 0; } - if (test_mode == BT_REMOTE) + if (remote_mode) { /* BT_REMOTE: check buttons with leds */ if (gStatus. @@ -249,10 +244,10 @@ /* Entering remote mode */ if (ir_command == K_STARTVOIP) { - if (test_mode != BT_REMOTE) - test_mode = BT_REMOTE; + if (!remote_mode) + remote_mode = 1; else - test_mode = BT_NO_TEST; + remote_mode = 0; } } @@ -264,7 +259,7 @@ alt_mode = 0; /* Remote control mode */ - if (test_mode == BT_REMOTE) + if (remote_mode) { switch (ir_command) { @@ -327,196 +322,7 @@ break; } } - } - - /* Test mode */ - if (test_mode == BT_MBTEST) - { - volatile uint16_t i, j; - - /* Use led lines as communication signal */ - /* LED_R is still active low */ - - /* Release the signal input */ - sigin_ini(); - - /* #0 */ - for (i = 0; i < 0xFFF; i++) ; /* keep the negative pulse to synchronize with the tester */ - sigout_set(); /* signal test mode entered */ - /* #1 */ - while (!sigin) ; /* synchronize with the tester */ - - cli(); - /* Check capacitors */ - PORTD = 0x00; - DDRD = 0xFF; - PORTB = 0x00; - DDRB = 0xFF; - PORTC &= ~_BV(PC1); - DDRC |= _BV(PC1); - for (i = 0; i < 10; i++) - _delay_ms(5); - DDRD = 0x00; - DDRB = 0x00; - DDRC &= ~_BV(PC1); - PORTD |= (_BV(PD6) | _BV(PD7) | _BV(PD3)); - PORTB |= (_BV(PB3) | _BV(PB4)); - PORTC |= _BV(PC1); - _delay_ms(1); - if (PIND & (_BV(PD6) | _BV(PD7) | _BV(PD3))) - error(1); - if (PINB & (_BV(PB3) | _BV(PB4))) - error(2); - if (PINC & _BV(PC1)) - error(3); - - /* Check the shortcuts here */ - /* PORTB */ - PORTB = 0xFF; /* all pull-up */ - DDRB = 0xFF; - DDRC &= ~0x03; /* check only PC0 and PC1 */ - PORTC |= 0x03; /* all pull-up */ - DDRD = 0x00; - PORTD = 0xFF; /* all pull-up */ - for (j = 0; j < 5; j++) - _delay_ms(5); - DDRB = 0x00; - while (PINB != 0xFF) ; - while ((PINC & 0x03) != 0x03) ; - while (PIND != 0xFF) ; - for (i = 0; i < 8; i++) - { - PORTB = ~_BV(i); - DDRB = _BV(i); - if ((i == 3) || (i == 4) || (i == 7)) - for (j = 0; j < 10; j++) - _delay_ms(5); - while (PINB != (uint8_t) (~_BV(i))) ; - while ((PINC & 0x03) != 0x03) ; - while (PIND != 0xFF) ; - PORTB |= _BV(i); - if ((i == 3) || (i == 4) || (i == 7)) - for (j = 0; j < 10; j++) - _delay_ms(5); - } - PORTB = 0xFF; - /* PORTC */ - for (i = 0; i < 2; i++) - { - PORTC &= ~_BV(i); - DDRC |= _BV(i); - while (PINB != 0xFF) ; - while ((PINC & 0x03) != ((~_BV(i)) & 0x03)) ; - while (PIND != 0xFF) ; - PORTC |= _BV(i); - DDRC &= ~_BV(i); - } - /* PORTD */ - for (i = 0; i < 8; i++) - { - PORTD = ~_BV(i); - DDRD = _BV(i); - while (PINB != 0xFF) ; - while ((PINC & 0x03) != 0x03) ; - while (PIND != (uint8_t) (~_BV(i))) ; - } - - PORTB = 0x00; - DDRB = 0x00; - PORTD = 0x00; - DDRD = 0x00; - initMotors(); - CHARGER_INH_DDR |= CHARGER_INH_MK; - - /* Set the audio CPU in AT_MBTEST mode to check the flash and audio */ - audioIntBuf[0] = TEST_MODE_CMD; - audioIntBuf[2] = AT_MBTEST; - audioIntBufIdx = 3; - mb_test_flag = 0; - - test_mode = BT_MBTEST0; /* go to next state */ - /* #2 */ - sigout_unset(); - while (sigin) ; /* synchronize with the tester */ - } - else if (test_mode == BT_MBTEST0) /* check the I/O of the sound */ - { - if (gStatus.mic == 0xFF) - { - cli(); /* disable interrupts because the ADC ISR can affect PC0 */ - PORTC &= ~_BV(PC0); - while (PINC & _BV(PC0)) ; /* check the IR power connection */ - sei(); - /* #3 */ - sigout_set(); - while (!sigin) ; /* synchronize with the tester */ - sigout_unset(); - while (sigin) ; /* synchronize with the tester */ - - test_mode = BT_MBTEST1; /* go to next state */ - } - } - else if (test_mode == BT_MBTEST1) /* check the flash */ - { - if (gStatus.bat == 0xFF) - mb_test_flag = 1; - else if (gStatus.bat == 0xFE) /* flash failed */ - mb_test_flag = 0; - if ((gStatus.sw & GSTATUS_CHARGER_MK) && (gStatus.sw & STATUS_POWERPLUGSW_MK) && mb_test_flag) /* if not charging, not plugged and flash OK */ - { - /* #4 */ - sigout_set(); - while (!sigin) ; /* synchronize with the tester */ - test_mode = BT_MBTEST2; /* go to next state */ - } - } - else if (test_mode == BT_MBTEST2) /* check the motors */ - { - TIMSK2 = 0; - runEyes(); - sigout_unset(); - while (sigin) ; /* synchronize with the tester */ - runIEyes(); - sigout_set(); - while (!sigin) ; /* synchronize with the tester */ - stopEyes(); - runWingsFw(); - sigout_unset(); - while (sigin) ; /* synchronize with the tester */ - runWingsBw(); - sigout_set(); - while (!sigin) ; /* synchronize with the tester */ - stopWings(); - runSpinRight(); - sigout_unset(); - while (sigin) ; /* synchronize with the tester */ - runSpinLeft(); - sigout_set(); - while (!sigin) ; /* synchronize with the tester */ - stopSpin(); - - TIMSK2 = _BV(OCIE2A); - test_mode = BT_MBTEST3; /* go to next state */ - } - else if (test_mode == BT_MBTEST3) - { - if (!(gStatus.sw & GSTATUS_CHARGER_MK) && !(gStatus.sw & STATUS_POWERPLUGSW_MK)) /* if charging OK and plugged */ - { - /* #5 */ - sigout_unset(); - while (sigin) ; /* synchronize with the tester */ - while (!sigin) ; /* wait signal to turn the IR on */ - turnIrOn(); /* this should be the end of the test */ - test_mode = BT_NO_TEST; /* exit test mode */ - } - } - - /* Test mode */ - if (test_mode == BT_TEST_ALL) - { - } - } void error(uint8_t en) |