|
@@ -17,9 +17,7 @@
|
|
|
|
|
|
|
|
// U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // All Boards without Reset of the Display
|
|
// U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // All Boards without Reset of the Display
|
|
|
|
|
|
|
|
- #define U8LOG_WIDTH 16
|
|
|
|
|
- #define U8LOG_HEIGHT 8
|
|
|
|
|
- uint8_t u8log_buffer[U8LOG_WIDTH*U8LOG_HEIGHT];
|
|
|
|
|
|
|
+
|
|
|
U8X8LOG u8x8log;
|
|
U8X8LOG u8x8log;
|
|
|
|
|
|
|
|
#endif
|
|
#endif
|
|
@@ -56,7 +54,7 @@ const byte address[6] = "00001";
|
|
|
|
|
|
|
|
// #include "struct.h"
|
|
// #include "struct.h"
|
|
|
#define HAS_QMC5883LCompass
|
|
#define HAS_QMC5883LCompass
|
|
|
-#if defined(QMC5883LCompass)
|
|
|
|
|
|
|
+#if defined(HAS_QMC5883LCompass)
|
|
|
#include <QMC5883LCompass.h>
|
|
#include <QMC5883LCompass.h>
|
|
|
QMC5883LCompass compass;
|
|
QMC5883LCompass compass;
|
|
|
#endif
|
|
#endif
|
|
@@ -83,7 +81,7 @@ void setup()
|
|
|
#include "u8g2__setup.h"
|
|
#include "u8g2__setup.h"
|
|
|
#endif
|
|
#endif
|
|
|
//#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
|
//#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
|
|
- // Wire.begin();
|
|
|
|
|
|
|
+ Wire.begin();
|
|
|
//#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
|
|
//#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
|
|
|
// Fastwire::setup(400, true);
|
|
// Fastwire::setup(400, true);
|
|
|
//#endif
|
|
//#endif
|
|
@@ -96,14 +94,16 @@ void setup()
|
|
|
SPFT(title);
|
|
SPFT(title);
|
|
|
|
|
|
|
|
#include "scan.h"
|
|
#include "scan.h"
|
|
|
- #if defined(QMC5883LCompass)
|
|
|
|
|
- Serial.println("compass.init()");
|
|
|
|
|
|
|
+ #if defined(HAS_QMC5883LCompass)
|
|
|
|
|
+ SPFT(compass); SPFT(init);
|
|
|
compass.init();
|
|
compass.init();
|
|
|
#endif
|
|
#endif
|
|
|
#if defined(HAS_MPU6050)
|
|
#if defined(HAS_MPU6050)
|
|
|
- Serial.println("accelgyro.initialize()");
|
|
|
|
|
|
|
+ SPFT(gyroscope);SPFT(init);
|
|
|
accelgyro.initialize();
|
|
accelgyro.initialize();
|
|
|
- Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
|
|
|
|
|
|
|
+ if(accelgyro.testConnection()) {
|
|
|
|
|
+ SPFT(ok);
|
|
|
|
|
+ } else {SPFT(failed);}
|
|
|
accelgyro.setMotionDetectionDuration(80);
|
|
accelgyro.setMotionDetectionDuration(80);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
@@ -131,10 +131,11 @@ void setup()
|
|
|
void loop()
|
|
void loop()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- // u8x8log.print("millis=");
|
|
|
|
|
-
|
|
|
|
|
|
|
+ u8x8log.print("millis=");
|
|
|
|
|
+//uint8_t tiles[8] = { B00001111,0x0f,0x0f,0x0f,0xf0,0xf0,0xf0,0xf0};
|
|
|
|
|
+//u8x8.drawTile(0, U8LOG_HEIGHT+1, 1, tiles);
|
|
|
|
|
|
|
|
-#if defined(QMC5883LCompass)
|
|
|
|
|
|
|
+#if defined(HAS_QMC5883LCompass)
|
|
|
int x, y, z;
|
|
int x, y, z;
|
|
|
Serial.println();
|
|
Serial.println();
|
|
|
// Read compass values
|
|
// Read compass values
|
|
@@ -143,12 +144,12 @@ void loop()
|
|
|
x = compass.getX();
|
|
x = compass.getX();
|
|
|
y = compass.getY();
|
|
y = compass.getY();
|
|
|
z = compass.getZ();
|
|
z = compass.getZ();
|
|
|
- SPFT(compass);
|
|
|
|
|
- SPFT2(x,x);
|
|
|
|
|
- Serial.print(" Y: ");
|
|
|
|
|
- Serial.print(y);
|
|
|
|
|
- Serial.print(" Z: ");
|
|
|
|
|
- Serial.print(z);
|
|
|
|
|
|
|
+ // SPFT(compass);
|
|
|
|
|
+ // SPFT2(X,x);
|
|
|
|
|
+ // SPFT(Y);
|
|
|
|
|
+ // SP(y);
|
|
|
|
|
+ // SPFT(Z);
|
|
|
|
|
+ // SP(z);
|
|
|
#endif
|
|
#endif
|
|
|
#if defined(HAS_MPU6050)
|
|
#if defined(HAS_MPU6050)
|
|
|
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
|
|
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
|
|
@@ -157,13 +158,13 @@ void loop()
|
|
|
//accelgyro.getRotation(&gx, &gy, &gz);
|
|
//accelgyro.getRotation(&gx, &gy, &gz);
|
|
|
#ifdef OUTPUT_READABLE_ACCELGYRO
|
|
#ifdef OUTPUT_READABLE_ACCELGYRO
|
|
|
// display tab-separated accel/gyro x/y/z values
|
|
// display tab-separated accel/gyro x/y/z values
|
|
|
- Serial.print(" a/g:\t");
|
|
|
|
|
- Serial.print(ax); Serial.print("\t");
|
|
|
|
|
- Serial.print(ay); Serial.print("\t");
|
|
|
|
|
- Serial.print(az); Serial.print("\t");
|
|
|
|
|
- Serial.print(gx); Serial.print("\t");
|
|
|
|
|
- Serial.print(gy); Serial.print("\t");
|
|
|
|
|
- Serial.print(gz);
|
|
|
|
|
|
|
+ // SPFT(gyroscope);
|
|
|
|
|
+ // SPFT2(ax,ax); SP("\t");
|
|
|
|
|
+ // SPFT2(ay,ay); SP("\t");
|
|
|
|
|
+ // SPFT2(az,az); SP("\t");
|
|
|
|
|
+ // SPFT2(gx,gx); SP("\t");
|
|
|
|
|
+ // SPFT2(gy,gy); SP("\t");
|
|
|
|
|
+ // SPFT2(gz,gz);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef OUTPUT_BINARY_ACCELGYRO
|
|
#ifdef OUTPUT_BINARY_ACCELGYRO
|