Bonjour
j'ai essayé de compiler avec ces paramètre dans HardwareConfig.h
/*----------------------------*/
/* HARDWARE */
/* Vario parameters */
/* */
/*----------------------------*/
/* Comment or uncomment according to */
/* what you embed in the variometer */
#define HAVE_SPEAKER
//#define HAVE_ACCELEROMETER
#define HAVE_SCREEN
mais ca ne passe pas... ( si je décommente ça compile )
Est ce qu'en modifiant le variocal.cfg d'une certaine man je peux arriver à mes fins ( ne plus tenir compte du mpu9250 )
Olivier
Bonsoir,
Malheureusement, tu ne vas pas pouvoir enlever le MPU facilement. Au fur et à mesure de l'évolution, cette possibilité a été abandonner. Cependant, nous avons comme projet de faire une refonte du code et revenir sur quelque chose de plus modulaire. Mais on ne va pas ce mentir, ce n'est pas pour tout de suite.
Cependant, ton problème ne semble pas général et nous sommes plusieurs à ne pas avoir ce problème. On peut donc penser qu'il s'agit plus d'un problème matériel que logiciel. Il faut être bien conscient que c'est un peu la loterie avec ces modules CJMCU à 10 balles.
Si j'étais à ta place:
1/ Je repasserai un petit coup de soudure sur les pins du CJMCU. Histoire de...ça a déjà sauvé la mise. Même si j'étais sur de mon coup.
2/ Je testerai le MS5611 avec le code "Test materiel" que tu trouveras ici:
http://gnuvario-e.yj.fr/Puis tu peux visualiser les variations du baro en utilisant le traceur série (donc pas le moniteur série) pour voir comment il se comporte. Si tu as un long cable usb, tu peux l'agiter, le monter, descendre, faire des virages etc... le faire passer devant une lampe voir si les valeurs ne se satellisent pas (si tu as un boitier clair, bien protéger le MS5611 avec une mousse opaque).
Tu peux aussi utiliser ce code ou un filtre a été ajouté. La valeur se modifie en changeant le coef ligne 80: filtered = filtered + 0.25*(alti-filtered);
Une sorte de préfiltre du baro avant le kalman...
Dans la 8b5, tu peux modifier cette valeur de coeff dans le fichier VarioData.cpp, ligne 107:
#define ALTI_FILTER
#define COEF_ALTI_FILTERED 0.1
#include <Arduino.h>
#include <HardwareConfig.h>
#include <VarioSettings.h>
#include "VarioImuTwoWire.h"
#include <esp_heap_caps.h>
/***************/
unsigned long lastDisplayTimestamp;
unsigned long count = 0;
double alti;
#define POWER_PIN 12
#define POWER_PIN_STATE HIGH
float filtered = 0;
void setup() {
SerialPort.begin(115200);
pinMode(POWER_PIN, OUTPUT);
digitalWrite(POWER_PIN, POWER_PIN_STATE); // turn on POWER
/*****************************/
/* wait for devices power on */
/*****************************/
delay(VARIOMETER_POWER_ON_DELAY);
/**************************/
/* init Two Wires devices */
/**************************/
//!!!
intTW.begin();
twScheduler.init();
// vertaccel.init();
/******************/
/* get first data */
/******************/
/* wait for first alti and acceleration */
while( ! twScheduler.havePressure() ) { }
#ifdef PROG_DEBUG
SerialPort.println("première mesure");
#endif //PROG_DEBUG
/* init kalman filter with 0.0 accel*/
double firstAlti = twScheduler.getAlti();
#ifdef PROG_DEBUG
SerialPort.print("firstAlti : ");
SerialPort.println(firstAlti);
#endif //PROG_DEBUG
/* init time */
lastDisplayTimestamp = millis();
}
void loop() {
/* if( vertaccel.readRawAccel(accel, quat) ){
count++;
}*/
if (twScheduler.havePressure( )) {
#ifdef PROG_DEBUG
// SerialPort.println("havePressure && haveAccel");
#endif //PROG_DEBUG
alti = twScheduler.getAlti();
}
if( millis() - lastDisplayTimestamp > 100 ) {
lastDisplayTimestamp = millis();
if(filtered != 0){
filtered = filtered + 0.25*(alti-filtered);
}
else {
filtered = alti; // first reading so set filtered to reading
}
#ifdef PROG_DEBUG
//SerialPort.print("Alti : ");
SerialPort.print(alti);
SerialPort.print(",");
SerialPort.println(filtered);
/* Serial.print("Memoire Totale : ");
Serial.println(heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_32BIT));
Serial.print("DRam : ");
Serial.println(heap_caps_get_free_size(MALLOC_CAP_INTERNAL| MALLOC_CAP_8BIT));
Serial.print("SpRam : ");
Serial.println(heap_caps_get_free_size(MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));*/
#endif //PROG_DEBUG
}
}
3/ Je testerai également le MPU9250 mais pas avec le code .ino du dossier mais avec celui ci dessous pour également visualiser son comportement sur les 3 axes.
#include <MPU9250_asukiaaa.h>
/*#ifdef _ESP32_HAL_I2C_H_
//TTGO-T5
#define SDA_PIN 21 //19
#define SCL_PIN 22 //18
//TTGO-TS
//#define SDA_PIN 19
//#define SCL_PIN 18
#endif*/
#define POWER_PIN 12
#define POWER_PIN_STATE HIGH
#define VARIO_SDA_PIN 27
#define VARIO_SCL_PIN 32
MPU9250_asukiaaa mySensor;
void setup() {
while(!Serial);
pinMode(POWER_PIN, OUTPUT);
digitalWrite(POWER_PIN, POWER_PIN_STATE); // turn on POWER
delay(3000);
Serial.begin(115200);
Serial.println("started");
/*#ifdef _ESP32_HAL_I2C_H_
// for esp32
//Wire.begin(19, 18); //sda, scl
Wire.begin(VARIO_SDA_PIN, VARIO_SCL_PIN); //SDA_PIN, SCL_PIN); //sda, scl
#else
Wire.begin();
#endif*/
Wire.begin(VARIO_SDA_PIN, VARIO_SCL_PIN); //SDA_PIN, SCL_PIN); //sda, scl
mySensor.setWire(&Wire);
mySensor.beginAccel();
mySensor.beginGyro();
mySensor.beginMag();
// you can set your own offset for mag values
// mySensor.magXOffset = -50;
// mySensor.magYOffset = -55;
// mySensor.magZOffset = -10;
}
void loop() {
/* uint8_t sensorId;
if (mySensor.readId(&sensorId) == 0) {
Serial.println("sensorId: " + String(sensorId));
} else {
Serial.println("Cannot read sensorId");
}
*/
if (mySensor.accelUpdate() == 0) {
//Serial.println("print accel values");
Serial.print( String(mySensor.accelX()));
Serial.print(",");
Serial.print( String(mySensor.accelY()));
Serial.print(",");
Serial.print( String(mySensor.accelZ()));
Serial.println();
//Serial.print("accelSqrt: " + String(mySensor.accelSqrt()));
} else {
Serial.println("Cannod read accel values");
}
/*
if (mySensor.gyroUpdate() == 0) {
Serial.println("gyroX: " + String(mySensor.gyroX()));
Serial.println("gyroY: " + String(mySensor.gyroY()));
Serial.println("gyroZ: " + String(mySensor.gyroZ()));
} else {
Serial.println("Cannot read gyro values");
}
if (mySensor.magUpdate() == 0) {
Serial.println("print mag values");
Serial.println("magX: " + String(mySensor.magX()));
Serial.println("maxY: " + String(mySensor.magY()));
Serial.println("magZ: " + String(mySensor.magZ()));
Serial.println("horizontal direction: " + String(mySensor.magHorizDirection()));
} else {
Serial.println("Cannot read mag values");
}
Serial.println("at " + String(millis()) + "ms");
*/
delay(100);
}
Pareil, le faire tourner dans tous les sens, grands mouvements etc...
Et si après tout ça je ne vois rien de flagrant et bien... je remplacerai le CJMCU-117, mais ça c'est parce que je n'arrive jamais à acheter à l'unité et que j'en ai toujours un qui traine quelque part...
A+