pymakr plugin with multiple devices



  • Using the pymakr plugin for Atom here, on Linux. Have just got my second lopy and have been trying to figure out a convenient workflow that lets me hack on different projects for both devices concurrently.

    I'm trying to figure out how the content of pymakr.conf in those two projects can help me out, as obviously its not appropriate to constantly edit the global settings for the plugin to modify the device address info.

    As it happens, I connect to one device via IP, and the other via USB UART console. I have set the device addresses in their project's respective pymakr.conf files accordingly, but nothing seems to respect that configuration. What is it actually for?

    With respect to the global settings, the name certainly matches the behavior, but it is very clunky to keep editing them and using this approach does present a high risk of inadvertently programming the wrong device.

    Has anyone got any tips for me, please?



  • Alternatively I've let my modules connect in STA mode to the existing office net. Just need to determine their assigned ip address (... print(wlan.ifconfig()[0]).

    After modifying <user>.atom\packages\pymakr\lib\config.js around line 60 and following as shown below (add those additional ip addresses), I restarted my Atom IDE and now I can connect to my modules at their WiFi ip enjoying the REPL console: the additional addresses show up under 'Connect Device'.

      static settings() {
        return {
          address: {
            type: "array",
            items: {
              type: "string"
            },
            default: ["192.168.4.1", "192.168.3.207"],
            title: "Device addresses (list)",
    
    

    ![alt text](0a71a7b2-eae4-4a89-95cd-d9c51a99d677-image.png image url)



  • I have the same challenge: working with multiple LoPy modules, having not enough expansion boards. So I need to connect to them via WiFi. For this purpose I program one of the modules to AP mode, the others to STA mode with the following code.

    from binascii import hexlify, unhexlify
    from machine import unique_id, idle
    from network import WLAN
    
    ModuleIdent = os.uname()[1].lower()[0:4] + '_' + str(hexlify(unique_id()))[8:14]
    # equals something like 'lopy_123456'
    
    wlan = WLAN()
    if ModuleIdent == 'lopy_0e09a0':
        wlan.init(mode=WLAN.AP, ssid='Pycom_dev')
        # this module will default to 192.168.4.1
    elif ModuleIdent == 'lopy_0e1b14':
        # go for fixed IP settings (IP, Subnet, Gateway, DNS)
        wlan.init(mode=WLAN.STA)
        wlan.ifconfig(config=('192.168.4.2', '255.255.255.0', '192.168.4.1', '192.168.4.1'))
        wlan.connect(ssid='Pycom_dev')
        while not wlan.isconnected():
            idle()
        print('  WLAN connection succeeded.')
    

    Then connect my laptop to the development wlan. Now I can use WinSCP or similar FTP clients to move files to the different modules (default usr: micro, pwd: python). Note: The modules do not support all the ftp features/commands, but copying files is supported. Added convenience: you can transfer single files.

    The main dev module I still keep connected via COM interface for ease of development out of Atom + PYMAKR.



  • Still would love a solution for this.



  • Any one found a way to do this?
    Here's my fix for this on VS Code after having the same problem

    • Create new window for each individual project.
    • On the individual pymaker.conf of each device change the address to the associated COM port

    Example:
    On the first device:

    "address": "COM4",
    

    On the second device:

    "address": "COM3",
    

    alt text



  • @John-Baird @Martinnn the feature that might help you both is 'autoconnect'. If enabled (in global settings), Pymakr connects to any board you plug in to the usb within 2 seconds. If you plugin multiple boards, it connects to the first one in the ports list.

    The feature @John-Baird is suggesting is also a good thing we could implement, to have a list with addresses to connect to. Autoconnect doesn't work ideal if you have multiple boards connected over USB, or if you connect over wifi and have a list of IP's from your devices. It's definitely on the tasklist to look at.



  • Hey.

    One workaround would be to use multiple "projects" or folders. and a per project config file with a different connection string in each.

    On Atom you need to click the ^ button on the Pymakr pane, then click Project Settings.
    On Visual Studio Code you need to click the All commands button on the bottom of the windows, then click Pymakr > Project Settings.

    This creates a file called pymakr.conf inside your project and populates it with default settings copied over from your global settings.

    Those Project settings will override anything in Global Settings.



  • @john-baird Same here. What doesn't really help is that com port number also switch constantly.



  • This post is quite old but still relevant...

    I'm working on a project that's deployed to half a dozen devices at the moment, so I'm constantly switching devices, forgetting serial port IDs and network addresses - it's a pain. Anyone out there developed a solution, either a tool or a workflow?

    What would be great would be to have the conf file support "address1" "address2", address3", etc... with a dropdown menu that allows you to select which address you want to have active.



  • No solution either, but am interested too in this kind of development setup.


Log in to reply
 

Pycom on Twitter