Skip to content

Commit cad469e

Browse files
authored
Merge pull request #1 from jedie/develop
merge Develop
2 parents d1efefc + 94efa49 commit cad469e

File tree

6 files changed

+234
-160
lines changed

6 files changed

+234
-160
lines changed

src/boot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
esp.osdebug(None) # turn off vendor O/S debugging messages
1515

1616

17+
print('gc.collect()')
1718
gc.collect()
19+
20+
21+
print('boot.py END')

src/main.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import gc
22

33
import utime as time
4+
5+
for no in range(3, 0, -1):
6+
print('%i main.py wait...' % no)
7+
time.sleep(1)
8+
9+
import micropython
10+
11+
micropython.alloc_emergency_exception_buf(128)
12+
413
from leds import power_led
514
from ntp import ntp_sync
615
from watchdog import watchdog
@@ -13,11 +22,6 @@
1322
print('watchdog:', watchdog)
1423

1524

16-
for no in range(3, 0, -1):
17-
print('%i main.py wait...' % no)
18-
time.sleep(1)
19-
20-
2125
print('gc.collect()')
2226
gc.collect()
2327

src/ntp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import utime as time
88
from watchdog import watchdog
99

10+
1011
rtc = machine.RTC()
1112

1213

@@ -37,11 +38,11 @@ def _timer_callback(self, timer):
3738
self.timer.deinit()
3839

3940
def _sync(self):
40-
print('Synchronize time from NTP server ...')
41+
print('Synchronize time from %r ...' % ntptime.host)
4142
gc.collect()
4243
print('old UTC:', rtc.datetime())
44+
s = 1
4345
while True:
44-
s = 1
4546
try:
4647
ntptime.settime()
4748
except Exception as e:

src/watchdog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ def _timer_callback(self, timer):
4040
self.last_refresh = rtc.datetime()
4141
print('diff:', self.last_diff)
4242
if self.last_diff >= self.timeout:
43-
print('Timeout -> reset!')
43+
for no in range(3, 0, -1):
44+
print('Watchdog timeout -> reset in %i sec...' % no)
45+
time.sleep(1)
46+
4447
self.timer.deinit()
4548
machine.reset() # Hard reset
4649
sys.exit() # Soft reset

0 commit comments

Comments
 (0)