[solved]Can run 2 extra void but whit the 3rd screen stop working

I am busy whit project to control ibt2 whit softstart, current sensing.
when current is to high two things can happen, or program stop motor and wait 1sec
or it turns the motor the orther way around.
this using arduino nano

for information on display and the amount of if else i used "void oled()" to easily put the code on several places

softstart/stop is working but only right is working correctly
if i turn on leftsoft(); than the display does not show anything anymore, also if i switch to right.
but whit oled() it does work correctly

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// On an arduino UNO:       A4(SDA), A5(SCL)
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int amp = A0; // amperage meter on pin A0
int pot1 = A6; //potentionmeter 1
int pot2 = A7; //potentionmeter 2
int switchab = A1; // switch a and b
int switchcd = A2; // switch c and d
int pwm1 = 5; // send left pwm speed 
int pwm2 = 6; // send right pwm speed
int val = 0;
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int maxc = 50;
int settime = 1;
int setpwm1 = 0;
int setpwm2 = 0;
int testpwm1 = 0;
int testpwm2 = 0;
int turn1 = 0;
int turn2 = 0;
int turn3=0;
int i=0;
float ampsens; // measured value from currentsensor
float amptest; // to calculate how mutch current (can be negative and positive)
float current; // amptest value turned negative to positive, keep positive value positive

void setup()
{
  Serial.begin(9600);
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(20); // Pause for 2 seconds

  // Clear the buffer
  display.clearDisplay();
 }


void loop(){

//--------------------------------------------------------------------------------------------------------
//clear display and set 
  display.clearDisplay();
  display.setTextSize(1); // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);  
//--------------------------------------------------------------------------------------------------------
//Read all inputs  
ampsens = analogRead(amp); // currentsensor
int AB = analogRead (switchab); //switch a and b
int CD = analogRead (switchcd); // switch c and d
int p1 = analogRead (pot1); //potentionmeter 1
int p2 = analogRead (pot2); //potentionmeter 2
  turn2=map(p2,0,1023,0,255);
//--------------------------------------------------------------------------------------------------------
//turn to amperage and set negative value to positve
amptest = (2.5 - (ampsens * (5.0 / 1024.0)) )/0.066; // turn measured currentsensor value to Amperage value
if (amptest < 0) { // if else to turn negative to positive and keep positive positive
  current = (amptest*(-1)); 
 }
else  {
  current = amptest;
 }
//------------------------------------------------------------------------------------------------------
//crapping whitch switch is on or off
//switch ab value same as for switch cd
// A on at507, 625
// A off at 0 and 382
// B on at 382 and 625
// B off at 0 and 507 
if ((AB > 575 && AB < 675) || (AB > 450 && AB < 550))              { 
a = 1;                 }
else if (AB < 50 || (AB > 330 && AB < 430))                {
a = 0;  }
else { 
 a = 2;  }
if ((AB > 575 && AB < 675) || (AB > 330 && AB < 430))                 {
b = 1;  }
else if (AB < 50 || (AB > 450 && AB < 550))                 {
b =0; }
else  { 
b = 2;  }
//switch cd
if ((CD > 575 && CD < 675) || (CD > 450 && CD < 550))              { 
c = 1;                 }
else if (CD < 50 || (CD > 330 && CD < 430))                {
c = 0;  }
else { 
c = 2;  }
if ((CD > 575 && CD < 675) || (CD > 330 && CD < 430))                 {
d = 1;  }
else if (CD < 50 || (CD > 450 && CD < 550))                 {
d =0; }
else  { 
d = 2;  }

//--------------------------------------------------------------------------------------------------------
// to set time or max current whit switch d
if (d==0){
  maxc = map(p1,0,1023,0,50);  
  }
else if (d==1){
  settime = map(p1,0,1023,0,50);}  //50 ms for delay 
else{
  maxc = 0;
  settime = 0;
}

//-------------------------------------------------------------------------------------------------------
//autorotate 
if (a == 1)  {
display.setCursor(0,40);  
display.print("AUTO");
    if  (current<maxc && setpwm1 == 0)
    {
//      analogWrite(pwm1, 0); 
      delay (10);
//      analogWrite(pwm2, turn1);
//      testpwm1=0;
//      testpwm2=turn1;
      display.print(", left");
        if (b == 0) 
        {
        setpwm1 = 0;
        setpwm2 = 1;  
        }
        else
        {
        setpwm1 = 1;
        setpwm2 = 0;
        }
    }
  else if (current<maxc && setpwm2 == 0)
      {
//      analogWrite(pwm2, 0); 
      delay (10);
//      analogWrite(pwm1, turn1);
//      testpwm1=turn1;
//      testpwm2=0;
      display.print(", right");
        if (b == 1) 
        {
        setpwm1 = 1;
        setpwm2 = 0;  
        }
        else
        {
        setpwm1 = 0;
        setpwm2 = 1;
        }
      }
else if (current>=maxc && setpwm1 == 0)
      {
//      analogWrite(pwm2, 0); 
      delay (10);
//      analogWrite(pwm1, turn1);
      setpwm1 = 1;
      setpwm2 = 0;
//      testpwm1=turn1;
//      testpwm2=0;
      display.print(", right high");
      }
else if (current>=maxc && setpwm2 == 0)
      {
//      analogWrite(pwm1, 0); 
      delay (10);
//      analogWrite(pwm2, turn1);
      setpwm1 = 0;
      setpwm2 = 1;
//      testpwm1=0;
//      testpwm2=turn1;
      display.print(", left high");
            }
}
//------------------------------------------------------------------------------------------------
// Only turning and stopping when current is to high
else if(a==0)
  {
     display.setCursor(0,40);
     display.print("Turn");
  if (b == 1) 
    { 
      if (current<=maxc)
      {
//        analogWrite(pwm1, turn1);
//        analogWrite(pwm2, 0);
//        testpwm1=turn1;
//        testpwm2=0;
      setpwm1 = 1;
      setpwm2 = 0;
       display.print(", right");
    }
    else
    {
//        analogWrite(pwm1, 0);
//        analogWrite(pwm2, 0);
//        testpwm1=0;
//        testpwm2=0;
      setpwm1 = 1;
      setpwm2 = 0;
        display.print(", right stopped!");
        
    }
    }
else 
{
  if (current<=maxc)
    {
      analogWrite(pwm2, turn1);
      analogWrite(pwm1, 0);
//      testpwm1=0;
//      testpwm2=turn1;
      setpwm1 = 0;
      setpwm2 = 1;
      display.println(", left");
  }
  else
  {
      analogWrite(pwm1, 0);
      analogWrite(pwm2, 0);
//      testpwm1=0;
//      testpwm2=0;
      display.print(", left stopped!");
          
  }
}
  }
else
  {
  display.println(", error");
  display.display();
  analogWrite(pwm1, 0);
  analogWrite(pwm2, 0); 
  }

//--------------------------------------------------------------------------------------------------------
// softstart on/off switch c
if (c == 1){
  if (setpwm1==1 &&setpwm2==0)//turn right softstart 
{ 
softright(); //run void softright
}
else if (setpwm2==1 && setpwm1==0)//turn left softstart
{ 
 oled(); 
//leftsoft(); //run void softleft
}
else if (setpwm1==0&&setpwm2==0)
{ 
  analogWrite(pwm1,0);
  analogWrite(pwm2,0);
  display.setCursor(0,50);
  display.print("sofstart both off");
oled(); //run void oled
}
else //both off or when error occured.
{ 
  analogWrite(pwm1,0);
  analogWrite(pwm2,0);
  display.setCursor(0,50);
  display.print ("softstart on error");
oled(); //run void oled
}
}
else
{ 
     if (setpwm1==1 &&setpwm2==0)//turn right  
{ 
  analogWrite(pwm1,turn2);
  analogWrite(pwm2,0);
  testpwm1 = turn2;
  testpwm2 = 0;
  display.setCursor(0,50);
  display.print("softstart off right");
oled(); //run void oled
}
else if (setpwm2==1 && setpwm1==0)//turn left 
{ 
  analogWrite(pwm1,0);
  analogWrite(pwm2,turn2);
  testpwm1 = 0;
  testpwm2 = turn2;
  display.setCursor(0,50);
  display.print("softstart off left");
  oled(); //run void oled
}
else if (setpwm1==0&&setpwm2==0)
{ 
  analogWrite(pwm1,0);
  analogWrite(pwm2,0);
  testpwm1 = 0;
  testpwm2 = 0;
  display.setCursor(0,50);
  display.print("sofstart both off");
oled(); //run void oled
}
else //both off or when error occured.
{ 
  analogWrite(pwm1,0);
  analogWrite(pwm2,0);
  testpwm1 = 0;
  testpwm2 = 0;
  display.setCursor(0,50);
  display.print ("softstart off error");
oled(); //run void oled

}
}


}
//--------------------------------------------------------------------------------------------
//code for softstart right
void softright() {
 if (testpwm2>0){ //if left is turning slow it down first, than speed up 
  for (i=testpwm2; i>=0; i--){ // slow down left-----
//analogWrite(pwm2,i);
  testpwm2 = i;
    display.setCursor(0,50);
  display.println("softstart ON RIGHT");
  display.print("left slowdown");
oled();
  delay(settime);
  }
}
else if (testpwm2==0)
{
  if (testpwm1<turn2) //speed up right to turn2 value
  {
    for (i=testpwm1; i<=turn2; i++){ //speed up right------
//  analogWrite(pwm1,i);
    testpwm1 = i;
  display.setCursor(0,50);
  display.println("softstart ON RIGHT");
  display.print("right SPEED UP");
oled();
    delay(settime);
    }  
  }
  else if(testpwm1>turn2) // speed down right to turn2 value
  {
  for (i=testpwm1; i>=turn2; i--){ // slow down left-----
//analogWrite(pwm2,i);
  testpwm1 = i;
  display.setCursor(0,50);
  display.println("softstart ON RIGHT");
  display.print("right SPEED DOWN");
oled();
  delay(settime); 
  }
  }
  else
  {
    testpwm1=turn2;
      display.setCursor(0,50);
  display.println("softstart ON RIGHT");
oled();
delay(settime);
  }
}
else //right error
{
   for (i=turn2; i>=0; i--){ // slow down right-----
  testpwm1 = i;
  testpwm2=i;
  analogWrite(pwm1,i);
  analogWrite(pwm2,i);
  display.setCursor(0,50);
  display.println("softstart ON RIGHT");
  display.print("right ERROR DOWN");
oled();
  delay(settime);   
   }
}}
//---------------------------------------------------------------------------------------------------
//softstart left
void leftsoft() {
 if (testpwm1>0){ //if left is turning slow it down first, than speed up 
  for (i=testpwm1; i>=0; i--){ // slow down right-----
//analogWrite(pwm1,i);
  testpwm1 = i;
    display.setCursor(0,50);
  display.println("softstart ON LEFT");
  display.print("left slowdown");
oled();
  delay(settime);
  }
}
else if (testpwm1==0)
{
  if (testpwm2<turn2) //speed up right to turn2 value
  {
    for (i=testpwm2; i<=turn2; i++){ //speed up left------
//  analogWrite(pwm2,i);
    testpwm2 = i;
  display.setCursor(0,50);
  display.println("softstart ON LEFT");
  display.print("left SPEED UP");
oled();
    delay(settime);
    }  
  }
  else if(testpwm2>turn2) // speed down right to turn2 value
  {
  for (i=testpwm2; i>=turn2; i--){ // slow down left-----
//analogWrite(pwm1,i);
  testpwm2 = i;
  display.setCursor(0,50);
  display.println("softstart ON LEFT");
  display.print("left SPEED DOWN");
oled();
  delay(settime); 
  }
  }
  else
  {
    testpwm2=turn2;
      display.setCursor(0,50);
  display.println("softstart ON LEFT");
oled();
delay(settime);
  }
}
else //left error
{
   for (i=turn2; i>=0; i--){ // slow down both-----
  testpwm1 = i;
  testpwm2=i;
  analogWrite(pwm1,i);
    analogWrite(pwm2,i);
  display.setCursor(0,50);
  display.println("softstart ON LEFT");
  display.print("left ERROR DOWN");
oled();
  delay(settime);   
   }
}}
//---------------------------------------------------------------------------------------------------
//display oled
void oled()  {
  display.setCursor(0, 0);
  display.print(ampsens,0);
  display.print("mV ");
  display.print(testpwm1);
  display.print(" ");  
  display.print(testpwm2);
  display.print(" ");  
  display.print( turn2);
  display.setCursor(0, 10); 
  display.print("AMP = ");
  display.print(current,4);
  display.print("A");
  display.setCursor(0,20);
  display.print("max current set = ");
  display.print(maxc);
  display.setCursor(0,30);
  display.print("set time = ");
  display.print(settime); 
  display.display();      // Show initial text
  }

the code for softright is copied to leftsoft. but changed all left to right and other way around also.
that is why i find it strange it does not put any info on the display.
just if arduino is stopped working al together

// softstart on/off switch c
if (c == 1){
  if (setpwm1==1 &&setpwm2==0)//turn right softstart 
{ 
softright(); //run void softright
}
else if (setpwm2==1 && setpwm1==0)//turn left softstart
{ 
 oled(); 
//leftsoft(); //run void softleft

the bottom two lines are the issue.
whit oled it works correctly and with leftsoft nothing shows up on display

Your code is difficult to follow. Use CTRL-T in the IDE to clean up the indentation. Also, your loop is a mess. The loop function should be as concise as possible- it makes debugging so much easier. You almost have a state machine here. Instead of

if(turningLeft){
  if(something else){
  do stuff
  }else{
  do other stuff
}else{
  do something else
etc
etc

make the "do stuff" a separate function. For example:

if(turningLeft){
  doTurnLeft()
}

and repeat for the other states you are testing in the loop function.

Any further diagnosis may require seeing a schematic. Note, pretty Fritzing pictures are NOT schematics.

REally?

yes i know the code can be made easier to read
but ctrl-t gives in arduino there is no clean up to be found.
offcourse the code compiles correctly

found out that only one of the two void can work and not both of them.
even if i just put one of the two voids in the void loop as code and remove void it stil has the same issue.

so inside void softright and void leftsoft are giving difficulties for the arduino when using both

@aarg
meant grabbing. i focused more on the code than the correct english words.

also i think i found the issue in the mean time.
the display command in one void was the same as the orther one, but having it on both void gave the problem.
atleast in void leftsoft putted // before the display command lines and now both working correctly.
so need to find a other way to get is working like i want it

void is simply a data type, like int or bool.

Saying "found out that only one of the two void can work and not both of them" says nothing to us.

I only suggested parsing the messy loop function to make it much easier to debug or modify in the future. It also makes the code easier to follow.

Had you done CTRL-T, your braces would not have indented like this:

   }
   }
else 
{

If you see indenting like this after CTRL-T, then you have a brace mismatch.

i saw now that i had a error from the oled (SSD1306 allocation failed)
but saw also somewhere else it needs 1kb of data (1024bytes)
the code uses
the schets uses 19366bytes (63%) from the max30720bytes
global variable 931bytes (45%) from the max 2048bytes
so i have 1117bytes left of room for the oled if i say it correct

if i remove part of the code
than i have the next thing
18734bytes (60%) and 701bytes (34%) so i have now 1347bytes free.
than al works correctly.

don't know if this is true that i have not enough memory on the arduino

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// On an arduino UNO:       A4(SDA), A5(SCL)
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int amp = A0; // amperage meter on pin A0
int pot1 = A6; //potentionmeter 1
int pot2 = A7; //potentionmeter 2
int switchab = A1; // switch a and b
int switchcd = A2; // switch c and d
int pwm1 = 5; // send left pwm speed
int pwm2 = 6; // send right pwm speed
int val = 0;
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int maxc = 50;
int settime = 1;
int setpwm1 = 0;
int setpwm2 = 0;
int testpwm1 = 0;
int testpwm2 = 0;
int turn1 = 0;
int turn2 = 0;
int turn3 = 0;
int i = 0;
int tekst = 0;
float ampsens; // measured value from currentsensor
float amptest; // to calculate how mutch current (can be negative and positive)
float current; // amptest value turned negative to positive, keep positive value positive

void setup()
{
  Serial.begin(9600);
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }

  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(20); // Pause for 2 seconds

  // Clear the buffer
  display.clearDisplay();
}


void loop()
{
  //--------------------------------------------------------------------------------------------------------
  //clear display and set
  display.clearDisplay();
  display.setTextSize(1); // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  //--------------------------------------------------------------------------------------------------------
  //Read all inputs
  ampsens = analogRead(amp); // currentsensor
  int AB = analogRead (switchab); //switch a and b
  int CD = analogRead (switchcd); // switch c and d
  int p1 = analogRead (pot1); //potentionmeter 1
  int p2 = analogRead (pot2); //potentionmeter 2
  turn2 = map(p2, 0, 1023, 0, 255);
  //--------------------------------------------------------------------------------------------------------
  //turn to amperage and set negative value to positve
  amptest = (2.5 - (ampsens * (5.0 / 1024.0)) ) / 0.066; // turn measured currentsensor value to Amperage value
  if (amptest < 0) { // if else to turn negative to positive and keep positive positive
    current = (amptest * (-1));
  }
  else  {
    current = amptest;
  }
  //------------------------------------------------------------------------------------------------------
  //crapping whitch switch is on or off
  //switch ab value same as for switch cd
  // A on at507, 625
  // A off at 0 and 382
  // B on at 382 and 625
  // B off at 0 and 507
  if ((AB > 575 && AB < 675) || (AB > 450 && AB < 550))              {
    a = 1;
  }
  else if (AB < 50 || (AB > 330 && AB < 430))                {
    a = 0;
  }
  else {
    a = 2;
  }
  if ((AB > 575 && AB < 675) || (AB > 330 && AB < 430))                 {
    b = 1;
  }
  else if (AB < 50 || (AB > 450 && AB < 550))                 {
    b = 0;
  }
  else  {
    b = 2;
  }
  //switch cd
  if ((CD > 575 && CD < 675) || (CD > 450 && CD < 550))              {
    c = 1;
  }
  else if (CD < 50 || (CD > 330 && CD < 430))                {
    c = 0;
  }
  else {
    c = 2;
  }
  if ((CD > 575 && CD < 675) || (CD > 330 && CD < 430))                 {
    d = 1;
  }
  else if (CD < 50 || (CD > 450 && CD < 550))                 {
    d = 0;
  }
  else  {
    d = 2;
  }

  //--------------------------------------------------------------------------------------------------------
  // to set time or max current whit switch d
  if (d == 0) {
    maxc = map(p1, 0, 1023, 0, 50);
  }
  else if (d == 1) {
    settime = map(p1, 0, 1023, 0, 50);
  }  //50 ms for delay
  else {
    maxc = 0;
    settime = 0;
  }

  //-------------------------------------------------------------------------------------------------------
  //autorotate
  if (a == 1)  {
    display.setCursor(0, 40);
    display.print("AUTO");
    if  (current < maxc && setpwm1 == 0)
    {
      //      analogWrite(pwm1, 0);
      delay (10);
      //      analogWrite(pwm2, turn1);
      //      testpwm1=0;
      //      testpwm2=turn1;
      display.print(", left");
      if (b == 0)
      {
        setpwm1 = 0;
        setpwm2 = 1;
      }
      else
      {
        setpwm1 = 1;
        setpwm2 = 0;
      }
    }
    else if (current < maxc && setpwm2 == 0)
    {
      //      analogWrite(pwm2, 0);
      delay (10);
      //      analogWrite(pwm1, turn1);
      //      testpwm1=turn1;
      //      testpwm2=0;
      display.print(", right");
      if (b == 1)
      {
        setpwm1 = 1;
        setpwm2 = 0;
      }
      else
      {
        setpwm1 = 0;
        setpwm2 = 1;
      }
    }
    else if (current >= maxc && setpwm1 == 0)
    {
      //      analogWrite(pwm2, 0);
      delay (10);
      //      analogWrite(pwm1, turn1);
      setpwm1 = 1;
      setpwm2 = 0;
      //      testpwm1=turn1;
      //      testpwm2=0;
      display.print(", right high");
    }
    else if (current >= maxc && setpwm2 == 0)
    {
      //      analogWrite(pwm1, 0);
      delay (10);
      //      analogWrite(pwm2, turn1);
      setpwm1 = 0;
      setpwm2 = 1;
      //      testpwm1=0;
      //      testpwm2=turn1;
      display.print(", left high");
    }
  }
  //------------------------------------------------------------------------------------------------
  // Only turning and stopping when current is to high
  else if (a == 0)
  {
    display.setCursor(0, 40);
    display.print("Turn");
    if (b == 1)
    {
      if (current <= maxc)
      {
        //        analogWrite(pwm1, turn1);
        //        analogWrite(pwm2, 0);
        //        testpwm1=turn1;
        //        testpwm2=0;
        setpwm1 = 1;
        setpwm2 = 0;
        display.print(", right");
      }
      else
      {
        //        analogWrite(pwm1, 0);
        //        analogWrite(pwm2, 0);
        //        testpwm1=0;
        //        testpwm2=0;
        setpwm1 = 1;
        setpwm2 = 0;
        display.print(", right stopped!");

      }
    }
    else
    {
      if (current <= maxc)
      {
        analogWrite(pwm2, turn1);
        analogWrite(pwm1, 0);
        //      testpwm1=0;
        //      testpwm2=turn1;
        setpwm1 = 0;
        setpwm2 = 1;
        display.print(", left");
      }
      else
      {
        analogWrite(pwm1, 0);
        analogWrite(pwm2, 0);
        //      testpwm1=0;
        //      testpwm2=0;
        display.print(", left stopped!");

      }
    }
  }
  else
  {
    display.print(", error");
    display.display();
    analogWrite(pwm1, 0);
    analogWrite(pwm2, 0);
  }

  //--------------------------------------------------------------------------------------------------------
  // softstart on/off switch c
  if (c == 1) { //softstart on
    if (setpwm1 == 1 && setpwm2 == 0) //turn right softstart
    {
      // oled();
      softright(); //run void softright
    }
    else if (setpwm2 == 1 && setpwm1 == 0) //turn left softstart
    {
      //  oled();
      leftsoft(); //run void softleft
      oled();
    }
    else if (setpwm1 == 0 && setpwm2 == 0)
    {
      analogWrite(pwm1, 0);
      analogWrite(pwm2, 0);
      tekst = 1; //sofstart both off
      oled(); //run void oled
    }
    else //both off or when error occured.
    {
      analogWrite(pwm1, 0);
      analogWrite(pwm2, 0);
      tekst = 2; //softstart on error
      oled(); //run void oled
    }
  }
  else //softstart off
  {
    if (setpwm1 == 1 && setpwm2 == 0) //turn right
    {
      analogWrite(pwm1, turn2);
      analogWrite(pwm2, 0);
      testpwm1 = turn2;
      testpwm2 = 0;
      tekst = 3; // softstart off right
      oled(); //run void oled
    }
    else if (setpwm2 == 1 && setpwm1 == 0) //turn left
    {
      analogWrite(pwm1, 0);
      analogWrite(pwm2, turn2);
      testpwm1 = 0;
      testpwm2 = turn2;
      tekst = 4; //softstart off left
      oled(); //run void oled
    }
    else if (setpwm1 == 0 && setpwm2 == 0)
    {
      analogWrite(pwm1, 0);
      analogWrite(pwm2, 0);
      testpwm1 = 0;
      testpwm2 = 0;
      tekst = 1;
      oled(); //run void oled
    }
    else //both off or when error occured.
    {
      analogWrite(pwm1, 0);
      analogWrite(pwm2, 0);
      testpwm1 = 0;
      testpwm2 = 0;
      tekst = 5; //softstart off error
      oled(); //run void oled

    }
  }


}
//--------------------------------------------------------------------------------------------
//code for softstart right
void softright() {
  if (testpwm2 > 0) { //if left is turning slow it down first, than speed up
    for (i = testpwm2; i >= 0; i--) { // slow down left-----
      analogWrite(pwm2, i);
      testpwm2 = i;
      tekst = 6;
      oled();
      delay(settime);
    }
  }
  else if (testpwm2 == 0)
  {
    if (testpwm1 < turn2) //speed up right to turn2 value
    {
      for (i = testpwm1; i <= turn2; i++) { //speed up right------
        analogWrite(pwm1, i);
        testpwm1 = i;
        tekst = 7;
        oled();
        delay(settime);
      }
    }
    else if (testpwm1 > turn2) // speed down right to turn2 value
    {
      for (i = testpwm1; i >= turn2; i--) { // slow down left-----
        analogWrite(pwm2, i);
        testpwm1 = i;
        tekst = 8;
        oled();
        delay(settime);
      }
    }
    else
    {
      testpwm1 = turn2;
      tekst = 9;
      oled();
      delay(settime);
    }
  }
  else //right error
  {
    //    for (i = turn2; i >= 0; i--) { // slow down right-----
    testpwm1 = 0;
    testpwm2 = 0;
    analogWrite(pwm1, 0);
    analogWrite(pwm2, 0);
    tekst = 10;
    oled();
    delay(settime);
    //    }
  }
}
//---------------------------------------------------------------------------------------------------
//softstart left
void leftsoft() {
  if (testpwm1 > 0) { //if left is turning slow it down first, than speed up
    for (i = testpwm1; i >= 0; i--) { // slow down right-----
      analogWrite(pwm1, i);
      testpwm1 = i;
      tekst = 11;
      oled();
      delay(settime);
    }
  }
  else if (testpwm1 == 0)
  {
    if (testpwm2 < turn2) //speed up right to turn2 value
    {
      for (i = testpwm2; i <= turn2; i++) { //speed up left------
        analogWrite(pwm2, i);
        testpwm2 = i;
        tekst = 12;
        oled();
        delay(settime);
      }
    }
    else if (testpwm2 > turn2) // speed down right to turn2 value
    {
      for (i = testpwm2; i >= turn2; i--) { // slow down left-----
        analogWrite(pwm1, i);
        testpwm2 = i;
        tekst = 13;
        oled();
        delay(settime);
      }
    }
    else
    {
      testpwm2 = turn2;
      tekst = 14;
      oled();
      delay(settime);
    }
  }
  else //left error
  {
    //    for (i = turn2; i >= 0; i--) { // slow down left-----
    testpwm1 = 0;
    testpwm2 = 0;
    analogWrite(pwm1, 0);
    analogWrite(pwm2, 0);
    tekst = 15;
    oled();
    delay(settime);
    //    }
  }
}
//---------------------------------------------------------------------------------------------------
//display oled
void oled()  {
  display.setCursor(0, 0);
  display.print(ampsens, 0);
  display.print("mV ");
  display.print(testpwm1);
  display.print(" ");
  display.print(testpwm2);
  display.print(" ");
  display.print( turn2);
  display.setCursor(0, 10);
  display.print("AMP = ");
  display.print(current, 4);
  display.print("A");
  display.setCursor(0, 20);
  display.print("max current set = ");
  display.print(maxc);
  display.setCursor(0, 30);
  display.print("set time = ");
  display.print(settime);
  display.setCursor(0, 50);
  if (tekst == 1)
  {
    display.print("sofstart both off");
  }
  else if (tekst == 2)
  {
    display.print ("softstart on error");
  }
  else if (tekst == 3)
  {
    display.print("softstart off right");
  }
  else if (tekst == 4)
  {
    display.print("softstart off left");
  }
  else if (tekst == 5)
  {
    display.print ("softstart off error");
  }
  else if (tekst == 6)
  {
    display.println("softstart on right");
    display.print("left slowdown");
  }
  else if (tekst == 7)
  {
    display.println("softstart on right");
    display.print("right SPEED UP");
  }
  else if (tekst == 8)
  {
    display.println("softstart on right");
    display.print("right SPEED DOWN");
  }
  else if (tekst == 9)
  {
    display.println("softstart on right");
  }
  else if (tekst == 10)
  {
    display.println("softstart RIGHT ERROR");
    display.print("ERROR DOWN");
  }
  else if (tekst = 11)
  {
    display.println("softstart on left");
    display.print("right slowdown");
  }
  else if (tekst == 12)
  {
    display.println("softstart on left");
    display.print("left SPEED UP");
  }
  else if (tekst == 13)
  {
    display.println("softstart on left");
    display.print("left SPEED DOWN");
  }
  else if (tekst == 14)
  {
    display.print("softstart on left");
  }
  else
  {
    display.print("ERROR ERROR");
  }
  display.display();      // Show initial text
}

if i remove the bottom if else part

  if (tekst == 1)
  {
    display.print("sofstart both off");
  }
  else if (tekst == 2)
  {
    display.print ("softstart on error");
  }
  else if (tekst == 3)
  {
    display.print("softstart off right");
  }
  else if (tekst == 4)
  {
    display.print("softstart off left");
  }
  else if (tekst == 5)
  {
    display.print ("softstart off error");
  }
  else if (tekst == 6)
  {
    display.println("softstart on right");
    display.print("left slowdown");
  }
  else if (tekst == 7)
  {
    display.println("softstart on right");
    display.print("right SPEED UP");
  }
  else if (tekst == 8)
  {
    display.println("softstart on right");
    display.print("right SPEED DOWN");
  }
  else if (tekst == 9)
  {
    display.println("softstart on right");
  }
  else if (tekst == 10)
  {
    display.println("softstart RIGHT ERROR");
    display.print("ERROR DOWN");
  }
  else if (tekst = 11)
  {
    display.println("softstart on left");
    display.print("right slowdown");
  }
  else if (tekst == 12)
  {
    display.println("softstart on left");
    display.print("left SPEED UP");
  }
  else if (tekst == 13)
  {
    display.println("softstart on left");
    display.print("left SPEED DOWN");
  }
  else if (tekst == 14)
  {
    display.print("softstart on left");
  }
  else
  {
    display.print("ERROR ERROR");
  }

than all works correctly in serial i can see that tekst number is changing also.
But does this really mean i need to find parts to clean up. to make more room

Yes, the display buffer uses a huge chunk of Arduino memory. You will have to optimize your code to improve the memory utilization. You can begin by putting all your printed text in the F macro, like:

display.print( F("softstart off left") );

thanks that fixed it. That made 360bytes of extra room free. From 1117bytes free to 1475bytes free.
Now it looks like everything works correctly, so i can finaly check this out.

Much more readable if you use switch-case:

swich (tekst) {
  case 1:
    display.print("sofstart both off");
    break;

  case 2:
    display.print ("softstart on error");
    break;
 
  case 3:
    display.print("softstart off right");
    break;
 
  case 4:
    display.print("softstart off left");
    break;

  case 5:
    display.print ("softstart off error");
    break;

  case 6:
    display.println("softstart on right");
    display.print("left slowdown");
    break;

  case 7:
    display.println("softstart on right");
    display.print("right SPEED UP");
    break;

  case 8:
    display.println("softstart on right");
    display.print("right SPEED DOWN");
    break;

  case 9:
    display.println("softstart on right");
    break;

  case 10:
    display.println("softstart RIGHT ERROR");
    display.print("ERROR DOWN");
    break;

  case 11:
    display.println("softstart on left");
    display.print("right slowdown");
    break;

  case 12:
    display.println("softstart on left");
    display.print("left SPEED UP");
    break;

  case 13:
    display.println("softstart on left");
    display.print("left SPEED DOWN");
    break;

  case 14:
    display.print("softstart on left");
    break;

  default:
    display.print("ERROR ERROR");
    break;
 }

[solution found]
the fix was indeed of the amount of variables stored was to big to run also the rest.

@thehardwareman
That is indeed also a way to do it but never used function case/break/default. so was not aware that it can do the same thing.
At the end i removed it completly and putted the display.print tekst directly on the correct spot
Used it because as testing if the oled screen was working.
at the end putting (F("tekst")) was the fix to save enough room to able to get it to work

for all
thanks for all the fast replies