Bug correction

Updated version (bug on protocol initialization)
This commit is contained in:
JJROBOTS
2017-05-06 20:36:29 +01:00
parent 0ff1d58c97
commit b4ae198db0
3 changed files with 20 additions and 27 deletions

View File

@@ -5,8 +5,8 @@
// This code doesn´t need external libraries
// Author: JJROBOTS.COM
// Date: 02/09/2014
// Updated: 08/03/2017
// Version: 2.8
// Updated: 06/05/2017
// Version: 2.81
// License: GPL v2
// Project URL: http://jjrobots.com/b-robot (Features,documentation,build instructions,how it works, SHOP,...)
// New updates:
@@ -214,8 +214,7 @@ void setup()
#else
delay(1000);
#endif
Serial.println("BROBOT by JJROBOTS v2.8");
Serial.println("JJROBOTS");
delay(200);
Serial.println("Don't move for 10 sec...");
MPU6050_setup(); // setup MPU6050 IMU
@@ -264,19 +263,14 @@ void setup()
ESPsendCommand(cmd, "OK", 6);
#endif
// Start UDP SERVER on port 2222, telemetry port 2223
//Serial.println("Start UDP server");
//ESPsendCommand("AT+CIPMUX=0", "OK", 3); // Single connection mode
//ESPsendCommand("AT+CIPMODE=1", "OK", 3); // Transparent mode
//char Telemetry[80];
//strcpy(Telemetry,"AT+CIPSTART=\"UDP\",\"");
//strcat(Telemetry,TELEMETRY);
//strcat(Telemetry,"\",2223,2222,0");
//ESPsendCommand(Telemetry, "OK", 3);
// Start TCP SERVER
ESPsendCommand("AT+CIPMUX=1", "OK", 3); // Single connection mode
Serial.println("Start UDP server");
ESPsendCommand("AT+CIPMUX=0", "OK", 3); // Single connection mode
ESPsendCommand("AT+CIPMODE=1", "OK", 3); // Transparent mode
ESPsendCommand("AT+CIPSERVER=1,2222", "OK", 3); // TCP server
char Telemetry[80];
strcpy(Telemetry,"AT+CIPSTART=\"UDP\",\"");
strcat(Telemetry,TELEMETRY);
strcat(Telemetry,"\",2223,2222,0");
ESPsendCommand(Telemetry, "OK", 3);
// Calibrate gyros
MPU6050_calibrate();
@@ -330,7 +324,7 @@ void setup()
Serial.print("BATT:");
Serial.println(BatteryValue);
#endif
Serial.println("BROBOT by JJROBOTS v2.81");
Serial.println("Start...");
timer_old = micros();
}

View File

@@ -576,8 +576,8 @@ void MPU6050_read_3axis()
// read 14 bytes (gyros, temp and accels)
error = MPU6050_read (MPU6050_ACCEL_XOUT_H, (uint8_t *) &accel_t_gyro, sizeof(accel_t_gyro));
if (error != 0) {
//Serial.print("MPU6050 Error:");
//Serial.println(error);
Serial.print("MPU6050 Error:");
Serial.println(error);
}
// swap bytes
SWAP (accel_t_gyro.reg.x_accel_h, accel_t_gyro.reg.x_accel_l);
@@ -617,14 +617,14 @@ void MPU6050_read_1axis()
// read X accel
error = MPU6050_read(MPU6050_ACCEL_XOUT_H, (uint8_t *) &accel_t_gyro.reg.x_accel_h, 6);
if (error != 0) {
//Serial.print("MPU6050 Error:");
//Serial.println(error);
Serial.print("MPU6050 Error:");
Serial.println(error);
}
// read X gyro
error = MPU6050_read(MPU6050_GYRO_XOUT_H, (uint8_t *) &accel_t_gyro.reg.x_gyro_h, 2);
if (error != 0) {
//Serial.print("MPU6050 Error:");
//Serial.println(error);
Serial.print("MPU6050 Error:");
Serial.println(error);
}
SWAP (accel_t_gyro.reg.x_accel_h, accel_t_gyro.reg.y_accel_l);
SWAP (accel_t_gyro.reg.z_accel_h, accel_t_gyro.reg.z_accel_l);
@@ -645,8 +645,8 @@ bool MPU6050_newData()
error = MPU6050_read(MPU6050_INT_STATUS, &status, 1);
if (error != 0) {
//Serial.print("MPU6050 Error:");
//Serial.println(error);
Serial.print("MPU6050 Error:");
Serial.println(error);
}
if (status & (0b00000001)) // Data ready?
return true;

View File

@@ -15,7 +15,7 @@
// for DEBUG uncomment this lines...
//#define OSCDEBUG 3
//#define OSCDEBUG 0
char UDPBuffer[8]; // input message buffer
@@ -105,7 +105,6 @@ void OSC_MsgRead()
UDPBuffer[i] = UDPBuffer[i - 1];
}
UDPBuffer[0] = Serial1.read();
Serial.print(UDPBuffer[0]);
#ifdef OSCDEBUG3
Serial.print(UDPBuffer[0]);
#endif