Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
// Update the current time with the new interval int16_t currentTime = runner->currentTime + interval; if(currentTime >= runner->totalTime){ // We have finished playing the animation if(pgm_read_byte(&animation->sweep)==FALSE){ currentTime %= runner->totalTime; // Set back to start of loop if(runner->repeatCount){ runner->repeatCount -= 1; // One less frame to go if(runner->repeatCount==0){ runner->playing = FALSE; // we have reached the end currentTime = 0; // set servos to final position } }///////NEW CODE }else if(pgm_read_byte(&animation->sweep)==2){ currentTime = runner->totalTime;///////END NEW CODE }else{ // Start going backwards through the animation currentTime = runner->totalTime - (currentTime - runner->totalTime); runner->backwards = TRUE; }
if( currentTime == runner->totalTime && pgm_read_byte(&animation->sweep) == 2) { runner->playing = FALSE; // we have reached the end }
if(int8var)
if(int16var)
if(int8var && int16var)
if(int16var && int8var)
if( currentTime == runner->totalTime && pgm_read_byte(&animation->sweep) == 2)
if (!firstPart) goto endif(!secondPart) goto end..both are true:end
if(currentTime >= runner->totalTime){ // We have finished playing the animation if(pgm_read_byte(&animation->sweep)==FALSE){ currentTime %= runner->totalTime; // Set back to start of loop if(runner->repeatCount){ runner->repeatCount -= 1; // One less frame to go if(runner->repeatCount==0){ runner->playing = FALSE; // we have reached the end currentTime = 0; // set servos to final position } }///NEW CODE }else if(pgm_read_byte(&animation->sweep)==2){ currentTime = runner->totalTime; //Triggers block at end of this function///END NEW CODE }else{ // Start going backwards through the animation currentTime = runner->totalTime - (currentTime - runner->totalTime); runner->backwards = TRUE; } }else if(currentTime < 0){ // We have moved before the start if(pgm_read_byte(&animation->sweep)==FALSE){ currentTime = runner->totalTime + currentTime; if(runner->repeatCount){ runner->repeatCount += 1; // One more frame to go if(runner->repeatCount==0){ runner->playing = FALSE; // we have reached the end currentTime = 0; // set servos to start position } }///NEW CODE }else if(pgm_read_byte(&animation->sweep)==2){ currentTime = 0; //Triggers block at end of this function///END NEW CODE }else{ // We have completed a sweep runner->backwards = FALSE; currentTime = -currentTime; if(runner->repeatCount){ runner->repeatCount -= 1; // One less frame to go if(runner->repeatCount==0){ runner->playing = FALSE; // we have reached the end currentTime = 0; // set servos to initial position } } } }
///Stops gait when we get to the end of a sweep == 2 animation if( pgm_read_byte(&animation->sweep) == 2) { if( currentTime == runner->totalTime || currentTime == 0) { // if (currentTime == runner->totalTime) { // led = 1; // } // currentTime = 0; // affects nothing. runner->playing = FALSE; // we have reached the end runner->animation = NO_GAIT; // if (currentPos != SIT_POS) { // currentPos = START_POS; // } // led = 1; } }
Started by Webbot « 1 2 » Software
Started by Gertlex Software
Started by totalis Software
Started by RifRaf Software