 }
 
 void motorOff() {
-  motor_enable = false;
+  xv_config.motor_enable = false;
   Timer3.pwm(xv_config.motor_pwm_pin, 0);
   Serial.println("Motor off");
 }
 
 void motorOn() {
-  motor_enable = true;
+  xv_config.motor_enable = true;
   Timer3.pwm(xv_config.motor_pwm_pin, xv_config.pwm_min);
   Serial.println("Motor on");
 }
 
 void relayOff() {
-  relay = false;
+  xv_config.relay = false;
   Serial.println("Lidar data disabled");
 }
 
 void relayOn() {
-  relay = true;
+  xv_config.relay = true;
   Serial.println("Lidar data enabled");
 }
 

}

void initEEPROM() {
  xv_config.id = 0x99;
  xv_config.motor_pwm_pin = 9;  // pin connected N-Channel Mosfet

  xv_config.rpm_setpoint = 300;  // desired RPM

  // read byte from LIDAR and relay to USB
  if (Serial1.available() > 0) {
    inByte = Serial1.read();  // get incoming byte:
    if (xv_config.relay) {
      Serial.print(inByte, BYTE);  // relay
    }
    decodeData(inByte);
  }

  if (xv_config.motor_enable) {  
    rpmPID.Compute();
    if (pwm_val != pwm_last) {
      Timer3.pwm(xv_config.motor_pwm_pin, pwm_val);
