AP_Periph: node stats
- Added new config parameter object - STAT - init and update statistics
This commit is contained in:
parent
183352cdfe
commit
80e2533cf0
@ -142,6 +142,10 @@ void AP_Periph_FW::init()
|
|||||||
printf("Reboot after watchdog reset\n");
|
printf("Reboot after watchdog reset\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if AP_STATS_ENABLED
|
||||||
|
node_stats.init();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAL_PERIPH_ENABLE_GPS
|
#ifdef HAL_PERIPH_ENABLE_GPS
|
||||||
if (gps.get_type(0) != AP_GPS::GPS_Type::GPS_TYPE_NONE && g.gps_port >= 0) {
|
if (gps.get_type(0) != AP_GPS::GPS_Type::GPS_TYPE_NONE && g.gps_port >= 0) {
|
||||||
serial_manager.set_protocol_and_baud(g.gps_port, AP_SerialManager::SerialProtocol_GPS, AP_SERIALMANAGER_GPS_BAUD);
|
serial_manager.set_protocol_and_baud(g.gps_port, AP_SerialManager::SerialProtocol_GPS, AP_SERIALMANAGER_GPS_BAUD);
|
||||||
@ -331,6 +335,10 @@ void AP_Periph_FW::show_stack_free()
|
|||||||
|
|
||||||
void AP_Periph_FW::update()
|
void AP_Periph_FW::update()
|
||||||
{
|
{
|
||||||
|
#if AP_STATS_ENABLED
|
||||||
|
node_stats.update();
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint32_t last_led_ms;
|
static uint32_t last_led_ms;
|
||||||
uint32_t now = AP_HAL::native_millis();
|
uint32_t now = AP_HAL::native_millis();
|
||||||
if (now - last_led_ms > 1000) {
|
if (now - last_led_ms > 1000) {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <AP_CANManager/AP_CANManager.h>
|
#include <AP_CANManager/AP_CANManager.h>
|
||||||
#include <AP_Scripting/AP_Scripting.h>
|
#include <AP_Scripting/AP_Scripting.h>
|
||||||
#include <AP_HAL/CANIface.h>
|
#include <AP_HAL/CANIface.h>
|
||||||
|
#include <AP_Stats/AP_Stats.h>
|
||||||
|
|
||||||
#if HAL_GCS_ENABLED
|
#if HAL_GCS_ENABLED
|
||||||
#include "GCS_MAVLink.h"
|
#include "GCS_MAVLink.h"
|
||||||
@ -103,6 +104,10 @@ public:
|
|||||||
|
|
||||||
AP_SerialManager serial_manager;
|
AP_SerialManager serial_manager;
|
||||||
|
|
||||||
|
#if AP_STATS_ENABLED
|
||||||
|
AP_Stats node_stats;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAL_PERIPH_ENABLE_GPS
|
#ifdef HAL_PERIPH_ENABLE_GPS
|
||||||
AP_GPS gps;
|
AP_GPS gps;
|
||||||
#if HAL_NUM_CAN_IFACES >= 2
|
#if HAL_NUM_CAN_IFACES >= 2
|
||||||
|
@ -403,6 +403,12 @@ const AP_Param::Info AP_Periph_FW::var_info[] = {
|
|||||||
GOBJECT(scripting, "SCR_", AP_Scripting),
|
GOBJECT(scripting, "SCR_", AP_Scripting),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if AP_STATS_ENABLED
|
||||||
|
// @Group: Node
|
||||||
|
// @Path: ../libraries/AP_Stats/AP_Stats.cpp
|
||||||
|
GOBJECT(node_stats, "STAT", AP_Stats),
|
||||||
|
#endif
|
||||||
|
|
||||||
AP_VAREND
|
AP_VAREND
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
k_param_can_fdmode,
|
k_param_can_fdmode,
|
||||||
k_param_can_fdbaudrate0,
|
k_param_can_fdbaudrate0,
|
||||||
k_param_can_fdbaudrate1,
|
k_param_can_fdbaudrate1,
|
||||||
|
k_param_node_stats,
|
||||||
};
|
};
|
||||||
|
|
||||||
AP_Int16 format_version;
|
AP_Int16 format_version;
|
||||||
|
Loading…
Reference in New Issue
Block a user