ATTiny85; order of magnitude loss of speed when enabling map AnalogRead function

Hello Jiggy-Ninja

Well, spent a few more hours with this:

Now have two separate square waves / triangle wave, these square waves box BOTH the rising and falling edges...... :o See attached scope shot.

[code]
  if((micros()-StartUs) >= ramplength) 
      {                                           
        Pwm+=Dir;                 //increment or decrement PWM depending of sign of Dir 
        analogWrite(ledPin, Pwm); //Update built-in LED
        if(Pwm==pwmMax) Dir=-1;   //if PWM reaches the maximum: change direction 
        if(Pwm==pwmMax)
        {
          digitalWrite(outPin,LOW);
          delay(ramplength);
        }
        if(Pwm==pwmMin) 
        { 
          digitalWrite(outPin,LOW);          
          delay(INTERVAL);
          
          Dir=+1;                 //delay *INTERVAL* & change direction 
          delayStartTime = micros();
          
              do
              {
                INTERVAL   = map(analogRead(intervalPin),0,1023,800,50000);               //800=16ms          // adjust all maps according to
                pwmMax     = map(analogRead(pwmMaxPin),0,1023,100,255);                    // circuit layout & potentiomenters
                ramplength = map(analogRead(ramplengthPin),0,1023,2,11800);               // adjust map for packetcount
              }
              while(micros()-delayStartTime<=INTERVAL);
              
         }                        
          //StartUs += ramplength;  //loose control of ramplengthPin & pwmMaxPin // only intervalPin works // with int Dir=2; min 4ms
                                  //loose control of ramplengthPin  -- pwmMaxPin && intervalPin works  // with int static Dir=1; 
         
            StartUs=micros();         //loose control of pwmMaxPin // ramplenghtPin & intervalPin works      // with int Dir=2; min 4ms
  }                                 // All three work!!!! but....now Triangle wave!!!!!                   // with int static Dir=1;

[/code]

Guess this is progress, but not how I envisaged it.

Now the pot. input for variable ramplengthPin only controls the pwmMax plateau of the triangle wave, making it no longer a triangle but a flat top triangle wave.

This wave form may be useful in future experiments, but not what is needed now.

I know that I am making some basic mistake with the format of this program.
I feel that I am close to making this work, I would definitely appreciate any pointer in the proper direction to expedite the process.

Thanks again.
take care, peace
lost_bro