 
 
 
-
-//=======================================
-
-// 'power' command
-void power()
-{
-  cmd = buf[1];
-  if (cmd == 'm') pm();
-  else pp();
-}
-
-void pm() {
-  pulsePin(MOTOR_PIN, 20);
-}
-
-void pp() {
-  pulsePin(POWER_PIN, 20);
-}
-
-//=======================================
-
-// 'battery voltage' command
-// result in mV and mA
-void battery()
-{
-  float shuntvoltage = ina219.getShuntVoltage_mV();
-  float busvoltage = ina219.getBusVoltage_V();
-  int current_mA = int(ina219.getCurrent_mA());
-  unsigned long voltage = (unsigned long)(busvoltage * 1000 + shuntvoltage);
-  Serial.write('b');
-  Serial.println(voltage);
-  Serial.write('a');
-  Serial.println(current_mA);
-}
 
 //=======================================
 

void OnDisconnected()
{
  driveStop();
  IsConnected = false;
}


  }
  
  OnValidCommand();
}

//=======================================

// 'power off' command
void power()
{
  pulsePin(POWER_PIN, 20);
}

//=======================================

// 'battery voltage' command
// result in mV and mA
void battery()
{
  float shuntvoltage = ina219.getShuntVoltage_mV();
  float busvoltage = ina219.getBusVoltage_V();
  int current_mA = int(ina219.getCurrent_mA());
  unsigned long voltage = (unsigned long)(busvoltage * 1000 + shuntvoltage);
  Serial.write('b');
  Serial.println(voltage);
  Serial.write('a');
  Serial.println(current_mA);
}

//=======================================
