VirtualWatchdog: fix missing kick and init check in process

Also syntax error for ticker definitions.
pull/11023/head
Martin Kojtal 2019-06-28 12:37:16 +01:00
parent 90033869d9
commit c4eeb5ecbd
1 changed files with 10 additions and 6 deletions

View File

@ -25,9 +25,9 @@
namespace mbed { namespace mbed {
#if DEVICE_LPTICKER #if DEVICE_LPTICKER
SingletonPtr<LowPowerTicker> _ticker; SingletonPtr<LowPowerTicker> VirtualWatchdog::_ticker;
#else #else
SingletonPtr<Ticker> _ticker; SingletonPtr<Ticker> VirtualWatchdog::_ticker;
#endif #endif
VirtualWatchdog *VirtualWatchdog::_first = NULL; VirtualWatchdog *VirtualWatchdog::_first = NULL;
@ -121,12 +121,16 @@ void VirtualWatchdog::remove_from_list()
void VirtualWatchdog::process() void VirtualWatchdog::process()
{ {
Watchdog::get_instance().kick();
VirtualWatchdog *cur_ptr = _first; VirtualWatchdog *cur_ptr = _first;
while (cur_ptr != NULL) { while (cur_ptr != NULL) {
if (cur_ptr->_current_count > cur_ptr->_timeout) { if (cur_ptr->_is_initialized) {
system_reset(); if (cur_ptr->_current_count > cur_ptr->_timeout) {
} else { system_reset();
cur_ptr->_current_count += US_TO_MS(_ticker_timeout); } else {
cur_ptr->_current_count += US_TO_MS(_ticker_timeout);
}
} }
cur_ptr = cur_ptr->_next; cur_ptr = cur_ptr->_next;
} }