1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-24 00:35:34 +03:00

stats: don't record for flioghts < 10s

+stats doc in Cli.md
This commit is contained in:
Krzysztof Matula 2017-06-09 23:29:04 +02:00
parent 46b2ded1a7
commit 670282e0a1
2 changed files with 12 additions and 3 deletions

View file

@ -369,6 +369,9 @@ Re-apply any new defaults as desired.
| fw_autotune_threshold | 50 | Threshold [%] of max rate to consider overshoot/undershoot detection | | fw_autotune_threshold | 50 | Threshold [%] of max rate to consider overshoot/undershoot detection |
| fw_autotune_ff_to_p_gain | 10 | FF to P gain (strength relationship) [%] | | fw_autotune_ff_to_p_gain | 10 | FF to P gain (strength relationship) [%] |
| fw_autotune_ff_to_i_tc | 600 | FF to I time (defines time for I to reach the same level of response as FF) [ms] | | fw_autotune_ff_to_i_tc | 600 | FF to I time (defines time for I to reach the same level of response as FF) [ms] |
| stats | OFF | General switch of the statistics recording feature (a.k.a. odometer) |
| stats_total_time | 0 | Total flight time [in seconds]. The value is updated on every disarm when "stats" are enabled. |
| stats_total_dist | 0 | Total flight distance [in meters]. The value is updated on every disarm when "stats" are enabled. |
This Markdown table is made by MarkdwonTableMaker addon for google spreadsheet. This Markdown table is made by MarkdwonTableMaker addon for google spreadsheet.
Original Spreadsheet used to make this table can be found here https://docs.google.com/spreadsheets/d/1ubjYdMGmZ2aAMUNYkdfe3hhIF7wRfIjcuPOi_ysmp00/edit?usp=sharing Original Spreadsheet used to make this table can be found here https://docs.google.com/spreadsheets/d/1ubjYdMGmZ2aAMUNYkdfe3hhIF7wRfIjcuPOi_ysmp00/edit?usp=sharing

View file

@ -12,6 +12,9 @@
#include "config/parameter_group.h" #include "config/parameter_group.h"
#include "config/parameter_group_ids.h" #include "config/parameter_group_ids.h"
#define MIN_FLIGHT_TIME_TO_RECORD_STATS_S 10 //prevent recording stats for that short "flights" [s]
PG_REGISTER_WITH_RESET_FN(statsConfig_t, statsConfig, PG_STATS_CONFIG, 0); PG_REGISTER_WITH_RESET_FN(statsConfig_t, statsConfig, PG_STATS_CONFIG, 0);
void pgResetFn_statsConfig(statsConfig_t *instance) void pgResetFn_statsConfig(statsConfig_t *instance)
@ -33,9 +36,12 @@ void statsOnArm(void)
void statsOnDisarm(void) void statsOnDisarm(void)
{ {
if (statsConfig()->stats_enabled) { if (statsConfig()->stats_enabled) {
statsConfigMutable()->stats_total_time += (millis() - arm_millis) / 1000; //[s] uint32_t dt = (millis() - arm_millis) / 1000;
statsConfigMutable()->stats_total_dist += (getTotalTravelDistance() - arm_distance_cm) / 100; //[m] if (dt >= MIN_FLIGHT_TIME_TO_RECORD_STATS_S) {
writeEEPROM(); statsConfigMutable()->stats_total_time += dt; //[s]
statsConfigMutable()->stats_total_dist += (getTotalTravelDistance() - arm_distance_cm) / 100; //[m]
writeEEPROM();
}
} }
} }