Skip to content

Commit 50df953

Browse files
committed
ports/esp32/machine_wdt.c: micropython#98 (comment)
ports/esp8266/machine_wdt.c: micropython#98 (comment)
1 parent 2af2b4c commit 50df953

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

ports/esp32/machine_wdt.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* The MIT License (MIT)
55
*
66
* Copyright (c) 2016 Paul Sokolovsky
7+
* Copyright (c) 2017 Eric Poulsen
78
*
89
* Permission is hereby granted, free of charge, to any person obtaining a copy
910
* of this software and associated documentation files (the "Software"), to deal
@@ -49,10 +50,11 @@ STATIC mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type_in, size_t n_args
4950
}
5051

5152
switch (id) {
52-
case 0:
53-
return &wdt_default;
54-
default:
55-
mp_raise_ValueError("");
53+
case 0:
54+
esp_task_wdt_feed();
55+
return &wdt_default;
56+
default:
57+
mp_raise_ValueError("");
5658
}
5759
}
5860

@@ -63,16 +65,9 @@ STATIC mp_obj_t machine_wdt_feed(mp_obj_t self_in) {
6365
}
6466
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_wdt_feed_obj, machine_wdt_feed);
6567

66-
STATIC mp_obj_t machine_wdt_deinit(mp_obj_t self_in) {
67-
(void)self_in;
68-
esp_task_wdt_delete();
69-
return mp_const_none;
70-
}
71-
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_wdt_deinit_obj, machine_wdt_deinit);
7268

7369
STATIC const mp_map_elem_t machine_wdt_locals_dict_table[] = {
7470
{ MP_OBJ_NEW_QSTR(MP_QSTR_feed), (mp_obj_t)&machine_wdt_feed_obj },
75-
{ MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&machine_wdt_deinit_obj },
7671
};
7772
STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
7873

ports/esp8266/machine_wdt.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* The MIT License (MIT)
55
*
66
* Copyright (c) 2016 Paul Sokolovsky
7+
* Copyright (c) 2017 Eric Poulsen
78
*
89
* Permission is hereby granted, free of charge, to any person obtaining a copy
910
* of this software and associated documentation files (the "Software"), to deal
@@ -51,6 +52,7 @@ STATIC mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type_in, size_t n_args
5152

5253
switch (id) {
5354
case 0:
55+
system_soft_wdt_feed();
5456
return &wdt_default;
5557
default:
5658
mp_raise_ValueError("");
@@ -64,16 +66,8 @@ STATIC mp_obj_t machine_wdt_feed(mp_obj_t self_in) {
6466
}
6567
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_wdt_feed_obj, machine_wdt_feed);
6668

67-
STATIC mp_obj_t machine_wdt_deinit(mp_obj_t self_in) {
68-
(void)self_in;
69-
ets_wdt_disable();
70-
return mp_const_none;
71-
}
72-
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_wdt_deinit_obj, machine_wdt_deinit);
73-
7469
STATIC const mp_rom_map_elem_t machine_wdt_locals_dict_table[] = {
7570
{ MP_ROM_QSTR(MP_QSTR_feed), MP_ROM_PTR(&machine_wdt_feed_obj) },
76-
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_wdt_deinit_obj) },
7771
};
7872
STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
7973

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy