Uavcan Node Pets the watchdog

This commit is contained in:
David Sidrane 2021-01-29 07:01:14 -08:00 committed by Daniel Agar
parent ef29ed7db3
commit da67537291
2 changed files with 11 additions and 0 deletions

View File

@ -134,6 +134,7 @@ px4_add_module(
UavcanNodeParamManager.hpp
UavcanNodeParamManager.cpp
DEPENDS
arch_watchdog_iwdg
px4_uavcan_dsdlc
drivers_bootloaders

View File

@ -35,6 +35,7 @@
#include "boot_app_shared.h"
#include <drivers/drv_watchdog.h>
#include <lib/ecl/geo/geo.h>
#include <lib/version/version.h>
@ -145,6 +146,7 @@ int UavcanNode::getHardwareVersion(uavcan::protocol::HardwareVersion &hwver)
int UavcanNode::start(uavcan::NodeID node_id, uint32_t bitrate)
{
if (_instance != nullptr) {
PX4_WARN("Already started");
return -1;
@ -232,6 +234,7 @@ void UavcanNode::busevent_signal_trampoline()
static void cb_reboot(const uavcan::TimerEvent &)
{
watchdog_pet();
board_reset(0);
}
@ -310,6 +313,10 @@ void UavcanNode::Run()
{
pthread_mutex_lock(&_node_mutex);
// Bootloader started it.
watchdog_pet();
if (!_initialized) {
get_node().setRestartRequestHandler(&restart_request_handler);
@ -434,6 +441,9 @@ extern "C" int uavcannode_start(int argc, char *argv[])
{
//board_app_initialize(nullptr);
// Sarted byt the bootloader, we must pet it
watchdog_pet();
// CAN bitrate
int32_t bitrate = 0;