sg-wireless / pymakr-atom

Adds a REPL console to Atom that connects to your Pycom board. It can run code on the board or synchronize your project files.
Other
35 stars 11 forks source link

Sync only works once #13

Closed danieleparazza closed 7 years ago

danieleparazza commented 7 years ago

I updated my Atom plugin and my LoPy firmware to the lastest versions. The project sync command works only the "first time", then the sync process hangs forever like this:

Syncing project (main folder)...

>>>
>>>

Then I need to reset the board, restart Atom and format the flash memory to make the sync work again (for just one time!!) my project actually contains 15 files, 60kb total.

RalphHogenbirk commented 7 years ago

It's possible that your project is using a significant amount of ram, leaving not enough for the sync feature to work properly (resulting in an error on the board). Can you put your board in safe mode before you sync and see if that works?

In any case, error handling in this situation has to be improved on the plugin side.

danieleparazza commented 7 years ago

Nope, my main.py does nothing. If I power cycle the board, free ram is 64752 and sync does not work. If i press the reset button on the LoPy while the sync is stuck, I see [1/15] writing file (etc)...

RalphHogenbirk commented 7 years ago

Thanks for the information. For debugging, you could keep a seperate telnet connection open to the board (using iterm or so) during sync and see if you get any errors or useful information back (assuming you are syncing over serial).

If you have the time, you could also enable logging (set 'logging_level' to 0 in ~/.atom/packages/pymakr/lib/config.js), restart pymakr, open the console (cmd-opt-i) and copy the console output during sync here.

danieleparazza commented 7 years ago

I have this errors just opening Atom

file:///C:/Users/danie/AppData/Local/atom/app-1.16.0/resources/app.asar/static/xterm.css Failed to load resource: net::ERR_FILE_NOT_FOUND
C:\Users\danie\AppData\Local\atom\app-1.16.0\resources\app.asar\src\task.js:46 spell-check:en-us Can't load en_US: Cannot find dictionary for en_US.

And that's the output of the "sync" button:

[silly] Pyboard | Received message: 
>>> 
>>> 
logger.js:23 [silly] Pyboard | Received message: 
raw REPL; CTRL-B to exit
>
pymakr-view.js:122 Status: 3
pymakr-view.js:124 Writing extra line
logger.js:23 [silly] Pyboard | Received message: OK
logger.js:23 [info] Sync | Reading pymakr file
logger.js:23 [silly] Pyboard | Received message: 
[silly] Pyboard | Received message: [["communication.py","f","ff21b18f70b6f39b31cbeb3c9c80247f39c96b82ca007d63da45ed52ad2637b7"],["config.py","f","08f1423ad0de001d4f1f367f97b355ccce77337bc8f5d2ec5fbc428250d747a4"],["etsdn.py","f","53b1f48652f9db89c1ebed3cc5b58ec08216f815633167153b70e62df39f3cb3"],["gattonode.py","f","6d7a2f61e2bb185a667a0db086cca074c0533ad22a88e6b15c3206437413b292"],["gattoway.py","f","1fbda35d8dbd5f5899c5c023827bb6dcd76ebe4ebd018062b87b6d63e4cec94e"],["globals.py","f","1ae0b19d52519f11ddda6a636d5f049a9cd1e46bfdb2c42d991ffe186eacf538"],["hardware.py","f","c2996162bf3e9ea936e9e55ba7270b34bd3fa38b730afb24b223cd5163f7cc69"],["http.py","f","dc9a3f981380543f9c03b8c29a6960c00bc597801d2d8824cc70929f5c48168b"],["log_factory.py","f","dc35de52e03d8b90525f011b57ed6e6070d2cdc2bc02a443ed98776d5ce1fe27"],["lora.py","f","28086d46cb4df22665a7283160a0c7f6d13bbab671d7c111d6c7cef92146070e"],["main.py","f","dbeacc4f53a559847ffd795e4f4bfb30eba8352520c5c50a8717e0aea395ede5"],["no_main.py","f","a911aecd49b98be0dc1a72c58070558c
[silly] Pyboard | Received message: 372171aabf5206864dae03e22cd7b3d1"],["uart.py","f","6155f606eef67302e051ef218422a8c02f1b370c69c1eeb45a723d36eee61abe"],["utils.py","f","c95a6438b1903e5ea33c513644eaa8b0afede28c6c8903eb55e1a749e91f87a7"]]
logger.js:23 [silly] Pyboard | Received message: >
bjoernbusch commented 7 years ago

I have the same issue, after the first sync, it won't sync again. This is only happening since the update a couple days ago.

[silly] Pyboard | Received message: OK
[info] Sync | Reading pymakr file
[silly] Pyboard | Received message: �
[silly] Pyboard | Received message: [["boot.py","f","acf2e83ea1bcc0388282558c9643b9234aa4242c1c90e
[silly] Pyboard | Received message: 16e210f5e4fcdce483a"],["main.py","f","e3b0c44298fc1c149afbf4c8
[silly] Pyboard | Received message: 996fb92427ae41e4649b934ca495991b7852b855"]]
[silly] Pyboard | Received message: >

My boot.py contains very little data. I'm on the latest FW, it was working fine with the last version of the Atom plugin.

RalphHogenbirk commented 7 years ago

Is this happening on serial, telnet or both? I haven't been able to reproduce it yet.

I suspect it's going wrong while reading the project file from the board (the json file that contains the file status). I've added improved error handling when reading the project file to the develop branch now (from commit #fe26110). It now displays a message 'failed to read project file' and continues synchronizing anyway.

@bjoernbusch @theRealBugger Can one of you try the code on develop and tell me if you see this message?

danieleparazza commented 7 years ago

Ok @RalphHogenbirk sync worked ok for a couple of hours (syncing only the modified files), then prompted this output (I did modified just one file in my project):

Failed to read project status, synchronizing all files
[1/12] Writing file communication.py
Synchronizing failed: Write failed. Please reboot your device manually.

And developer console shows these errors:

Failed to load resource: net::ERR_FILE_NOT_FOUND    C:\Users\danie\AppData\Local\atom\app-1.16.0\resources\app.asar\src\task.js:46 
spell-check:en-us Can't load en_US: Cannot find dictionary for en_US.
48index.html:1 Uncaught TypeError: undefined is not a function
(program):116 Handling of 'mousewheel' input event was delayed for 101 ms due to main thread being busy. Consider marking event handler as 'passive' to make the page more responive.
(program):677 Handling of 'wheel' input event was delayed for 101 ms due to main thread being busy. Consider marking event handler as 'passive' to make the page more responive.
75index.html:1 Uncaught TypeError: undefined is not a function

After a device soft-reset and "reconnect" sync worked normally

swfecsacSWse commented 7 years ago

Today I upgraded to Pymakr plugin 0.9.4, latest SiPy firmware, and latest PlatformIO software. Sync then wouldn't work at all for me, producing the same screen output as the original post. Reverting back to 0.9.3 worked fine.

danieleparazza commented 7 years ago

With the upgrade on develop branch It works, but I have that new error sometimes.

RalphHogenbirk commented 7 years ago

I've put some new bugfixes on develop just now. Solves the issue of not being able to read the project file but also the sync failing randomly. @theRealBugger @swfecsacSWse feel free to test it!

lachmeijer commented 7 years ago

Solved now for me.

RalphHogenbirk commented 7 years ago

I'm assuming this is solved with the newest code on develop judging from @servicing's comment and the lack of other responses. If anyone still has this or a similar problem, feel free to re-open or create a new issue.

jdcrunchman commented 5 years ago

I'm using PyMakr 1.4.14. For some reason, the Synch is not working properly.

import os os.listdir('www') ['css', 'fonts', 'img', 'index.html', 'p-contacts.html', 'p-msg.html', 'w-msg.html', 'test.pyhtml', 'www', 'MainSetup.py', 'Quickies', 'ideas.py', 'lora_api.py', 'project.pymakr', 'mainweb.py', 'microWebSocket.py', 'microWebSrv.py', 'microWebTemplate.py', 'quickies.py', 'user.py', 'webview.py', 'tst.py']

I am only supposed to have these files in my "www" directory.... ['css', 'fonts', 'img', 'index.html', 'p-contacts.html', 'p-msg.html', 'w-msg.html', 'test.pyhtml']

But as you see, most of the files in my root folder, are also displayed. As you see above, another "www" folder was created.

Then, I tried to go into the 2nd "www" directory, which I thought was somehow created. I was already in the first "www" directory, but wanted to try to go into the 2nd one.

os.chdir('wwww') Traceback (most recent call last): File "", line 1, in OSError:

When I did this, I got an OSError, so I'm confused.

Do you think that these other files (WHICH APPEARED) to be added to the "www" filles as I've shown above, have just come from the root, but somehow displayed when I went into the "www" directory?

Could this be from a fuckup of the Synch function from PyMakr and be a bug.

From all I can tell, there doesn't seem to be any "www" directory created into my original one.

I have trouble explaining things. If any of the developers are interested in helping me, or looking further, please contact me at jdcrunchman@gmail.com, or Signal or Telegram at +1 818-640-5290.

I have Zoom account, and can screen share with you on Zoom or Skype (jdcrunchman).

I need to know if it's possible to re-synch the entire directory and file structure.

Before, I had to re-flash the ESP32 board, re-install the PyMakr (which took me over 2 hours of struggle and failure), I prefer not to have to do that again.

PLEASE HELP.

jdcrunchman commented 5 years ago

Oh, I did notice this, and had entered this incorrectly... My eyes are VERY BAD, and for weeks now, I've been trying to make the ESP32 console text larger so I can read it, so far, no luck, I sure can use some pointers to change the font size. I had originally put in....

os.chdir('wwww')

should have been os.chdir('www')

But I also observed some other interesting and VERY ANNOYING behavior

I often import or run a file I call Quickies, which defines simple file management stuff.

One such function I defined was this...

from os import listdir, remove, chdir, getcwd def pwd(): getcwd()

Just to see what directory its in.

This function DOES NOT WORK.... But when I tried to copy the console output, I get this...

Uncaught TypeError: Cannot read property 'length' of undefined /Users/johndraper/.atom/packages/pymakr/node_modules/xterm/lib/utils/BufferLine.js:11 Show Stack Trace The error was thrown from the pymakr package. This issue has already been reported. View Issue

Which shows up when I try to copy the console, so I can't show this to you.

I was able to copy the last part.

cd('www') pwd() . <---- notice here, the pwd() function things it's root. import os <---- so without using this function, which for whatever, didn't work.
os.getcwd() <---- I imported the os, and used directly, '/www' . <---- and presto, there it is....

Is this a bug in the Micropython, or a bug on PyMakr? I have no clue.

Perhaps a bug on BOTH.

Can someone please contact me on Skype (jdcrunchman) so I can show you in detail, and interact with you?

John