Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window size #7

Closed
Bromiun opened this issue Jan 19, 2023 · 17 comments
Closed

Window size #7

Bromiun opened this issue Jan 19, 2023 · 17 comments

Comments

@Bromiun
Copy link

Bromiun commented Jan 19, 2023

Thank you for this great piece of software.

How can I increase the window size on the browser both horizontally and vertically?

And why is the page code in binary?

Thanks
Bromium

@asjdf
Copy link
Owner

asjdf commented Jan 22, 2023

I'm so sorry I just saw this issue.

If you need to customize the webpage, you need to edit the original webpage file and regenerate it yourself.
Converting the web page into binary and directly writing it into the firmware area is mainly for the convenience of users to upload the firmware.

@Bromiun
Copy link
Author

Bromiun commented Jan 22, 2023

Thanks for your reply.

But how do I "you should install NodeJS and pnpm first"?

And how do I generate the page in Windows? Are your instructions for Linux or Windows?

Thanks!

@Bromiun
Copy link
Author

Bromiun commented Jan 22, 2023

Also, I don't want the output to go into a sub-Window. I just want it to go into the Browser window.

Could you please give me a hint how to remove the subwindow? I have zero knowledge of JS BTW.

Regards,
Bromium

@asjdf
Copy link
Owner

asjdf commented Jan 22, 2023

The generator can work in any system(if the environment have nodejs)

In your case, you can try to use scoop to help you install the environment. https://scoop.sh
Then run command scoop install nodejs and scoop install pnpm. After that you can follow the docs.

@Bromiun
Copy link
Author

Bromiun commented Jan 22, 2023

Thanks for your prompt reply.

I am still at a loss here. Index.html is 9 kB. Finalize.mjs is 2 kB. So all this compression and de-compression is to reduce the size of the upload from 9 kB to 4.5 kB, saving 4.5 kB, which at 115200 baud (12kB/sec) is just 0.38 secs. Is it worth all the complications?

ESPAsyncWebServer is 800 kB, which has to be uploaded everytime. There is really no difference between 800 kB and 804.5 kB.

Probably there is something else that I do not understand?

Regards,
Bromium

@asjdf
Copy link
Owner

asjdf commented Jan 22, 2023

My other projects also use ESPAsyncWebServer, so there's not much overhead for me to add to webserial, I try to reduce the size of the web page and put css and js together in order to speed up the loading of the web page (microcontroller only needs to handle one request, and the optimized size is in microcontroller's favor, Reduce the consumption of computing resources of the single chip computer. As far as I know, ESPAsyncWebServer is currently the only good option for the esp family of microcontrollers to provide web services (it does not block.

@asjdf
Copy link
Owner

asjdf commented Jan 22, 2023

Actually,0.38s is quite a long time.

@Bromiun
Copy link
Author

Bromiun commented Jan 22, 2023

Thank you for your response. It would be much more beneficial to reduce the size of ESPAsyncWebServer.cpp which is an astounding 800 kB plus 15 kB of SRAM. I am sure your code and everyone else's code uses less than 10% of this gigantic monster. Then we and everyone else in the ESP32 world can be saving 720 kB. I like your effort to build a Lite version of WebSerial. The original WebSerial is useless, with a page that is compressed to 60 kB! Uncompressed, this page would be about another 200 kB on top of the 800 kB for a total of 1 mB, leaving only 300 kB for user code.

I'll modify the Lite code and put index.html in the code, as that is faster for me than trying to figure out JS and scoop.sh and the other two modules.

Could you please give me a hint how to write directly to the browser, instead of the Terminal? Terminal appears to boil down to
textArea.value += raw;
How do I instead write to the browser window? I greatly appreciate your help.

Thanks a lot, and please don't get me wrong. I greatly appreciate your work.

Bromium

@asjdf
Copy link
Owner

asjdf commented Jan 22, 2023

It would obviously be nice to be able to minify ESPAsyncWebServer.cpp, but the problem I'm currently facing is that there doesn't seem to be a lightweight library that responds to http requests gracefully and non-blocking, I'd be more than happy to try it out if there are any suggestions.

Do you still need those buttons and input boxes below?
If you just want to display the console in full screen, you can solve it directly by modifying css. If you modify js, you need to modify other parts of html at the same time.

image
I don't know if this effect is what you want, you can try the two styles I added which show in the picture.
Forgive me for using the browser debug style directly.

@Bromiun
Copy link
Author

Bromiun commented Jan 23, 2023

Thank you asjdf, that is very helpful.

I am using the Arduino IDE.

1- Where does console.log() go in the IDE?

2- So I embedded the index.html in WebSeral.cpp and removed the gzip. It worked partially. I got the Terminal in the browser, and also got "[WebSerial] Connecting..." in the Terminal, but never got "[WebSerial] Connected...\n" of the onOpen function. I have no idea why this failed? The Terminal is frozen and does not do anything. Nothing has been changed except for embedding WEBSERIAL_HTML, and commenting out the gzip line.

Can I show my code to you? Shall I do a pull request, or do a fork? I have no idea how GitHub works.

Thanks a lot,
Bromium

@asjdf
Copy link
Owner

asjdf commented Jan 23, 2023

console.log() is for the web browser.

Fork is enough. If you are debugging, the connection won't be successful, because you didn't run a backend for debugging. By the way, I haven't dealt with this issue. #6 There might be some problems I haven't solved.

@Bromiun
Copy link
Author

Bromiun commented Jan 23, 2023

Hi asjdf - I have forked and committed my changes and removed a few files.

Please advise.

Bromium

@Bromiun
Copy link
Author

Bromiun commented Jan 23, 2023

Yes, #6 was the problem. After fixing, it works. Funny that the Library version does not have the #6 problem, but your repository version has this problem. Suggest you update index.html.

I will will work on the embedded version and see how it behaves.

@asjdf
Copy link
Owner

asjdf commented Jan 23, 2023

Would you mind show me more code?(I would like to see your process of initializing the library (because I thought that there is no problem with the code you changed, I began to worry that there is something wrong in my code, but I have no equipment for testing at present (China is during the Spring Festival))😵‍💫

@asjdf
Copy link
Owner

asjdf commented Jan 23, 2023

Ohhh, I'm glad to see you fixed the bug created by me.

Thank you very much for your continuous follow-up of this library. I will fix this bug when I return to school.

@Bromiun
Copy link
Author

Bromiun commented Jan 23, 2023

"Would you mind show me more code?" -- I am just using the "demo.ino" in the example, with the modified code in the Embedded branch, and after making the change as per #6 issue. Everything is working at the moment.

I will now integrate WebSerialLite with a VS1053 music player/internet radio, and see how it behaves. Player/Radio generates a lot of Serial.print messages. I am afraid after redirecting to WebSerial, I will run into the Async limit on lines - the #4 problem. I will try to fix that problem.

Your English is so good. And you are in China?

Best regards,
Bromium

@asjdf
Copy link
Owner

asjdf commented Jan 23, 2023

Yes, I am Chinese.

Glad to see this library can help you.🙂And since this issue is solved, I will close this issue first.

Best regards,
Atom

@asjdf asjdf closed this as completed Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants