machine.sleep(time_in_millis) does time_in_millis has some limit? not works for 6 hours value...
-
Hi there,
can someone please say me, if there any limit for argument passing to machine.deepsleep()? When I pass 600000 ms to the funciton it works just nicely, SiPY sends message every 10 minutes, but when I pass 21600000 which is 6 hours, then my SiPy start to send message every 2 minutes!# 10 min SLEEP_TIME_10M = 600000 # 6 hours SLEEP_TIME_6H = 21600000 .... code .... s.send(str(sensor1.distance_in_cm())) machine.deepsleep(SLEEP_TIME_6H)
Thanks in advance!
-
@jmarcelino
created
https://github.com/pycom/pycom-micropython-sigfox/issues/1
and also pull
https://github.com/pycom/pycom-micropython-sigfox/pull/2
-
@livius
I think the current one is https://github.com/pycom/pycom-micropython-sigfoxYou'll be the very first issue ;-)
-
@jmarcelino
Do you know what repository is now valid?
https://github.com/pycom/pycom-micropython
https://github.com/pycom/pycom-micropython-sigfox
or current merging
https://github.com/pycom/pycom-micropython-censis
-
@livius
You are right of course. I guess someone should file it with github let me know if you want me to do it.You can see the problem with this small C test code:
#include <stdint.h> int in32 = 21600000; void castresult () { uint64_t out64 = 0; out64 = (uint64_t) (in32 * 1000); } void casttime () { uint64_t out64 = 0; out64 = (uint64_t)in32 * 1000; }
Compile with:
xtensa-esp32-elf-gcc -c test.c
then dump the generated Xtensa assembly code:xtensa-esp32-elf-objdump -D test.o
and the difference - and problem - between the two becomes obvious.00000000 <castresult>: 0: 006136 entry a1, 48 3: 017d mov.n a7, a1 5: 000021 l32r a2, fffc0008 <casttime+0xfffbffd8> 8: 000031 l32r a3, fffc0008 <casttime+0xfffbffd8> b: 0729 s32i.n a2, a7, 0 d: 1739 s32i.n a3, a7, 4 f: 000021 l32r a2, fffc0010 <casttime+0xfffbffe0> 12: 0238 l32i.n a3, a2, 0 14: 032d mov.n a2, a3 16: 1122b0 slli a2, a2, 5 19: c02230 sub a2, a2, a3 1c: 1122e0 slli a2, a2, 2 1f: 223a add.n a2, a2, a3 21: 1122d0 slli a2, a2, 3 24: 0729 s32i.n a2, a7, 0 26: 312f20 srai a2, a2, 31 29: 1729 s32i.n a2, a7, 4 2b: f03d nop.n 2d: f01d retw.n ... 00000030 <casttime>: 30: 006136 entry a1, 48 33: 017d mov.n a7, a1 35: 000081 l32r a8, fffc0038 <casttime+0xfffc0008> 38: 000091 l32r a9, fffc0038 <casttime+0xfffc0008> 3b: 0789 s32i.n a8, a7, 0 3d: 1799 s32i.n a9, a7, 4 3f: 000061 l32r a6, fffc0040 <casttime+0xfffc0010> 42: 0668 l32i.n a6, a6, 0 44: 064d mov.n a4, a6 46: 316f60 srai a6, a6, 31 49: 065d mov.n a5, a6 4b: e8a362 movi a6, 0x3e8 4e: 828560 mull a8, a5, a6 51: 060c movi.n a6, 0 53: 826460 mull a6, a4, a6 56: 886a add.n a8, a8, a6 58: e8a362 movi a6, 0x3e8 5b: 829460 mull a9, a4, a6 5e: a23460 muluh a3, a4, a6 61: 092d mov.n a2, a9 63: 483a add.n a4, a8, a3 65: 043d mov.n a3, a4 67: 0729 s32i.n a2, a7, 0 69: 1739 s32i.n a3, a7, 4 6b: 0729 s32i.n a2, a7, 0 6d: 1739 s32i.n a3, a7, 4 6f: f03d nop.n 71: f01d retw.n
-
@josua
I supposed then some range was reached
but i see in source code cast to uint64STATIC mp_obj_t machine_deepsleep (uint n_args, const mp_obj_t *arg) { mperror_enable_heartbeat(false); bt_deinit(NULL); wlan_deinit(NULL); if (n_args == 0) { esp_deep_sleep_start(); } else { esp_deep_sleep((uint64_t)(mp_obj_get_int(arg[0]) * 1000)); } }
i do not known C but
is this ok?
(uint64_t)(mp_obj_get_int(arg[0]) * 1000)
or it should be?
(uint64_t)mp_obj_get_int(arg[0]) * 1000