 #include "Arduino.h"
 
-int motorPin1_1 = 4;
-int motorPin1_2 = 5;
-int motorPin1_speed = 3;
-int motorPin1_A = A7;
-
-int motorPin2_1 = 7;
-int motorPin2_2 = 8;
-int motorPin2_speed = 6;
-int motorPin2_A = A6;
-
-int motorPin3_1 = 10;
-int motorPin3_2 = 11;
-int motorPin3_speed = 9;
-int motorPin3_A = A5;
-
-// ----------
-
-int motor1_RPMCount = 0;
-int motor1_State = 0;
-int motor1_MaxRPM = 0;
-
-int motor2_RPMCount = 0;
-int motor2_State = 0;
-int motor2_MaxRPM = 0;
-
-int motor3_RPMCount = 0;
-int motor3_State = 0;
-int motor3_MaxRPM = 0;
-
-// ----------
-
-typedef struct {
-  int RPM;
-  int Speed;
-  long MappedSpeed;
-  bool Set;
-} SpeedMappingEntity;
-
+uint8_t motorPin1_1 = 4;
+uint8_t motorPin1_2 = 5;
+uint8_t motorPin1_speed = 3;
+uint8_t motorPin1_A = A7;
+
+uint8_t motorPin2_1 = 7;
+uint8_t motorPin2_2 = 8;
+uint8_t motorPin2_speed = 6;
+uint8_t motorPin2_A = A6;
+
+uint8_t motorPin3_1 = 10;
+uint8_t motorPin3_2 = 11;
+uint8_t motorPin3_speed = 9;
+uint8_t motorPin3_A = A5;
+
+// ----------
+
+uint16_t motor1_RPMCount = 0;
+uint8_t motor1_State = 0;
+uint16_t motor1_MaxRPM = 0;
+
+uint16_t motor2_RPMCount = 0;
+uint8_t motor2_State = 0;
+uint16_t motor2_MaxRPM = 0;
+
+uint16_t motor3_RPMCount = 0;
+uint8_t motor3_State = 0;
+uint16_t motor3_MaxRPM = 0;
+
+// ----------
+
+// TODO: check if only one would be enough
 const int SpeedMappingSize = 256;
-SpeedMappingEntity SpeedMapping_Motor1[SpeedMappingSize] = {{0, 0, 0, false}};
-SpeedMappingEntity SpeedMapping_Motor2[SpeedMappingSize]= {{0, 0, 0, false}};
-SpeedMappingEntity SpeedMapping_Motor3[SpeedMappingSize]= {{0, 0, 0, false}};
-
-// ----------
-
-unsigned long time = 0;
-
-int initState = 0;
-unsigned long initTimestamp = 0;
-int initSpeed = 255;
+uint8_t SpeedMapping_Motor1[SpeedMappingSize];
+uint8_t SpeedMapping_Motor2[SpeedMappingSize];
+uint8_t SpeedMapping_Motor3[SpeedMappingSize];
+
+// ----------
+
+uint8_t initState = 0;
+uint32_t initTimestamp = 0;
+uint8_t initSpeed = 255;
 
 // ----------
 // ----------

        return;
    }

    if(initState == 0)
    {
        initSpeed = 255;


    if (initState == 1 && initSpeed == 0)
    {
        initState = 2;
        for(int i = 0; i < SpeedMappingSize; i++)
        {
            Serial.print(i);
            Serial.println("----------");
            Serial.println(SpeedMapping_Motor1[i]);
            Serial.println(SpeedMapping_Motor2[i]);
            Serial.println(SpeedMapping_Motor3[i]);
        }
    }
}
