Optimizations

MS5611
sinseman 10 years ago
parent d27229ad08
commit 25a64746b6

@ -43,7 +43,15 @@ Voici à titre indicatif le matériel utilisé et leur prix d'achat sur eBay int
- Mini USB Battery Charging Board 5V | 0,90€
- Buzzer 8 ohm | 0,20€
- DC-DC Converter Step Up 1-5V 500mA | 1,15€
- 3,7V 600mAh LiPo Battery | 3,25€
- 3,
-
-
-
-
-
-
-
- V 600mAh LiPo Battery | 3,25€
- RTC Module for Arduino | 1,55€
- 3x 10k Ohm resistor + 1x 120 Ohm resistor | 0,10€
- Right Angle Mini Slide Switch | 0,10€
@ -136,7 +144,7 @@ Lorsqu'il n'y a pas de baisse ou de prise d'altitude significative pendant un ce
A la fin du vol les statistiques sont sauvegardées et ne sont pas perdues à l'extinction du variomètre.
Ce programme peut enregistrer 7 rapports de vol. Une fois un vol terminé, la piste suivante d'enregistrement est sélectionnée. Si celle-ci n'est pas vide elle n'est pas écrasée. Il faut alors manuellement effacer la plage de stat en cours (avec un appui long sur le bouton depuis l'interface Vario) ou reset toutes les plages (Menu Stats --> Reset).
Ce programme peut enregistrer 8 rapports de vol. Une fois un vol terminé, la piste suivante d'enregistrement est sélectionnée. Si celle-ci n'est pas vide elle n'est pas écrasée. Il faut alors manuellement effacer la plage de stat en cours (avec un appui long sur le bouton depuis l'interface Vario) ou reset toutes les plages (Menu Stats --> Reset).
**Statistique**

@ -119,6 +119,7 @@ uint8_t push_write_eeprom = 6;
float my_temperature;
float alt;
float tim;
float cumul_alt;
#define memoryBase 32
// Configuration structure (89 bits)
@ -136,18 +137,8 @@ struct Conf
3, -11 , 0, 0, 50, true, 1040.00, 0
};
float getVarioClimbRateStart()
{
return (float)conf.vario_climb_rate_start / 10;
}
float getVarioSinkRateStart()
{
return (float)conf.vario_sink_rate_start / 10;
}
// Statistic structure (128 bits)
#define NB_STATS 7
// Statistic structure (112 bits)
#define NB_STATS 8
struct Stat
{
uint32_t chrono_start;
@ -156,16 +147,26 @@ struct Stat
int alti_min;
uint8_t txchutemax;
uint8_t txchutemin;
float cumul_alt;
uint16_t cumul_alt;
} stat = {
0, 0, -20000, 20000, 0, 0, 0
};
float getVarioClimbRateStart()
{
return (float)conf.vario_climb_rate_start / 10;
}
float getVarioSinkRateStart()
{
return (float)conf.vario_sink_rate_start / 10;
}
void readStat(uint8_t index = conf.stat_index, Stat &value = stat)
{
EEPROM_readAnything(sizeof(Conf) + sizeof(Stat) * index, value);
}
void writeStat(uint8_t index = conf.stat_index, Stat &value = stat)
{
EEPROM_writeAnything(sizeof(Conf) + sizeof(Stat) * index, value);
@ -958,7 +959,7 @@ void loop()
if (stat.chrono_start != 0) {
if (vario > 0)
stat.cumul_alt += Altitude - alt;
cumul_alt += Altitude - alt;
if (Altitude > stat.alti_max)
stat.alti_max = Altitude;
@ -1026,6 +1027,7 @@ void loop()
DateTime now = rtc.now();
stat.chrono_start = now.unixtime();
chrono_cpt = 0;
cumul_alt = 0;
}
else { // every 15 seconds, the altitude "zone" is updated
chrono_cpt++;
@ -1036,12 +1038,13 @@ void loop()
}
}
if (stat.chrono_start != 0 && stat.chrono == 0) {
// if altitude left in the same "zone" (1.5 meters) during 15 seconds, the timer is stopped
// if altitude left in the same "zone" (1.5 meter) during 15 seconds, the timer is stopped
if (altitude_temp - 0.75 < Altitude && altitude_temp + 0.75 > Altitude) {
chrono_cpt++;
if (chrono_cpt >= 15) {
DateTime now = rtc.now();
stat.chrono = now.unixtime() - stat.chrono_start;
stat.cumul_alt = (int)cumul_alt;
writeStat();
incrementStatIndex();
}

Loading…
Cancel
Save