tux-droid-svn Mailing List for Tux Droid CE (Page 212)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Paul_R <c2m...@c2...> - 2007-11-27 09:38:38
|
Author: Paul_R Date: 2007-11-27 10:38:35 +0100 (Tue, 27 Nov 2007) New Revision: 730 Modified: firmware/tuxaudio/trunk/AT26F004.c firmware/tuxaudio/trunk/AT26F004.h firmware/tuxaudio/trunk/PC_communication.c firmware/tuxaudio/trunk/flash.c firmware/tuxaudio/trunk/flash.h firmware/tuxaudio/trunk/main.c firmware/tuxaudio/trunk/varis.c firmware/tuxaudio/trunk/varis.h firmware/tuxdefs/api.h firmware/tuxdefs/commands.h Log: * The way to store the sounds in the memory has changed : Now, the indexes aren't not sent by the PC, but they are computed by the firmware. The sound's track are stored one by one in the memory. When the storage is done, the program waits for a confirmation. If the storage is confirmed, the indexes are written, else the sound is directly erased. The status have changed. Two new status commands have been created, one for the playback, the other for the recording. The number of sounds stored in the memory and the last used block are also sent to the PC each time they're changing. Modified: firmware/tuxaudio/trunk/AT26F004.c =================================================================== --- firmware/tuxaudio/trunk/AT26F004.c 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/AT26F004.c 2007-11-27 09:38:35 UTC (rev 730) @@ -24,9 +24,10 @@ #include "hardware.h" #include "spi.h" +static void unprotect_sectors(void); /** * \ingroup at26f004 - * \brief initialize a table with the sectors adresses values + * \brief initialize a table with the sector adresses values */ static uint8_t sector_adress[11][3] = { {SECTOR0}, @@ -117,6 +118,17 @@ */ void erase_flash(void) { + + unprotect_sectors(); + write_enable(); /* Enable the writing */ + + flash_select(); + spiSend(CHIP_ERASE); /* Send Erase Bulk command */ + flash_unselect(); +} + +static void unprotect_sectors(void) +{ uint8_t i; write_status(0x00); /* Disable sector protection register */ for (i=0; i<=10; i++) @@ -124,14 +136,7 @@ write_enable(); /* Enable the writing */ unprotect_sector(sector_adress[i][0], sector_adress[i][1],sector_adress[i][2]); } - - write_enable(); /* Enable the writing */ - - flash_select(); - spiSend(CHIP_ERASE); /* Send Erase Bulk command */ - flash_unselect(); } - /** * \ingroup at26f004 \param ad2 high address part @@ -168,7 +173,6 @@ { uint8_t data1; - flash_enable(); // Set the HOLD signal flash_select(); spiSend(READ_ARRAY_LOW_F); /* Send Read Page Command */ /* Send address */ @@ -177,10 +181,41 @@ spiSend(ad0); data1 = spiSend(NOP); /* Wait response */ flash_unselect(); - flash_onhold(); // Reset the HOLD signal return data1; } +/** + * \ingroup at26f004 + \param first_block The first block to erase + \param last_block The last block to erase + \brief This function erase a specified area in the memory. The memory will be erased by 4kB's blocks. + */ +void blockErase(uint8_t first_block, uint8_t last_block) +{ + uint8_t diff, ad0, ad1; + // unprotect all sectors + unprotect_sectors(); + // diff is the number of block to erase + diff = last_block - first_block + 1; + while(diff) + { + // Erase a 4kB block + write_enable(); + flash_select(); + ad0 = (last_block >> 4); + ad1 = (last_block << 4); + spiSend(BLOCK_ERASE_4K); /* Send Erase Bulk command */ + spiSend(ad0); + spiSend(ad1); + spiSend(0x00); + flash_unselect(); + + diff --; + last_block --; + while (read_status() & BUSY); + } +} + Modified: firmware/tuxaudio/trunk/AT26F004.h =================================================================== --- firmware/tuxaudio/trunk/AT26F004.h 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/AT26F004.h 2007-11-27 09:38:35 UTC (rev 730) @@ -146,6 +146,7 @@ /** \name Misc. functions * @{ */ extern void erase_flash(void); +extern void blockErase(uint8_t first_block, uint8_t last_block); extern void unprotect_sector(uint8_t const ad2, uint8_t const ad1, uint8_t const ad0); /* @} */ Modified: firmware/tuxaudio/trunk/PC_communication.c =================================================================== --- firmware/tuxaudio/trunk/PC_communication.c 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/PC_communication.c 2007-11-27 09:38:35 UTC (rev 730) @@ -44,7 +44,7 @@ asm volatile /* Clear the SPI interrupt flag */ ("in __tmp_reg__, %0" "\n\t" "in __tmp_reg__, %1" "\n\t":: "I" (_SFR_IO_ADDR(SPSR)), "I"(_SFR_IO_ADDR(SPDR))); - + flash_onhold(); PORTB &= ~0x04; // Chip select while (1) { @@ -113,6 +113,20 @@ spi_lenght_data = 34; else spi_lenght_data = 17; + if (spi_master_config == 0x08 || spi_master_config == 0x00) + { + if (frame_without_sound) + frame_without_sound --; + + else + sound_played = 0; + } + else + { + sound_played = 1; + frame_without_sound = frame_without_sound_timeout; + } + spi_master = PUT_SOUND_FIFO; // Go to the next state if (!programmingFlash && !flashPlay) // XXX code must be review it's very strange ..... @@ -169,6 +183,7 @@ } } } + flash_enable(); } } Modified: firmware/tuxaudio/trunk/flash.c =================================================================== --- firmware/tuxaudio/trunk/flash.c 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/flash.c 2007-11-27 09:38:35 UTC (rev 730) @@ -27,101 +27,248 @@ #include "i2c.h" #include "flash.h" #include "AT26F004.h" +#include "common/api.h" + /* Declarations */ -/* Theses functions are declared with the static attribute, so they're - * accessible only by this module */ - -static void erasingFlash(void); -static void programmingNumSound(void); -static void programmingToc(void); -static void initSoundProgramming(void); -static void soundProgramming(void); -static void endProgramming(void); - +static void init_programming(uint8_t adi0, uint8_t adi1, uint8_t adi2); +static void programming_sound(void); static void playInit(uint8_t const nsound); static void playingSound(void); static void stopPlaying(void); -uint8_t f_state; uint8_t flash_state; -uint8_t ad0, ad1, ad2, i, j; - uint8_t soundNum; +static uint16_t index; +static uint8_t sound_stored = 0; +static uint8_t count, ad0, ad1; +static uint8_t first_block; -/* Public functions */ /** * \ingroup flash - \brief This function is used to reprogram sound flash memory.. - - This function is structured like a state machine. The six states are : - - ERASE_STATE which perform a full chip erase. This state turn off the PWM - and disable I2C interrupt. - - FIRST_PROG_STATE write the number of sounds to be stored. - - PROG_TOC_STATE write the sound's indexes each time a INDEX COMMAND is - received. The last indexes are stored. - - INIT_SOUND_PROG_STATE initiate the memory to a sequential programming. The - first sound byte is writed in the flash. - - SOUND_PROG_STATE store all the sound data received. - - END_STATE clear all variable used to control the programming task, and - reswitch-on the I2C and the PWM timer. + \brief Read the number of sound in the flash memory. + This function scan the sound's indexes, and return the number of sound stored + in the flash memory. */ -void flashProgramming(void) -{ - SPCR = 0x00; - SPCR = 0X50; - PORTB |= 0x01; - if (f_state == ERASE_STATE) +uint8_t readFlashNumber(void) +{ + uint8_t i; + ad0 = 0x01; + ad1 = 0x00; + count = 0; + while(1) { - if (flash_state) - erasingFlash(); - - else if (!(read_status() & BUSY)) + if (read_data(0x00, ad1, ad0) == 0xFF) { - send_status(STATUS_AUDIO_CMD, 0, 2, 0); - f_state ++; + count --; + return count; } + else + { + for (i = 0; i < 3; i++) + { + ad0 ++; + if (ad0 == 0) + ad1++; + } + } + count ++; } - else if (f_state == FIRST_PROG_STATE) + return 0; +} + +uint8_t readLastBlock(uint8_t num) +{ + index = (numSound * 3) + 1; + ad[0] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[1] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[2] = read_data(0x00, (index>>8), (index & 0xFF)); + return (ad[0] << 4) + (ad[1] >> 4); +} +/** + * \ingroup flash + \brief Store a sound in the memory. + + This function contain 5 states : + + DETECT_INDEXES : Detect if the memory is empty or not, and determine where the sound must be stored. + + PROG_INIT : Start the programmation cycle with the indexes determinated in the first state. + + PROGRAMMING : Program the memory with the sound byte received by the RF. + + PROG_TOC : If the programming sequence is finished, the indexes are written. + + PROG_END : Restore the context. + + \note Each sound starts at the first byte of a 4kB block. To do this, the + lower address byte is reset, and the medium address byte is incremented. + +*/ + +void programming(void) +{ + uint8_t static programming_state = DETECT_INDEXES; + if (programming_state == DETECT_INDEXES) { - send_status(STATUS_AUDIO_CMD, 0, 3, 0); - programmingNumSound(); - send_status(STATUS_AUDIO_CMD, 0, 4, 0); - f_state ++; - } - else if (f_state == PROG_TOC_STATE) - { - if (TOCRX) + TIMSK0 = 0x00; + //numSound = readFlashNumber(); + if (numSound == 0) { - programmingToc(); + /* The flash memory is empty. The first address is 0x000400 */ + ad[0] = 0x00; + ad[1] = 0x04; + ad[2] = 0x00; + first_block = 0; } + else + { + /* One or more sounds are programmed in the flash memory. + * The next sound must be stored after the others */ + index = (numSound * 3) + 1; + ad[0] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[1] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[2] = read_data(0x00, (index>>8), (index & 0xFF)); - if (flash_state) - f_state ++; + // Goto the next 4kB block. + ad[1] += 0x10; + ad[1] &= ~0x0F; + if (ad[1] == 0) + ad[0] ++; + ad[2] = 0; + first_block = (ad[0] << 4) + (ad[1] >> 4); + } + resetFifo(&PWMFifo); + + if (ad[0] > 0x07) + { + programming_state = PROG_END; + send_status(STATUS_FLASH_PROG_CMD, FLASH_FULL, 0, 0); + } + else + programming_state ++; + + frame_without_sound = 5000; + frame_without_sound_timeout = 5000; + send_status(STATUS_FLASH_PROG_CMD, IN_PROGRESS, ad[0], ad[1]); } - else if (f_state == INIT_SOUND_PROG_STATE) + + else if (programming_state == PROG_INIT) { - initSoundProgramming(); + init_programming(ad[0], ad[1], ad[2]); + programming_state ++; + flash_state = 1; + sound_stored = 0; + } + else if (programming_state == PROGRAMMING) + { if (flash_state) + programming_sound(); + + else { - send_status(STATUS_AUDIO_CMD, 0, 5, 0); - f_state ++; + write_disable(); + if (sound_stored) + { + last_block = (ad[0] << 4) + (ad[1] >> 4); + send_status(STATUS_FLASH_PROG_CMD, WAITING_FOR_CONFIRMATION, last_block - first_block, 0); + programming_state ++; + } + else + { + send_status(STATUS_FLASH_PROG_CMD, NO_SOUND, 0, 0); + programming_state = PROG_END; + } } + } + else if (programming_state == WAITING_STATE) + { + if (write_toc == 1) + { + programming_state = PROG_TOC; + } + else if (write_toc == 2) + { + send_status(STATUS_FLASH_PROG_CMD, ERASING_LAST_SOUND, 0, 0); + if (first_block == 0) + { + eraseFlag = 1; + frame_without_sound_timeout = TTS_TIMEOUT; + programming_state = 0; + programmingFlash = 0; + } + else + { + last_block = (ad[0] << 4) + (ad[1] >> 4); + blockErase(first_block, last_block); + programming_state = PROG_END; + } + } + write_toc = 0; } - if (f_state == SOUND_PROG_STATE) + else if (programming_state == PROG_TOC) { - soundProgramming(); + send_status(STATUS_FLASH_PROG_CMD, WRITE_TOC, 0, 0); + numSound ++; + index = (numSound * 3) + 1; + program_flash(0x00, (index>>8), (index & 0xFF), ad[0]); + index ++; + program_flash(0x00, (index>>8), (index & 0xFF), ad[1]); + index ++; + program_flash(0x00, (index>>8), (index & 0xFF), ad[2]); + last_block = (ad[0] << 4) + (ad[1] >> 4); + programming_state ++; + } + else if (programming_state == PROG_END) + { + numSound = readFlashNumber(); + frame_without_sound_timeout = TTS_TIMEOUT; + programming_state = 0; + programmingFlash = 0; + TIMSK0 = 0x01; + //info_flg = 1; + send_status(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); + send_status(SOUND_VAR_CMD, numSound, last_block, 0); + } +} - if (flash_state) - f_state ++; +/** + * \ingroup flash + \brief Erase the flash memory. + + The first step is to send the command to erase the flash. + After, the status is polled while the erase process isn't finished. + When the BUSY flag is null, the erase sequence is stopped. +*/ +void erase(void) +{ + uint8_t static enter = 1; + if (enter) + { + erase_flash(); + enter = 0; } - else if (f_state == END_STATE) + else if (!(read_status() & BUSY)) { - endProgramming(); - send_status(STATUS_AUDIO_CMD, 0, 0, 0); - f_state = 0; + //send_status(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); + enter = 1; + eraseFlag = 0; + program_flash(0x00, 0x00, 0x00, 0xFE); + program_flash(0x00, 0x00, 0x01, 0x00); + program_flash(0x00, 0x00, 0x02, 0x04); + program_flash(0x00, 0x00, 0x03, 0x00); + numSound = 0; + last_block = 0; + send_status(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); + send_status(SOUND_VAR_CMD, numSound, last_block, 0); + //info_flg = 1; + TIMSK0 = 0x01; } } @@ -132,20 +279,18 @@ The first step (playInit) is to initialize the flash memory with the selected sound to play. Many tests are made to ensure that the sound to play exist, the indexes are correct, etc. - The second step (playingSound) is to fill the fifo with the sound's bytes, and to verify the adresses. + The second step (playingSound) is to fill the fifo with the sound's bytes, and to verify the addresses. + */ - */ + void playSound(void) { if (flash_state) - playInit(soundNum); + playInit(soundToPlay); else playingSound(); } - - - /* Static functions */ /** * \ingroup flash @@ -163,50 +308,54 @@ static void playInit(uint8_t const nsound) { - uint8_t count, i; - uint8_t adp1, adp0, sounds_stored; // Address pointer varaible - flash_enable(); - sounds_stored = read_data(0x00, 0x00, 0x00); - if (sounds_stored == 0xFF) /* if unprogrammed we have 0xFF stored in flash */ + uint8_t i; + + if (numSound == 0x00) /* if unprogrammed we have 0xFF stored in flash */ { flashPlay = 0; return; } - if (!nsound || (nsound > sounds_stored)) /* check the limits */ + if (!nsound || (nsound > numSound)) /* check the limits */ { flashPlay = 0; return; } count = 1; - adp1 = 0x00; - adp0 = 0x01; + ad1 = 0x00; + ad0 = 0x01; while (count != nsound) // Compute address { for (i = 0; i < 3; i++) { - adp0++; - if (adp0 == 0) - adp1++; + ad0++; + if (ad0 == 0) + ad1++; } count++; } - flash_select(); // Chip Select - flash_enable(); spiSend(READ_ARRAY_LOW_F); // Send Read Page Command spiSend(0x00); // Send Address - spiSend(adp1); - spiSend(adp0); + spiSend(ad1); + spiSend(ad0); for (i = 0; i < 6; i++) { ad[i] = spiSend(NOP); // Read start and stop sound address } + if (nsound > 1) + { + ad[1] += 0x10; + ad[1] &= ~0x0F; + if (ad[1] == 0) + ad[0] ++; + ad[2] = 0; + } flash_unselect(); // Chip Deselect - /* Check adresses */ + /* Check addresses */ if (ad[0] > TOP_A2) { flashPlay = 0; @@ -255,7 +404,6 @@ spiSend(ad[0]); // Send Address spiSend(ad[1]); spiSend(ad[2]); - flash_onhold(); // Reset the HOLD signal OCR0A = 250; // Normal operation for PWM if fifo adaptative is on flash_state = 0; @@ -273,7 +421,6 @@ static void playingSound(void) { uint8_t sound; - flash_enable(); while (!spi_start && !isFifoFull(&PWMFifo)) { sound = spiSend(0x00); // Wait response @@ -302,7 +449,6 @@ break; } } - flash_onhold(); } /* Static functions */ @@ -311,181 +457,99 @@ \brief Stop the play sequence. */ - static void stopPlaying(void) { + soundToPlay = 0; flashPlay = 0; send_status(STATUS_AUDIO_CMD, 0, 0, 0); PORTB |= 0x01; // Set the HOLD signal PORTB |= 0x02; // Chip Deselect } - /** * \ingroup flash - * \brief Erase the flash memory. - * - * This funtion perform a full erase of the flash memory and initiate the sound - * flash programming. - */ -static void erasingFlash(void) + \brief Init the programming sequence + + To perform a sequential programming, the first step is to send the correct OP + code, and the three address bytes where the first data byte must be stored. + The second step is to send the OP code and a data to write. + + This function perform the first step. + */ +static void init_programming(uint8_t adi0, uint8_t adi1, uint8_t adi2) { - /* Desactivate the PWM */ - TCCR0A = 0x00; - TCCR0B = 0x00; - OCR0A = 0x00; - TIMSK0 = 0x00; - - - resetFifo(&PWMFifo); /* Reinitialise the PWM fifo */ - erase_flash(); /* Erase the flash */ - flash_state = 0; + write_enable(); + flash_select(); + spiSend(SEQU_PROGRAM); + spiSend(adi0); + spiSend(adi1); + spiSend(adi2); + if (!isFifoEmpty(&PWMFifo)) + spiSend(pullFifo(&PWMFifo)); + else + spiSend(0x80); + + flash_unselect(); // Chip Deselect } + /** * \ingroup flash - * \brief Write the number of sound to be stored. - * - This function store the first TOC byte (numSound), received with the flash - program command, at the first memory adress. - */ + \brief Program the sound's data into the flash memory -static void programmingNumSound(void) -{ - program_flash(0x00, 0x00, 0x00, numSound); // Write first byte of the TOC + This function is executed while the SPI start command is not present. Each + cycle, one byte is popped from the PWM fifo and stored in the sound flash. - ad0 = 0x01; // Init TOC address - ad1 = 0x00; - ad2 = 0x00; - i = 0; -} -/** - * \ingroup flash - * \brief Write the TOC in the memory. - * - * This function store the the indexes into the memory. - */ + The frame_without_sound variable is decremented each time the RF receive a + frame without sound. When this variable is null, the sound process is + stopped. -static void programmingToc(void) -{ - TOCRX = 0; - flash_state = 0; - for (j = 0; j < 3; j++) - { - program_flash(ad2, ad1, ad0, TOCadress[j]); - ad0++; // Increment new adress - if (ad0 == 0x00) - ad1++; - } - i++; + If a programming sequence starts, but no sound is received, the cycle is + stopped. - /* Store the final adress */ - if (i == numSound + 1) - { - ad[0] = TOCadress[2]; - ad[1] = TOCadress[1]; - ad[2] = TOCadress[0]; + If the address is equal to 0x07FFFF (the last memory address), the programming + cycle is stopped. - /* Init the first sound byte adress */ - ad2 = 0x00; - ad1 = 0x04; - ad0 = 0x00; - - flash_state = 1; - } -} -/** - * \ingroup flash - * \brief Initiate the sound programming. - * - * This function initiate the sound flash memory for a sequential programming. + The sound_stored flag is set when at least one byte is stored in the memory. + Else, this variable is null. */ -static void initSoundProgramming (void) +static void programming_sound(void) { - flash_state = 0; - write_enable(); - flash_select(); - spiSend(SEQU_PROGRAM); - spiSend(ad2); - spiSend(ad1); - spiSend(ad0); - while (!spi_start) // Send first byte into the page flash + while (!spi_start) { - if (!isFifoEmpty(&PWMFifo)) // Fifo not empty + if (!isFifoEmpty(&PWMFifo)) { - spiSend(pullFifo(&PWMFifo)); // Write data in flash - ad0++; - flash_state = 1; // End of firt command - break; - } - else - flash_state = 0; - } - flash_unselect(); // Chip Deselect -} + sound_stored = 1; + frame_without_sound = STOP_FRAME_NUMBER; + frame_without_sound_timeout = STOP_FRAME_NUMBER; -/** - * \ingroup flash - * \brief Program the sound in the flash memory. - * - * This function store the sound in the flash memory. - */ -static void soundProgramming(void) -{ - flash_state = 0; - while (!spi_start) - { - if (!isFifoEmpty(&PWMFifo)) // Fifo not empty - { - flash_select(); // Chip Select - spiSend(SEQU_PROGRAM); // Send Sequencial Program Command - spiSend(pullFifo(&PWMFifo)); // Write data in flash - flash_unselect(); // Chip DeselecT - ad0++; // Increment address byte - if (ad0 == 0x00) + flash_select(); + spiSend(SEQU_PROGRAM); + spiSend(pullFifo(&PWMFifo)); + flash_unselect(); + + ad[2] ++; + if (ad[2] == 0x00) { - ad1++; - if (ad1 == 0x00) - ad2++; + ad[1]++; + if (ad[1] == 0x00) + ad[0]++; } - while (read_status() & BUSY) ; // Wait Page Program Cycle + while (read_status() & BUSY) ; } /* Check for the last sound byte */ - if (ad2 == ad[2]) + if (!(frame_without_sound)) { - if (ad1 == ad[1]) - { - if (ad0 == ad[0]) - { - flash_state = 1; - break; // Stop programming flash - } - } + flash_state = 0; + break; } + if (ad[0] == 0x07 && ad[1] == 0xFF && ad[2] == 0xFF) + { + flash_state = 0; + break; + } } } -/** - * \ingroup flash - * \brief This function end the flash programming task. - * - * This function restore all the parameters. - */ - -static void endProgramming (void) -{ - write_disable(); // Disable wrtie flash - flash_state = 0; - TCCR0A = 0x23; // Reactivate PWM - TCCR0B = 0x09; - OCR0A = 249; /* we need TOP=250 to get a 8kHz sampling frequency */ - TIMSK0 = 0x01; - - TWCR = (TWCR & TWCR_CMD_MASK) | _BV(TWIE); // Reactivate I2C - - programmingFlash = 0; // Reset the flag to suspend the task -} - - Modified: firmware/tuxaudio/trunk/flash.h =================================================================== --- firmware/tuxaudio/trunk/flash.h 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/flash.h 2007-11-27 09:38:35 UTC (rev 730) @@ -36,18 +36,43 @@ /** \name Flash programming states @{ */ -#define ERASE_STATE 0 -#define FIRST_PROG_STATE 1 -#define PROG_TOC_STATE 2 -#define INIT_SOUND_PROG_STATE 3 -#define SOUND_PROG_STATE 4 -#define END_STATE 5 +enum { + DETECT_INDEXES = 0, + PROG_INIT, + PROGRAMMING, + WAITING_STATE, + PROG_TOC, + PROG_END, +}; /* @} */ +/** \name No sound in frame timeout + @{ */ +#define STOP_FRAME_NUMBER 10 +#define TTS_TIMEOUT 10 +#define START_FRAME_NUMBER 100 +/* @} */ +/** \name Flash programming status + @{ */ +/* +enum { + STANDBY = 0, + IN_PROGRESS, + WAITING_FOR_CONFIRMATION, + WRITE_TOC, + ERASING_LAST_SOUND, + FLASH_FULL, + NO_SOUND, +}; +*/ +/* @} */ -extern void flashProgramming(void); +extern void programming(void); extern void playSound(void); +extern void erase(void); +extern uint8_t readFlashNumber(void); +extern uint8_t readLastBlock(uint8_t num); /** start / end flash states flag */ extern uint8_t flash_state; Modified: firmware/tuxaudio/trunk/main.c =================================================================== --- firmware/tuxaudio/trunk/main.c 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/main.c 2007-11-27 09:38:35 UTC (rev 730) @@ -54,7 +54,7 @@ {REVISION_CMD, SVN_REV, RELEASE_TYPE}; const version_t tag_version __attribute__ ((section("version.1"))) = {VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE}; -static uint8_t info_flg = 0; /* indicates if version information should be sent */ + static uint8_t pre_sleep_delay = 0; /* set when sleep should be entered */ void send_info(void) @@ -70,8 +70,8 @@ i2cSlaveReceiveService(4, buf + 8); sei(); buf[0] = SOUND_VAR_CMD; - buf[1] = read_data(0x00, 0x00, 0x00); - buf[2] = 0; + buf[1] = numSound; + buf[2] = last_block; buf[3] = 0; cli(); i2cSlaveReceiveService(4, buf); @@ -164,7 +164,7 @@ return; audioLevel = audioBuf[2]; //playingAudio(audioBuf[1]); /* start playing the sound */ - soundNum = audioBuf[1]; + soundToPlay = audioBuf[1]; send_status(STATUS_AUDIO_CMD, audioBuf[1], 0, 0); flashPlay = 1; flash_state = 1; @@ -201,30 +201,26 @@ { if (flashPlay) flashPlay = 0; - /* param: command[1] : number of sounds */ - numSound = command[1]; - f_state =0; /* First programming state */ flash_state = 1; /* Erasing flash flag */ - send_status(STATUS_AUDIO_CMD, 0, 1, 0); programmingFlash = 1; /* Set the flag to enter programming sequence */ } - else if (command[0] == STORE_INDEX_CMD) + else if (command[0] == ERASE_FLASH_CMD) { - /* param: command[1] : lower address byte */ - /* command[2] : middle address byte */ - /* command[3] : higher address byte */ - TOCadress[2] = command[3]; // High address - TOCadress[1] = command[2]; // Medium address - TOCadress[0] = command[1]; // Lower address - TOCRX = 1; // Set TOC incoming flag - command[0] = 0; + eraseFlag = 1; } /* Version */ else if (command[0] == INFO_TUXAUDIO_CMD) + info_flg = 1; /* info should be sent when the buffer will be free */ + + else if (command[0] == CONFIRM_STORAGE_CMD) { - info_flg = 1; /* info should be sent when the buffer will be free */ + if (command[1]) + write_toc = 1; + else + write_toc = 2; } + else pushCommands(command); /* push the command set on the filo stack */ } @@ -244,8 +240,11 @@ if (PINB & 0x40) command[1] |= 0x20; command[1] ^= 0x9B; /* some bits should be inverted */ - command[2] = audio_level; - command[3] = battery_level; + command[2] = soundToPlay; + if (soundToPlay || sound_played) + command[3] = 1; + else + command[3] = 0; pushCommands(command); /* push the command set on the filo stack */ } @@ -256,8 +255,10 @@ resetFifo(&PWMFifo); /* Initialise the PWM fifo */ resetFifo(&ADCFifo); /* Initialise the ADC fifo */ config_init(); /* load the configuration defaults from EEPROM */ - + numSound = readFlashNumber(); + last_block = readLastBlock(numSound); i2cCommunicationInit(); /* I2C initialization */ + frame_without_sound_timeout = TTS_TIMEOUT; sei(); /* Init global interrupt */ @@ -297,11 +298,14 @@ } if (programmingFlash) // Restora all the context for flash programming - flashProgramming(); + programming(); if (flashPlay) playSound(); + if (eraseFlag) + erase(); + if (sendSensorsFlag) { sendSensorsFlag = 0; Modified: firmware/tuxaudio/trunk/varis.c =================================================================== --- firmware/tuxaudio/trunk/varis.c 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/varis.c 2007-11-27 09:38:35 UTC (rev 730) @@ -51,15 +51,15 @@ fifo_t ADCFifo = { (uint8_t *) ADCbuffer, sizeof ADCbuffer - 1, 0, 0 }; // Flash programming +uint8_t eraseFlag = 0; volatile unsigned char programmingFlash = 0; -volatile unsigned char numSound; -volatile unsigned char TOCadress[3]; -volatile unsigned char TOCRX = 0; +volatile uint8_t numSound; // Flash Variables volatile unsigned char flashPlay = 0; volatile unsigned char ad[6]; volatile unsigned char audioLevel; +uint8_t soundToPlay; unsigned char sendSensorsCmpt, sendSensorsFlag; unsigned char audio_level, battery_level; @@ -70,3 +70,12 @@ volatile unsigned char lockAdaptFifo = 1; volatile unsigned char Fifoinert = 0; + +uint16_t frame_without_sound = 0; +uint16_t frame_without_sound_timeout= 0; +uint8_t sound_played = 0; +uint8_t last_block = 0; + +// General flags +uint8_t info_flg = 0; /* indicates if version information should be sent */ +uint8_t write_toc = 0; Modified: firmware/tuxaudio/trunk/varis.h =================================================================== --- firmware/tuxaudio/trunk/varis.h 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxaudio/trunk/varis.h 2007-11-27 09:38:35 UTC (rev 730) @@ -59,15 +59,16 @@ extern fifo_t ADCFifo; // Flash programming + +extern uint8_t eraseFlag; extern volatile unsigned char programmingFlash; -extern volatile unsigned char numSound; -extern volatile unsigned char TOCadress[3]; -extern volatile unsigned char TOCRX; +extern volatile uint8_t numSound; // Flash Variables extern unsigned char flashPlay; extern volatile unsigned char ad[6]; extern volatile unsigned char audioLevel; +extern uint8_t soundToPlay; extern unsigned char sendSensorsCmpt, sendSensorsFlag; extern unsigned char audio_level, battery_level; @@ -80,5 +81,12 @@ extern volatile unsigned char lockAdaptFifo; extern volatile unsigned char Fifoinert; +extern uint16_t frame_without_sound; +extern uint16_t frame_without_sound_timeout; +extern uint8_t sound_played; +extern uint8_t last_block; +// General flags +extern uint8_t info_flg; +extern uint8_t write_toc; #endif Modified: firmware/tuxdefs/api.h =================================================================== --- firmware/tuxdefs/api.h 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxdefs/api.h 2007-11-27 09:38:35 UTC (rev 730) @@ -188,6 +188,18 @@ */ #define SOUND_VAR_CMD 0xCB +/** States of the audio recording (flash programming) process */ +typedef enum audiorec_status +{ + STANDBY = 0, + IN_PROGRESS, + WAITING_FOR_CONFIRMATION, + WRITE_TOC, + ERASING_LAST_SOUND, + FLASH_FULL, + NO_SOUND, +} audiorec_status_t; + /*! @} */ /*! @} */ Modified: firmware/tuxdefs/commands.h =================================================================== --- firmware/tuxdefs/commands.h 2007-11-27 09:09:53 UTC (rev 729) +++ firmware/tuxdefs/commands.h 2007-11-27 09:38:35 UTC (rev 730) @@ -99,12 +99,14 @@ #define PLAY_SOUND_CMD 0x90 /* play a sound from the flash sound bank */ /* 1st parameter: sound number */ /* 2nd parameter: sound volume */ -#define STORE_SOUND_CMD 0x52 /* start flash sound bank storage [1] */ -/* 1st parameter: number of sounds to store */ -#define STORE_INDEX_CMD 0xD0 /* get indexes of the flash sound bank [1] */ -/* 1st parameter: lower address byte */ -/* 2nd parameter: middle address byte */ -/* 3rd parameter: higher address byte */ +#define STORE_SOUND_CMD 0x52 + +#define CONFIRM_STORAGE_CMD 0x53 +/* 1st parameter: 1 to write the sound + * 0 to not write the sound*/ + +#define ERASE_FLASH_CMD 0xD0 /* get indexes of the flash sound bank [1] */ + #define TEST_SOUND_CMD 0x10 /* test the audio input and output [1] */ #define MUTE_CMD 0x92 /* mute/unmute the audio amplifier */ /* 1st parameter: mute state 0:unmute 1:mute */ @@ -122,8 +124,7 @@ #define SLEEP_CMD 0xB7 /* set the CPU in sleep mode */ /* 1st parameter: reserved */ /* 2nd parameter: type of sleep mode */ -#define DEEPSLEEP_MODE 1 /* minimal power consumption, can't wake-up from this - mode */ +#define DEEPSLEEP_MODE 1 /* minimal power consumption, can't wake-up from this mode */ #define SLEEP_MODE 2 /* standard sleep mode */ #define SLEEP_ACK_CMD 0xF7 /* acknowledge of the sleep mode command */ /* 1st parameter: acknowledge of tuxcore */ @@ -167,7 +168,7 @@ /* send sensors status of the audio CPU to the core CPU */ #define SEND_AUDIOSENSORS_CMD 0xF0 -/* send sensors status of the audio CPU to the computer */ +/* send the playback status */ #define STATUS_SENSORS1_CMD 0xC1 /* 1st parameter: switches and status from the audio CPU * .0: left wing push button @@ -188,9 +189,17 @@ #define STATUS_RF_MK 0x20 #define STATUS_VCC_MK 0x20 #define STATUS_MUTE_MK 0x80 -/* 2nd parameter: microphone level */ -/* 3rd parameter: battery level */ +/* 2nd parameter: sound played from the flash + * 3rd parameter: audio activity + * .0: True if a sound is played from the flash memory, TTS or streaming. + */ +/* send the programming state from the audio CPU */ +#define STATUS_FLASH_PROG_CMD 0xCD +/* 1st parameter: The current state (see flash.h) + * 2nd parameter: The size of the last sound (1 = 4kB) + */ + #define STATUS_LIGHT_CMD 0xC2 /* 1st parameter: light level high byte */ /* 2nd parameter: light level low byte */ |
From: jaguarondi <c2m...@c2...> - 2007-11-27 09:09:53
|
Author: jaguarondi Date: 2007-11-27 10:09:53 +0100 (Tue, 27 Nov 2007) New Revision: 729 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Only kept one API function to get the sound flash information. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-27 09:08:35 UTC (rev 728) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-27 09:09:53 UTC (rev 729) @@ -654,15 +654,6 @@ case DATA_STATUS_RF_CONNECTED: result[1] = RF_status; break; - case DATA_STATUS_SOUND_COUNT: - result[1] = tux_status.sound_flash.number_of_sounds; - break; - case DATA_STATUS_FLASH_USAGE: - result[1] = tux_status.sound_flash.flash_usage; - break; - case DATA_STATUS_AVAILABLE_RECORD_TIME: - result[1] = tux_status.sound_flash.available_record_time; - break; case DATA_STATUS_SOUND_FLASH: result[1] = tux_status.sound_flash.number_of_sounds; result[2] = tux_status.sound_flash.flash_usage; Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 09:08:35 UTC (rev 728) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 09:09:53 UTC (rev 729) @@ -178,12 +178,9 @@ #define DATA_STATUS_RIGHT_BLUE_LED 0x20 #define DATA_STATUS_RF_CONNECTED 0x21 #define DATA_STATUS_IR_CODE 0x22 -#define DATA_STATUS_SOUND_COUNT 0x23 #define DATA_STATUS_PONG 0x24 #define DATA_STATUS_BATTERY 0x25 #define DATA_STATUS_AUDIO 0x26 -#define DATA_STATUS_FLASH_USAGE 0x27 -#define DATA_STATUS_AVAILABLE_RECORD_TIME 0x28 #define DATA_STATUS_SOUND_FLASH 0x29 /* tux connection commands available on the usb dongle */ @@ -359,7 +356,7 @@ /** Battery status. * 'loaded' can be used to filter out 'level' measurements that occurred * when the motors were running as the battery voltage is highly affected - * by the load. */ + * by the load. */ struct { unsigned int level; /**< Last battery level measurement (raw data |
From: jaguarondi <c2m...@c2...> - 2007-11-27 09:08:34
|
Author: jaguarondi Date: 2007-11-27 10:08:35 +0100 (Tue, 27 Nov 2007) New Revision: 728 Modified: api/python/trunk/tuxapi_class.py Log: * Only kept one single status function for the sound flash information. Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-27 08:29:31 UTC (rev 727) +++ api/python/trunk/tuxapi_class.py 2007-11-27 09:08:35 UTC (rev 728) @@ -1101,7 +1101,7 @@ STATUS_MOUTH_POSITION_COUNTER, STATUS_WINGS_POSITION_COUNTER, STATUS_SPIN_POSITION_COUNTER, STATUS_RIGHT_BLUE_LED, STATUS_RF_CONNECTED, STATUS_IR_CODE, - STATUS_SOUND_COUNT, STATUS_PONG, + STATUS_SOUND_FLASH, STATUS_PONG, STATUS_BATTERY, STATUS_MICRO_ENERGY, ) @@ -3538,6 +3538,7 @@ return self.sounds_count() def sounds_count(self): """ + Deprecated, use tux.status.sound_flash instead. Get the number of sounds stored in the flash memory Return a integer (0..255) @@ -3545,37 +3546,9 @@ Example: >>> var = tux.status.sounds_count() """ - return self.get_one_status(DATAS_STATUS_SOUND_COUNT) + return self.sound_flash()[0] #-------------------------------------------------------------------------- - # Get the flash usage as percentage - #-------------------------------------------------------------------------- - def flash_usage(self): - """ - Get the usage of the sound flash memory as a percentage filled - - Return a integer (0..100) - - Example: - >>> var = tux.status.flash_usage() - """ - return self.get_one_status(DATAS_STATUS_FLASH_USAGE) - - #-------------------------------------------------------------------------- - # Get the sound duration still available to record in the sound flash - #-------------------------------------------------------------------------- - def available_record_time(self): - """ - Get the sound duration still available to record in the sound flash - - Return a integer (0..255) - - Example: - >>> var = tux.status.available_record_time() - """ - return self.get_one_status(DATAS_STATUS_AVAILABLE_RECORD_TIME) - - #-------------------------------------------------------------------------- # Get sound flash information #-------------------------------------------------------------------------- def sound_flash(self): |
From: Paul_R <c2m...@c2...> - 2007-11-27 08:29:48
|
Author: Paul_R Date: 2007-11-27 09:29:31 +0100 (Tue, 27 Nov 2007) New Revision: 727 Modified: firmware/tuxaudio/branches/new_flash_programming/AT26F004.c firmware/tuxaudio/branches/new_flash_programming/AT26F004.h firmware/tuxaudio/branches/new_flash_programming/PC_communication.c firmware/tuxaudio/branches/new_flash_programming/flash.c firmware/tuxaudio/branches/new_flash_programming/flash.h firmware/tuxaudio/branches/new_flash_programming/main.c firmware/tuxaudio/branches/new_flash_programming/varis.c firmware/tuxaudio/branches/new_flash_programming/varis.h Log: * Changed the way to program the sounds in the memory Modified: firmware/tuxaudio/branches/new_flash_programming/AT26F004.c =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/AT26F004.c 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/AT26F004.c 2007-11-27 08:29:31 UTC (rev 727) @@ -24,6 +24,7 @@ #include "hardware.h" #include "spi.h" +static void unprotect_sectors(void); /** * \ingroup at26f004 * \brief initialize a table with the sector adresses values @@ -117,6 +118,17 @@ */ void erase_flash(void) { + + unprotect_sectors(); + write_enable(); /* Enable the writing */ + + flash_select(); + spiSend(CHIP_ERASE); /* Send Erase Bulk command */ + flash_unselect(); +} + +static void unprotect_sectors(void) +{ uint8_t i; write_status(0x00); /* Disable sector protection register */ for (i=0; i<=10; i++) @@ -124,14 +136,7 @@ write_enable(); /* Enable the writing */ unprotect_sector(sector_adress[i][0], sector_adress[i][1],sector_adress[i][2]); } - - write_enable(); /* Enable the writing */ - - flash_select(); - spiSend(CHIP_ERASE); /* Send Erase Bulk command */ - flash_unselect(); } - /** * \ingroup at26f004 \param ad2 high address part @@ -180,5 +185,37 @@ return data1; } +/** + * \ingroup at26f004 + \param first_block The first block to erase + \param last_block The last block to erase + \brief This function erase a specified area in the memory. The memory will be erased by 4kB's blocks. + */ +void blockErase(uint8_t first_block, uint8_t last_block) +{ + uint8_t diff, ad0, ad1; + // unprotect all sectors + unprotect_sectors(); + // diff is the number of block to erase + diff = last_block - first_block + 1; + while(diff) + { + // Erase a 4kB block + write_enable(); + flash_select(); + ad0 = (last_block >> 4); + ad1 = (last_block << 4); + spiSend(BLOCK_ERASE_4K); /* Send Erase Bulk command */ + spiSend(ad0); + spiSend(ad1); + spiSend(0x00); + flash_unselect(); + + diff --; + last_block --; + while (read_status() & BUSY); + } +} + Modified: firmware/tuxaudio/branches/new_flash_programming/AT26F004.h =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/AT26F004.h 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/AT26F004.h 2007-11-27 08:29:31 UTC (rev 727) @@ -146,6 +146,7 @@ /** \name Misc. functions * @{ */ extern void erase_flash(void); +extern void blockErase(uint8_t first_block, uint8_t last_block); extern void unprotect_sector(uint8_t const ad2, uint8_t const ad1, uint8_t const ad0); /* @} */ Modified: firmware/tuxaudio/branches/new_flash_programming/PC_communication.c =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/PC_communication.c 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/PC_communication.c 2007-11-27 08:29:31 UTC (rev 727) @@ -117,9 +117,15 @@ { if (frame_without_sound) frame_without_sound --; + + else + sound_played = 0; } else + { + sound_played = 1; frame_without_sound = frame_without_sound_timeout; + } spi_master = PUT_SOUND_FIFO; // Go to the next state Modified: firmware/tuxaudio/branches/new_flash_programming/flash.c =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/flash.c 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/flash.c 2007-11-27 08:29:31 UTC (rev 727) @@ -27,6 +27,7 @@ #include "i2c.h" #include "flash.h" #include "AT26F004.h" +#include "common/api.h" /* Declarations */ static void init_programming(uint8_t adi0, uint8_t adi1, uint8_t adi2); @@ -40,6 +41,7 @@ static uint16_t index; static uint8_t sound_stored = 0; static uint8_t count, ad0, ad1; +static uint8_t first_block; /** @@ -59,7 +61,10 @@ while(1) { if (read_data(0x00, ad1, ad0) == 0xFF) - return count - 1; + { + count --; + return count; + } else { for (i = 0; i < 3; i++) @@ -73,6 +78,17 @@ } return 0; } + +uint8_t readLastBlock(uint8_t num) +{ + index = (numSound * 3) + 1; + ad[0] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[1] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[2] = read_data(0x00, (index>>8), (index & 0xFF)); + return (ad[0] << 4) + (ad[1] >> 4); +} /** * \ingroup flash \brief Store a sound in the memory. @@ -100,13 +116,14 @@ if (programming_state == DETECT_INDEXES) { TIMSK0 = 0x00; - numSound = readFlashNumber(); + //numSound = readFlashNumber(); if (numSound == 0) { /* The flash memory is empty. The first address is 0x000400 */ ad[0] = 0x00; ad[1] = 0x04; ad[2] = 0x00; + first_block = 0; } else { @@ -120,20 +137,26 @@ ad[2] = read_data(0x00, (index>>8), (index & 0xFF)); // Goto the next 4kB block. - ad[1] ++; + ad[1] += 0x10; + ad[1] &= ~0x0F; if (ad[1] == 0) ad[0] ++; ad[2] = 0; + first_block = (ad[0] << 4) + (ad[1] >> 4); } resetFifo(&PWMFifo); if (ad[0] > 0x07) + { programming_state = PROG_END; + send_status(STATUS_FLASH_PROG_CMD, FLASH_FULL, 0, 0); + } else programming_state ++; - frame_without_sound = 255; - frame_without_sound_timeout = 255; + frame_without_sound = 5000; + frame_without_sound_timeout = 5000; + send_status(STATUS_FLASH_PROG_CMD, IN_PROGRESS, ad[0], ad[1]); } else if (programming_state == PROG_INIT) @@ -146,20 +169,52 @@ else if (programming_state == PROGRAMMING) { if (flash_state) - { programming_sound(); - } + else { write_disable(); if (sound_stored) + { + last_block = (ad[0] << 4) + (ad[1] >> 4); + send_status(STATUS_FLASH_PROG_CMD, WAITING_FOR_CONFIRMATION, last_block - first_block, 0); programming_state ++; + } else + { + send_status(STATUS_FLASH_PROG_CMD, NO_SOUND, 0, 0); programming_state = PROG_END; + } } - } + } + else if (programming_state == WAITING_STATE) + { + if (write_toc == 1) + { + programming_state = PROG_TOC; + } + else if (write_toc == 2) + { + send_status(STATUS_FLASH_PROG_CMD, ERASING_LAST_SOUND, 0, 0); + if (first_block == 0) + { + eraseFlag = 1; + frame_without_sound_timeout = TTS_TIMEOUT; + programming_state = 0; + programmingFlash = 0; + } + else + { + last_block = (ad[0] << 4) + (ad[1] >> 4); + blockErase(first_block, last_block); + programming_state = PROG_END; + } + } + write_toc = 0; + } else if (programming_state == PROG_TOC) { + send_status(STATUS_FLASH_PROG_CMD, WRITE_TOC, 0, 0); numSound ++; index = (numSound * 3) + 1; program_flash(0x00, (index>>8), (index & 0xFF), ad[0]); @@ -167,13 +222,19 @@ program_flash(0x00, (index>>8), (index & 0xFF), ad[1]); index ++; program_flash(0x00, (index>>8), (index & 0xFF), ad[2]); + last_block = (ad[0] << 4) + (ad[1] >> 4); programming_state ++; } else if (programming_state == PROG_END) { + numSound = readFlashNumber(); + frame_without_sound_timeout = TTS_TIMEOUT; programming_state = 0; programmingFlash = 0; TIMSK0 = 0x01; + //info_flg = 1; + send_status(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); + send_status(SOUND_VAR_CMD, numSound, last_block, 0); } } @@ -195,13 +256,18 @@ } else if (!(read_status() & BUSY)) { + //send_status(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); enter = 1; eraseFlag = 0; program_flash(0x00, 0x00, 0x00, 0xFE); program_flash(0x00, 0x00, 0x01, 0x00); program_flash(0x00, 0x00, 0x02, 0x04); program_flash(0x00, 0x00, 0x03, 0x00); - numSound = readFlashNumber(); + numSound = 0; + last_block = 0; + send_status(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); + send_status(SOUND_VAR_CMD, numSound, last_block, 0); + //info_flg = 1; TIMSK0 = 0x01; } } @@ -278,10 +344,14 @@ { ad[i] = spiSend(NOP); // Read start and stop sound address } - ad[1] ++; - if (ad[1] == 0) - ad[0] ++; - ad[2] = 0; + if (nsound > 1) + { + ad[1] += 0x10; + ad[1] &= ~0x0F; + if (ad[1] == 0) + ad[0] ++; + ad[2] = 0; + } flash_unselect(); // Chip Deselect @@ -389,6 +459,7 @@ */ static void stopPlaying(void) { + soundToPlay = 0; flashPlay = 0; send_status(STATUS_AUDIO_CMD, 0, 0, 0); PORTB |= 0x01; // Set the HOLD signal @@ -450,7 +521,8 @@ if (!isFifoEmpty(&PWMFifo)) { sound_stored = 1; - frame_without_sound = frame_without_sound_timeout = STOP_FRAME_NUMBER; + frame_without_sound = STOP_FRAME_NUMBER; + frame_without_sound_timeout = STOP_FRAME_NUMBER; flash_select(); spiSend(SEQU_PROGRAM); Modified: firmware/tuxaudio/branches/new_flash_programming/flash.h =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/flash.h 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/flash.h 2007-11-27 08:29:31 UTC (rev 727) @@ -36,25 +36,41 @@ /** \name Flash programming states @{ */ -#define DETECT_INDEXES 0 -#define PROG_INIT 1 -#define PROGRAMMING 2 -#define PROG_TOC 3 -#define PROG_END 4 +enum { + DETECT_INDEXES = 0, + PROG_INIT, + PROGRAMMING, + WAITING_STATE, + PROG_TOC, + PROG_END, +}; /* @} */ /** \name No sound in frame timeout @{ */ -#define STOP_FRAME_NUMBER 10 +#define STOP_FRAME_NUMBER 10 +#define TTS_TIMEOUT 10 #define START_FRAME_NUMBER 100 /* @} */ +/** \name Flash programming status + @{ */ +enum { + STANDBY = 0, + IN_PROGRESS, + WAITING_FOR_CONFIRMATION, + WRITE_TOC, + ERASING_LAST_SOUND, + FLASH_FULL, + NO_SOUND, +}; +/* @} */ - extern void programming(void); extern void playSound(void); extern void erase(void); extern uint8_t readFlashNumber(void); +extern uint8_t readLastBlock(uint8_t num); /** start / end flash states flag */ extern uint8_t flash_state; Modified: firmware/tuxaudio/branches/new_flash_programming/main.c =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/main.c 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/main.c 2007-11-27 08:29:31 UTC (rev 727) @@ -54,7 +54,7 @@ {REVISION_CMD, SVN_REV, RELEASE_TYPE}; const version_t tag_version __attribute__ ((section("version.1"))) = {VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE}; -static uint8_t info_flg = 0; /* indicates if version information should be sent */ + static uint8_t pre_sleep_delay = 0; /* set when sleep should be entered */ void send_info(void) @@ -71,7 +71,7 @@ sei(); buf[0] = SOUND_VAR_CMD; buf[1] = numSound; - buf[2] = 0; + buf[2] = last_block; buf[3] = 0; cli(); i2cSlaveReceiveService(4, buf); @@ -201,21 +201,26 @@ { if (flashPlay) flashPlay = 0; - /* param: command[1] : number of sounds */ flash_state = 1; /* Erasing flash flag */ - send_status(STATUS_AUDIO_CMD, 0, 1, 0); programmingFlash = 1; /* Set the flag to enter programming sequence */ } - else if (command[0] == STORE_INDEX_CMD) + else if (command[0] == ERASE_FLASH_CMD) { eraseFlag = 1; } /* Version */ else if (command[0] == INFO_TUXAUDIO_CMD) + info_flg = 1; /* info should be sent when the buffer will be free */ + + else if (command[0] == CONFIRM_STORAGE_CMD) { - info_flg = 1; /* info should be sent when the buffer will be free */ + if (command[1]) + write_toc = 1; + else + write_toc = 2; } + else pushCommands(command); /* push the command set on the filo stack */ } @@ -235,8 +240,11 @@ if (PINB & 0x40) command[1] |= 0x20; command[1] ^= 0x9B; /* some bits should be inverted */ - command[2] = audio_level; - command[3] = battery_level; + command[2] = soundToPlay; + if (soundToPlay || sound_played) + command[3] = 1; + else + command[3] = 0; pushCommands(command); /* push the command set on the filo stack */ } @@ -248,7 +256,9 @@ resetFifo(&ADCFifo); /* Initialise the ADC fifo */ config_init(); /* load the configuration defaults from EEPROM */ numSound = readFlashNumber(); + last_block = readLastBlock(numSound); i2cCommunicationInit(); /* I2C initialization */ + frame_without_sound_timeout = TTS_TIMEOUT; sei(); /* Init global interrupt */ Modified: firmware/tuxaudio/branches/new_flash_programming/varis.c =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/varis.c 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/varis.c 2007-11-27 08:29:31 UTC (rev 727) @@ -71,5 +71,11 @@ volatile unsigned char Fifoinert = 0; -uint8_t frame_without_sound = 0; -uint8_t frame_without_sound_timeout= 0; +uint16_t frame_without_sound = 0; +uint16_t frame_without_sound_timeout= 0; +uint8_t sound_played = 0; +uint8_t last_block = 0; + +// General flags +uint8_t info_flg = 0; /* indicates if version information should be sent */ +uint8_t write_toc = 0; Modified: firmware/tuxaudio/branches/new_flash_programming/varis.h =================================================================== --- firmware/tuxaudio/branches/new_flash_programming/varis.h 2007-11-26 16:02:39 UTC (rev 726) +++ firmware/tuxaudio/branches/new_flash_programming/varis.h 2007-11-27 08:29:31 UTC (rev 727) @@ -81,6 +81,12 @@ extern volatile unsigned char lockAdaptFifo; extern volatile unsigned char Fifoinert; -extern uint8_t frame_without_sound; -extern uint8_t frame_without_sound_timeout; +extern uint16_t frame_without_sound; +extern uint16_t frame_without_sound_timeout; +extern uint8_t sound_played; +extern uint8_t last_block; + +// General flags +extern uint8_t info_flg; +extern uint8_t write_toc; #endif |
From: jaguarondi <c2m...@c2...> - 2007-11-26 16:15:12
|
Author: jaguarondi Date: 2007-11-26 17:00:27 +0100 (Mon, 26 Nov 2007) New Revision: 725 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Added a command to send all sound flash status at once. * Changed the order of the charger states so that it should stay compatible with the python API. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-26 15:38:58 UTC (rev 724) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-26 16:00:27 UTC (rev 725) @@ -663,6 +663,11 @@ case DATA_STATUS_AVAILABLE_RECORD_TIME: result[1] = tux_status.sound_flash.available_record_time; break; + case DATA_STATUS_SOUND_FLASH: + result[1] = tux_status.sound_flash.number_of_sounds; + result[2] = tux_status.sound_flash.flash_usage; + result[3] = tux_status.sound_flash.available_record_time; + break; } } Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-26 15:38:58 UTC (rev 724) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-26 16:00:27 UTC (rev 725) @@ -184,6 +184,7 @@ #define DATA_STATUS_AUDIO 0x26 #define DATA_STATUS_FLASH_USAGE 0x27 #define DATA_STATUS_AVAILABLE_RECORD_TIME 0x28 +#define DATA_STATUS_SOUND_FLASH 0x29 /* tux connection commands available on the usb dongle */ typedef enum @@ -286,13 +287,13 @@ /** States of the battery charger */ typedef enum charger_status { - CHARGER_UNPLUGGED, /**< unplugged, on batteries */ - CHARGER_CHARGING, /**< fast charge ongoing */ - CHARGER_PLUGGED_NO_POWER, /**< transformer plugged on tux but not in the - wall socket */ - CHARGER_TRICKLE, /**< trickle mode, mainly activated at the end of - charge */ - CHARGER_INHIBITED, /**< the CPU has inhibited the charger */ + CHARGER_CHARGING = 0, /**< fast charge ongoing */ + CHARGER_UNPLUGGED = 1, /**< unplugged, on batteries */ + CHARGER_PLUGGED_NO_POWER = 2, /**< transformer plugged on tux but not in + the wall socket */ + CHARGER_TRICKLE = 3, /**< trickle mode, mainly activated at the end of + charge */ + CHARGER_INHIBITED = 4, /**< the CPU has inhibited the charger */ } charger_status_t; /** States of the battery level */ |
From: jaguarondi <c2m...@c2...> - 2007-11-26 16:02:44
|
Author: jaguarondi Date: 2007-11-26 17:02:39 +0100 (Mon, 26 Nov 2007) New Revision: 726 Modified: api/python/trunk/tuxapi_class.py api/python/trunk/tuxapi_const.py Log: * Removed the charge inhibit status. * The charger led status is now a generalized charger status. The returned value is no longer a bool so the API should be modified in order to use the new states. (look for FIXME) * Added a couple of functions to retrieve the new status of the sound flash. This needs some firmware modifications which are still not committed yet. Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-26 16:00:27 UTC (rev 725) +++ api/python/trunk/tuxapi_class.py 2007-11-26 16:02:39 UTC (rev 726) @@ -1087,7 +1087,7 @@ (STATUS_WINGS_MOTOR_BACKWARD, STATUS_SPIN_MOTOR_BACKWARD, STATUS_SPIN_MOTOR_FORWARD, STATUS_MOUTH_OPEN_POSITION, STATUS_MOUTH_CLOSED_POSITION, STATUS_HEAD_PUSH_POSITION, - STATUS_CHARGER_INHIBIT_SIGNAL, STATUS_WINGS_POSITION_SWITCH, + STATUS_WINGS_POSITION_SWITCH, STATUS_MOTOR_FOR_WINGS, STATUS_LEFT_BLUE_LED, STATUS_I2C_SDA_LINE, STATUS_I2C_SCL_LINE , STATUS_HEAD_MOTOR_FOR_MOUTH, STATUS_HEAD_MOTOR_FOR_EYES, @@ -1096,7 +1096,7 @@ STATUS_EYES_OPEN_POSITION_SWITCH, STATUS_EYES_CLOSED_POSITION_SWITCH, STATUS_LEFT_WING_PUSH, STATUS_RIGHT_WING_PUSH, STATUS_POWER_PLUG_SWITCH, STATUS_HEAD_PUSH_SWITCH, - STATUS_CHARGER_LED, STATUS_MUTE_STATUS, + STATUS_CHARGER, STATUS_MUTE_STATUS, STATUS_LIGHT_LEVEL, STATUS_EYES_POSITION_COUNTER, STATUS_MOUTH_POSITION_COUNTER, STATUS_WINGS_POSITION_COUNTER, STATUS_SPIN_POSITION_COUNTER, STATUS_RIGHT_BLUE_LED, @@ -2751,8 +2751,6 @@ line=line+"Mouth closed position->" if status[4]==DATAS_STATUS_HEAD_PUSH_POSITION: line=line+"Head push position->" - if status[4]==DATAS_STATUS_CHARGER_INHIBIT_SIGNAL: - line=line+"Charger inhibit signal->" if status[4]==DATAS_STATUS_WINGS_POSITION_SWITCH: line=line+"Wings position switch->" if status[4]==DATAS_STATUS_MOTOR_FOR_WINGS: @@ -2783,8 +2781,8 @@ line=line+"Power plug switch->" if status[4]==DATAS_STATUS_HEAD_PUSH_SWITCH: line=line+"Head push switch->" - if status[4]==DATAS_STATUS_CHARGER_LED_STATUS: - line=line+"Charger led status->" + if status[4]==DATAS_STATUS_CHARGER_STATUS: + line=line+"Charger status->" if status[4]==DATAS_STATUS_MUTE_STATUS: line=line+"Audio mute->" if status[4]==DATAS_STATUS_LIGHT_LEVEL: @@ -3030,12 +3028,12 @@ """ Get the status of the charger - Return 1 for charging and 0 for not charging + Return FIXME returns a value from charger_status enum Example: >>>var = tux.status.charger_state() """ - return self.get_one_status(DATAS_STATUS_CHARGER_LED_STATUS) + return self.get_one_status(DATAS_STATUS_CHARGER_STATUS) #-------------------------------------------------------------------------- # Get the last state of wings position switch status @@ -3383,7 +3381,7 @@ #-------------------------------------------------------------------------- def battery_level(self): """ - Get the last battery level + Get the last battery level measurement Return a tupple with the battery level and the status: (level, status) @@ -3531,7 +3529,7 @@ return self.get_one_status(DATAS_STATUS_RF_CONNECTED) #-------------------------------------------------------------------------- - # Get the number of sound in flash + # Get the number of sounds in flash #-------------------------------------------------------------------------- def get_sound_flash_count(self): """ @@ -3549,6 +3547,62 @@ """ return self.get_one_status(DATAS_STATUS_SOUND_COUNT) + #-------------------------------------------------------------------------- + # Get the flash usage as percentage + #-------------------------------------------------------------------------- + def flash_usage(self): + """ + Get the usage of the sound flash memory as a percentage filled + + Return a integer (0..100) + + Example: + >>> var = tux.status.flash_usage() + """ + return self.get_one_status(DATAS_STATUS_FLASH_USAGE) + + #-------------------------------------------------------------------------- + # Get the sound duration still available to record in the sound flash + #-------------------------------------------------------------------------- + def available_record_time(self): + """ + Get the sound duration still available to record in the sound flash + + Return a integer (0..255) + + Example: + >>> var = tux.status.available_record_time() + """ + return self.get_one_status(DATAS_STATUS_AVAILABLE_RECORD_TIME) + + #-------------------------------------------------------------------------- + # Get sound flash information + #-------------------------------------------------------------------------- + def sound_flash(self): + """ + Get sound flash information + + Return a tupple with: + (number_of_sounds, flash_usage, available_record_time) + number_of_sounds: number of sounds store in the sound flash + flash_usage: flash space percentage filled + available_record_time: time (in seconds) of free space + remaining in the flash + + Example: + >>> var = tux.status.sound_flash() + """ + if not self.parent.daemon.connected: + return 0 + frame = self.get(DATAS_STATUS_SOUND_FLASH) + try: + if len(frame) > 0: + return (ord(frame[5]), ord(frame[6]), ord(frame[7])) + else: + return 0 + except: + return 0 + #============================================================================== # TUXTCPCommunicator - daemon - class #============================================================================== @@ -4041,9 +4095,11 @@ tux.hw.alsa_devices_select tux.hw.audio_get_version tux.hw.behavior_get_version - tux.hw.donglerf_get_version + tux.hw.tuxrf_get_version + tux.hw.fuxrf_get_version + tux.hw.fuxusb_get_version tux.hw.oss_device - tux.hw.tuxrf_get_version + tux.hw.firmware_release_get_version """ #-------------------------------------------------------------------------- # Constructor of this class @@ -4066,7 +4122,7 @@ Not a user function """ if not self.parent.daemon.connected: - return (0,0,0,0,0) + return (0,0,0,0,0,0) data=(DEST_TUX,SD_DEFAULT,DATA_TP_REQ,SUBDATA_TP_INFO, \ TUX_REQ_INFO_VERSION,cpu_index,0,0,0,0,0,0,0,0,0,0) self.parent._sock_send_frame("".join( [chr(x) for x in data] )) @@ -4077,17 +4133,37 @@ ver_update=ord(frame[7]) revision=(ord(frame[8])<<8)+ord(frame[9]) author_id=(ord(frame[10])<<8)+ord(frame[11]) - return (ver_major,ver_minor,ver_update,revision,author_id) + released=ord(frame[12]) + return (ver_major,ver_minor,ver_update,revision,author_id, + released) #-------------------------------------------------------------------------- # Get the version of the behavior firmware #-------------------------------------------------------------------------- + def firmware_release_get_version(self): + """ + Get the version of the firmware release package + + Return a tuple : (major version, minor version, update version, + author_id) + + Example: + >>> print tux.hw.firmware_release_get_version() + """ + release = self.get_firmware_versioning(5) + # Need to remove 'revision' and 'released' from the tuple as that + # doesn't make sense in a release package + return release[:3]+tuple([release[4]]) + + #-------------------------------------------------------------------------- + # Get the version of the behavior firmware + #-------------------------------------------------------------------------- def behavior_get_version(self): """ Get the version of the behavior firmware Return a tuple : (major version, minor version, update version, - revision, author_id) + revision, author_id, released) Example: >>> print tux.hw.behavior_get_version() @@ -4102,7 +4178,7 @@ Get the version of the audio firmware Return a tuple : (major version, minor version, update version, - revision, author_id) + revision, author_id, released) Example: >>> print tux.hw.audio_get_version() @@ -4117,7 +4193,7 @@ Get the version of the tuxrf firmware Return a tuple : (major version, minor version, update version, - revision, author_id) + revision, author_id, released) Example: >>> print tux.hw.tuxrf_get_version() @@ -4127,19 +4203,34 @@ #-------------------------------------------------------------------------- # Get the version of the donglerf firmware #-------------------------------------------------------------------------- - def donglerf_get_version(self): + def fuxrf_get_version(self): """ Get the version of the donglerf firmware Return a tuple : (major version, minor version, update version, - revision, author_id) + revision, author_id, released) Example: - >>> print tux.hw.donglerf_get_version() + >>> print tux.hw.fuxrf_get_version() """ return self.get_firmware_versioning(3) #-------------------------------------------------------------------------- + # Get the version of fuxusb firmware + #-------------------------------------------------------------------------- + def fuxusb_get_version(self): + """ + Get the version of the donglerf firmware + + Return a tuple : (major version, minor version, update version, + revision, author_id, released) + + Example: + >>> print tux.hw.fuxusb_get_version() + """ + return self.get_firmware_versioning(4) + + #-------------------------------------------------------------------------- # Get the alsa devices #-------------------------------------------------------------------------- def alsa_devices_enumerate(self): Modified: api/python/trunk/tuxapi_const.py =================================================================== --- api/python/trunk/tuxapi_const.py 2007-11-26 16:00:27 UTC (rev 725) +++ api/python/trunk/tuxapi_const.py 2007-11-26 16:02:39 UTC (rev 726) @@ -126,7 +126,6 @@ DATAS_STATUS_MOUTH_OPEN_POSITION = 0x04 DATAS_STATUS_MOUTH_CLOSED_POSITION = 0x05 DATAS_STATUS_HEAD_PUSH_POSITION = 0x06 -DATAS_STATUS_CHARGER_INHIBIT_SIGNAL = 0x07 DATAS_STATUS_WINGS_POSITION_SWITCH = 0x08 DATAS_STATUS_MOTOR_FOR_WINGS = 0x09 DATAS_STATUS_LEFT_BLUE_LED = 0x0A @@ -144,7 +143,7 @@ DATAS_STATUS_RIGHT_WING_PUSH = 0x16 DATAS_STATUS_POWER_PLUG_SWITCH = 0x17 DATAS_STATUS_HEAD_PUSH_SWITCH = 0x18 -DATAS_STATUS_CHARGER_LED_STATUS = 0x19 +DATAS_STATUS_CHARGER_STATUS = 0x19 DATAS_STATUS_MUTE_STATUS = 0x1A DATAS_STATUS_LIGHT_LEVEL = 0x1B DATAS_STATUS_EYES_POSITION_COUNTER = 0x1C @@ -159,6 +158,9 @@ DATAS_STATUS_BATTERY = 0x25 DATAS_STATUS_MICRO_ENERGY = 0xF0 DATAS_STATUS_AUDIO = 0x26 +DATAS_STATUS_FLASH_USAGE = 0x27 +DATAS_STATUS_AVAILABLE_RECORD_TIME = 0x28 +DATAS_STATUS_SOUND_FLASH = 0x29 STATUS_WINGS_MOTOR_BACKWARD = 0x01 STATUS_SPIN_MOTOR_BACKWARD = 0x02 @@ -166,7 +168,6 @@ STATUS_MOUTH_OPEN_POSITION = 0x04 STATUS_MOUTH_CLOSED_POSITION = 0x05 STATUS_HEAD_PUSH_POSITION = 0x06 -STATUS_CHARGER_INHIBIT_SIGNAL = 0x07 STATUS_WINGS_POSITION_SWITCH = 0x08 STATUS_MOTOR_FOR_WINGS = 0x09 STATUS_LEFT_BLUE_LED = 0x0A @@ -184,7 +185,7 @@ STATUS_RIGHT_WING_PUSH = 0x16 STATUS_POWER_PLUG_SWITCH = 0x17 STATUS_HEAD_PUSH_SWITCH = 0x18 -STATUS_CHARGER_LED = 0x19 +STATUS_CHARGER = 0x19 STATUS_MUTE_STATUS = 0x1A STATUS_LIGHT_LEVEL = 0x1B STATUS_EYES_POSITION_COUNTER = 0x1C |
From: jaguarondi <c2m...@c2...> - 2007-11-26 15:39:12
|
Author: jaguarondi Date: 2007-11-26 16:38:58 +0100 (Mon, 26 Nov 2007) New Revision: 724 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * CHARGER_LED_STATUS is now simply CHARGER_STATUS and represents now the charger state as defined in charger_status_t enum. Removed the charger inhibit status that was stull unused. * Added status and API for the sound flash but these values are still not sent by the firmware. * Now sending the release flag with the firmware version command. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-23 13:23:59 UTC (rev 723) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-26 15:38:58 UTC (rev 724) @@ -572,10 +572,6 @@ case DATA_STATUS_HEAD_PUSH_POSITION: result[1] = portb.bits.PB5; break; - case DATA_STATUS_CHARGER_INHIBIT_SIGNAL: - result[0] = DATA_STATUS_CHARGER_INHIBIT_SIGNAL; - result[1] = portb.bits.PB6; - break; case DATA_STATUS_WINGS_POSITION_SWITCH: result[1] = portc.bits.PB0; break; @@ -623,8 +619,8 @@ case DATA_STATUS_HEAD_PUSH_SWITCH: result[1] = sensors1.bits.PB3; break; - case DATA_STATUS_CHARGER_LED_STATUS: - result[1] = sensors1.bits.PB4; + case DATA_STATUS_CHARGER_STATUS: + result[1] = tux_status.battery.charger_state; break; case DATA_STATUS_MUTE_STATUS: result[1] = sensors1.bits.PB7; @@ -634,9 +630,9 @@ result[2] = sensors2.light_level % 256; break; case DATA_STATUS_BATTERY: - result[1] = battery.level / 256; - result[2] = battery.level % 256; - result[3] = battery.status; + result[1] = tux_status.battery.level / 256; + result[2] = tux_status.battery.level % 256; + result[3] = tux_status.battery.loaded; break; case DATA_STATUS_AUDIO: result[1] = audio.play; @@ -661,6 +657,12 @@ case DATA_STATUS_SOUND_COUNT: result[1] = tux_status.sound_flash.number_of_sounds; break; + case DATA_STATUS_FLASH_USAGE: + result[1] = tux_status.sound_flash.flash_usage; + break; + case DATA_STATUS_AVAILABLE_RECORD_TIME: + result[1] = tux_status.sound_flash.available_record_time; + break; } } @@ -1014,7 +1016,8 @@ /************************************************************************ */ static void tux_req_info(unsigned char const data[], unsigned char result[]) { - struct firmware_info_t const *const firmware = &tux_status.firmware_info[data[1]]; + struct firmware_info_t const *const firmware = + &tux_status.firmware_info[data[1]]; result[0] = data[0]; @@ -1027,6 +1030,7 @@ result[5] = (unsigned char)(firmware->revision & 0x00FF); result[6] = (unsigned char)((firmware->author& 0xFF00) >> 8); result[7] = (unsigned char)(firmware->author& 0x00FF); + result[8] = firmware->release; } } Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-23 13:23:59 UTC (rev 723) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-26 15:38:58 UTC (rev 724) @@ -22,6 +22,7 @@ /*_____________________ I N C L U D E S____________________________________ */ #include <stdio.h> +#include <stdbool.h> #include <assert.h> #include "USBDaemon_status_table.h" @@ -155,7 +156,8 @@ { tcp_frame[4] = DATA_STATUS_POWER_PLUG_SWITCH; tcp_frame[5] = !sensors1.bits.PB2; - log_debug("power plug insertion switch %s", tcp_frame[5] ? "off" : "on"); + log_debug("power plug insertion switch %s", + tcp_frame[5] ? "off" : "on"); tcp_server_send_raw(tcp_frame); } @@ -171,8 +173,22 @@ /* Led charger */ if ((sensors1.Byte & 0x10) != (new_value & 0x10)) { - tcp_frame[4] = DATA_STATUS_CHARGER_LED_STATUS; - tcp_frame[5] = sensors1.bits.PB4; + tcp_frame[4] = DATA_STATUS_CHARGER_STATUS; + + /* XXX should be removed when charger status will be added in firmware, + * now using this simplified status. */ + if (sensors1.bits.PB4) + { + tux_status.battery.charger_state = CHARGER_UNPLUGGED; + tcp_frame[5] = CHARGER_UNPLUGGED; + } + else + { + tux_status.battery.charger_state = CHARGER_CHARGING; + tcp_frame[5] = CHARGER_CHARGING; + } + + /*tcp_frame[5] = sensors1.bits.PB4;*/ log_debug("Charger led %d", tcp_frame[5]); tcp_server_send_raw(tcp_frame); } @@ -209,7 +225,9 @@ tcp_server_send_raw(tcp_frame); } -static void battery_changed(int level, int status) +/* TODO Add functions to get the average battery voltage and status */ +static void battery_changed(unsigned int const level, + unsigned int const loaded) { tcp_frame_t tcp_frame; @@ -222,12 +240,12 @@ tcp_frame[4] = DATA_STATUS_BATTERY; - battery.level = level; - battery.status = status; + tux_status.battery.level = level; + tux_status.battery.loaded = loaded; tcp_frame[5] = level / 256; tcp_frame[6] = level % 256; - tcp_frame[7] = status; + tcp_frame[7] = loaded; tcp_server_send_raw(tcp_frame); } @@ -331,15 +349,6 @@ tcp_server_send_raw(tcp_frame); } - /* charger inhibit signal */ - if ((portb.Byte & 0x40) != (new_value & 0x40)) - { - tcp_frame[4] = DATA_STATUS_CHARGER_INHIBIT_SIGNAL; - tcp_frame[5] = !portb.bits.PB6; - log_debug("charger inhibit signal %d", tcp_frame[5]); - tcp_server_send_raw(tcp_frame); - } - portb.Byte = new_value; } @@ -650,7 +659,6 @@ new_status[2], new_status[3]); break; } - } /************************************************************************ */ Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-23 13:23:59 UTC (rev 723) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-26 15:38:58 UTC (rev 724) @@ -74,7 +74,7 @@ #define SUBDATA_TP_STATUS 0x03 #define SUBDATA_TP_INFO 0x04 -/* ------------------------------ ACK --------------------------------------// */ +/* ------------------------------ ACK -------------------------------------- */ /* ACK daemon processing */ #define ACK_DP_OK 0x01 @@ -92,7 +92,7 @@ #define ACK_CMD_NO_ACK 0x04 #define ACK_CMD_ERROR 0xFF -/* ----------------------------- Sub daemon const --------------------------// */ +/* ----------------------------- Sub daemon const -------------------------- */ /* Sub daemon commands */ #define SUB_D_CMD_STRUC_DISCONNECT_CLIENT 0x01 @@ -107,7 +107,7 @@ #define SUB_D_REQ_INFO_MY_CLIENT_ID 0x04 #define SUB_D_REQ_INFO_PID 0x05 -/* ----------------------------- TUX const ---------------------------------// */ +/* ----------------------------- TUX const --------------------------------- */ /* Tux structured commands */ #define TUX_CMD_STRUCT_EYES 0x01 @@ -151,7 +151,6 @@ #define DATA_STATUS_MOUTH_OPEN_POSITION 0x04 #define DATA_STATUS_MOUTH_CLOSED_POSITION 0x05 #define DATA_STATUS_HEAD_PUSH_POSITION 0x06 -#define DATA_STATUS_CHARGER_INHIBIT_SIGNAL 0x07 #define DATA_STATUS_WINGS_POSITION_SWITCH 0x08 #define DATA_STATUS_MOTOR_FOR_WINGS 0x09 #define DATA_STATUS_LEFT_BLUE_LED 0x0A @@ -169,7 +168,7 @@ #define DATA_STATUS_RIGHT_WING_PUSH 0x16 #define DATA_STATUS_POWER_PLUG_SWITCH 0x17 #define DATA_STATUS_HEAD_PUSH_SWITCH 0x18 -#define DATA_STATUS_CHARGER_LED_STATUS 0x19 +#define DATA_STATUS_CHARGER_STATUS 0x19 #define DATA_STATUS_MUTE_STATUS 0x1A #define DATA_STATUS_LIGHT_LEVEL 0x1B #define DATA_STATUS_EYES_POSITION_COUNTER 0x1C @@ -183,6 +182,8 @@ #define DATA_STATUS_PONG 0x24 #define DATA_STATUS_BATTERY 0x25 #define DATA_STATUS_AUDIO 0x26 +#define DATA_STATUS_FLASH_USAGE 0x27 +#define DATA_STATUS_AVAILABLE_RECORD_TIME 0x28 /* tux connection commands available on the usb dongle */ typedef enum @@ -204,7 +205,7 @@ TUX_CONNECTION_ACK = 1, TUX_CONNECTION_NOTFOUND = 2, } tux_connection_ack_t; -/* ------------------ Daemon to Application, frame construction ----------------- */ +/* ----------------- Daemon to Application, frame construction ------------ */ /*_____________________ T Y P E _ D E F ____________________________________*/ typedef unsigned char _BIT_; @@ -250,13 +251,6 @@ } sensors2; struct { - _PORT_BYTE_ level_high; - _PORT_BYTE_ level_low; - int status; - int level; -} battery; -struct -{ int play; int record; int status; @@ -289,33 +283,104 @@ /** Size of the version string. */ #define VERSION_STRING_LENGTH 100 +/** States of the battery charger */ +typedef enum charger_status +{ + CHARGER_UNPLUGGED, /**< unplugged, on batteries */ + CHARGER_CHARGING, /**< fast charge ongoing */ + CHARGER_PLUGGED_NO_POWER, /**< transformer plugged on tux but not in the + wall socket */ + CHARGER_TRICKLE, /**< trickle mode, mainly activated at the end of + charge */ + CHARGER_INHIBITED, /**< the CPU has inhibited the charger */ +} charger_status_t; + +/** States of the battery level */ +typedef enum battery_status +{ + FULL, + HIGH, + LOW, + EMPTY, +} battery_status_t; + +/** States of the audio recording (flash programming) process */ +typedef enum audiorec_status +{ + NOP, /**< XXX to be defined */ +} audiorec_status_t; + /** * Tux status table. * - * This hierarchical structure holds all available status of tux and the dongle. + * This hierarchical structure holds all available status of tux and the + * dongle. */ struct tux_status_t { - /** Firmware versioning , svn revision and author. */ + /** Firmware general information like versioning , svn revision, author and + * a couple more stuff. + * + * The version number is written as 'major.minor.update'. + * + * When local_modification or mixed_revisions are found, it can't be a + * release. */ struct firmware_info_t { - int version_major; - int version_minor; - int version_update; - int revision; - bool release; - bool local_modification; - bool mixed_revisions; - int author; - int variation; - char version_string[VERSION_STRING_LENGTH]; + unsigned int version_major; /**< Major version number */ + unsigned int version_minor; /**< Minor version number */ + unsigned int version_update;/**< Update version number */ + unsigned int revision; /**< SVN revision number */ + bool release; /**< Set for a released firmware */ + bool local_modification; /**< Has local modifications compared to + the SVN revision copy */ + bool mixed_revisions; /**< Has been compiled with a mix of SVN + revisions */ + unsigned int author;/**< Number representing the author of the + firmware, '0' is the official firmware of Kysoh */ + unsigned int variation; /**< Variation can be used by the author to + differentiate multiple variations of the + same firmware */ + char version_string[VERSION_STRING_LENGTH]; /**< Whole version number + stored as a string */ } firmware_info[NUMBER_OF_FIRMWARE]; + /** Sound flash properties. */ struct sound_flash_t { - int number_of_sounds; - int filled_space; + unsigned int number_of_sounds; /**< number of sounds stored in the + sound flash */ + unsigned int flash_usage; /**< flash space percentage filled */ + unsigned int available_record_time; /**< time (in seconds) of free + space remaining in the flash */ } sound_flash; + + /** Battery status. + * 'loaded' can be used to filter out 'level' measurements that occurred + * when the motors were running as the battery voltage is highly affected + * by the load. */ + struct + { + unsigned int level; /**< Last battery level measurement (raw data + from the ADC) */ + bool loaded; /**< Set if the battery was loaded when the + measurement was done (i.e. motors running). */ + float voltage; /**< Mean battery voltage */ + battery_status_t status;/**< Battery level status (low, high, etc.) */ + charger_status_t charger_state; /**<Battery charger state. */ + } battery; + + /** Audio status */ + struct audio_t + { + unsigned int play_internal_sound; /**< Number of the sound currently + playing ('0' when none) */ + bool streaming; /**< Set when audio data is streamed through the RF + link */ + bool mute; /**< Set when the amplifier has been muted */ + audiorec_status_t record_state; /**< XXX need to define the enum for + the states */ + } audio; }; /** |
From: jaguarondi <c2m...@c2...> - 2007-11-23 13:24:13
|
Author: jaguarondi Date: 2007-11-23 14:23:59 +0100 (Fri, 23 Nov 2007) New Revision: 723 Modified: daemon/trunk/doc/Doxyfile firmware/tuxaudio/trunk/doc/Doxyfile Log: * Minor modifications of the doxygen configuration files. Both tuxaudio and tuxd documentation pages are now available through http://doc.tuxisalive.com Modified: daemon/trunk/doc/Doxyfile =================================================================== --- daemon/trunk/doc/Doxyfile 2007-11-21 16:06:15 UTC (rev 722) +++ daemon/trunk/doc/Doxyfile 2007-11-23 13:23:59 UTC (rev 723) @@ -45,7 +45,7 @@ # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = "Tux Droid daemon" +PROJECT_NAME = "tuxd" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or Modified: firmware/tuxaudio/trunk/doc/Doxyfile =================================================================== --- firmware/tuxaudio/trunk/doc/Doxyfile 2007-11-21 16:06:15 UTC (rev 722) +++ firmware/tuxaudio/trunk/doc/Doxyfile 2007-11-23 13:23:59 UTC (rev 723) @@ -1141,7 +1141,7 @@ # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) -HAVE_DOT = NO +HAVE_DOT = YES # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and |
From: jaguarondi <c2m...@c2...> - 2007-11-21 16:06:13
|
Author: jaguarondi Date: 2007-11-21 17:06:15 +0100 (Wed, 21 Nov 2007) New Revision: 722 Modified: api/python/trunk/tuxapi_class.py Log: * A longer timeut is necessary for some new commands based on the id like the id lookup. Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-21 16:04:07 UTC (rev 721) +++ api/python/trunk/tuxapi_class.py 2007-11-21 16:06:15 UTC (rev 722) @@ -615,7 +615,7 @@ # Fill up the end of the frame with 0 data.extend([0] * (TCPIP_FRAME_LENGTH - len(data))) self.parent._sock_send_frame("".join( [chr(x) for x in data] )) - return self.parent.status.rsp_status(connection_command, timeout=5) + return self.parent.status.rsp_status(connection_command, timeout=10) #-------------------------------------------------------------------------- # Disconnect from tux |
From: jaguarondi <c2m...@c2...> - 2007-11-21 16:04:07
|
Author: jaguarondi Date: 2007-11-21 17:04:07 +0100 (Wed, 21 Nov 2007) New Revision: 721 Modified: api/python/trunk/tuxapi_class.py Log: * Updated versioning of the daemon, now indicates if it's a release or not. Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-21 16:01:37 UTC (rev 720) +++ api/python/trunk/tuxapi_class.py 2007-11-21 16:04:07 UTC (rev 721) @@ -3931,12 +3931,15 @@ """ if not self.connected : return '' frame = self.request(SUB_D_REQ_INFO_VERSION,0,0,0) - result=[0,0,0] + result=[0,0,0,""] if len(frame) > 0: result[0]=ord(frame[5]) result[1]=ord(frame[6]) result[2]=ord(frame[7]) - return "%d.%d.%d"%(result[0],result[1],result[2]) + print "%s"%ord(frame[8]) + if ord(frame[8]) == 0: + result[3] = " (SVN/UNRELEASED)" + return "%d.%d.%d%s"%(result[0],result[1],result[2],result[3]) #-------------------------------------------------------------------------- # Get the number of clients connected to tuxd |
From: jaguarondi <c2m...@c2...> - 2007-11-21 16:01:40
|
Author: jaguarondi Date: 2007-11-21 17:01:37 +0100 (Wed, 21 Nov 2007) New Revision: 720 Modified: firmware/tuxup/trunk/main.c Log: * Increased PATH length to 512. Modified: firmware/tuxup/trunk/main.c =================================================================== --- firmware/tuxup/trunk/main.c 2007-11-21 16:00:01 UTC (rev 719) +++ firmware/tuxup/trunk/main.c 2007-11-21 16:01:37 UTC (rev 720) @@ -32,7 +32,7 @@ #include "common/defines.h" #define countof(X) ( (size_t) ( sizeof(X)/sizeof*(X) ) ) -#define PATH_LENGTH 255 +#define MAX_PATH_LEN 512 /* Messages. */ static char const *msg_old_firmware = @@ -131,7 +131,7 @@ printf("The dongle was found.\n"); /* Check if we have the old firmware that requires entering - * bootloader mode manually, exits with a message that exlains what + * bootloader mode manually, exits with a message that explains what * to do in such a case. */ if (device->descriptor.bcdDevice < 0x030) { @@ -310,7 +310,7 @@ { /* XXX include those as defines in commands.h */ uint8_t send_data[5] = { 0x01, 0x01, 0x00, 0x00, 0xFF }; - char tmp_string[PATH_LENGTH]; + char tmp_string[MAX_PATH_LEN]; int ret; printf("Programming %s in the USB CPU\n", filename); @@ -400,7 +400,7 @@ { int ret = -1; size_t len; - char *extension, filenamepath[PATH_LENGTH]; + char *extension, filenamepath[MAX_PATH_LEN]; if (path) { @@ -470,7 +470,7 @@ */ int main(int argc, char *argv[]) { - char path[PATH_LENGTH]; + char path[MAX_PATH_LEN]; enum program_modes_t program_mode = NONE; time_t start_time, end_time; int ret = 0; |
From: jaguarondi <c2m...@c2...> - 2007-11-21 16:00:11
|
Author: jaguarondi Date: 2007-11-21 17:00:01 +0100 (Wed, 21 Nov 2007) New Revision: 719 Modified: daemon/trunk/Makefile daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_globals.h daemon/trunk/libs/USBDaemon_status_table.h daemon/trunk/main.c daemon/trunk/versioning.c daemon/trunk/versioning.h Log: * Updated versioning of the daemon. Modified: daemon/trunk/Makefile =================================================================== --- daemon/trunk/Makefile 2007-11-21 15:53:56 UTC (rev 718) +++ daemon/trunk/Makefile 2007-11-21 16:00:01 UTC (rev 719) @@ -57,11 +57,6 @@ @$(CC) $(CFLAGS) $(C_PREPROC) $(C_INCLUDE_DIRS) -c "$<" -o "$@" endef -## Generate doxygen documentation -.PHONY: doc -doc: - @./doc/builddoc.sh - .PHONY: print_header directories $(TARGET): print_header directories version.h $(SRC_OBJS) @@ -74,10 +69,12 @@ -@rm -rf "$(OBJ_DIR)" -@rm -rf "$(OUTPUT_DIR)/$(TARGET)" -@rmdir "$(OUTPUT_DIR)" + -@rm version.h clean: @echo Deleting intermediate files for 'USBDaemon - $(CFG)' -@rm -rf "$(OBJ_DIR)" + -@rm version.h print_header: @echo ----------Configuration: USBDaemon - Linux $(CFG)---------- @@ -87,7 +84,7 @@ -@if [ ! -d "$(OBJ_DIR)" ]; then mkdir "$(OBJ_DIR)"; fi version.h: version.txt - @echo "#define VERSION \"`cat version.txt`\"" > version.h + @echo "#define _TUXD_VERSION_ \"`cat version.txt`\"" > version.h $(OBJ_DIR)/main.o: main.c \ libs/USBDaemon_globals.h \ @@ -148,5 +145,8 @@ libs/USBDaemon_tcp_server.h $(compile_source) +## Generate doxygen documentation +.PHONY: doc +doc: + @./doc/builddoc.sh - Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-21 15:53:56 UTC (rev 718) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-21 16:00:01 UTC (rev 719) @@ -313,9 +313,10 @@ switch (data[0]) { case SUB_D_REQ_INFO_VERSION: - result[1] = version.major; - result[2] = version.minor; - result[3] = version.release; + result[1] = daemon_version.major; + result[2] = daemon_version.minor; + result[3] = daemon_version.update; + result[4] = daemon_version.release; break; case SUB_D_REQ_INFO_CLIENT_COUNT: result[1] = tcp_clients_count; Modified: daemon/trunk/libs/USBDaemon_globals.h =================================================================== --- daemon/trunk/libs/USBDaemon_globals.h 2007-11-21 15:53:56 UTC (rev 718) +++ daemon/trunk/libs/USBDaemon_globals.h 2007-11-21 16:00:01 UTC (rev 719) @@ -51,21 +51,4 @@ extern pid_t daemon_pid; extern bool show_invalid_raw; -#define MATURITY_LEN 9 -typedef char maturity_t[MATURITY_LEN + 1]; - -#define RELEASE_STATUS_LEN 19 -typedef char release_status_t[RELEASE_STATUS_LEN + 1]; - -struct version_s -{ - int major; - int minor; - int release; - maturity_t maturity; - release_status_t release_status; - int revision; -}; -extern struct version_s version; - #endif Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-21 15:53:56 UTC (rev 718) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-21 16:00:01 UTC (rev 719) @@ -27,6 +27,7 @@ #include "../tuxdefs/api.h" #include "../tuxdefs/defines.h" #include <stdbool.h> +#include "../version.h" /*_____________________ D E F I N E S ______________________________________*/ @@ -274,6 +275,9 @@ extern unsigned char cmd_status_flag; extern unsigned char pong_received; +extern void update_raw_status_table(const unsigned char *new_status); +extern void update_system_status_table(const unsigned char *new_status); + /** Number of firmware information structures to store. * There's one for each firmware and one for the general release package. * Firmware will have the same index as defined in CPU_IDENTIFIERS, the last @@ -282,6 +286,8 @@ /** Index of the general release package information structure defined in * tux_status. */ #define RELEASE_INDEX (NUMBER_OF_FIRMWARE - 1) +/** Size of the version string. */ +#define VERSION_STRING_LENGTH 100 /** * Tux status table. @@ -297,20 +303,33 @@ int version_minor; int version_update; int revision; - int release; - int local_modification; - int mixed_revisions; + bool release; + bool local_modification; + bool mixed_revisions; int author; int variation; - char version_string[100]; + char version_string[VERSION_STRING_LENGTH]; } firmware_info[NUMBER_OF_FIRMWARE]; /** Sound flash properties. */ struct sound_flash_t { int number_of_sounds; + int filled_space; } sound_flash; }; +/** + * Daemon version information. + */ +struct daemon_version_t +{ + int major; /**< major version number */ + int minor; /**< minor version number */ + int update; /**< update version number */ + bool release; /**< has been tagged as a release */ + const char *version_string;/**< version string given in version.txt */ +}; + struct connection_status_t { /** USB request flag set when a USB command is issued and reset @@ -326,11 +345,10 @@ uint8_t wifi_channel; }; +/* Structures that define the variables that should be accessible by the API. + */ extern struct tux_status_t tux_status; - +extern struct daemon_version_t daemon_version; extern struct connection_status_t connection_status; -extern void update_raw_status_table(const unsigned char *new_status); -extern void update_system_status_table(const unsigned char *new_status); - #endif Modified: daemon/trunk/main.c =================================================================== --- daemon/trunk/main.c 2007-11-21 15:53:56 UTC (rev 718) +++ daemon/trunk/main.c 2007-11-21 16:00:01 UTC (rev 719) @@ -41,19 +41,10 @@ #include "libs/USBDaemon_tcp_server.h" #include "libs/USBDaemon_status_table.h" #include "libs/USBDaemon_command_tux.h" -#include "version.h" +#include "versioning.h" /*_____________________ F U N C T I O N S __________________________________*/ -struct version_s version = { - .major = 0, - .minor = 0, - .release = 0, - .maturity = "", - .release_status = "", - .revision = 0 -}; - bool show_frames = false; /**< Show USB frames structure */ bool show_raw_status = false; /**< Show all raw statuses */ bool show_invalid_raw = false; /**< Show only invalid statuses */ @@ -65,42 +56,6 @@ static gid_t group = (gid_t)-1; /**< Initial group id */ /** - * Extract daemon info from version string. - */ -static void setup_daemon_info(void) -{ - const char delimiters[] = " .-"; - char cp[] = VERSION; - char *token; - - if ((token = strtok(cp, delimiters)) != NULL) - version.major = atoi(token); - - if ((token = strtok(NULL, delimiters)) != NULL) - version.minor = atoi(token); - - if ((token = strtok(NULL, delimiters)) != NULL) - version.release = atoi(token); - - if ((token = strtok(NULL, delimiters)) != NULL) - strncpy(version.maturity, token, sizeof(version.maturity)); - - if ((token = strtok(NULL, delimiters)) != NULL) - strncpy(version.release_status, token, sizeof(version.release_status)); -} - -/** - * Display daemon info on standard output. - */ -static void print_daemon_info(void) -{ - printf("-----------------------------------\n"); - printf("Tux USB Daemon version %s\n", VERSION); - printf("Kysoh 2007.\n"); - printf("-----------------------------------\n"); -} - -/** * Clean closing of stdin and stdout. */ static int fd_nullify(int desired_fd) @@ -318,6 +273,15 @@ exit(status); } +/** + * Display daemon info on standard output. + */ +static void print_version(char const *me) +{ + printf("%s %s\n", me, daemon_version.version_string); + printf("Copyright (C) 2007 KySoH S.A. <tux...@ky...>\n"); +} + int main(int argc, char *argv[]) { unsigned char i; @@ -360,6 +324,9 @@ exit(0); } + /* Initialization */ + init_daemon_info(); + if (daemonized) daemonize(log_target, log_level); else @@ -369,12 +336,9 @@ log_open(LOG_TARGET_SHELL); log_set_level(log_level); + print_version(argv[0]); } - /* Setup & print daemon information */ - setup_daemon_info(); - print_daemon_info(); - #ifdef USB_DEBUG /* Set libusb debug level */ usb_set_debug(LIBUSB_DEBUG_LEVEL); Modified: daemon/trunk/versioning.c =================================================================== --- daemon/trunk/versioning.c 2007-11-21 15:53:56 UTC (rev 718) +++ daemon/trunk/versioning.c 2007-11-21 16:00:01 UTC (rev 719) @@ -32,6 +32,33 @@ #include "tuxdefs/api.h" /** + * Daemon version information. + */ +struct daemon_version_t daemon_version = { .version_string = _TUXD_VERSION_}; + +/** + * Extract daemon version numbers from the version string and store them in the + * daemon version structure. + */ +void init_daemon_info(void) +{ + const char delimiters[] = " .-"; + char *token; + char cp[255]; + + strcpy(cp,daemon_version.version_string); + if ((token = strtok(cp, delimiters)) != NULL) + daemon_version.major = atoi(token); + if ((token = strtok(NULL, delimiters)) != NULL) + daemon_version.minor = atoi(token); + if ((token = strtok(NULL, delimiters)) != NULL) + daemon_version.update = atoi(token); + if ((token = strtok(NULL, "")) == NULL || + !(strstr(token, "SVN") || strstr(token, "svn"))) + daemon_version.release = true; +} + +/** * CPU names mapped from their identifiers. * Should be in sync with CPU_IDENTIFIERS so that cpu_name[some_cpu_id] * should return its CPU name. Modified: daemon/trunk/versioning.h =================================================================== --- daemon/trunk/versioning.h 2007-11-21 15:53:56 UTC (rev 718) +++ daemon/trunk/versioning.h 2007-11-21 16:00:01 UTC (rev 719) @@ -23,6 +23,7 @@ #ifndef _VERSIONING_H_ #define _VERSIONING_H_ +extern void init_daemon_info(void); extern void tux_information_cleaning(void); extern void get_versioning(void); extern void versioning_call(void); |
From: Paul_R <c2m...@c2...> - 2007-11-21 15:54:04
|
Author: Paul_R Date: 2007-11-21 16:53:56 +0100 (Wed, 21 Nov 2007) New Revision: 718 Added: firmware/tuxaudio/branches/new_flash_programming/ Modified: firmware/tuxaudio/branches/new_flash_programming/AT26F004.c firmware/tuxaudio/branches/new_flash_programming/PC_communication.c firmware/tuxaudio/branches/new_flash_programming/flash.c firmware/tuxaudio/branches/new_flash_programming/flash.h firmware/tuxaudio/branches/new_flash_programming/main.c firmware/tuxaudio/branches/new_flash_programming/varis.c firmware/tuxaudio/branches/new_flash_programming/varis.h Log: * Added a branches for the new way to store the sounds into the memory Copied: firmware/tuxaudio/branches/new_flash_programming (from rev 701, firmware/tuxaudio/trunk) Modified: firmware/tuxaudio/branches/new_flash_programming/AT26F004.c =================================================================== --- firmware/tuxaudio/trunk/AT26F004.c 2007-11-15 10:27:04 UTC (rev 701) +++ firmware/tuxaudio/branches/new_flash_programming/AT26F004.c 2007-11-21 15:53:56 UTC (rev 718) @@ -26,7 +26,7 @@ /** * \ingroup at26f004 - * \brief initialize a table with the sectors adresses values + * \brief initialize a table with the sector adresses values */ static uint8_t sector_adress[11][3] = { {SECTOR0}, @@ -168,7 +168,6 @@ { uint8_t data1; - flash_enable(); // Set the HOLD signal flash_select(); spiSend(READ_ARRAY_LOW_F); /* Send Read Page Command */ /* Send address */ @@ -177,7 +176,6 @@ spiSend(ad0); data1 = spiSend(NOP); /* Wait response */ flash_unselect(); - flash_onhold(); // Reset the HOLD signal return data1; } Modified: firmware/tuxaudio/branches/new_flash_programming/PC_communication.c =================================================================== --- firmware/tuxaudio/trunk/PC_communication.c 2007-11-15 10:27:04 UTC (rev 701) +++ firmware/tuxaudio/branches/new_flash_programming/PC_communication.c 2007-11-21 15:53:56 UTC (rev 718) @@ -44,7 +44,7 @@ asm volatile /* Clear the SPI interrupt flag */ ("in __tmp_reg__, %0" "\n\t" "in __tmp_reg__, %1" "\n\t":: "I" (_SFR_IO_ADDR(SPSR)), "I"(_SFR_IO_ADDR(SPDR))); - + flash_onhold(); PORTB &= ~0x04; // Chip select while (1) { @@ -113,6 +113,14 @@ spi_lenght_data = 34; else spi_lenght_data = 17; + if (spi_master_config == 0x08 || spi_master_config == 0x00) + { + if (frame_without_sound) + frame_without_sound --; + } + else + frame_without_sound = frame_without_sound_timeout; + spi_master = PUT_SOUND_FIFO; // Go to the next state if (!programmingFlash && !flashPlay) // XXX code must be review it's very strange ..... @@ -169,6 +177,7 @@ } } } + flash_enable(); } } Modified: firmware/tuxaudio/branches/new_flash_programming/flash.c =================================================================== --- firmware/tuxaudio/trunk/flash.c 2007-11-15 10:27:04 UTC (rev 701) +++ firmware/tuxaudio/branches/new_flash_programming/flash.c 2007-11-21 15:53:56 UTC (rev 718) @@ -27,101 +27,182 @@ #include "i2c.h" #include "flash.h" #include "AT26F004.h" -/* Declarations */ -/* Theses functions are declared with the static attribute, so they're - * accessible only by this module */ -static void erasingFlash(void); -static void programmingNumSound(void); -static void programmingToc(void); -static void initSoundProgramming(void); -static void soundProgramming(void); -static void endProgramming(void); - +/* Declarations */ +static void init_programming(uint8_t adi0, uint8_t adi1, uint8_t adi2); +static void programming_sound(void); static void playInit(uint8_t const nsound); static void playingSound(void); static void stopPlaying(void); -uint8_t f_state; uint8_t flash_state; -uint8_t ad0, ad1, ad2, i, j; - uint8_t soundNum; +static uint16_t index; +static uint8_t sound_stored = 0; +static uint8_t count, ad0, ad1; -/* Public functions */ /** * \ingroup flash - \brief This function is used to reprogram sound flash memory.. - - This function is structured like a state machine. The six states are : - - ERASE_STATE which perform a full chip erase. This state turn off the PWM - and disable I2C interrupt. - - FIRST_PROG_STATE write the number of sounds to be stored. - - PROG_TOC_STATE write the sound's indexes each time a INDEX COMMAND is - received. The last indexes are stored. - - INIT_SOUND_PROG_STATE initiate the memory to a sequential programming. The - first sound byte is writed in the flash. - - SOUND_PROG_STATE store all the sound data received. - - END_STATE clear all variable used to control the programming task, and - reswitch-on the I2C and the PWM timer. + \brief Read the number of sound in the flash memory. + This function scan the sound's indexes, and return the number of sound stored + in the flash memory. */ -void flashProgramming(void) -{ - SPCR = 0x00; - SPCR = 0X50; - PORTB |= 0x01; - if (f_state == ERASE_STATE) +uint8_t readFlashNumber(void) +{ + uint8_t i; + ad0 = 0x01; + ad1 = 0x00; + count = 0; + while(1) { - if (flash_state) - erasingFlash(); - - else if (!(read_status() & BUSY)) + if (read_data(0x00, ad1, ad0) == 0xFF) + return count - 1; + else { - send_status(STATUS_AUDIO_CMD, 0, 2, 0); - f_state ++; + for (i = 0; i < 3; i++) + { + ad0 ++; + if (ad0 == 0) + ad1++; + } } + count ++; } - else if (f_state == FIRST_PROG_STATE) + return 0; +} +/** + * \ingroup flash + \brief Store a sound in the memory. + + This function contain 5 states : + + DETECT_INDEXES : Detect if the memory is empty or not, and determine where the sound must be stored. + + PROG_INIT : Start the programmation cycle with the indexes determinated in the first state. + + PROGRAMMING : Program the memory with the sound byte received by the RF. + + PROG_TOC : If the programming sequence is finished, the indexes are written. + + PROG_END : Restore the context. + + \note Each sound starts at the first byte of a 4kB block. To do this, the + lower address byte is reset, and the medium address byte is incremented. + +*/ + +void programming(void) +{ + uint8_t static programming_state = DETECT_INDEXES; + if (programming_state == DETECT_INDEXES) { - send_status(STATUS_AUDIO_CMD, 0, 3, 0); - programmingNumSound(); - send_status(STATUS_AUDIO_CMD, 0, 4, 0); - f_state ++; - } - else if (f_state == PROG_TOC_STATE) - { - if (TOCRX) + TIMSK0 = 0x00; + numSound = readFlashNumber(); + if (numSound == 0) { - programmingToc(); + /* The flash memory is empty. The first address is 0x000400 */ + ad[0] = 0x00; + ad[1] = 0x04; + ad[2] = 0x00; } + else + { + /* One or more sounds are programmed in the flash memory. + * The next sound must be stored after the others */ + index = (numSound * 3) + 1; + ad[0] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[1] = read_data(0x00, (index>>8), (index & 0xFF)); + index ++; + ad[2] = read_data(0x00, (index>>8), (index & 0xFF)); - if (flash_state) - f_state ++; + // Goto the next 4kB block. + ad[1] ++; + if (ad[1] == 0) + ad[0] ++; + ad[2] = 0; + } + resetFifo(&PWMFifo); + + if (ad[0] > 0x07) + programming_state = PROG_END; + else + programming_state ++; + + frame_without_sound = 255; + frame_without_sound_timeout = 255; } - else if (f_state == INIT_SOUND_PROG_STATE) + + else if (programming_state == PROG_INIT) { - initSoundProgramming(); + init_programming(ad[0], ad[1], ad[2]); + programming_state ++; + flash_state = 1; + sound_stored = 0; + } + else if (programming_state == PROGRAMMING) + { if (flash_state) { - send_status(STATUS_AUDIO_CMD, 0, 5, 0); - f_state ++; + programming_sound(); } + else + { + write_disable(); + if (sound_stored) + programming_state ++; + else + programming_state = PROG_END; + } + } + else if (programming_state == PROG_TOC) + { + numSound ++; + index = (numSound * 3) + 1; + program_flash(0x00, (index>>8), (index & 0xFF), ad[0]); + index ++; + program_flash(0x00, (index>>8), (index & 0xFF), ad[1]); + index ++; + program_flash(0x00, (index>>8), (index & 0xFF), ad[2]); + programming_state ++; } - if (f_state == SOUND_PROG_STATE) + else if (programming_state == PROG_END) { - soundProgramming(); + programming_state = 0; + programmingFlash = 0; + TIMSK0 = 0x01; + } +} - if (flash_state) - f_state ++; +/** + * \ingroup flash + \brief Erase the flash memory. + + The first step is to send the command to erase the flash. + After, the status is polled while the erase process isn't finished. + When the BUSY flag is null, the erase sequence is stopped. +*/ +void erase(void) +{ + uint8_t static enter = 1; + if (enter) + { + erase_flash(); + enter = 0; } - else if (f_state == END_STATE) + else if (!(read_status() & BUSY)) { - endProgramming(); - send_status(STATUS_AUDIO_CMD, 0, 0, 0); - f_state = 0; + enter = 1; + eraseFlag = 0; + program_flash(0x00, 0x00, 0x00, 0xFE); + program_flash(0x00, 0x00, 0x01, 0x00); + program_flash(0x00, 0x00, 0x02, 0x04); + program_flash(0x00, 0x00, 0x03, 0x00); + numSound = readFlashNumber(); + TIMSK0 = 0x01; } } @@ -132,20 +213,18 @@ The first step (playInit) is to initialize the flash memory with the selected sound to play. Many tests are made to ensure that the sound to play exist, the indexes are correct, etc. - The second step (playingSound) is to fill the fifo with the sound's bytes, and to verify the adresses. - + The second step (playingSound) is to fill the fifo with the sound's bytes, and to verify the addresses. */ + + void playSound(void) { if (flash_state) - playInit(soundNum); + playInit(soundToPlay); else playingSound(); } - - - /* Static functions */ /** * \ingroup flash @@ -163,50 +242,50 @@ static void playInit(uint8_t const nsound) { - uint8_t count, i; - uint8_t adp1, adp0, sounds_stored; // Address pointer varaible - flash_enable(); - sounds_stored = read_data(0x00, 0x00, 0x00); - if (sounds_stored == 0xFF) /* if unprogrammed we have 0xFF stored in flash */ + uint8_t i; + + if (numSound == 0x00) /* if unprogrammed we have 0xFF stored in flash */ { flashPlay = 0; return; } - if (!nsound || (nsound > sounds_stored)) /* check the limits */ + if (!nsound || (nsound > numSound)) /* check the limits */ { flashPlay = 0; return; } count = 1; - adp1 = 0x00; - adp0 = 0x01; + ad1 = 0x00; + ad0 = 0x01; while (count != nsound) // Compute address { for (i = 0; i < 3; i++) { - adp0++; - if (adp0 == 0) - adp1++; + ad0++; + if (ad0 == 0) + ad1++; } count++; } - flash_select(); // Chip Select - flash_enable(); spiSend(READ_ARRAY_LOW_F); // Send Read Page Command spiSend(0x00); // Send Address - spiSend(adp1); - spiSend(adp0); + spiSend(ad1); + spiSend(ad0); for (i = 0; i < 6; i++) { ad[i] = spiSend(NOP); // Read start and stop sound address } + ad[1] ++; + if (ad[1] == 0) + ad[0] ++; + ad[2] = 0; flash_unselect(); // Chip Deselect - /* Check adresses */ + /* Check addresses */ if (ad[0] > TOP_A2) { flashPlay = 0; @@ -255,7 +334,6 @@ spiSend(ad[0]); // Send Address spiSend(ad[1]); spiSend(ad[2]); - flash_onhold(); // Reset the HOLD signal OCR0A = 250; // Normal operation for PWM if fifo adaptative is on flash_state = 0; @@ -273,7 +351,6 @@ static void playingSound(void) { uint8_t sound; - flash_enable(); while (!spi_start && !isFifoFull(&PWMFifo)) { sound = spiSend(0x00); // Wait response @@ -302,7 +379,6 @@ break; } } - flash_onhold(); } /* Static functions */ @@ -311,7 +387,6 @@ \brief Stop the play sequence. */ - static void stopPlaying(void) { flashPlay = 0; @@ -320,172 +395,89 @@ PORTB |= 0x02; // Chip Deselect } - /** * \ingroup flash - * \brief Erase the flash memory. - * - * This funtion perform a full erase of the flash memory and initiate the sound - * flash programming. - */ -static void erasingFlash(void) + \brief Init the programming sequence + + To perform a sequential programming, the first step is to send the correct OP + code, and the three address bytes where the first data byte must be stored. + The second step is to send the OP code and a data to write. + + This function perform the first step. + */ +static void init_programming(uint8_t adi0, uint8_t adi1, uint8_t adi2) { - /* Desactivate the PWM */ - TCCR0A = 0x00; - TCCR0B = 0x00; - OCR0A = 0x00; - TIMSK0 = 0x00; - - - resetFifo(&PWMFifo); /* Reinitialise the PWM fifo */ - erase_flash(); /* Erase the flash */ - flash_state = 0; + write_enable(); + flash_select(); + spiSend(SEQU_PROGRAM); + spiSend(adi0); + spiSend(adi1); + spiSend(adi2); + if (!isFifoEmpty(&PWMFifo)) + spiSend(pullFifo(&PWMFifo)); + else + spiSend(0x80); + + flash_unselect(); // Chip Deselect } -/** - * \ingroup flash - * \brief Write the number of sound to be stored. - * - This function store the first TOC byte (numSound), received with the flash - program command, at the first memory adress. - */ -static void programmingNumSound(void) -{ - program_flash(0x00, 0x00, 0x00, numSound); // Write first byte of the TOC - - ad0 = 0x01; // Init TOC address - ad1 = 0x00; - ad2 = 0x00; - i = 0; -} /** * \ingroup flash - * \brief Write the TOC in the memory. - * - * This function store the the indexes into the memory. - */ + \brief Program the sound's data into the flash memory -static void programmingToc(void) -{ - TOCRX = 0; - flash_state = 0; - for (j = 0; j < 3; j++) - { - program_flash(ad2, ad1, ad0, TOCadress[j]); - ad0++; // Increment new adress - if (ad0 == 0x00) - ad1++; - } - i++; + This function is executed while the SPI start command is not present. Each + cycle, one byte is popped from the PWM fifo and stored in the sound flash. - /* Store the final adress */ - if (i == numSound + 1) - { - ad[0] = TOCadress[2]; - ad[1] = TOCadress[1]; - ad[2] = TOCadress[0]; + The frame_without_sound variable is decremented each time the RF receive a + frame without sound. When this variable is null, the sound process is + stopped. - /* Init the first sound byte adress */ - ad2 = 0x00; - ad1 = 0x04; - ad0 = 0x00; + If a programming sequence starts, but no sound is received, the cycle is + stopped. - flash_state = 1; - } -} -/** - * \ingroup flash - * \brief Initiate the sound programming. - * - * This function initiate the sound flash memory for a sequential programming. + If the address is equal to 0x07FFFF (the last memory address), the programming + cycle is stopped. + + The sound_stored flag is set when at least one byte is stored in the memory. + Else, this variable is null. */ -static void initSoundProgramming (void) +static void programming_sound(void) { - flash_state = 0; - write_enable(); - flash_select(); - spiSend(SEQU_PROGRAM); - spiSend(ad2); - spiSend(ad1); - spiSend(ad0); - while (!spi_start) // Send first byte into the page flash - { - if (!isFifoEmpty(&PWMFifo)) // Fifo not empty - { - spiSend(pullFifo(&PWMFifo)); // Write data in flash - ad0++; - flash_state = 1; // End of firt command - break; - } - else - flash_state = 0; - } - flash_unselect(); // Chip Deselect -} - -/** - * \ingroup flash - * \brief Program the sound in the flash memory. - * - * This function store the sound in the flash memory. - */ -static void soundProgramming(void) -{ - flash_state = 0; while (!spi_start) { - if (!isFifoEmpty(&PWMFifo)) // Fifo not empty + if (!isFifoEmpty(&PWMFifo)) { - flash_select(); // Chip Select - spiSend(SEQU_PROGRAM); // Send Sequencial Program Command - spiSend(pullFifo(&PWMFifo)); // Write data in flash - flash_unselect(); // Chip DeselecT - ad0++; // Increment address byte - if (ad0 == 0x00) + sound_stored = 1; + frame_without_sound = frame_without_sound_timeout = STOP_FRAME_NUMBER; + + flash_select(); + spiSend(SEQU_PROGRAM); + spiSend(pullFifo(&PWMFifo)); + flash_unselect(); + + ad[2] ++; + if (ad[2] == 0x00) { - ad1++; - if (ad1 == 0x00) - ad2++; + ad[1]++; + if (ad[1] == 0x00) + ad[0]++; } - while (read_status() & BUSY) ; // Wait Page Program Cycle + while (read_status() & BUSY) ; } /* Check for the last sound byte */ - if (ad2 == ad[2]) + if (!(frame_without_sound)) { - if (ad1 == ad[1]) - { - if (ad0 == ad[0]) - { - flash_state = 1; - break; // Stop programming flash - } - } + flash_state = 0; + break; } + if (ad[0] == 0x07 && ad[1] == 0xFF && ad[2] == 0xFF) + { + flash_state = 0; + break; + } } } -/** - * \ingroup flash - * \brief This function end the flash programming task. - * - * This function restore all the parameters. - */ - -static void endProgramming (void) -{ - write_disable(); // Disable wrtie flash - flash_state = 0; - TCCR0A = 0x23; // Reactivate PWM - TCCR0B = 0x09; - OCR0A = 249; /* we need TOP=250 to get a 8kHz sampling frequency */ - TIMSK0 = 0x01; - - TWCR = (TWCR & TWCR_CMD_MASK) | _BV(TWIE); // Reactivate I2C - - programmingFlash = 0; // Reset the flag to suspend the task -} - - Modified: firmware/tuxaudio/branches/new_flash_programming/flash.h =================================================================== --- firmware/tuxaudio/trunk/flash.h 2007-11-15 10:27:04 UTC (rev 701) +++ firmware/tuxaudio/branches/new_flash_programming/flash.h 2007-11-21 15:53:56 UTC (rev 718) @@ -36,18 +36,25 @@ /** \name Flash programming states @{ */ -#define ERASE_STATE 0 -#define FIRST_PROG_STATE 1 -#define PROG_TOC_STATE 2 -#define INIT_SOUND_PROG_STATE 3 -#define SOUND_PROG_STATE 4 -#define END_STATE 5 +#define DETECT_INDEXES 0 +#define PROG_INIT 1 +#define PROGRAMMING 2 +#define PROG_TOC 3 +#define PROG_END 4 /* @} */ +/** \name No sound in frame timeout + @{ */ +#define STOP_FRAME_NUMBER 10 +#define START_FRAME_NUMBER 100 +/* @} */ -extern void flashProgramming(void); + +extern void programming(void); extern void playSound(void); +extern void erase(void); +extern uint8_t readFlashNumber(void); /** start / end flash states flag */ extern uint8_t flash_state; Modified: firmware/tuxaudio/branches/new_flash_programming/main.c =================================================================== --- firmware/tuxaudio/trunk/main.c 2007-11-15 10:27:04 UTC (rev 701) +++ firmware/tuxaudio/branches/new_flash_programming/main.c 2007-11-21 15:53:56 UTC (rev 718) @@ -70,7 +70,7 @@ i2cSlaveReceiveService(4, buf + 8); sei(); buf[0] = SOUND_VAR_CMD; - buf[1] = read_data(0x00, 0x00, 0x00); + buf[1] = numSound; buf[2] = 0; buf[3] = 0; cli(); @@ -164,7 +164,7 @@ return; audioLevel = audioBuf[2]; //playingAudio(audioBuf[1]); /* start playing the sound */ - soundNum = audioBuf[1]; + soundToPlay = audioBuf[1]; send_status(STATUS_AUDIO_CMD, audioBuf[1], 0, 0); flashPlay = 1; flash_state = 1; @@ -202,22 +202,13 @@ if (flashPlay) flashPlay = 0; /* param: command[1] : number of sounds */ - numSound = command[1]; - f_state =0; /* First programming state */ flash_state = 1; /* Erasing flash flag */ send_status(STATUS_AUDIO_CMD, 0, 1, 0); programmingFlash = 1; /* Set the flag to enter programming sequence */ } else if (command[0] == STORE_INDEX_CMD) { - /* param: command[1] : lower address byte */ - /* command[2] : middle address byte */ - /* command[3] : higher address byte */ - TOCadress[2] = command[3]; // High address - TOCadress[1] = command[2]; // Medium address - TOCadress[0] = command[1]; // Lower address - TOCRX = 1; // Set TOC incoming flag - command[0] = 0; + eraseFlag = 1; } /* Version */ @@ -256,7 +247,7 @@ resetFifo(&PWMFifo); /* Initialise the PWM fifo */ resetFifo(&ADCFifo); /* Initialise the ADC fifo */ config_init(); /* load the configuration defaults from EEPROM */ - + numSound = readFlashNumber(); i2cCommunicationInit(); /* I2C initialization */ sei(); /* Init global interrupt */ @@ -297,11 +288,14 @@ } if (programmingFlash) // Restora all the context for flash programming - flashProgramming(); + programming(); if (flashPlay) playSound(); + if (eraseFlag) + erase(); + if (sendSensorsFlag) { sendSensorsFlag = 0; Modified: firmware/tuxaudio/branches/new_flash_programming/varis.c =================================================================== --- firmware/tuxaudio/trunk/varis.c 2007-11-15 10:27:04 UTC (rev 701) +++ firmware/tuxaudio/branches/new_flash_programming/varis.c 2007-11-21 15:53:56 UTC (rev 718) @@ -51,15 +51,15 @@ fifo_t ADCFifo = { (uint8_t *) ADCbuffer, sizeof ADCbuffer - 1, 0, 0 }; // Flash programming +uint8_t eraseFlag = 0; volatile unsigned char programmingFlash = 0; -volatile unsigned char numSound; -volatile unsigned char TOCadress[3]; -volatile unsigned char TOCRX = 0; +volatile uint8_t numSound; // Flash Variables volatile unsigned char flashPlay = 0; volatile unsigned char ad[6]; volatile unsigned char audioLevel; +uint8_t soundToPlay; unsigned char sendSensorsCmpt, sendSensorsFlag; unsigned char audio_level, battery_level; @@ -70,3 +70,6 @@ volatile unsigned char lockAdaptFifo = 1; volatile unsigned char Fifoinert = 0; + +uint8_t frame_without_sound = 0; +uint8_t frame_without_sound_timeout= 0; Modified: firmware/tuxaudio/branches/new_flash_programming/varis.h =================================================================== --- firmware/tuxaudio/trunk/varis.h 2007-11-15 10:27:04 UTC (rev 701) +++ firmware/tuxaudio/branches/new_flash_programming/varis.h 2007-11-21 15:53:56 UTC (rev 718) @@ -59,15 +59,16 @@ extern fifo_t ADCFifo; // Flash programming + +extern uint8_t eraseFlag; extern volatile unsigned char programmingFlash; -extern volatile unsigned char numSound; -extern volatile unsigned char TOCadress[3]; -extern volatile unsigned char TOCRX; +extern volatile uint8_t numSound; // Flash Variables extern unsigned char flashPlay; extern volatile unsigned char ad[6]; extern volatile unsigned char audioLevel; +extern uint8_t soundToPlay; extern unsigned char sendSensorsCmpt, sendSensorsFlag; extern unsigned char audio_level, battery_level; @@ -80,5 +81,6 @@ extern volatile unsigned char lockAdaptFifo; extern volatile unsigned char Fifoinert; - +extern uint8_t frame_without_sound; +extern uint8_t frame_without_sound_timeout; #endif |
From: jaguarondi <c2m...@c2...> - 2007-11-20 16:03:50
|
Author: jaguarondi Date: 2007-11-20 17:03:39 +0100 (Tue, 20 Nov 2007) New Revision: 717 Added: daemon/trunk/doc/ daemon/trunk/doc/Doxyfile daemon/trunk/doc/builddoc.sh Removed: daemon/trunk/Doxyfile Modified: daemon/trunk/Makefile Log: * Updated the files to generate doxygen documentation. Just type 'make doc' to get the html files. Deleted: daemon/trunk/Doxyfile =================================================================== --- daemon/trunk/Doxyfile 2007-11-20 11:00:23 UTC (rev 716) +++ daemon/trunk/Doxyfile 2007-11-20 16:03:39 UTC (rev 717) @@ -1,1253 +0,0 @@ -# Doxyfile 1.4.7 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "Tux Droid daemon" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -# Damien-- exclude Quilt directories -EXCLUDE = .pc patches - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), -# the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO Modified: daemon/trunk/Makefile =================================================================== --- daemon/trunk/Makefile 2007-11-20 11:00:23 UTC (rev 716) +++ daemon/trunk/Makefile 2007-11-20 16:03:39 UTC (rev 717) @@ -57,6 +57,11 @@ @$(CC) $(CFLAGS) $(C_PREPROC) $(C_INCLUDE_DIRS) -c "$<" -o "$@" endef +## Generate doxygen documentation +.PHONY: doc +doc: + @./doc/builddoc.sh + .PHONY: print_header directories $(TARGET): print_header directories version.h $(SRC_OBJS) Added: daemon/trunk/doc/Doxyfile =================================================================== --- daemon/trunk/doc/Doxyfile (rev 0) +++ daemon/trunk/doc/Doxyfile 2007-11-20 16:03:39 UTC (rev 717) @@ -0,0 +1,1278 @@ +# Doxyfile 1.5.2 - Doxygen configuration file for TUXCORE +# +# Tux Droid - USB Daemon +# Copyright (C) 2007 C2ME S.A. <tux...@c2...> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# $Id: $ + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Tux Droid daemon" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = $(VERSION) + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names... [truncated message content] |
From: remi <c2m...@c2...> - 2007-11-20 11:00:28
|
Author: remi Date: 2007-11-20 12:00:23 +0100 (Tue, 20 Nov 2007) New Revision: 716 Modified: api/python/trunk/tuxapi_class.py Log: UPD: Micro on-off Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-20 10:22:34 UTC (rev 715) +++ api/python/trunk/tuxapi_class.py 2007-11-20 11:00:23 UTC (rev 716) @@ -1160,16 +1160,18 @@ funct(args) except: self.remove(idx) + + fff = frame[5:] + ord_frame = [] + for val in fff: + ord_frame.append(ord(val)) for i, event in enumerate(events): if event[1] != None: if event[0] == ord(frame[4]): - frame = frame[5:] - ord_frame = [] - for val in frame: - ord_frame.append(ord(val)) - args = tuple(ord_frame) - thread.start_new_thread(__load_funct_async, (i, event[1], args)) + m_args = tuple(ord_frame) + t = threading.Thread(target = __load_funct_async, args = (i, event[1], m_args)) + t.start() #============================================================================== @@ -2552,6 +2554,15 @@ """ self.last_ack=self.structured(TUX_CMD_STRUCT_SOUND, \ TUX_CMD_STRUCT_SUB_TEST,0,0,0) + + #-------------------------------------------------------------------------- + # test + #-------------------------------------------------------------------------- + def sound_on(self): + self.last_ack = self.raw(0x92, 0, 0, 0) + + def sound_off(self): + self.last_ack = self.raw(0x92, 0, 0, 0) #-------------------------------------------------------------------------- # Send a command to tux for the "ping-pong" test @@ -5235,8 +5246,11 @@ def __init__(self,parent): self.parent = parent self.__state = False + self.__state_mutex = threading.Lock() self.__process = None self.__process_mutex = threading.Lock() + self.__mic_on_mutex = threading.Lock() + self.__mic_on_flag = False self.__thread = None self.on_buffer = EventControl() self.on_capture_stop = EventControl() @@ -5303,9 +5317,10 @@ >>> tux.micro.capture_start_free('/home/remi/Desktop/test.wav', 10.0) >>> tux.micro.capture_start_free('/home/remi/Desktop/test.wav') """ + time.sleep(0.1) if self.__capturing: return False - if not self.__state: + if not self.__get_state(): return False self.__capture_path = out_path self.__capture_buffer = [] @@ -5344,6 +5359,28 @@ wavfile.close() except: pass + + def __set_state(self, value): + self.__state_mutex.acquire() + self.__state = value + self.__state_mutex.release() + + def __get_state(self): + self.__state_mutex.acquire() + ret = self.__state + self.__state_mutex.release() + return ret + + def __set_mic_on_flag(self, value): + self.__state_mutex.acquire() + self.__mic_on_flag = value + self.__state_mutex.release() + + def __get_mic_on_flag(self): + self.__state_mutex.acquire() + ret = self.__mic_on_flag + self.__state_mutex.release() + return ret def on(self): """ @@ -5352,25 +5389,43 @@ Example: >>> tux.micro.on() """ - if self.__state: - return def get_micro_data(): device = self.parent.hw.alsa_device cmd = ["arecord", "-D", device, "-t", "raw"] - self.__process = subprocess.Popen(cmd, stdout = subprocess.PIPE,\ - stderr = subprocess.PIPE) - self.__state = True - while self.__process.poll() == None: + try: + time.sleep(0.1) + self.__process = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE) + except: + return + print 'MICRO STREAM: ACQUISITION ON' + self.__set_state(True) + while (self.__process.poll() == None): self.__process_mutex.acquire() buff = self.__process.stdout.read(800) self.__on_new_buffer(buff) self.__process_mutex.release() time.sleep(0.01) - self.__state = False + print 'MICRO STREAM: ACQUISITION OFF' + self.__process_mutex.acquire() + self.__process = None + self.__process_mutex.release() + self.__set_state(False) + + self.__mic_on_mutex.acquire() + if self.__get_state(): + self.__mic_on_mutex.release() + return + if self.__thread != None: + if self.__thread.isAlive(): + self.__mic_on_mutex.release() + self.__thread._Thread__stop() + return + self.__thread = threading.Thread(target=get_micro_data) self.__thread.setName('micro.on') self.__thread.start() + self.__mic_on_mutex.release() def off(self): """ @@ -5379,11 +5434,15 @@ Example: >>> tux.micro.off() """ - if not self.__state: + if not self.__get_state(): return self.__process_mutex.acquire() - os.kill(self.__process.pid, signal.SIGKILL) - os.waitpid(-1, os.WNOHANG) + try: + if self.__process != None: + os.kill(self.__process.pid, signal.SIGKILL) + os.waitpid(-1, os.WNOHANG) + except: + pass self.__process_mutex.release() self.capture_stop() @@ -5391,7 +5450,7 @@ i_buffer = [] for c in buffer: i_buffer.append(ord(c)) - if self.__state: + if self.__get_state(): self.__send_energy_monitoring(i_buffer) self.on_buffer.notify(i_buffer) |
From: Paul_R <c2m...@c2...> - 2007-11-20 10:22:41
|
Author: Paul_R Date: 2007-11-20 11:22:34 +0100 (Tue, 20 Nov 2007) New Revision: 715 Modified: software/gadgets/battery_monitor/trunk/Battery_monitor.tgf software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml Log: * Changed the on_battery_level function to always release the mutex Modified: software/gadgets/battery_monitor/trunk/Battery_monitor.tgf =================================================================== (Binary files differ) Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py 2007-11-19 16:14:36 UTC (rev 714) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py 2007-11-20 10:22:34 UTC (rev 715) @@ -480,6 +480,8 @@ # ########################################################### def on_battery_level(self, args): + if self.__on_battery_mutex.locked(): + return try: self.__on_battery_mutex.acquire() @@ -543,6 +545,7 @@ self.event_control() self.__on_battery_mutex.release() except: + self.__on_battery_mutex.release() print sys.exc_info() Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml 2007-11-19 16:14:36 UTC (rev 714) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml 2007-11-20 10:22:34 UTC (rev 715) @@ -11,7 +11,7 @@ <widget_lblControl type='str'>Contrôle</widget_lblControl> <Increase type='str'>Le niveau de la batterie est passé en dessus du seuil</Increase> <full type='str'>Les batteries sont pleines</full> - <gui_conf_accept_bt type='str'>Valider</gui_conf_accept_bt> + <widget_lblChangeD type='str'>Changement inf.</widget_lblChangeD> <lblLowThreshold type='str'>Limite inférieure</lblLowThreshold> <help_text type='str'>-- Les évènements : Deux grands types d'évènements peuvent avoir lieu, contenant chacun diverses options : @@ -73,7 +73,7 @@ <MainBehavior type='str'>Comportement principal</MainBehavior> <speaker_name type='str'>Bruno8k</speaker_name> <conf_lblSample type='str'>Points</conf_lblSample> - <charging type='str'>En charge</charging> + <conf_lblType type='str'>Type</conf_lblType> <Change type='str'>Le niveau de la batterie a changé</Change> <Both type='str'>Le niveau de la batterie a passé le seuil</Both> <conf_btnModify type='str'>Modifier</conf_btnModify> @@ -102,18 +102,18 @@ <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <widget_lblChange type='str'>Changement</widget_lblChange> <name_to_read type='str'>Moniteur de batteries</name_to_read> - <conf_lblNotNotified type='str'>Non notifié</conf_lblNotNotified> + <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> <Drop type='str'>Le niveau de la batterie a chuté</Drop> <conf_lblDrop type='str'>Chute</conf_lblDrop> - <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> + <conf_lblNotNotified type='str'>Non notifié</conf_lblNotNotified> <Raise type='str'>Le niveau de la batterie a augmenté</Raise> - <conf_lblType type='str'>Type</conf_lblType> + <charging type='str'>En charge</charging> <widget_lblSet type='str'>Ajouter a la config.</widget_lblSet> <Decrease type='str'>Le niveau de la batterie est passé en dessous du seuil</Decrease> <conf_lblValue type='str'>Valeur (V)</conf_lblValue> <conf_lblRate type='str'>Rafraichissement</conf_lblRate> <widget_lblBehavior type='str'>Activer le script</widget_lblBehavior> - <widget_lblChangeD type='str'>Changement inf.</widget_lblChangeD> + <gui_conf_accept_bt type='str'>Valider</gui_conf_accept_bt> <conf_lblTime type='str'>Temps (sec.)</conf_lblTime> <conf_lblControl type='str'>Contrôle</conf_lblControl> <conf_lblNotified type='str'>Notifié ?</conf_lblNotified> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml 2007-11-19 16:14:36 UTC (rev 714) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml 2007-11-20 10:22:34 UTC (rev 715) @@ -1,8 +1,8 @@ <?xml version='1.0' encoding='UTF-8'?> <about> + <gadget_description type='str'> + </gadget_description> <gadget_author type='str'>Paul Rathgeb</gadget_author> + <gadget_name type='str'>battery_monitor</gadget_name> <gadget_version type='str'>0.0.1</gadget_version> - <gadget_name type='str'>battery_monitor</gadget_name> - <gadget_description type='str'> - </gadget_description> </about> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-11-19 16:14:36 UTC (rev 714) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-11-20 10:22:34 UTC (rev 715) @@ -1,14 +1,14 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> - <Sample type='float'>600.0</Sample> + <test_tab type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, None, False, 0]]</test_tab> + <chkMotors type='bool'>True</chkMotors> <low_threshold type='float'>4.8</low_threshold> - <chkMotors type='bool'>True</chkMotors> <MainScript type='str'>None</MainScript> - <test_tab type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, None, False, 0]]</test_tab> + <Sample type='float'>600.0</Sample> <Rate type='float'>1.0</Rate> <high_threshold type='float'>6.0</high_threshold> - <config type='list'>[[1, 0, 0, 1.0, 1.0, False, 'None', False, 0], [2, 1, 0, 4.0, 1.0, False, 'None', False, 0]]</config> + <config type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, None, False, 0]]</config> </parameters> <general> <have_settings_part type='bool'>True</have_settings_part> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-11-19 16:14:36 UTC (rev 714) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-11-20 10:22:34 UTC (rev 715) @@ -3,15 +3,20 @@ <conf_lblIncrease type='str'>Increase</conf_lblIncrease> <conf_lblThreshold type='str'>Threshold</conf_lblThreshold> <gui_conf_remote_title type='str'>Control</gui_conf_remote_title> + <conf_lblTime type='str'>Time (sec.)</conf_lblTime> <battery type='str'>On battery</battery> + <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> <conf_lblRaise type='str'>Raise</conf_lblRaise> + <widget_lblTest type='str'>Notifications</widget_lblTest> <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> <conf_lblEvent type='str'>Event</conf_lblEvent> <widget_lblControl type='str'>Control</widget_lblControl> <Increase type='str'>The battery level exceeded the threshold</Increase> - <full type='str'>The level of the batteries is full</full> + <conf_btnModify type='str'>Modify</conf_btnModify> <widget_lblChangeD type='str'>Drop and raise</widget_lblChangeD> - <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> + <lblLowThreshold type='str'>Lower limit</lblLowThreshold> + <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> + <lblMotors type='str'>Disable measurement when the motors are running</lblMotors> <help_text type='str'>--The events: Two main types of events can take place, each containing various options: @@ -47,41 +52,38 @@ When this window is displayed, the events stored in the settings window are not notified. This window makes it possible to try various configurations and to add them in the settings table.</help_text> <end_of_charge type='str'>The recharging of the battery is finished</end_of_charge> - <conf_btnRemove type='str'>Remove</conf_btnRemove> <conf_lblChange type='str'>Change</conf_lblChange> <conf_lblBoth type='str'>Both</conf_lblBoth> <widget_lblBtnApply type='str'>Apply changes</widget_lblBtnApply> <widget_lblChangeU type='str'>Raise and drop</widget_lblChangeU> <widget_lblNotified type='str'>Notified</widget_lblNotified> + <conf_lblNotNotified type='str'>Not notified</conf_lblNotNotified> <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> <gui_conf_update_title type='str'>Update</gui_conf_update_title> <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <gui_conf_cancel_bt type='str'>Cancel</gui_conf_cancel_bt> - <widget_lblBoth type='str'>Both direction</widget_lblBoth> - <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> <absolute_threshold_high type='str'>The batteries are full</absolute_threshold_high> - <conf_lblType type='str'>Type</conf_lblType> <mainscript type='str'>I've found the light !</mainscript> - <MainBehavior type='str'>Main behavior</MainBehavior> - <lblLowThreshold type='str'>Lower limit</lblLowThreshold> + <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> <plugged type='str'>Plugged</plugged> - <ChangeU type='str'>The battery level raised and dropped</ChangeU> <conf_btnBehavior type='str'>Clear path</conf_btnBehavior> <charge type='str'>and the batteries are recharging</charge> <gui_conf_about_title type='str'>About</gui_conf_about_title> <conf_lblChangeD type='str'>Drop and raise</conf_lblChangeD> <low type='str'>The level of the batteries is weak</low> - <speaker_name type='str'>Ryan8k</speaker_name> + <conf_btnAdd type='str'>Add</conf_btnAdd> + <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> <conf_lblSample type='str'>Samples</conf_lblSample> - <charging type='str'>Charging</charging> + <conf_lblType type='str'>Type</conf_lblType> <Change type='str'>The battery level changed</Change> + <conf_lblValue type='str'>Value (V)</conf_lblValue> <Both type='str'>The battery level reached the threshold</Both> - <conf_btnModify type='str'>Modify</conf_btnModify> + <full type='str'>The level of the batteries is full</full> <widget_lblEvent type='str'>Event</widget_lblEvent> <normal type='str'>The level of the batteries is good</normal> <widget_lblIncrease type='str'>Increasing</widget_lblIncrease> <widget_lblRaise type='str'>Raise</widget_lblRaise> - <conf_btnAdd type='str'>Add</conf_btnAdd> + <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> <on_battery type='str'>and I'm powered by the battery</on_battery> <widget_lblDecrease type='str'>Decreasing</widget_lblDecrease> <gui_conf_sample_lb type='str'>Sample :</gui_conf_sample_lb> @@ -89,33 +91,31 @@ <conf_lblNotifiedBehavior type='str'>Notified</conf_lblNotifiedBehavior> <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> <widget_lblDrop type='str'>Drop</widget_lblDrop> - <ChangeD type='str'>The battery level dropped and raised</ChangeD> - <absolute_threshold type='str'>Weak batteries </absolute_threshold> - <lblMotors type='str'>Disable measurement when the motors are running</lblMotors> + <conf_lblNotified type='str'>Notified ?</conf_lblNotified> + <widget_lblBoth type='str'>Both direction</widget_lblBoth> <conf_lblDecrease type='str'>Decrease</conf_lblDecrease> - <lblHighThreshold type='str'>Upper limit</lblHighThreshold> <widget_lblValue type='str'>Value (V)</widget_lblValue> <conf_lblDefaultBehavior type='str'>Default behavior</conf_lblDefaultBehavior> - <widget_lblDisplayThreshold type='str'>Display threshold on graph</widget_lblDisplayThreshold> - <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> + <speaker_name type='str'>Ryan8k</speaker_name> <plug type='str'>and the power supply is plugged</plug> - <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> + <absolute_threshold type='str'>Weak batteries </absolute_threshold> <widget_lblChange type='str'>Change</widget_lblChange> <name_to_read type='str'>Battery monitor</name_to_read> + <lblHighThreshold type='str'>Upper limit</lblHighThreshold> <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> <Drop type='str'>The battery level dropped</Drop> <conf_lblDrop type='str'>Drop</conf_lblDrop> - <conf_lblNotNotified type='str'>Not notified</conf_lblNotNotified> + <ChangeD type='str'>The battery level dropped and raised</ChangeD> <Raise type='str'>The battery level raised</Raise> - <conf_lblNotified type='str'>Notified ?</conf_lblNotified> + <charging type='str'>Charging</charging> <widget_lblSet type='str'>Add to config</widget_lblSet> <Decrease type='str'>The battery level passed below the threshold</Decrease> - <conf_lblValue type='str'>Value (V)</conf_lblValue> + <widget_lblDisplayThreshold type='str'>Display threshold on graph</widget_lblDisplayThreshold> <conf_lblRate type='str'>Refresh rate</conf_lblRate> <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> - <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> - <conf_lblTime type='str'>Time (sec.)</conf_lblTime> + <MainBehavior type='str'>Main behavior</MainBehavior> + <ChangeU type='str'>The battery level raised and dropped</ChangeU> <conf_lblControl type='str'>Control</conf_lblControl> - <widget_lblTest type='str'>Notifications</widget_lblTest> + <conf_btnRemove type='str'>Remove</conf_btnRemove> <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> </strings> |
From: jaguarondi <c2m...@c2...> - 2007-11-19 16:14:43
|
Author: jaguarondi Date: 2007-11-19 17:14:36 +0100 (Mon, 19 Nov 2007) New Revision: 714 Added: daemon/trunk/supervise.c daemon/trunk/supervise.h daemon/trunk/versioning.c daemon/trunk/versioning.h Modified: daemon/trunk/Makefile daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h daemon/trunk/libs/USBDaemon_tcp_server.c Log: * Added a supervise module which will add new functionalities to the daemon. * Added versioning which collects all version information from all CPUs and store them in the main status table. Still need to update the API to send out these new status. Modified: daemon/trunk/Makefile =================================================================== --- daemon/trunk/Makefile 2007-11-19 16:09:54 UTC (rev 713) +++ daemon/trunk/Makefile 2007-11-19 16:14:36 UTC (rev 714) @@ -43,6 +43,8 @@ $(OBJ_DIR)/USBDaemon_pidfile.o \ $(OBJ_DIR)/USBDaemon_command_tux.o \ $(OBJ_DIR)/USBDaemon_tcp_server.o \ + $(OBJ_DIR)/supervise.o \ + $(OBJ_DIR)/versioning.o \ $(OBJ_DIR)/USBDaemon_log.o define build_target @@ -92,6 +94,12 @@ version.h $(compile_source) +$(OBJ_DIR)/supervise.o: supervise.c supervise.h + $(compile_source) + +$(OBJ_DIR)/versioning.o: versioning.c versioning.h + $(compile_source) + $(OBJ_DIR)/USBDaemon_log.o: libs/USBDaemon_log.c libs/USBDaemon_log.h $(compile_source) Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-19 16:09:54 UTC (rev 713) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-19 16:14:36 UTC (rev 714) @@ -1013,7 +1013,7 @@ /************************************************************************ */ static void tux_req_info(unsigned char const data[], unsigned char result[]) { - struct firmware_version_t const *const firmware = &tux_status.firmware[data[1]]; + struct firmware_info_t const *const firmware = &tux_status.firmware_info[data[1]]; result[0] = data[0]; Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-19 16:09:54 UTC (rev 713) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-19 16:14:36 UTC (rev 714) @@ -23,11 +23,14 @@ /*_____________________ I N C L U D E S____________________________________ */ #include <stdio.h> #include <assert.h> + #include "USBDaemon_status_table.h" #include "USBDaemon_usb.h" #include "USBDaemon_globals.h" #include "USBDaemon_log.h" #include "USBDaemon_tcp_server.h" +#include "../supervise.h" +#include "../versioning.h" #include "../tuxdefs/commands.h" #include "../tuxdefs/defines.h" @@ -42,23 +45,11 @@ unsigned char CMD_status = 0; unsigned char pong_received; unsigned char cmd_status_flag; -static int current_cpu = INVALID_CPU_NUM; static unsigned char last_remote_key = 0xFF; static unsigned char last_toggle_key = 0xFF; unsigned char sound_flash_count = 0; /** - * CPU names mapped from their identifiers. - * Should be in sync with CPU_IDENTIFIERS so that cpu_name[some_cpu_id] - * should return its CPU name. - * XXX is there a better way to achieve this functionality? I didn't want to - * have that array declared in defines.h otherwise it would end up in all - * firmware too. - */ -char const *const cpu_name[] = {"tuxcore", "tuxaudio", "tuxrf", "fuxrf", - "fuxusb"}; - -/** * Tux status table. * * This hierarchical structure holds all current status of tux and the dongle. @@ -72,85 +63,6 @@ struct connection_status_t connection_status; /** - * Update tux_status with the given firmware version data. - */ -void update_firmware_version(const unsigned char *data) -{ - struct firmware_version_t *firmware; - - /* When returning 'information', the firmware starts by sending this - * version information which includes the CPU number. This number is - * used to determine which CPU is sending the upcoming information data - * like revision and author. So we should save that number. */ - current_cpu = CPU_VER_CPU(data[1]); - /* Check if the value received is a valid CPU number. */ - assert(current_cpu >= LOWEST_CPU_NUM && current_cpu <= HIGHEST_CPU_NUM); - /* Select the corresponding CPU entry in the status table. */ - firmware = &tux_status.firmware[current_cpu]; - /* Save major, minor and update numbers. */ - firmware->version_major = CPU_VER_MAJ(data[1]); - firmware->version_minor = data[2]; - firmware->version_update = data[3]; - - log_debug("version of %s: %d.%d.%d", cpu_name[current_cpu], - CPU_VER_MAJ(firmware->version_major), firmware->version_minor, - firmware->version_update); -} - -/** - * Update tux_status with the given firmware revision data. - */ -static void update_firmware_revision(const unsigned char *data) -{ - /* Release types defined as strings. See parameters of REVISION_CMD. */ - char revision_string[40]; - struct firmware_version_t *firmware; - - /* Preconditions */ - assert((current_cpu == INVALID_CPU_NUM) || - (current_cpu >= LOWEST_CPU_NUM && current_cpu <= HIGHEST_CPU_NUM)); - /* Check that a valid CPU number has been received. INVALID_CPU_NUM can be - * be received if the version frame is lost and we directly get the - * revision frame. */ - if (current_cpu == INVALID_CPU_NUM) - return; - /* Select the corresponding CPU entry in the status table. */ - firmware = &tux_status.firmware[current_cpu]; - /* Save revision number. */ - firmware->revision = (data[2] << 8) + data[1]; - /* We already got the version when receiving the revision so we can now - * store the version string. */ - sprintf(revision_string, " - r%d (SVN/UNRELEASED)", firmware->revision); - sprintf(firmware->version_string, "%s %d.%d.%d%s%s%s", cpu_name[current_cpu], - CPU_VER_MAJ(firmware->version_major), firmware->version_minor, - firmware->version_update, - data[3] & 1<<2 ? "" : revision_string, - data[3] & 1<<0 ? "(modified locally)" : "", - data[3] & 1<<1 ? "(mixed revisions)" : ""); - printf(firmware->version_string); - printf("\n"); - log_debug("revision of %s: %d - type %d", cpu_name[current_cpu], - firmware->revision, data[3]); -} - -/** - * Update tux_status with the given firmware author data. - */ -static void update_firmware_author(const unsigned char *data) -{ - struct firmware_version_t *firmware; - /* Check that a valid CPU number has been received. */ - if (current_cpu == INVALID_CPU_NUM) - return; - /* Select the corresponding CPU entry in the status table. */ - firmware = &tux_status.firmware[current_cpu]; - /* Save author. */ - firmware->author = (data[2] << 8) + data[1]; - - log_debug("author of %s: %d", cpu_name[current_cpu], firmware->author); -} - -/** * Update tux_status with the given properties of the sound flash. */ static void update_sound_flash_properties(const unsigned char *data) @@ -629,9 +541,7 @@ } /************************************************************************ */ - /* update_raw_status_table() */ - /************************************************************************ */ void update_raw_status_table(const unsigned char *new_status) { @@ -740,6 +650,7 @@ new_status[2], new_status[3]); break; } + } /************************************************************************ */ @@ -758,24 +669,27 @@ tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; - /* RF connection change. */ + /* DONGLE_status is null for now */ if (new_status[0] != DONGLE_status) { DONGLE_status = new_status[0]; - if (DONGLE_status == 1) + } + + /* RF connection change. */ + if (new_status[1] != RF_status) + { + RF_status = new_status[1]; + if (RF_status == 1) /* RF connected */ { + on_connect_status_update(); } else /* RF disconnected */ { + on_disconnect_status_cleaning(); } - } - /*RF status change */ - if (RF_status != new_status[1]) - { - RF_status = new_status[1]; tcp_frame[4] = DATA_STATUS_RF_CONNECTED; tcp_frame[5] = RF_status; tcp_server_send_raw(tcp_frame); @@ -785,6 +699,7 @@ if (CMD_status != new_status[2]) { CMD_status = new_status[2]; + //if (CMD_status == ACK_CMD_OK || CMD_status == ACK_CMD_KO) if (CMD_status == ACK_CMD_OK || CMD_status == ACK_CMD_KO) cmd_status_flag = 0; } Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-19 16:09:54 UTC (rev 713) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-19 16:14:36 UTC (rev 714) @@ -25,6 +25,7 @@ /*_____________________ I N C L U D E S____________________________________ */ #include "../tuxdefs/api.h" +#include "../tuxdefs/defines.h" #include <stdbool.h> /*_____________________ D E F I N E S ______________________________________*/ @@ -273,6 +274,15 @@ extern unsigned char cmd_status_flag; extern unsigned char pong_received; +/** Number of firmware information structures to store. + * There's one for each firmware and one for the general release package. + * Firmware will have the same index as defined in CPU_IDENTIFIERS, the last + * one will be the release package. */ +#define NUMBER_OF_FIRMWARE (HIGHEST_CPU_NUM + 2) +/** Index of the general release package information structure defined in + * tux_status. */ +#define RELEASE_INDEX (NUMBER_OF_FIRMWARE - 1) + /** * Tux status table. * @@ -280,8 +290,8 @@ */ struct tux_status_t { - /** Firmware version numbers, svn revision and author. */ - struct firmware_version_t + /** Firmware versioning , svn revision and author. */ + struct firmware_info_t { int version_major; int version_minor; @@ -291,8 +301,9 @@ int local_modification; int mixed_revisions; int author; + int variation; char version_string[100]; - } firmware[5]; + } firmware_info[NUMBER_OF_FIRMWARE]; /** Sound flash properties. */ struct sound_flash_t { Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-11-19 16:09:54 UTC (rev 713) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-11-19 16:14:36 UTC (rev 714) @@ -35,6 +35,7 @@ #include "USBDaemon_tcp_server.h" #include "USBDaemon_usb.h" #include "USBDaemon_pidfile.h" +#include "../supervise.h" #include "USBDaemon_log.h" /*_____________________ V A R I A B L E S __________________________________*/ @@ -191,6 +192,8 @@ exit(1); } + supervise(); + timeout = TIMEOUT; } else if (r < 0) Added: daemon/trunk/supervise.c =================================================================== --- daemon/trunk/supervise.c (rev 0) +++ daemon/trunk/supervise.c 2007-11-19 16:14:36 UTC (rev 714) @@ -0,0 +1,49 @@ +/* + * Tux Droid - USB Daemon + * Copyright (C) 2007 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +/* $Id$ */ + +#include "versioning.h" +#include "libs/USBDaemon_status_table.h" + +/** + * Actions that should be triggered when tux is just getting disconnected. + */ +void on_disconnect_status_cleaning(void) +{ + tux_information_cleaning(); +} + +/** + * Actions that should be triggered when tux is just getting connected. + */ +void on_connect_status_update(void) +{ + get_versioning(); +} + +/** + * This functions is called regularly to supervise all the functionalities that + * the daemon should manage. + */ +void supervise(void) +{ + versioning_call(); +} Property changes on: daemon/trunk/supervise.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: daemon/trunk/supervise.h =================================================================== --- daemon/trunk/supervise.h (rev 0) +++ daemon/trunk/supervise.h 2007-11-19 16:14:36 UTC (rev 714) @@ -0,0 +1,33 @@ +/* + * Tux Droid - USB Daemon + * Copyright (C) 2007 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +/* $Id$ */ + +#ifndef _SUPERVISE_H_ +#define _SUPERVISE_H_ + +void init_versioning(void); +void versioning(void); + +void on_disconnect_status_cleaning(void); +void on_connect_status_update(void); +void supervise(void); + +#endif /* _SUPERVISE_H_ */ Property changes on: daemon/trunk/supervise.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: daemon/trunk/versioning.c =================================================================== --- daemon/trunk/versioning.c (rev 0) +++ daemon/trunk/versioning.c 2007-11-19 16:14:36 UTC (rev 714) @@ -0,0 +1,393 @@ +/* + * Tux Droid - USB Daemon + * Copyright (C) 2007 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +/* $Id$ */ + +#include <stdio.h> +#include <string.h> +#include <assert.h> + +#include "libs/USBDaemon_log.h" +#include "libs/USBDaemon_status_table.h" +#include "libs/USBDaemon_globals.h" +#include "libs/USBDaemon_usb.h" +#include "tuxdefs/defines.h" +#include "tuxdefs/api.h" + +/** + * CPU names mapped from their identifiers. + * Should be in sync with CPU_IDENTIFIERS so that cpu_name[some_cpu_id] + * should return its CPU name. + * XXX is there a better way to achieve this functionality? I didn't want to + * have that array declared in defines.h otherwise it would end up in all + * firmware too. + */ +static char const *const cpu_name[] = +{ + [TUXCORE_CPU_NUM] = "tuxcore", + [TUXAUDIO_CPU_NUM] = "tuxaudio", + [TUXRF_CPU_NUM] = "tuxrf", + [FUXRF_CPU_NUM] = "fuxrf", + [FUXUSB_CPU_NUM] = "fuxusb" +}; + +/** + * Versioning states. + */ +typedef enum versioning_state +{ + STDBY, + INIT, + INFO_REQ, + INFO_GET, + SPECIAL, + RELEASE, + FINALIZE, +} versioning_state_t; + +/** State of the versioning state machine. */ +static versioning_state_t versioning_state = STDBY; + +/** Used to hold the CPU number that is currently sending its information as it + * needs multiple commands to send it all. */ +static int current_cpu = INVALID_CPU_NUM; + +/** + * Remove all information associated with tux: tuxcore, tuxaudio and tuxrf. + * + * This can be used when a tux is disconnected to avoid having information + * buffered but which is not relevant anymore. + */ +void tux_information_cleaning(void) +{ + int firmware_num[4] = {TUXCORE_CPU_NUM, TUXAUDIO_CPU_NUM, TUXRF_CPU_NUM, + RELEASE_INDEX}; + struct firmware_info_t *firmware; + int i; + + for (i=0; i<4; i++) + { + firmware = &tux_status.firmware_info[firmware_num[i]]; + memset((char*)firmware, 0, sizeof(struct firmware_info_t)); + } + tux_status.sound_flash.number_of_sounds = 0; +} + +/** + * Update tux_status with the given firmware version data. + */ +void update_firmware_version(const unsigned char *data) +{ + struct firmware_info_t *firmware; + + /* When returning 'information', the firmware starts by sending this + * version information which includes the CPU number. This number is + * used to determine which CPU is sending the upcoming information data + * like revision and author. So we should save that number. */ + current_cpu = CPU_VER_CPU(data[1]); + /* Check if the value received is a valid CPU number. */ + assert(current_cpu >= LOWEST_CPU_NUM && current_cpu <= HIGHEST_CPU_NUM); + /* Select the corresponding CPU entry in the status table. */ + firmware = &tux_status.firmware_info[current_cpu]; + /* Save major, minor and update numbers. */ + firmware->version_major = CPU_VER_MAJ(data[1]); + firmware->version_minor = data[2]; + firmware->version_update = data[3]; + + log_debug("FW: version of %s: %d.%d.%d", cpu_name[current_cpu], + CPU_VER_MAJ(firmware->version_major), firmware->version_minor, + firmware->version_update); +} + +/** + * Update tux_status with the given firmware revision data. + */ +void update_firmware_revision(const unsigned char *data) +{ + char revision_string[40]; + struct firmware_info_t *firmware; + + /* Preconditions */ + assert((current_cpu == INVALID_CPU_NUM) || + (current_cpu >= LOWEST_CPU_NUM && current_cpu <= HIGHEST_CPU_NUM)); + /* Check that a valid CPU number has been received. INVALID_CPU_NUM can be + * be received if the version frame is lost and we directly get the + * revision frame. */ + if (current_cpu == INVALID_CPU_NUM) + return; + /* Select the corresponding CPU entry in the status table, save. */ + firmware = &tux_status.firmware_info[current_cpu]; + firmware->revision = (data[2] << 8) + data[1]; + firmware->release = (data[3] & 1<<2) ? 1 : 0; + firmware->local_modification = (data[3] & 1<<0) ? 1 : 0; + firmware->mixed_revisions = (data[3] & 1<<1) ? 1 : 0; + /* A release shouldn't get local_modifications or mixed revisions. */ + if ((firmware->local_modification || firmware->mixed_revisions) + && firmware->release) + { + firmware->release = 0; + log_debug("FW: this firmware is released with local modifications or " + "mixed revisions. 'release' status has been dropped."); + } + /* We already got the version when receiving the revision so we can now + * store the version string. */ + sprintf(revision_string, " - r%d (SVN/UNRELEASED)", firmware->revision); + sprintf(firmware->version_string, "%s %d.%d.%d%s%s%s", + cpu_name[current_cpu], + CPU_VER_MAJ(firmware->version_major), firmware->version_minor, + firmware->version_update, + firmware->release ? "" : revision_string, + firmware->local_modification ? "(modified locally)" : "", + firmware->mixed_revisions ? "(mixed revisions)" : ""); + log_debug("FW: revision of %s: %d - type %d", cpu_name[current_cpu], + firmware->revision, data[3]); +} + +/** + * Update tux_status with the given firmware author data. + */ +void update_firmware_author(const unsigned char *data) +{ + struct firmware_info_t *firmware; + /* Check that a valid CPU number has been received. */ + if (current_cpu == INVALID_CPU_NUM) + return; + /* Select the corresponding CPU entry in the status table. */ + firmware = &tux_status.firmware_info[current_cpu]; + /* Save author. */ + firmware->author = (data[2] << 8) + data[1]; + firmware->variation = data[3]; + + log_debug("FW: author of %s: %d (variation %d)", cpu_name[current_cpu], + firmware->author, firmware->variation); +} + +/** + * Determine the general release package information from all firmware + * information. + * + * \todo TODO This general release package information can only be found in an + * external file, ideally an xml generated from the firmware release section of + * the website. For now, we simply hardcode the available releases in the + * daemon. This needs to be changed later on when the xml file will be + * available. */ +void determine_release_package(void) +{ + int cpu_num = LOWEST_CPU_NUM; + int major, minor, update = 0; + struct firmware_info_t *release, *firmware; + + release = &tux_status.firmware_info[RELEASE_INDEX]; + /* We first check that all firmware are released and have the same + * major/minor version numbers. Also find the update number. */ + major = tux_status.firmware_info[LOWEST_CPU_NUM].version_major; + minor = tux_status.firmware_info[LOWEST_CPU_NUM].version_minor; + while (cpu_num <= HIGHEST_CPU_NUM) + { + firmware = &tux_status.firmware_info[cpu_num]; + if (update < firmware->version_update) + update = firmware->version_update; + if (!firmware->release + || (firmware->version_major != major) + || (firmware->version_minor != minor)) + return; + cpu_num ++; + } + /* Check that all different versions are part of a package released on the + * website, hardcoded here for now. */ + if (major == 0 && minor == 3 && update == 0) + /* release 0.3.0, all CPUs have the same version number 0.3.0. */ + { + if ((tux_status.firmware_info[TUXCORE_CPU_NUM].version_update != 0) + || (tux_status.firmware_info[TUXAUDIO_CPU_NUM].version_update != 0) + || (tux_status.firmware_info[TUXRF_CPU_NUM].version_update != 0) + || (tux_status.firmware_info[FUXRF_CPU_NUM].version_update != 0) + || (tux_status.firmware_info[FUXUSB_CPU_NUM].version_update != 0)) + return; + } + else if (major == 0 && minor == 3 && update == 1) + /* release 0.3.1, tuxcore and tuxaudio updated to 0.3.1 */ + { + if ((tux_status.firmware_info[TUXCORE_CPU_NUM].version_update != 1) + || (tux_status.firmware_info[TUXAUDIO_CPU_NUM].version_update != 1) + || (tux_status.firmware_info[TUXRF_CPU_NUM].version_update != 0) + || (tux_status.firmware_info[FUXRF_CPU_NUM].version_update != 0) + || (tux_status.firmware_info[FUXUSB_CPU_NUM].version_update != 0)) + return; + } + + /* It's a release. */ + release->version_major = major; + release->version_minor = minor; + release->version_update = update; + /* Author and variation are taken from tuxcore as that's the CPU most + * likely to be customized. */ + release->author = tux_status.firmware_info[TUXCORE_CPU_NUM].author; + release->variation = tux_status.firmware_info[TUXCORE_CPU_NUM].variation; + sprintf(release->version_string, "tuxdroid firmware release %d.%d.%d", + major, minor, update); + log_debug("FW: %s", release->version_string); +} + +/** + * Fake versioning of old fimware that didn't support it. + * The first release of tuxrf and fuxrf are 0.3.0 but those + * firmware can't send their version information. So if we don't + * have those CPUs now, we simply assign this version number. */ +void old_firmware_versioning(const int cpu_num) +{ + uint8_t const tuxrf_version[4] = {0xC8, 2, 3, 0}; + uint8_t const fuxrf_version[4] = {0xC8, 3, 3, 0}; + uint8_t const revision[4] = {0xC9, 0xA9, 0x02, 0x04}; + uint8_t const author[4] = {0xC9, 0, 0, 0}; + if (cpu_num == TUXRF_CPU_NUM) + { + update_firmware_version(tuxrf_version); + update_firmware_revision(revision); + update_firmware_author(author); + } + else if (cpu_num == FUXRF_CPU_NUM) + { + update_firmware_version(fuxrf_version); + update_firmware_revision(revision); + update_firmware_author(author); + } +} + +/** + * Get the version information of all different firmware. + * + * This function has to be called to initiate the retrieving process. + */ +void get_versioning(void) +{ + if (versioning_state == STDBY) + versioning_state = INIT; +} + +/** Number of times the info command will be restarted if no responses have + * been received after the TIMEOUT period. So there will be RETRY+1 attempts in + * total. */ +#define RETRY 1 +/** Timeout of the INFO command before we retry or skip. */ +#define TIMEOUT 5 + +/** + * This is the state machine to collect all firmware version information one at + * a time and do the required processing to update the status. + * + * This function should be called at a regular basis in order to do its job. + */ +void versioning_call(void) +{ + int ret; + uint8_t usb_command[TUX_SEND_LENGTH] = {0, 0, 0, 0, 0}; + static int cpu_num; + static unsigned int retries, wait; + + switch(versioning_state) + { + case STDBY: + break; + case INIT: + /* Preconditions */ + assert(RETRY >= 0); + assert(TIMEOUT >= 0); + + cpu_num = LOWEST_CPU_NUM; + versioning_state = INFO_REQ; + retries = RETRY; + break; + case INFO_REQ: + { + const uint8_t info_cpu_cmd[5] = {INFO_TUXCORE_CMD, + INFO_TUXAUDIO_CMD, INFO_TUXRF_CMD, INFO_FUXRF_CMD, + INFO_FUXUSB_CMD}; + /* Check when all CPUs are done. */ + if ((cpu_num) > HIGHEST_CPU_NUM) + { + versioning_state = SPECIAL; + break; + } + usb_command[1] = info_cpu_cmd[cpu_num]; + /* By-pass if we already have the information. We need to do that + * otherwise the command will be sent and the version_string + * detected immediately after even though we might not yet have + * received the answer from the CPU. At that point a new request + * can be sent for the next CPU and all answers will be mixed. */ + if (tux_status.firmware_info[cpu_num].version_string[0] == '\0') + { + ret = usb_send_TuxDroid(usb_command); + if (ret <=0) + break; + wait = TIMEOUT; + } + versioning_state = INFO_GET; + } + break; + case INFO_GET: + if (tux_status.firmware_info[cpu_num].version_string[0]) + { + cpu_num++; + retries = RETRY; + } + else if (!wait) + { + /* Retry or abandon. */ + if (retries-- == 0) + { + cpu_num++; + retries = RETRY; + } + } + else + { + wait--; + break; + } + versioning_state = INFO_REQ; + break; + case SPECIAL: + { + /* The first release of tuxrf and fuxrf are 0.3.0 but those + * firmware can't send their version information. So if we don't + * have those CPUs now, we simply assign this version number. + * XXX This probably have to be removed at a later stage when we + * won't support old firmwares anymore and be replaced by a + * warning. */ + if (tux_status.firmware_info[TUXRF_CPU_NUM].version_string[0] + == '\0') + old_firmware_versioning(TUXRF_CPU_NUM); + if (tux_status.firmware_info[FUXRF_CPU_NUM].version_string[0] + == '\0') + old_firmware_versioning(FUXRF_CPU_NUM); + } + versioning_state = RELEASE; + break; + case RELEASE: + determine_release_package(); + versioning_state = STDBY; + break; + case FINALIZE: + /* Can be used later on to trigger omething when versioning has been + * completed, like a callback function or set a flag. */ + break; + } +} Property changes on: daemon/trunk/versioning.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: daemon/trunk/versioning.h =================================================================== --- daemon/trunk/versioning.h (rev 0) +++ daemon/trunk/versioning.h 2007-11-19 16:14:36 UTC (rev 714) @@ -0,0 +1,33 @@ +/* + * Tux Droid - USB Daemon + * Copyright (C) 2007 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +/* $Id$ */ + +#ifndef _VERSIONING_H_ +#define _VERSIONING_H_ + +extern void tux_information_cleaning(void); +extern void get_versioning(void); +extern void versioning_call(void); +extern void update_firmware_version(const unsigned char *data); +extern void update_firmware_revision(const unsigned char *data); +extern void update_firmware_author(const unsigned char *data); + +#endif /* _VERSIONING_H_ */ Property changes on: daemon/trunk/versioning.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native |
From: jaguarondi <c2m...@c2...> - 2007-11-19 16:10:04
|
Author: jaguarondi Date: 2007-11-19 17:09:54 +0100 (Mon, 19 Nov 2007) New Revision: 713 Modified: daemon/trunk/libs/USBDaemon_usb.c Log: * Added some log messages when libusb fails. * Decreased the timeout when requesting status. Modified: daemon/trunk/libs/USBDaemon_usb.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb.c 2007-11-19 15:15:06 UTC (rev 712) +++ daemon/trunk/libs/USBDaemon_usb.c 2007-11-19 16:09:54 UTC (rev 713) @@ -22,6 +22,7 @@ #include <stdio.h> #include <errno.h> +#include <assert.h> #include "USBDaemon_usb.h" #include "USBDaemon_globals.h" @@ -69,7 +70,7 @@ static struct usb_dev_handle *usb_open_TuxDroid(struct usb_device *tux_dev) { usb_dev_handle *tux_hdl; - int error; + int ret; /* Open usb device */ tux_hdl = usb_open(tux_dev); @@ -86,17 +87,19 @@ if (usb_set_configuration(tux_hdl, 1) < 0) { log_debug("Couldn't set config 1: %s (%d)\n"\ - " Another module may have claimed an interface "\ - "already, see dmesg|tail.", strerror(errno), errno); + " Another module may have claimed the interface "\ + "already, see dmesg|tail. This isn't an error, most of "\ + "the time snd_usb_audio is already connected to the audio "\ + "interfaces of the dongle.", strerror(errno), errno); } /* Claim device interface */ - error = usb_claim_interface(tux_hdl, TUX_INTERFACE); - if (error != 0) + ret = usb_claim_interface(tux_hdl, TUX_INTERFACE); + if (ret != 0) { /*usb_detach_kernel_driver_np(tux_hdl, TUX_INTERFACE); */ - error = usb_claim_interface(tux_hdl, TUX_INTERFACE); - if (error != 0) + ret = usb_claim_interface(tux_hdl, TUX_INTERFACE); + if (ret != 0) { log_error("Can't claim interface: %s (%d)", strerror(errno), errno); return NULL; @@ -191,8 +194,13 @@ */ int usb_write_TuxDroid(const void *buf, size_t size) { - return usb_interrupt_write(tux_handle, TUX_WRITE_EP, (char *)buf, size, - TUX_WRITE_TIMEOUT); + int ret; + ret = usb_interrupt_write(tux_handle, TUX_WRITE_EP, (char *)buf, size, + TUX_WRITE_TIMEOUT); + if (ret <=0) + log_error("USB: can't write on device: %s (%d)", + strerror(errno), errno); + return ret; } /** @@ -205,8 +213,13 @@ */ int usb_read_TuxDroid(void *buf, size_t size) { - return usb_interrupt_read(tux_handle, TUX_READ_EP, (char *)buf, size, + int ret; + ret = usb_interrupt_read(tux_handle, TUX_READ_EP, (char *)buf, size, TUX_READ_TIMEOUT); + if (ret <=0) + log_error("USB: can't read on device: %s (%d)", + strerror(errno), errno); + return ret; } /** @@ -232,6 +245,8 @@ return; idx = usb_read_TuxDroid(data, sizeof(data)); + /* XXX in case of error, we should probably try reading again later, not + * reissue a write. */ if (idx <= 0) return; @@ -276,24 +291,24 @@ return ACK_CMD_DONGLE_NOT_PRESENT; /* Send data */ - cmd_status_flag = 1; idx = usb_write_TuxDroid(data, TUX_SEND_LENGTH); if (idx <= 0) return ACK_CMD_TIMEOUT; log_debug("CMD: %.2x %.2x %.2x %.2x", data[0], data[1], data[2], data[3]); + cmd_status_flag = 1; counter = 0; csf = cmd_status_flag; while (csf) { + usleep(5000); usb_get_status_TuxDroid(); csf = cmd_status_flag; counter++; - usleep(10000); - if (counter == 15) + if (counter == 5) { - log_debug("CMD: -> ! TIMEOUT"); + log_debug("CMD: -> ! TIMEOUT"); return ACK_CMD_TIMEOUT; } } |
From: jaguarondi <c2m...@c2...> - 2007-11-19 15:15:09
|
Author: jaguarondi Date: 2007-11-19 16:15:06 +0100 (Mon, 19 Nov 2007) New Revision: 712 Modified: daemon/trunk/libs/USBDaemon_globals.h Log: * Set libusb timeout to 1 second which should be long enough. Modified: daemon/trunk/libs/USBDaemon_globals.h =================================================================== --- daemon/trunk/libs/USBDaemon_globals.h 2007-11-19 13:00:54 UTC (rev 711) +++ daemon/trunk/libs/USBDaemon_globals.h 2007-11-19 15:15:06 UTC (rev 712) @@ -39,8 +39,8 @@ #define TUX_SEND_LENGTH 0x05 #define TUX_WRITE_EP 0x05 #define TUX_READ_EP 0x84 -#define TUX_WRITE_TIMEOUT 5000 -#define TUX_READ_TIMEOUT 5000 +#define TUX_WRITE_TIMEOUT 1000 +#define TUX_READ_TIMEOUT 1000 #define LIBUSB_DEBUG_LEVEL 0 #define NEWUID 65534 #define NEWGID 65534 |
From: Paul_R <c2m...@c2...> - 2007-11-19 13:01:01
|
Author: Paul_R Date: 2007-11-19 14:00:54 +0100 (Mon, 19 Nov 2007) New Revision: 711 Modified: software/gadgets/battery_monitor/trunk/Battery_monitor.tgf software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Pictures/Icons/gadget.png software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/GUI/conf/other.glade software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/GUI/conf/other.pyp software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml software/gadgets/light_monitor/trunk/Light_monitor.tgf software/gadgets/light_monitor/trunk/Light_monitor/Pictures/Icons/gadget.png software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.glade software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp software/gadgets/light_monitor/trunk/Light_monitor/about.xml software/gadgets/light_monitor/trunk/Light_monitor/settings.xml software/gadgets/light_monitor/trunk/Light_monitor/strings.xml Log: * Removed the description frame in the settings window * Updated the icons Modified: software/gadgets/battery_monitor/trunk/Battery_monitor.tgf =================================================================== (Binary files differ) Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Pictures/Icons/gadget.png =================================================================== (Binary files differ) Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/GUI/conf/other.glade =================================================================== (Binary files differ) Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/GUI/conf/other.pyp 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/GUI/conf/other.pyp 2007-11-19 13:00:54 UTC (rev 711) @@ -25,22 +25,7 @@ _me.string('gui_conf_window_title')) self.get_widget("window1").set_title(txt) - # About labels - txt = _me.string('gui_conf_about_title') - self.get_widget("label7").set_text(txt) - - txt = "%s : %s" % (_me.string('gui_conf_description_lb'), - _me.get_description()) - self.get_widget("label_description").set_text(txt) - - txt = "%s : %s" % (_me.string('gui_conf_author_lb'), - _me.get_author()) - self.get_widget("label_author").set_text(txt) - - txt = "%s : %s" % (_me.string('gui_conf_version_lb'), - _me.get_version()) - self.get_widget("label_version").set_text(txt) - + # Update Frame txt = _me.string('gui_conf_update_title') self.get_widget("label12").set_text(txt) Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml 2007-11-19 13:00:54 UTC (rev 711) @@ -11,7 +11,7 @@ <widget_lblControl type='str'>Contrôle</widget_lblControl> <Increase type='str'>Le niveau de la batterie est passé en dessus du seuil</Increase> <full type='str'>Les batteries sont pleines</full> - <widget_lblChangeD type='str'>Changement inf.</widget_lblChangeD> + <gui_conf_accept_bt type='str'>Valider</gui_conf_accept_bt> <lblLowThreshold type='str'>Limite inférieure</lblLowThreshold> <help_text type='str'>-- Les évènements : Deux grands types d'évènements peuvent avoir lieu, contenant chacun diverses options : @@ -73,7 +73,7 @@ <MainBehavior type='str'>Comportement principal</MainBehavior> <speaker_name type='str'>Bruno8k</speaker_name> <conf_lblSample type='str'>Points</conf_lblSample> - <conf_lblType type='str'>Type</conf_lblType> + <charging type='str'>En charge</charging> <Change type='str'>Le niveau de la batterie a changé</Change> <Both type='str'>Le niveau de la batterie a passé le seuil</Both> <conf_btnModify type='str'>Modifier</conf_btnModify> @@ -102,18 +102,18 @@ <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <widget_lblChange type='str'>Changement</widget_lblChange> <name_to_read type='str'>Moniteur de batteries</name_to_read> - <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> + <conf_lblNotNotified type='str'>Non notifié</conf_lblNotNotified> <Drop type='str'>Le niveau de la batterie a chuté</Drop> <conf_lblDrop type='str'>Chute</conf_lblDrop> - <conf_lblNotNotified type='str'>Non notifié</conf_lblNotNotified> + <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> <Raise type='str'>Le niveau de la batterie a augmenté</Raise> - <charging type='str'>En charge</charging> + <conf_lblType type='str'>Type</conf_lblType> <widget_lblSet type='str'>Ajouter a la config.</widget_lblSet> <Decrease type='str'>Le niveau de la batterie est passé en dessous du seuil</Decrease> <conf_lblValue type='str'>Valeur (V)</conf_lblValue> <conf_lblRate type='str'>Rafraichissement</conf_lblRate> <widget_lblBehavior type='str'>Activer le script</widget_lblBehavior> - <gui_conf_accept_bt type='str'>Valider</gui_conf_accept_bt> + <widget_lblChangeD type='str'>Changement inf.</widget_lblChangeD> <conf_lblTime type='str'>Temps (sec.)</conf_lblTime> <conf_lblControl type='str'>Contrôle</conf_lblControl> <conf_lblNotified type='str'>Notifié ?</conf_lblNotified> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml 2007-11-19 13:00:54 UTC (rev 711) @@ -1,7 +1,8 @@ <?xml version='1.0' encoding='UTF-8'?> <about> - <gadget_name type='str'>battery_monitor</gadget_name> <gadget_author type='str'>Paul Rathgeb</gadget_author> - <gadget_description type='str'>Battery monitor for tux droid</gadget_description> <gadget_version type='str'>0.0.1</gadget_version> + <gadget_name type='str'>battery_monitor</gadget_name> + <gadget_description type='str'> + </gadget_description> </about> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-11-19 13:00:54 UTC (rev 711) @@ -1,11 +1,11 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> - <test_tab type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, None, False, 0]]</test_tab> + <Sample type='float'>600.0</Sample> + <low_threshold type='float'>4.8</low_threshold> <chkMotors type='bool'>True</chkMotors> - <low_threshold type='float'>4.8</low_threshold> <MainScript type='str'>None</MainScript> - <Sample type='float'>600.0</Sample> + <test_tab type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, None, False, 0]]</test_tab> <Rate type='float'>1.0</Rate> <high_threshold type='float'>6.0</high_threshold> <config type='list'>[[1, 0, 0, 1.0, 1.0, False, 'None', False, 0], [2, 1, 0, 4.0, 1.0, False, 'None', False, 0]]</config> @@ -22,14 +22,14 @@ </gui_state> <language type='str'>en_US</language> <notified type='bool'>True</notified> - <have_widget_part type='bool'>True</have_widget_part> <notify_delay type='int'>1</notify_delay> <framework_version type='str'>0.0.0</framework_version> <menu_active type='bool'>True</menu_active> - <main_priority type='int'>4</main_priority> + <have_widget_part type='bool'>True</have_widget_part> <speaker type='int'>3</speaker> <pitch type='int'>100</pitch> <have_main_part type='bool'>True</have_main_part> + <main_priority type='int'>4</main_priority> <notify_priority type='int'>4</notify_priority> </general> </settings> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-11-19 13:00:54 UTC (rev 711) @@ -1,22 +1,17 @@ <?xml version='1.0' encoding='UTF-8'?> <strings> <conf_lblIncrease type='str'>Increase</conf_lblIncrease> - <widget_lblChangeD type='str'>Drop and raise</widget_lblChangeD> <conf_lblThreshold type='str'>Threshold</conf_lblThreshold> <gui_conf_remote_title type='str'>Control</gui_conf_remote_title> - <conf_lblTime type='str'>Time (sec.)</conf_lblTime> <battery type='str'>On battery</battery> <conf_lblRaise type='str'>Raise</conf_lblRaise> - <widget_lblTest type='str'>Notifications</widget_lblTest> <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> <conf_lblEvent type='str'>Event</conf_lblEvent> <widget_lblControl type='str'>Control</widget_lblControl> <Increase type='str'>The battery level exceeded the threshold</Increase> - <conf_btnModify type='str'>Modify</conf_btnModify> - <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> - <lblLowThreshold type='str'>Lower limit</lblLowThreshold> - <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> - <lblMotors type='str'>Disable measurement when the motors are running</lblMotors> + <full type='str'>The level of the batteries is full</full> + <widget_lblChangeD type='str'>Drop and raise</widget_lblChangeD> + <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> <help_text type='str'>--The events: Two main types of events can take place, each containing various options: @@ -51,7 +46,8 @@ This window displays the battery voltage graph. When this window is displayed, the events stored in the settings window are not notified. This window makes it possible to try various configurations and to add them in the settings table.</help_text> - <end_of_charge type='str'>The load of the battery is finished</end_of_charge> + <end_of_charge type='str'>The recharging of the battery is finished</end_of_charge> + <conf_btnRemove type='str'>Remove</conf_btnRemove> <conf_lblChange type='str'>Change</conf_lblChange> <conf_lblBoth type='str'>Both</conf_lblBoth> <widget_lblBtnApply type='str'>Apply changes</widget_lblBtnApply> @@ -61,28 +57,31 @@ <gui_conf_update_title type='str'>Update</gui_conf_update_title> <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <gui_conf_cancel_bt type='str'>Cancel</gui_conf_cancel_bt> + <widget_lblBoth type='str'>Both direction</widget_lblBoth> + <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> <absolute_threshold_high type='str'>The batteries are full</absolute_threshold_high> + <conf_lblType type='str'>Type</conf_lblType> <mainscript type='str'>I've found the light !</mainscript> - <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> + <MainBehavior type='str'>Main behavior</MainBehavior> + <lblLowThreshold type='str'>Lower limit</lblLowThreshold> <plugged type='str'>Plugged</plugged> + <ChangeU type='str'>The battery level raised and dropped</ChangeU> <conf_btnBehavior type='str'>Clear path</conf_btnBehavior> <charge type='str'>and the batteries are recharging</charge> <gui_conf_about_title type='str'>About</gui_conf_about_title> <conf_lblChangeD type='str'>Drop and raise</conf_lblChangeD> <low type='str'>The level of the batteries is weak</low> - <conf_btnAdd type='str'>Add</conf_btnAdd> - <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> + <speaker_name type='str'>Ryan8k</speaker_name> <conf_lblSample type='str'>Samples</conf_lblSample> <charging type='str'>Charging</charging> <Change type='str'>The battery level changed</Change> - <conf_lblValue type='str'>Value (V)</conf_lblValue> <Both type='str'>The battery level reached the threshold</Both> - <full type='str'>The level of the batteries is full</full> + <conf_btnModify type='str'>Modify</conf_btnModify> <widget_lblEvent type='str'>Event</widget_lblEvent> <normal type='str'>The level of the batteries is good</normal> <widget_lblIncrease type='str'>Increasing</widget_lblIncrease> <widget_lblRaise type='str'>Raise</widget_lblRaise> - <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> + <conf_btnAdd type='str'>Add</conf_btnAdd> <on_battery type='str'>and I'm powered by the battery</on_battery> <widget_lblDecrease type='str'>Decreasing</widget_lblDecrease> <gui_conf_sample_lb type='str'>Sample :</gui_conf_sample_lb> @@ -90,32 +89,33 @@ <conf_lblNotifiedBehavior type='str'>Notified</conf_lblNotifiedBehavior> <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> <widget_lblDrop type='str'>Drop</widget_lblDrop> - <conf_lblNotified type='str'>Notified ?</conf_lblNotified> - <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> - <widget_lblBoth type='str'>Both direction</widget_lblBoth> + <ChangeD type='str'>The battery level dropped and raised</ChangeD> + <absolute_threshold type='str'>Weak batteries </absolute_threshold> + <lblMotors type='str'>Disable measurement when the motors are running</lblMotors> <conf_lblDecrease type='str'>Decrease</conf_lblDecrease> + <lblHighThreshold type='str'>Upper limit</lblHighThreshold> <widget_lblValue type='str'>Value (V)</widget_lblValue> <conf_lblDefaultBehavior type='str'>Default behavior</conf_lblDefaultBehavior> - <speaker_name type='str'>Ryan8k</speaker_name> + <widget_lblDisplayThreshold type='str'>Display threshold on graph</widget_lblDisplayThreshold> + <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> <plug type='str'>and the power supply is plugged</plug> - <absolute_threshold type='str'>Weak batteries </absolute_threshold> + <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <widget_lblChange type='str'>Change</widget_lblChange> <name_to_read type='str'>Battery monitor</name_to_read> - <lblHighThreshold type='str'>Upper limit</lblHighThreshold> - <conf_lblNotNotified type='str'>Not notified</conf_lblNotNotified> + <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> <Drop type='str'>The battery level dropped</Drop> <conf_lblDrop type='str'>Drop</conf_lblDrop> - <ChangeD type='str'>The battery level dropped and raised</ChangeD> + <conf_lblNotNotified type='str'>Not notified</conf_lblNotNotified> <Raise type='str'>The battery level raised</Raise> - <conf_lblType type='str'>Type</conf_lblType> + <conf_lblNotified type='str'>Notified ?</conf_lblNotified> <widget_lblSet type='str'>Add to config</widget_lblSet> <Decrease type='str'>The battery level passed below the threshold</Decrease> - <widget_lblDisplayThreshold type='str'>Display threshold on graph</widget_lblDisplayThreshold> + <conf_lblValue type='str'>Value (V)</conf_lblValue> <conf_lblRate type='str'>Refresh rate</conf_lblRate> <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> - <MainBehavior type='str'>Main behavior</MainBehavior> - <ChangeU type='str'>The battery level raised and dropped</ChangeU> + <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> + <conf_lblTime type='str'>Time (sec.)</conf_lblTime> <conf_lblControl type='str'>Control</conf_lblControl> - <conf_btnRemove type='str'>Remove</conf_btnRemove> + <widget_lblTest type='str'>Notifications</widget_lblTest> <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> </strings> Modified: software/gadgets/light_monitor/trunk/Light_monitor/Pictures/Icons/gadget.png =================================================================== (Binary files differ) Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.glade =================================================================== (Binary files differ) Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp 2007-11-19 13:00:54 UTC (rev 711) @@ -25,22 +25,7 @@ _me.string('gui_conf_window_title')) self.get_widget("window1").set_title(txt) - # About labels - txt = _me.string('gui_conf_about_title') - self.get_widget("label7").set_text(txt) - - txt = "%s : %s" % (_me.string('gui_conf_description_lb'), - _me.get_description()) - self.get_widget("label_description").set_text(txt) - - txt = "%s : %s" % (_me.string('gui_conf_author_lb'), - _me.get_author()) - self.get_widget("label_author").set_text(txt) - - txt = "%s : %s" % (_me.string('gui_conf_version_lb'), - _me.get_version()) - self.get_widget("label_version").set_text(txt) - + # Update Frame txt = _me.string('gui_conf_update_title') self.get_widget("label12").set_text(txt) Modified: software/gadgets/light_monitor/trunk/Light_monitor/about.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-11-19 13:00:54 UTC (rev 711) @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <about> - <gadget_description type='str'>Light monitor for tux droid</gadget_description> <gadget_author type='str'>Paul Rathgeb</gadget_author> + <gadget_version type='str'>0.0.1</gadget_version> <gadget_name type='str'>light_monitor</gadget_name> - <gadget_version type='str'>0.0.1</gadget_version> + <gadget_description type='str'>Light monitor for tux droid</gadget_description> </about> Modified: software/gadgets/light_monitor/trunk/Light_monitor/settings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/settings.xml 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/light_monitor/trunk/Light_monitor/settings.xml 2007-11-19 13:00:54 UTC (rev 711) @@ -10,12 +10,13 @@ <changeD_rad type='bool'>False</changeD_rad> <threshold type='float'>50.0</threshold> <decrease_rad type='bool'>False</decrease_rad> - <behavior_file_threshold type='NoneType'>None</behavior_file_threshold> + <Sample type='float'>500.0</Sample> <raise type='float'>10.0</raise> <changeU_rad type='bool'>False</changeU_rad> <threshold_notified type='bool'>False</threshold_notified> <config type='list'>[]</config> <behavior_file_change type='NoneType'>None</behavior_file_change> + <drop_rad type='bool'>True</drop_rad> <raise_rad type='bool'>False</raise_rad> <changeD type='float'>10.0</changeD> <drop_time type='float'>1.0</drop_time> @@ -23,10 +24,9 @@ <changeU type='float'>10.0</changeU> <raise_time type='float'>1.0</raise_time> <drop type='float'>10.0</drop> - <drop_rad type='bool'>True</drop_rad> <MainScript type='str'> </MainScript> - <Sample type='float'>500.0</Sample> + <behavior_file_threshold type='NoneType'>None</behavior_file_threshold> <threshold_chk type='bool'>False</threshold_chk> <Rate type='float'>0.1</Rate> <changeD_time type='float'>1.0</changeD_time> @@ -41,21 +41,19 @@ <x type='int'>0</x> </widget> <conf> - <y type='int'>131</y> - <visible type='bool'>True</visible> - <x type='int'>656</x> + <visible type='bool'>False</visible> </conf> </gui_state> <language type='str'>en_US</language> <notified type='bool'>True</notified> - <have_widget_part type='bool'>True</have_widget_part> <notify_delay type='int'>1</notify_delay> <framework_version type='str'>0.0.0</framework_version> <menu_active type='bool'>True</menu_active> - <main_priority type='int'>4</main_priority> + <have_widget_part type='bool'>True</have_widget_part> <speaker type='int'>3</speaker> <pitch type='int'>100</pitch> <have_main_part type='bool'>True</have_main_part> + <main_priority type='int'>4</main_priority> <notify_priority type='int'>4</notify_priority> </general> </settings> Modified: software/gadgets/light_monitor/trunk/Light_monitor/strings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-11-19 08:05:50 UTC (rev 710) +++ software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-11-19 13:00:54 UTC (rev 711) @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='UTF-8'?> <strings> - <gui_conf_remote_title type='str'>Control</gui_conf_remote_title> + <conf_lblSample type='str'>Samples</conf_lblSample> <conf_lblRaise type='str'>Raise</conf_lblRaise> <conf_lblEvent type='str'>Event</conf_lblEvent> <widget_lblControl type='str'>Control</widget_lblControl> @@ -40,7 +40,7 @@ In the test part with two buttons you can make Tux search for the light source or darkest spot. Two example scripts can be found in /tmp/Light_monitor/Data.</help_text> - <conf_lblSample type='str'>Samples</conf_lblSample> + <gui_conf_remote_title type='str'>Control</gui_conf_remote_title> <widget_lblLight type='str'>Search light</widget_lblLight> <conf_lblNotifiedBehavior type='str'>Notified</conf_lblNotifiedBehavior> <Change type='str'>The light level changed</Change> @@ -53,36 +53,34 @@ <widget_lblSet type='str'>Add to config</widget_lblSet> <conf_lblValue type='str'>Value (%)</conf_lblValue> <conf_lblTime type='str'>Time (sec.)</conf_lblTime> - <widget_lblTest type='str'>Notifications</widget_lblTest> + <widget_lblDark type='str'>Search darkness</widget_lblDark> <conf_lblThreshold type='str'>Threshold</conf_lblThreshold> <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> <power_supply type='str'>You must disconnect the power supply</power_supply> <widget_lblNotified type='str'>Notified</widget_lblNotified> <conf_btnBehavior type='str'>Clear path</conf_btnBehavior> <conf_lblType type='str'>Type</conf_lblType> - <Drop type='str'>The light level dropped</Drop> + <dark2 type='str'>And darker here.</dark2> <widget_lblEvent type='str'>Event</widget_lblEvent> - <dark4 type='str'>This is the darkest spot.</dark4> - <widget_lblBoth type='str'>Both direction</widget_lblBoth> + <widget_lblDecrease type='str'>Decreasing</widget_lblDecrease> + <gui_conf_update_title type='str'>Update</gui_conf_update_title> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <search type='str'>I seek ...</search> <conf_lblNotNotified type='str'>Not notified</conf_lblNotNotified> <ChangeD type='str'>The light level dropped and raised</ChangeD> - <conf_lblNotified type='str'>Notified ?</conf_lblNotified> + <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> <light2 type='str'>ow wait, even lighter here.</light2> <light3 type='str'>or here ...</light3> <light1 type='str'>Seeing more light over here.</light1> <light4 type='str'>I think the light is coming from this direction.</light4> <light5 type='str'>I can't find the direction of the light.</light5> <ChangeU type='str'>The light level raised and dropped</ChangeU> - <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> - <widget_lblDark type='str'>Search darkness</widget_lblDark> <Increase type='str'>The light level exceeded the threshold</Increase> <conf_lblBoth type='str'>Both</conf_lblBoth> <conf_lblDecrease type='str'>Decrease</conf_lblDecrease> <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> - <gui_conf_update_title type='str'>Update</gui_conf_update_title> + <widget_lblBoth type='str'>Both direction</widget_lblBoth> <widget_lblValue type='str'>Value (%)</widget_lblValue> <gui_conf_cancel_bt type='str'>Cancel</gui_conf_cancel_bt> <mainscript type='str'>I've found the light !</mainscript> @@ -90,6 +88,7 @@ <widget_lblIncrease type='str'>Increasing</widget_lblIncrease> <conf_btnAdd type='str'>Add</conf_btnAdd> <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> + <widget_lblTest type='str'>Notifications</widget_lblTest> <conf_lblDrop type='str'>Drop</conf_lblDrop> <Raise type='str'>The light level raised</Raise> <Decrease type='str'>The light level passed below the threshold</Decrease> @@ -111,14 +110,15 @@ <conf_btnModify type='str'>Modify</conf_btnModify> <dark1 type='str'>It's pretty dark here.</dark1> <dark3 type='str'>hmm, but it's even more dark over here!</dark3> - <dark2 type='str'>And darker here.</dark2> + <Drop type='str'>The light level dropped</Drop> <dark5 type='str'>I can't find the darkest spot...</dark5> - <widget_lblDecrease type='str'>Decreasing</widget_lblDecrease> + <dark4 type='str'>This is the darkest spot.</dark4> <gui_conf_sample_lb type='str'>Sample :</gui_conf_sample_lb> <disable type='str'>Disable measurement when the eyes are closed</disable> <conf_lblDefaultBehavior type='str'>Default behavior</conf_lblDefaultBehavior> <speaker_name type='str'>Ryan8k</speaker_name> <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> + <conf_lblNotified type='str'>Notified ?</conf_lblNotified> <Threshold type='str'>The light reached the threshold</Threshold> <MainBehavior type='str'>Main behavior</MainBehavior> </strings> Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf =================================================================== (Binary files differ) |
From: Paul_R <c2m...@c2...> - 2007-11-19 08:06:02
|
Author: Paul_R Date: 2007-11-19 09:05:50 +0100 (Mon, 19 Nov 2007) New Revision: 710 Modified: software/gadgets/tux_controller/trunk/TuxController.tgf software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml software/gadgets/tux_controller/trunk/TuxController/strings.xml Log: * Added all the functions launched when the buttons are pressed. * Added the status tab with the treeview Modified: software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade 2007-11-19 08:05:50 UTC (rev 710) @@ -517,17 +517,29 @@ </child> <child> - <widget class="GtkButton" id="btnEyesOpen"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <widget class="GtkVSeparator" id="vseparator10"> + <property name="width_request">16</property> + <property name="height_request">50</property> <property name="visible">True</property> + </widget> + <packing> + <property name="x">65</property> + <property name="y">7</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="btnEyesRun"> + <property name="width_request">34</property> + <property name="height_request">34</property> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnEyesOpen_clicked" last_modification_time="Thu, 15 Nov 2007 08:45:59 GMT"/> + <signal name="clicked" handler="on_btnEyesRun_clicked" last_modification_time="Thu, 15 Nov 2007 08:32:08 GMT"/> <child> - <widget class="GtkAlignment" id="alignment1"> + <widget class="GtkAlignment" id="alignment11"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -539,13 +551,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox1"> + <widget class="GtkHBox" id="hbox11"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgEyesOpen"> + <widget class="GtkImage" id="imgEyesRun"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -564,7 +576,7 @@ </child> <child> - <widget class="GtkLabel" id="label1"> + <widget class="GtkLabel" id="label11"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -594,23 +606,24 @@ </child> </widget> <packing> - <property name="x">16</property> - <property name="y">0</property> + <property name="x">80</property> + <property name="y">16</property> </packing> </child> <child> - <widget class="GtkButton" id="btnEyesClose"> + <widget class="GtkButton" id="btnEyesOpen"> <property name="width_request">32</property> <property name="height_request">32</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnEyesClose_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:12 GMT"/> + <signal name="pressed" handler="on_btnEyesOpen_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:02 GMT"/> + <signal name="released" handler="on_btnEyesOpen_released" last_modification_time="Fri, 16 Nov 2007 07:47:05 GMT"/> <child> - <widget class="GtkAlignment" id="alignment3"> + <widget class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -622,13 +635,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox3"> + <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgEyesClose"> + <widget class="GtkImage" id="imgEyesOpen"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -647,7 +660,7 @@ </child> <child> - <widget class="GtkLabel" id="label3"> + <widget class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -678,34 +691,23 @@ </widget> <packing> <property name="x">16</property> - <property name="y">32</property> + <property name="y">0</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator10"> - <property name="width_request">16</property> - <property name="height_request">50</property> + <widget class="GtkButton" id="btnEyesClose"> + <property name="width_request">32</property> + <property name="height_request">32</property> <property name="visible">True</property> - </widget> - <packing> - <property name="x">65</property> - <property name="y">7</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="btnEyesRun"> - <property name="width_request">34</property> - <property name="height_request">34</property> - <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnEyesRun_clicked" last_modification_time="Thu, 15 Nov 2007 08:32:08 GMT"/> + <signal name="pressed" handler="on_btnEyesClose_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:14 GMT"/> + <signal name="released" handler="on_btnEyesClose_released" last_modification_time="Fri, 16 Nov 2007 07:47:18 GMT"/> <child> - <widget class="GtkAlignment" id="alignment11"> + <widget class="GtkAlignment" id="alignment3"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -717,13 +719,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox11"> + <widget class="GtkHBox" id="hbox3"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgEyesRun"> + <widget class="GtkImage" id="imgEyesClose"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -742,7 +744,7 @@ </child> <child> - <widget class="GtkLabel" id="label11"> + <widget class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -772,8 +774,8 @@ </child> </widget> <packing> - <property name="x">80</property> - <property name="y">16</property> + <property name="x">16</property> + <property name="y">32</property> </packing> </child> </widget> @@ -1061,7 +1063,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnMouthClose_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:22 GMT"/> + <signal name="pressed" handler="on_btnMouthClose_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:24 GMT"/> + <signal name="released" handler="on_btnMouthClose_released" last_modification_time="Fri, 16 Nov 2007 07:47:28 GMT"/> <child> <widget class="GtkAlignment" id="alignment12"> @@ -1144,7 +1147,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnMouthOpen_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:32 GMT"/> + <signal name="pressed" handler="on_btnMouthOpen_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:37 GMT"/> + <signal name="released" handler="on_btnMouthOpen_released" last_modification_time="Fri, 16 Nov 2007 07:47:40 GMT"/> <child> <widget class="GtkAlignment" id="alignment5"> @@ -1441,7 +1445,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnWingsUp_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:41 GMT"/> + <signal name="pressed" handler="on_btnWingsUp_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:48 GMT"/> + <signal name="released" handler="on_btnWingsUp_released" last_modification_time="Fri, 16 Nov 2007 07:47:50 GMT"/> <child> <widget class="GtkAlignment" id="alignment6"> @@ -1524,7 +1529,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnWingsDown_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:50 GMT"/> + <signal name="pressed" handler="on_btnWingsDown_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:58 GMT"/> + <signal name="released" handler="on_btnWingsDown_released" last_modification_time="Fri, 16 Nov 2007 07:48:01 GMT"/> <child> <widget class="GtkAlignment" id="alignment7"> @@ -1686,18 +1692,6 @@ </child> <child> - <widget class="GtkVSeparator" id="vseparator17"> - <property name="width_request">16</property> - <property name="height_request">70</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">68</property> - <property name="y">7</property> - </packing> - </child> - - <child> <widget class="GtkButton" id="btnSpinLeft"> <property name="width_request">32</property> <property name="height_request">32</property> @@ -2021,6 +2015,18 @@ <property name="y">77</property> </packing> </child> + + <child> + <widget class="GtkVSeparator" id="vseparator17"> + <property name="width_request">16</property> + <property name="height_request">70</property> + <property name="visible">True</property> + </widget> + <packing> + <property name="x">68</property> + <property name="y">7</property> + </packing> + </child> </widget> <packing> <property name="left_attach">1</property> @@ -2098,6 +2104,32 @@ </child> <child> + <widget class="GtkLabel" id="lblSoundL"> + <property name="width_request">138</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">56</property> + </packing> + </child> + + <child> <widget class="GtkLabel" id="lblLight"> <property name="width_request">46</property> <property name="height_request">17</property> @@ -2176,11 +2208,11 @@ </child> <child> - <widget class="GtkLabel" id="lblSoundL"> + <widget class="GtkLabel" id="lblLightL"> <property name="width_request">138</property> <property name="height_request">16</property> <property name="visible">True</property> - <property name="label" translatable="yes"> </property> + <property name="label" translatable="yes"></property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_RIGHT</property> @@ -2196,12 +2228,24 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">0</property> - <property name="y">56</property> + <property name="x">312</property> + <property name="y">0</property> </packing> </child> <child> + <widget class="GtkVSeparator" id="vseparator20"> + <property name="width_request">16</property> + <property name="height_request">70</property> + <property name="visible">True</property> + </widget> + <packing> + <property name="x">356</property> + <property name="y">0</property> + </packing> + </child> + + <child> <widget class="GtkLabel" id="lblBatteryL"> <property name="width_request">138</property> <property name="height_request">16</property> @@ -2232,7 +2276,7 @@ <property name="width_request">138</property> <property name="height_request">16</property> <property name="visible">True</property> - <property name="label" translatable="yes"></property> + <property name="label" translatable="yes"> </property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_RIGHT</property> @@ -2314,6 +2358,27 @@ <child> <widget class="GtkFixed" id="fixed30"> <property name="visible">True</property> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="width_request">792</property> + <property name="height_request">416</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="x">8</property> + <property name="y">8</property> + </packing> + </child> </widget> <packing> <property name="tab_expand">False</property> Modified: software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp 2007-11-19 08:05:50 UTC (rev 710) @@ -22,12 +22,16 @@ __led_toggled_by_event = False self.average = 0 self.count = 0 + self.__eyes_mutex = threading.Lock() + self.__mouth_mutex = threading.Lock() + self.__wings_mutex = threading.Lock() def update(self): self.update_status() self.binding() self.update_pix() self.update_labels() + self.status_table() def on_window1_destroy(self, widget, *args): tux.monitoring.remove(self.light_idx) @@ -104,6 +108,42 @@ self.get_widget('lblBatteryL').set_text(_me.string('lblBatteryL')) self.get_widget('lblSoundL').set_text(_me.string('lblSoundL')) + def status_table(self): + self.status_tree = gtk.TreeStore(str, str, str, str) + self.status_view = gtk.TreeView(self.status_tree) + + self.name1_renderer = gtk.CellRendererText() + self.name1_column = gtk.TreeViewColumn(_me.string('colStatus'), self.name1_renderer, text=0) + self.name1_column.set_min_width(300) + self.name1_column.add_attribute(self.name1_renderer, 'text', 0) + + self.value1_renderer = gtk.CellRendererText() + self.value1_column = gtk.TreeViewColumn(_me.string('colValue'), self.value1_renderer, text=1 ) + self.value1_column.set_min_width(85) + self.value1_column.add_attribute(self.value1_renderer, 'text', 1) + + self.name2_renderer = gtk.CellRendererText() + self.name2_column = gtk.TreeViewColumn(_me.string('colStatus'), self.name2_renderer, text=2) + self.name2_column.set_min_width(300) + self.name2_column.add_attribute(self.name2_renderer, 'text', 2) + + self.value2_renderer = gtk.CellRendererText() + self.value2_column = gtk.TreeViewColumn(_me.string('colValue'), self.value2_renderer, text=3 ) + self.value2_column.set_min_width(85) + self.value2_column.add_attribute(self.value2_renderer, 'text', 3) + + self.status_view.append_column(self.name1_column) + self.status_view.append_column(self.value1_column) + self.status_view.append_column(self.name2_column) + self.status_view.append_column(self.value2_column) + + self.status_view.set_rules_hint(True) + + self.get_widget("scrolledwindow1").add(self.status_view) + self.get_widget("scrolledwindow1").show_all() + + tux.sys.looped_function(self.refresh_treeview, 0.5) + #################################################################### # @@ -121,12 +161,30 @@ tux.cmd.leds_blink(int(value), int(freq)) ## btnEyesOpen - def on_btnEyesOpen_clicked(self, widget, *args): + def on_btnEyesOpen_pressed(self, widget, *args): + if self.__eyes_mutex.locked(): + return + self.__eyes_mutex.acquire() + tux.cmd.eyes_on_free(0) + + def on_btnEyesOpen_released(self, widget, *args): + tux.sys.wait(0.1) tux.cmd.eyes_open() + self.__eyes_mutex.release() + + ## btnEyesClose - def on_btnEyesClose_clicked(self, widget, *args): + def on_btnEyesClose_pressed(self, widget, *args): + if self.__eyes_mutex.locked(): + return + self.__eyes_mutex.acquire() + tux.cmd.eyes_on_free(0) + + def on_btnEyesClose_released(self, widget, *args): + tux.sys.wait(0.1) tux.cmd.eyes_close() + self.__eyes_mutex.release() ## btnEyesRun def on_btnEyesRun_clicked(self, widget, *args): @@ -137,12 +195,28 @@ tux.cmd.eyes_on_free(int(value)) ## btnMouthClose - def on_btnMouthClose_clicked(self, widget, *args): - tux.cmd.mouth_close() + def on_btnMouthClose_pressed(self, widget, *args): + if self.__mouth_mutex.locked(): + return + self.__mouth_mutex.acquire() + tux.cmd.mouth_on_free(0) + + def on_btnMouthClose_released(self, widget, *args): + tux.sys.wait(0.1) + tux.cmd.mouth_close() + self.__mouth_mutex.release() + +## btnMouthOpen + def on_btnMouthOpen_pressed(self, widget, *args): + if self.__mouth_mutex.locked(): + return + self.__mouth_mutex.acquire() + tux.cmd.mouth_on_free(0) -## btnMouthOpen - def on_btnMouthOpen_clicked(self, widget, *args): + def on_btnMouthOpen_released(self, widget, *args): + tux.sys.wait(0.1) tux.cmd.mouth_open() + self.__mouth_mutex.release() ## btnMouthRun def on_btnMouthRun_clicked(self, widget, *args): @@ -153,13 +227,30 @@ tux.cmd.mouth_on_free(int(value)) ## btnWingsUp - def on_btnWingsUp_clicked(self, widget, *args): - tux.cmd.raw(0x39, 0, 0, 0) + def on_btnWingsUp_pressed(self, widget, *args): + if self.__wings_mutex.locked(): + return + self.__wings_mutex.acquire() + tux.cmd.wings_on_free(0) + + def on_btnWingsUp_released(self, widget, *args): + tux.sys.wait(0.1) + tux.cmd.wings_up() + self.__wings_mutex.release() + ## btnWingsDown - def on_btnWingsDown_clicked(self, widget, *args): - tux.cmd.raw(0x3A, 0, 0, 0) + def on_btnWingsDown_pressed(self, widget, *args): + if self.__wings_mutex.locked(): + return + self.__wings_mutex.acquire() + tux.cmd.wings_on(0) + def on_btnWingsDown_released(self, widget, *args): + tux.sys.wait(0.1) + tux.cmd.wings_down() + self.__wings_mutex.release() + ## btnWingsRun def on_btnWingsRun_clicked(self, widget, *args): value = self.get_widget('spinWings').get_value() @@ -216,6 +307,9 @@ tux.cmd.ledl_on() else: tux.cmd.ledl_off() + + def on_chkLEDRight_clicked(self, widget, *args): + print 'clicked' ## slideLED def on_slideLED_value_changed(self, widget, *args): @@ -290,3 +384,23 @@ val = float(val / 127.0) self.get_widget('lblSound').set_text('%.1f%s'%(val*100, '%')) self.get_widget('SoundLevel').set_fraction(val) + + def refresh_treeview(self): + thread.start_new_thread(self.refresh, ()) + return True + + def refresh(self): + ## Buttons status + + lwing_pushed = tux.status.lwing_bt() + rwing_pushed = tux.status.rwing_bt() + head_pushed = tux.status.head_bt() + #print (lwing_pushed,rwing_pushed,head_pushed) + self.status_tree.clear() + self.status_tree.append(None, ['lwing_pushed', str(lwing_pushed), 'test', 'test']) + self.status_tree.append(None, ['rwing_pushed', str(rwing_pushed), 'test', 'test']) + self.status_tree.append(None, ['head_pushed', str(head_pushed), 'test', 'test']) + #print 'refreshing' + ## Motors status + + Modified: software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml 2007-11-19 08:05:50 UTC (rev 710) @@ -19,10 +19,12 @@ <gui_conf_current_bind_lb type='str'>Assignation</gui_conf_current_bind_lb> <gui_conf_author_lb type='str'>Auteur</gui_conf_author_lb> <lblSoundL type='str'>Niveau de son</lblSoundL> + <colValue type='str'>Valeur</colValue> <speaker_name type='str'>Bruno8k</speaker_name> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <name_to_read type='str'>Commande de Tux Droid</name_to_read> <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> <lblLightL type='str'>Niveau de lumière</lblLightL> <Second type='str'>sec.</Second> + <colStatus type='str'>Statut</colStatus> </strings> Modified: software/gadgets/tux_controller/trunk/TuxController/strings.xml =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/strings.xml 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/strings.xml 2007-11-19 08:05:50 UTC (rev 710) @@ -19,10 +19,12 @@ <gui_conf_current_bind_lb type='str'>Current</gui_conf_current_bind_lb> <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> <lblSoundL type='str'>Sound level</lblSoundL> + <colValue type='str'>Value</colValue> <speaker_name type='str'>Ryan8k</speaker_name> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <name_to_read type='str'>Tux Droid Controler</name_to_read> <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> <lblLightL type='str'>Light level</lblLightL> <Second type='str'>sec.</Second> + <colStatus type='str'>Status</colStatus> </strings> Modified: software/gadgets/tux_controller/trunk/TuxController.tgf =================================================================== (Binary files differ) |
From: Paul_R <c2m...@c2...> - 2007-11-16 14:34:26
|
Author: Paul_R Date: 2007-11-16 15:34:24 +0100 (Fri, 16 Nov 2007) New Revision: 709 Modified: api/python/trunk/tuxapi_class.py api/python/trunk/tuxapi_const.py Log: * Added two new command (tux.cmd.wings_down & tux.cmd.wings_up) * Changed the params sent to the daemon for the mouth_open/close and eyes_open/close commands. Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-16 14:31:29 UTC (rev 708) +++ api/python/trunk/tuxapi_class.py 2007-11-16 14:34:24 UTC (rev 709) @@ -1772,6 +1772,8 @@ tux.cmd.wings_off tux.cmd.wings_on tux.cmd.wings_on_free + tux.cmd.wings_up + tux.cmd.wings_down """ #-------------------------------------------------------------------------- @@ -1903,8 +1905,8 @@ Example: >>> tux.cmd.eyes_open() """ - if self.parent.status.get_eyes_closed_position_switch()==0: - self.eyes_on() + self.last_ack=self.structured(TUX_CMD_STRUCT_EYES, \ + TUX_CMD_STRUCT_SUB_OPEN,0,0,0) #-------------------------------------------------------------------------- # Send a command to tux for closing the eyes @@ -1916,8 +1918,8 @@ Example: >>> tux.cmd.eyes_close() """ - if self.parent.status.get_eyes_closed_position_switch()==1: - self.eyes_on() + self.last_ack=self.structured(TUX_CMD_STRUCT_EYES, \ + TUX_CMD_STRUCT_SUB_CLOSE,0,0,0) #-------------------------------------------------------------------------- # Send a command to tux for moving the eyes in free mode @@ -2002,9 +2004,8 @@ Example: >>> tux.cmd.mouth_open() """ - if self.parent.status.get_mouth_open_position()==1: - self.mouth_on() - + self.last_ack=self.structured(TUX_CMD_STRUCT_MOUTH, \ + TUX_CMD_STRUCT_SUB_OPEN,0,0,0) #-------------------------------------------------------------------------- # Send a command to tux for closing the mouth #-------------------------------------------------------------------------- @@ -2015,9 +2016,8 @@ Example: >>> tux.cmd.mouth_close() """ - if self.parent.status.get_mouth_open_position()==0: - self.mouth_on() - + self.last_ack=self.structured(TUX_CMD_STRUCT_MOUTH, \ + TUX_CMD_STRUCT_SUB_CLOSE,0,0,0) #-------------------------------------------------------------------------- # Send a command to tux for stopping the mouth movement #-------------------------------------------------------------------------- @@ -2091,6 +2091,32 @@ TUX_CMD_STRUCT_SUB_OFF,0,0,0) #-------------------------------------------------------------------------- + # Send a command to tux for raise the wings + #-------------------------------------------------------------------------- + def wings_up(self): + """ + Send a command to tux for raise the wings + + Example: + >>> tux.cmd.wings_up() + """ + self.last_ack=self.structured(TUX_CMD_STRUCT_WINGS, \ + TUX_CMD_STRUCT_SUB_UP,0,0,0) + + #-------------------------------------------------------------------------- + # Send a command to tux for raise the wings + #-------------------------------------------------------------------------- + def wings_down(self): + """ + Send a command to tux for lower the wings + + Example: + >>> tux.cmd.wings_down() + """ + self.last_ack=self.structured(TUX_CMD_STRUCT_WINGS, \ + TUX_CMD_STRUCT_SUB_DOWN,0,0,0) + + #-------------------------------------------------------------------------- # Send a command to tux to spin to the left #-------------------------------------------------------------------------- def spinl_on(self,count=4,speed=5): Modified: api/python/trunk/tuxapi_const.py =================================================================== --- api/python/trunk/tuxapi_const.py 2007-11-16 14:31:29 UTC (rev 708) +++ api/python/trunk/tuxapi_const.py 2007-11-16 14:34:24 UTC (rev 709) @@ -306,6 +306,10 @@ TUX_CMD_STRUCT_SUB_BLINK = 0x09 TUX_CMD_STRUCT_SUB_CH_GENERAL = 0x0A TUX_CMD_STRUCT_SUB_CH_TTS = 0x0B +TUX_CMD_STRUCT_SUB_OPEN = 0x0C +TUX_CMD_STRUCT_SUB_UP = 0x0C +TUX_CMD_STRUCT_SUB_CLOSE = 0x0D +TUX_CMD_STRUCT_SUB_DOWN = 0x0D # Tux request information TUX_REQ_INFO_VERSION = 0x01 |
From: Paul_R <c2m...@c2...> - 2007-11-16 14:31:41
|
Author: Paul_R Date: 2007-11-16 15:31:29 +0100 (Fri, 16 Nov 2007) New Revision: 708 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Added the eyes open/close; mouth open/close and wings up/down case, and send the correct command to Tux. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-16 14:28:53 UTC (rev 707) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-16 14:31:29 UTC (rev 708) @@ -371,6 +371,12 @@ case TUX_CMD_STRUCT_SUB_OFF: ACK = send_usb_tux_cmd(STOP_EYES_CMD, 0, 0, 0); break; + case TUX_CMD_STRUCT_SUB_OPEN: + ACK = send_usb_tux_cmd(OPEN_EYES_CMD, 0, 0, 0); + break; + case TUX_CMD_STRUCT_SUB_CLOSE: + ACK = send_usb_tux_cmd(CLOSE_EYES_CMD, 0, 0, 0); + break; } break; case TUX_CMD_STRUCT_MOUTH: @@ -382,6 +388,12 @@ case TUX_CMD_STRUCT_SUB_OFF: ACK = send_usb_tux_cmd(STOP_MOUTH_CMD, 0, 0, 0); break; + case TUX_CMD_STRUCT_SUB_OPEN: + ACK = send_usb_tux_cmd(OPEN_MOUTH_CMD, 0, 0, 0); + break; + case TUX_CMD_STRUCT_SUB_CLOSE: + ACK = send_usb_tux_cmd(CLOSE_MOUTH_CMD, 0, 0, 0); + break; } break; case TUX_CMD_STRUCT_WINGS: @@ -393,6 +405,12 @@ case TUX_CMD_STRUCT_SUB_OFF: ACK = send_usb_tux_cmd(STOP_WINGS_CMD, 0, 0, 0); break; + case TUX_CMD_STRUCT_SUB_UP: + ACK = send_usb_tux_cmd(RAISE_WINGS_CMD, 0, 0, 0); + break; + case TUX_CMD_STRUCT_SUB_DOWN: + ACK = send_usb_tux_cmd(LOWER_WINGS_CMD, 0, 0, 0); + break; } break; case TUX_CMD_STRUCT_SPINL: Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-16 14:28:53 UTC (rev 707) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-16 14:31:29 UTC (rev 708) @@ -134,6 +134,10 @@ #define TUX_CMD_STRUCT_SUB_BLINK 0x09 #define TUX_CMD_STRUCT_SUB_CH_GENERAL 0x0A #define TUX_CMD_STRUCT_SUB_CH_TTS 0x0B +#define TUX_CMD_STRUCT_SUB_OPEN 0x0C +#define TUX_CMD_STRUCT_SUB_UP 0x0C +#define TUX_CMD_STRUCT_SUB_CLOSE 0x0D +#define TUX_CMD_STRUCT_SUB_DOWN 0x0D /* Tux request information */ #define TUX_REQ_INFO_VERSION 0x01 |
From: Paul_R <c2m...@c2...> - 2007-11-16 14:28:54
|
Author: Paul_R Date: 2007-11-16 15:28:53 +0100 (Fri, 16 Nov 2007) New Revision: 707 Modified: firmware/tuxcore/trunk/motors.c Log: * Adapt the motors function to the new API commands. - When the mouth move, the tux.cmd.mouth_open/close commands can be used. - When the wings waves, the tux.cmd.wings_up/down stop the wings in the desired position. Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2007-11-16 12:06:07 UTC (rev 706) +++ firmware/tuxcore/trunk/motors.c 2007-11-16 14:28:53 UTC (rev 707) @@ -54,6 +54,10 @@ /** Minimum difference required between the period the flippers are moving from * up to down and from down to up. */ #define FLIPPERS_RESETTIMER_HYST 0x10 +/** Mouth final state */ +#define MOUTH_UDEF 0 +#define MOUTH_OPEN 1 +#define MOUTH_CLOSE 2 /** Number of periods remaining before stopping the eyes. * Normally used when braking, to stop the motor after a short period of @@ -71,6 +75,8 @@ * Normally used when braking, to stop the motor after a short period of * inversion. */ static uint8_t flippers_stop_delay; +/** A flag which indicate the final wanted state for the mouth */ +static uint8_t mouth_final_state; /** Number of movements remaining before stopping the flippers. */ uint8_t flippers_move_counter; /** PWM applied on the flippers motor. */ @@ -386,6 +392,9 @@ { if (!(PSW_MOUTH_PIN & PSW_MOUTH_C_MK)) move_mouth(1); + if (MOT_MOUTH_PT |= MOT_MOUTH_MK) + mouth_final_state = MOUTH_OPEN; + move_mouth(2); } /** @@ -398,6 +407,9 @@ { if (!(PSW_MOUTH_PIN & PSW_MOUTH_O_MK)) move_mouth(1); + if (MOT_MOUTH_PT |= MOT_MOUTH_MK) + mouth_final_state = MOUTH_CLOSE; + move_mouth(2); } /** @@ -424,8 +436,16 @@ if (mouth_move_counter) { mouth_move_counter--; + if (mouth_final_state != MOUTH_UDEF) + { + if ((mouth_final_state == MOUTH_OPEN) && !(PSW_MOUTH_PIN & PSW_MOUTH_O_MK)) + mouth_move_counter = 0; + else if ((mouth_final_state == MOUTH_CLOSE) && !(PSW_MOUTH_PIN & PSW_MOUTH_C_MK)) + mouth_move_counter = 0; + } if (!mouth_move_counter) { + mouth_final_state = MOUTH_UDEF; stop_mouth_motor(); invert_mouth_motor(); mouth_stop_delay = MOUTH_BRAKING_DLY; @@ -542,6 +562,8 @@ { if (gStatus.pos == 0) wave_flippers(1,5); + else + flippers_move_counter = 2; } /** @@ -558,6 +580,8 @@ { if (gStatus.pos == 1) wave_flippers(1,5); + else + flippers_move_counter = 2; } /** |
From: jaguarondi <c2m...@c2...> - 2007-11-16 12:06:18
|
Author: jaguarondi Date: 2007-11-16 13:06:07 +0100 (Fri, 16 Nov 2007) New Revision: 706 Modified: daemon/trunk/libs/USBDaemon_usb.c Log: * Added debug messages when sending commands to the dongle. I'll add timings to the messages to have an idea how much time a command takes to get acknowledged. Modified: daemon/trunk/libs/USBDaemon_usb.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb.c 2007-11-15 16:07:07 UTC (rev 705) +++ daemon/trunk/libs/USBDaemon_usb.c 2007-11-16 12:06:07 UTC (rev 706) @@ -270,13 +270,17 @@ { unsigned char counter; unsigned char csf; + int idx; if (usb_connection_status != USB_CONNECTED) return ACK_CMD_DONGLE_NOT_PRESENT; /* Send data */ cmd_status_flag = 1; - usb_write_TuxDroid(data, TUX_SEND_LENGTH); + idx = usb_write_TuxDroid(data, TUX_SEND_LENGTH); + if (idx <= 0) + return ACK_CMD_TIMEOUT; + log_debug("CMD: %.2x %.2x %.2x %.2x", data[0], data[1], data[2], data[3]); counter = 0; csf = cmd_status_flag; @@ -289,14 +293,24 @@ usleep(10000); if (counter == 15) { + log_debug("CMD: -> ! TIMEOUT"); return ACK_CMD_TIMEOUT; } } if (CMD_status == ACK_CMD_OK) + { + log_debug("CMD: -> ACK"); return ACK_CMD_OK; + } else if (CMD_status == ACK_CMD_KO) + { + log_debug("CMD: -> ! NACK"); return ACK_CMD_KO; + } else + { + log_debug(" -> ! ERROR"); return ACK_CMD_ERROR; + } } |