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:
parent
46b2ded1a7
commit
670282e0a1
2 changed files with 12 additions and 3 deletions
|
@ -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_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] |
|
||||
| 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.
|
||||
Original Spreadsheet used to make this table can be found here https://docs.google.com/spreadsheets/d/1ubjYdMGmZ2aAMUNYkdfe3hhIF7wRfIjcuPOi_ysmp00/edit?usp=sharing
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
#include "config/parameter_group.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);
|
||||
|
||||
void pgResetFn_statsConfig(statsConfig_t *instance)
|
||||
|
@ -33,10 +36,13 @@ void statsOnArm(void)
|
|||
void statsOnDisarm(void)
|
||||
{
|
||||
if (statsConfig()->stats_enabled) {
|
||||
statsConfigMutable()->stats_total_time += (millis() - arm_millis) / 1000; //[s]
|
||||
uint32_t dt = (millis() - arm_millis) / 1000;
|
||||
if (dt >= MIN_FLIGHT_TIME_TO_RECORD_STATS_S) {
|
||||
statsConfigMutable()->stats_total_time += dt; //[s]
|
||||
statsConfigMutable()->stats_total_dist += (getTotalTravelDistance() - arm_distance_cm) / 100; //[m]
|
||||
writeEEPROM();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue