Search found 393 matches

by kevinkk525
Tue May 28, 2019 6:14 pm
Forum: ESP32 boards
Topic: Does ESP32 restart automatically after an exception is thrown like ESP8266?
Replies: 1
Views: 164

Re: Does ESP32 restart automatically after an exception is thrown like ESP8266?

None of these devices restarts when an exception is thrown. You have to implement that yourself:

Code: Select all

import machine

try:
    your_code()
except Exception as e:
    # do something with the exception, or not
    machine.reset()
by kevinkk525
Tue May 28, 2019 1:47 pm
Forum: ESP8266 boards
Topic: How to switch on a electric bulb with ESP8266 board?
Replies: 50
Views: 1315

Re: How to switch on a electric bulb with ESP8266 board?

time.sleep( for 1 hour)
is certainly not right :D
by kevinkk525
Wed May 22, 2019 4:22 pm
Forum: ESP8266 boards
Topic: How to switch on a electric bulb with ESP8266 board?
Replies: 50
Views: 1315

Re: How to switch on a electric bulb with ESP8266 board?

RajaRamesh wrote:
Wed May 22, 2019 4:06 pm
is it possible for esp8266 to communicate with high power ....meaning 3-phase power supply 415v for heavy loads. if yes what kind of relays we can use.
If you find the right relay, it surely can. But I don't know about that kind of relay. I only bought ones for 230V
by kevinkk525
Tue May 21, 2019 11:28 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 757

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

That could be tricky. If for example in an interrupt occurs which calls 'ets_loop_iter', in the middle of 'mp_hal_ticks_ms', then 'system_time_high_word' may be incremented 2 times. I think you should protect the code with ets_intr_lock();/ets_intr_unlock(); just as in 'ets_loop_iter'. Or 'mp_hal_t...
by kevinkk525
Tue May 21, 2019 10:25 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 757

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

The micropython test revealed the offset (same as Roberthh's finding): >>> while True: ... gc.collect() ... t=time.ticks_ms() ... if time.ticks_us()<20: ... print("us overflow") ... time.sleep_us(20) ... delta = time.ticks_diff(time.ticks_ms(), t) ... if delta < 0 or delta >5: ... print("Fail time i...
by kevinkk525
Tue May 21, 2019 9:12 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 757

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

jomas wrote:
Tue May 21, 2019 9:04 am
MICROPY_PY_UTIME_TICKS_PERIOD = 2^30.
So MICROPY_PY_UTIME_TICKS_PERIOD-1 is used as a mask of 30bits (0b111111111111111111111111111111)
Ah thanks. This however gives exactly the same result.
by kevinkk525
Tue May 21, 2019 8:56 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 757

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

I tried to run some tests on my arduino: uint32_t system_time_high_word=0; uint32_t current_time = 4294967295; //just before overflow uint32_t MICROPY_PY_UTIME_TICKS_PERIOD =0; uint32_t system_get_time(void) { return current_time; } uint32_t mp_hal_ticks_ms(void) { return ((uint64_t)system_time_high...
by kevinkk525
Tue May 21, 2019 6:46 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 757

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

I had an event with @pythoncoder's simple test code this night. I used the settings for COUNT, MAX, MIN = 10000, 38, 34. There was a fail with a time gap of 4295005 ms, which is 1h 11m 35s 5 ms, or about 2^32 µs. A single pass runs ~35ms, which is the deviation to 2^32. Thank you @Roberthh for test...
by kevinkk525
Mon May 20, 2019 10:09 pm
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 757

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

No, your assumption is right. The whole uasyncio is blocking for 1h 11 minutes, not only one coroutine. I tested this when I first discovered the problem by running multiple testing codes (publishing sensor values and logging if there's a too big delay between executions in another coroutine) and al...
by kevinkk525
Mon May 20, 2019 9:17 pm
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 757

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

I thought I understand the implications but had to edit my post because I had thought it wrong. In uasyncio core.py in method run(): [...] if not self.runq: delay = -1 if self.waitq: tnow = self.time() t = self.waitq.peektime() delay = time.ticks_diff(t, tnow) if delay < 0: delay = 0 self.wait(delay...