silently return when watchdog isn't active
This commit is contained in:
parent
11cf031284
commit
8964228ed5
|
@ -184,12 +184,12 @@ msgstr ""
|
|||
msgid "%q must be <= %d"
|
||||
msgstr ""
|
||||
|
||||
#: py/argcheck.c
|
||||
msgid "%q must be >= %d"
|
||||
#: ports/espressif/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "%q must be <= %u"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/analogbufio/BufferedIn.c
|
||||
msgid "%q must be array of type 'H'"
|
||||
#: py/argcheck.c
|
||||
msgid "%q must be >= %d"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/analogbufio/BufferedIn.c
|
||||
|
@ -200,6 +200,10 @@ msgstr ""
|
|||
msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/analogbufio/BufferedIn.c
|
||||
msgid "%q must be array of type 'H'"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c
|
||||
#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c
|
||||
msgid "%q must be of type %q or %q, not %q"
|
||||
|
@ -1154,10 +1158,6 @@ msgstr ""
|
|||
msgid "Initial set pin state conflicts with initial out pin state"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "Initialization failed due to lack of memory"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitops/__init__.c
|
||||
#, c-format
|
||||
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
|
||||
|
@ -1229,7 +1229,8 @@ msgstr ""
|
|||
msgid "Interrupt error."
|
||||
msgstr ""
|
||||
|
||||
#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c
|
||||
#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c
|
||||
#: shared-bindings/digitalio/DigitalInOut.c
|
||||
#: shared-bindings/displayio/EPaperDisplay.c
|
||||
msgid "Invalid %q"
|
||||
msgstr ""
|
||||
|
@ -1523,10 +1524,6 @@ msgstr ""
|
|||
msgid "No in or out in program"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/aesio/aes.c
|
||||
msgid "No key was specified"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/time/__init__.c
|
||||
msgid "No long integer support"
|
||||
msgstr ""
|
||||
|
@ -1822,11 +1819,6 @@ msgstr ""
|
|||
msgid "Pull not used when direction is output."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "RAISE mode is not implemented"
|
||||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/countio/Counter.c
|
||||
msgid "RISE_AND_FALL not available on this chip"
|
||||
msgstr ""
|
||||
|
@ -2350,20 +2342,10 @@ msgstr ""
|
|||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/nrf/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/watchdog/WatchDogTimer.c
|
||||
msgid "WatchDogTimer is not currently running"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/watchdog/WatchDogTimer.c
|
||||
msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinhelp.c
|
||||
#, c-format
|
||||
msgid ""
|
||||
|
@ -3044,8 +3026,8 @@ msgid "extra positional arguments given"
|
|||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
|
||||
#: shared-bindings/displayio/OnDiskBitmap.c shared-bindings/synthio/__init__.c
|
||||
#: shared-module/gifio/GifWriter.c
|
||||
#: shared-bindings/displayio/OnDiskBitmap.c shared-bindings/gifio/OnDiskGif.c
|
||||
#: shared-bindings/synthio/__init__.c shared-module/gifio/GifWriter.c
|
||||
msgid "file must be a file opened in byte mode"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4087,10 +4069,7 @@ msgstr ""
|
|||
msgid "syntax error in uctypes descriptor"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/espressif/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/nrf/common-hal/watchdog/WatchDogTimer.c
|
||||
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "timeout duration exceeded the maximum supported value"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4291,10 +4270,6 @@ msgstr ""
|
|||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "watchdog not initialized"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/is31fl3741/FrameBuffer.c
|
||||
msgid "width must be greater than zero"
|
||||
msgstr ""
|
||||
|
|
|
@ -100,7 +100,7 @@ void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self, mp_floa
|
|||
}
|
||||
|
||||
if ((uint64_t)new_timeout > UINT32_MAX) {
|
||||
mp_raise_ValueError_varg(translate("%q must be <= %d"), MP_QSTR_timeout, UINT32_MAX);
|
||||
mp_raise_ValueError_varg(translate("%q must be <= %u"), MP_QSTR_timeout, UINT32_MAX);
|
||||
}
|
||||
self->timeout = new_timeout;
|
||||
|
||||
|
|
|
@ -50,22 +50,18 @@
|
|||
//|
|
||||
|
||||
//| def __init__(self) -> None:
|
||||
//| """Not currently dynamically supported. Access the sole instance through `microcontroller.watchdog`."""
|
||||
//| """Access the sole instance through `microcontroller.watchdog`."""
|
||||
//| ...
|
||||
|
||||
//| def feed(self) -> None:
|
||||
//| """Feed the watchdog timer. This must be called regularly, otherwise
|
||||
//| the timer will expire."""
|
||||
//| the timer will expire. Silently does nothing if the watchdog isn't active."""
|
||||
//| ...
|
||||
STATIC mp_obj_t watchdog_watchdogtimer_feed(mp_obj_t self_in) {
|
||||
watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
watchdog_watchdogmode_t current_mode = common_hal_watchdog_get_mode(self);
|
||||
|
||||
if (current_mode == WATCHDOGMODE_NONE) {
|
||||
mp_raise_ValueError(translate("WatchDogTimer is not currently running"));
|
||||
if (common_hal_watchdog_get_mode(self) != WATCHDOGMODE_NONE) {
|
||||
common_hal_watchdog_feed(self);
|
||||
}
|
||||
|
||||
common_hal_watchdog_feed(self);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watchdogtimer_feed);
|
||||
|
@ -89,7 +85,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_deinit_obj, watchdog_wat
|
|||
|
||||
//| timeout: float
|
||||
//| """The maximum number of seconds that can elapse between calls
|
||||
//| to feed()"""
|
||||
//| to `feed()`"""
|
||||
STATIC mp_obj_t watchdog_watchdogtimer_obj_get_timeout(mp_obj_t self_in) {
|
||||
watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
return mp_obj_new_float(common_hal_watchdog_get_timeout(self));
|
||||
|
@ -114,17 +110,16 @@ MP_PROPERTY_GETSET(watchdog_watchdogtimer_timeout_obj,
|
|||
//| mode: WatchDogMode
|
||||
//| """The current operating mode of the WatchDogTimer `watchdog.WatchDogMode`.
|
||||
//|
|
||||
//| Setting a WatchDogMode activates the WatchDog::
|
||||
//| Setting a `WatchDogMode` activates the WatchDog::
|
||||
//|
|
||||
//| import microcontroller
|
||||
//| import watchdog
|
||||
//| from microcontroller import watchdog as w
|
||||
//| from watchdog import WatchDogMode
|
||||
//|
|
||||
//| w = microcontroller.watchdog
|
||||
//| w.timeout = 5
|
||||
//| w.mode = watchdog.WatchDogMode.RAISE
|
||||
//| w.mode = WatchDogMode.RESET
|
||||
//|
|
||||
//|
|
||||
//| Once set, the WatchDogTimer will perform the specified action if the timer expires."""
|
||||
//| Once set, the `WatchDogTimer` will perform the specified action if the timer expires."""
|
||||
//|
|
||||
STATIC mp_obj_t watchdog_watchdogtimer_obj_get_mode(mp_obj_t self_in) {
|
||||
watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
|
Loading…
Reference in New Issue