• _thread vs uasyncio

    MicroPython uasyncio thread
    10
    0 Votes
    10 Posts
    209 Views
    B
    @peterp Note that the 'event.py' which defines a semaphore for asyncio does not load on the latest version, as it depends (for ThreadSafeFlag) on being able to extend uio.IOBase. This base class is not used in the pycom micropython uio port apparently... This is an issue to use asyncio on pycom ports as ThreadSafeFlag is the only way to do a semaphore from an ISR or other _thread task... any ideas?
  • neopixel and threading

    MicroPython thread micropython neopixel ws2812b
    1
    0 Votes
    1 Posts
    100 Views
    No one has replied
  • getaddrinfo in a thread

    GPy thread gettaddrinfo
    7
    0 Votes
    7 Posts
    969 Views
    A
    Just retyped this for the sake of improved readability. You might want to save it as /flash/lib/dnstest.py. import time import usocket import machine import _thread """ >>> import dnstest; dnstest.dns_lookup('google.com') 0 None 1 (2, 1, 0, '', ('172.217.18.14', 443)) 2 (2, 1, 0, '', ('172.217.18.14', 443)) 3 (2, 1, 0, '', ('172.217.18.14', 443)) 4 (2, 1, 0, '', ('172.217.18.14', 443)) """ response = None def run_getaddrinfo(host, port): global response response = usocket.getaddrinfo(host, port)[0] def dns_lookup(hostname, timeout=5): _thread.start_new_thread(run_getaddrinfo, (hostname, 443)) for i in range(timeout): print(i, response) machine.idle() time.sleep(1) print('Ready.') It works flawlessly over a WiFi connection, but LTE might well have its delicacies.
  • Terminating a thread after 5s

    GPy thread timeout
    3
    0 Votes
    3 Posts
    349 Views
    K
    @oligauc Have realised thread locking was not what we were after. What we actually want to do is put getaddrinfo in a thread so that if it the DNS lookup takes forever or fails the main program can move on. Unfortunately, this is not what happens, the main program pauses & waits for the thread. https://forum.pycom.io/topic/5295/getaddrinfo in-a-thread
  • is pycom.rgbled thread safe?

    WiPy 2&3 thread aws mqtt mqtt
    1
    0 Votes
    1 Posts
    314 Views
    No one has replied
  • 0 Votes
    6 Posts
    602 Views
    robert-hhR
    @robi90 I misunderstood your first post, assuming a hard crash. I just tried your example and agree, that this is not good and must be fixed, because the device locks up in an unresponsive state. I tried that with version 1.20.0.rc4. The situation is a little bit better with Ctrl-F, because then the device falls at least back to safe boot, from which it can be restarted with machine.reset(). But only from the USB port. Using telnet is only possible then, if you use the default settings for WiFi.
  • 0 Votes
    3 Posts
    539 Views
    P
    @paul-thornton Thanks for the response and information to this important thread. Just to let you know, the blocking and unstable lte.init()/deinit() behavior is forcing me to consider totally switching platforms, and abandoning Pycom. I am running the newest modem firmware.
  • LoRa Thread expectations

    LoPy lora thread mesh network low power
    1
    0 Votes
    1 Posts
    442 Views
    No one has replied
  • 0 Votes
    2 Posts
    755 Views
    J
    I have the same problem using this library or simple mqtt in another thread with version (1.18/1.19 Pybytes) rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff8028,len:8 load:0x3fff8030,len:1984 load:0x4009fa00,len:0 load:0x4009fa00,len:19112 entry 0x400a05e4 Initializing filesystem as FatFS! Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed) Core 0 register dump: PC : 0x401f27e8 PS : 0x00060c34 A0 : 0x8005582c A1 : 0x3ffc0970 A2 : 0x00000000 A3 : 0x00000001 A4 : 0x800995d1 A5 : 0x3ffea5f0 A6 : 0x0000b030 A7 : 0x3ffea6a4 A8 : 0x8008cc86 A9 : 0x01000000 A10 : 0x07040000 A11 : 0x00000000 A12 : 0x00000013 A13 : 0x00000000 A14 : 0x3ffae270 A15 : 0x00000000 SAR : 0x0000000e EXCCAUSE: 0x00000007 EXCVADDR: 0x00000000 LBEG : 0x40099276 LEND : 0x40099285 LCOUNT : 0x00000000 Core 0 was running in ISR context: EPC1 : 0x40092e5f EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x401f27e8 with the old version (1.17.3.b1 or 1.18.0) the error was different but there was. Connecting to MQTT broker.... 1 2 3 4 ***ERROR*** A stack overflow in task MPThread has been detected. abort() was called at PC 0x4008e66c on core 1 the mqtt library is: https://github.com/yutter/micropython-mqtt Furthermore after updating to the 1.18.0 or 1.19.4.b4 to try to understand if the problem related to the threads and mqtt had been solved I had another problem, I can not load some files ... example of what happens that did not happen before; I added the size of the files in which I have problems Reading file status Failed to read project status, uploading all files Creating dir lib Creating dir www Creating dir www/bootstrap Creating dir www/bootstrap/css Creating dir www/bootstrap/fonts Creating dir www/bootstrap/js Creating dir www/js [1/18] Writing file SI7006A20.py [2/18] Writing file boot.py [3/18] Writing file hal.py [4/18] Writing file lib/mqttserver.pub.pem [5/18] Writing file main.py [6/18] Writing file mqtt.py [7/18] Writing file umqtt.py [8/18] Writing file www/bootstrap/css/bootstrap.min.css "filesize (121.3kb)" Failed to write file, trying again... Failed to write file, trying again... Filecheck failed [9/18] Writing file www/bootstrap/js/bootstrap.min.js "filesize (36.9kb)" Failed to write file, trying again... [10/18] Writing file www/index.html [11/18] Writing file www/js/angular.min.js "filesize (99.0kb)" Failed to write file, trying again... Failed to write file, trying again... Filecheck failed [12/18] Writing file www/js/app.js [13/18] Writing file www/js/jquery-1.11.1.js "filesize (282.8kb)" Failed to write file, trying again... Failed to write file, trying again... Filecheck failed [14/18] Writing file xApp.py Failed to write file, trying again... [15/18] Writing file xConfigureFile.py [16/18] Writing file xHTTPConfigure.py [17/18] Writing file xWebServer.py [18/18] Writing file xWebSocket.py why? waiting for a quick reply best regards Giacomo
  • Errors using _thread, why?

    LoPy lopy thread
    4
    2
    0 Votes
    4 Posts
    1k Views
    Z
    @jmarcelino https://forum.pycom.io/topic/2431/lopy-with-pytrack-how-connect-use-gps The same thing happens to me, but indicating another error that already happened to me with the first Lopy. Right now they are other Lopy but theoretically updated with the software: [image: 1525354381246-captura-de-pantalla-2018-05-03-15.32.33-resized.png] But now I get this error: [image: 1525354487444-captura-de-pantalla-2018-05-03-15.34.38.png] I have tried all the ways I've seen of how to update the Lopy board or the expansion Board 2.0. If I try to update the expansion board as I did in its day, it does not detect it anymore: [image: 1525354677371-39b2c6d3-3f17-438f-8d3b-e419a0dc5c88-image-resized.png] Captura de pantalla 2018-05-03 15.37.08 and if I do the lopy update for the official software it says 'done' but it still does not work ... Does anyone know what's going on? [image: 1525356197626-captura-de-pantalla-2018-05-03-15.42.03-resized.png] [image: 1525356215594-captura-de-pantalla-2018-05-03-16.02.42.png] Another curious fact is that I put the program file main.py or boot.py with the program that I have set does not work. but sometimes that other without jumping the error that I just porner up sometimes runs it well from Atom ...? I sincerely believe I have tried all the ways to update the Lopy and supposedly the expansion board is updated. Therefore, I do not know what is failing. If someone can tell me what would be the process of update contract both the expansion board and the Lopy on Mac or Windows I do not care. But to verify that it can happen. regards.
  • 0 Votes
    9 Posts
    2k Views
    G
    @seb said in threading - thread starts, but main does not run: https://github.com/pycom/pycom-libraries/issues Ta. Opened; https://github.com/pycom/pycom-micropython-sigfox/issues/158
  • 0 Votes
    4 Posts
    2k Views
    T
    Functions and methods are actually different things and exist in different scopes. You can't look up a method by name without the self. (or similiar) prefix. Unless you bind it to another name in the current scope. The same applies to class methods.
  • Two LoRa Socket

    LoPy lora socket thread pymakr python
    7
    0 Votes
    7 Posts
    1k Views
    T
    @ahelllycan I think we would need to see code, or general overview of your process. At the moment we are guessing. But @jcaron is right. You should have a call back on message receive and you choose when to send messages based on other criteria. The rest of the time you will be sleeping or waiting.
  • ImportError: no module named 'threading'

    LoPy lopy thread threading
    3
    0 Votes
    3 Posts
    3k Views
    sebS
    try _thread
  • How do I exit a thread?

    Getting Started thread
    10
    1 Votes
    10 Posts
    7k Views
    P
    Thanks for the clarification.
  • Pytrack GPS example

    Getting Started pytrack gps thread
    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    1 Posts
    857 Views
    No one has replied
  • 0 Votes
    6 Posts
    2k Views
    A
    UP Anybody got a clue?
  • Threads are not daemon

    Issues & Bugs thread daemon
    2
    1
    1 Votes
    2 Posts
    1k Views
    guyG
    Short of doing a reset, I don't see any way to avoid this scenario currently. I'm not at the point of being able to update my device remotely yet, but warning lights are already flashing in my brain over this becoming an issue.
  • 1 Votes
    9 Posts
    3k Views
    A
    @Ralph It seems there's a new bug. (almost) Every time I click the "Sync" button all the files get uploaded. Also I notice something that looks like a piece of checksum being printed like this: >>> Syncing project (main folder)... >>> >>> [1/12] Writing file communication.py c8474829a403c5fefb5e339b"]] [2/12] Writing file config.py [3/12] Writing file globals.py [...etc...] [12/12] Writing file utils.py Synchronizing done, resetting board... EDIT: Also, "Run" command on a file doesn't update the file on the flash, resulting in a strange behaviour if the current file is also present in the flash. Editing the script and running it seems to use the classes from the file on the flash memory, and the "top level" instructions from the editor file :/ EDIT2: Now the "Sync" end with an error. I rebooted the board, the PC and updated the firmware.... >>> Syncing project (main folder)...   >>> >>> [1/13] Writing file communication.py [2/13] Writing file config.py Synchronizing failed: Write failed. Please reboot your device manually.    EDIT3: Fixed with the new release