-
• #2
Which version of espruino does the emulator run atm?
-
• #3
I think the emulator has a bug with g.fillRect dimensions not accurate , like if you draw 2x2 rect it makes it 3x2. I think I can't replicate it on the latest firmware watch so perhaps historical espruino bug or a bug with translating to canvas/webgl in emulator?
-
• #4
Which version of espruino does the emulator run atm?
run
process.env
in console - left side of IDEHow long does it take to load, its just white screen for me.
You can also just go to regular IDE https://www.espruino.com/ide/
click connect button and select "Emulator" -
• #5
Yes that is what I use, but I can't get it to load.
-
• #6
https://www.espruino.com/ide/emu_banglejs.html won't work - I'm not sure where you found that URL but it's not meant to be loaded on its own.
Best bet just go to https://www.espruino.com/ide/emulator.html (or even /ide and click 'emulator') and it'll work. If it doesn't, try doing a refresh of the page?
-
• #7
From
https://espruino.com/ide
, when clicking top left connect, then choosing emulator from list, a popup window with urlhttps://www.espruino.com/ide/emu_banglejs.html
appears, with white screen.
Is this unexpected?
I have tried many time and its not working here. Very odd!! -
• #8
I attached a log of console tab in settings from webide. Maybe it suggests something?
I cleared entire cache and also tried incognito, same effect. I asked a friend to test it, and it works fine for him. I also was using the exact same chrome browser version as him.
1 Attachment
-
• #9
Ok now it just randomly worked... But I didn't change anything.. So there is a chance it doesnt' load correctly, but if I refresh often enough, it works, OK.. My gpu usage is at 100% cos i'm mining, might be related?
For me its like 50% chance to fail, then F5/refresh for 50% chance not to fail
-
• #10
Where can I find the LCD_EMSCRIPTEN code? Ye Nvm, just can't get my head around why if i zoom into the pixels there are more horizontally than vertically if I do:
g.fillRect(5,5,7,7);
in the Emulator, but its out of my scope. Let me know if its strange or not
I'm expecting a square. -
• #11
Do you have an ad blocker or something like that which might be breaking it? Are you using Chrome, or something else? Honestly not sure what to suggest.
Not entirely sure what you mean about LCD_EMSCRIPTEN but the code is at https://github.com/espruino/Espruino/blob/master/libs/graphics/lcd_st7789_8bit.c
-
• #12
'makefile' : [ 'EMSCRIPTEN=1', 'DEFINES += -DUSE_TENSORFLOW', 'DEFINES += -DBANGLEJS', 'DEFINES += -DSPIFLASH_BASE=0x8000000 -DSPIFLASH_LENGTH=4194304', # 'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_banglejs_getBattery', 'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'', 'DEFINES+=-DUSE_FONT_6X8 -DGRAPHICS_PALETTED_IMAGES -DGRAPHICS_ANTIALIAS -DUSE_LCD_EMSCRTIPTEN',
EMSCRIPTEN.py
-DUSE_LCD_EMSCRTIPTEN'
this define, but couldn't find references to it, not thats its important.. -
• #13
that looks like like typo in the definition, there is extra T in USE_LCD_EMSCRTIPTEN and it seems unused
btw you can search github project easily via search in upper left corner so check this https://github.com/espruino/Espruino/search?q=EMSCRIPTEN
-
• #14
g.setPixel(5,5,215);
It can be reduced further to just this line. If I zoom in with paint the screenshot of the emulator canvas. I see 2 pixels, not 1. Is this just a related problem to scaling of windows 125%? Or possibly antialiasing of the browser.
I'm probably being very stupid by highligthing this, considering the emulated window size in my pixels was 300x300 , and bangle is 240.. so the extra pixels have to be drawn somewhere.. ignore me, im just being dumb :)
-
• #15
Ye I just launched chrome with
/high-dpi-support=1 /force-device-scale-factor=1
. And it was pixel perfect! -
• #16
Ahh. Ok, yes, that'd do it :) Is it a specific change you'd made to Chrome? Because when I view it the window is 240px and it's 1:1 - in fact the emulator itself goes to some lengths to ensure it only scales the image +/- 240px to avoid exactly this issue.
If there's something that can be done to set the actual pixel size then I'm all for changing it though. Code here: https://github.com/espruino/EspruinoWebIDE/blob/master/emu_banglejs.html#L206
-
• #17
Its because in windows 10 I have 125% scaling... window size was 300px by 300px which is exactly 1.25 x
-
• #18
I wonder whether there's a way for the webpage to detect the actual pixel size and scale accordingly though?
-
• #19
I made a pull request addressing this issue.
-
• #20
Thanks!
-
• #21
I am having a similar issue with the emulator. See:
Refreshing the emulator window doesn't seem to help.
I am on Windows 10 with a scaling of 200%.
I tried withchrome.exe /high-dpi-support=1 /force-device-scale-factor=1
but it didn't help.
I remember that the emulator used to work on my computer, but for some time already it is not the case anymore. At first I sought that the emulator server was down, but it is definitely a different story.
Any idea on how to fix that? -
• #22
if i remember correctly it was refreshing the main page, that eventually fixes it, something related to load order or cache of scripts..
Btw this thread also refers to another graphical bug, which is not really related to the first, confusing you, sorry.
Currently the emulator loads for me everytime, cant' recreate the problem. Using version chrome : Version 92.0.4515.131
Ah interesting, if I refresh the emulator after its loaded fine, it goes White, so that might be a clue as to what is happening behind the scene for you.
-
• #23
If I refresh the main page (not the small display window), I have to click on connect again. Is this what you mean? Anyhow, I have tried this a few times but it didn't help.
As you were talking of something related to load order or cache of scripts, I tried with no extensions in Chrome (
--disable-extensions
) but it didn't help as well...Chrome and Windows 10 are up to date...
-
• #24
That's pretty odd. Do you see any errors in the Chrome dev console?
-
• #25
Mon 2021.08.09
FIO: I am able to duplicate the issue using Fn+F5 within the stand alone emulator window.
Steps:
https://www.espruino.com/ide/
Orange Connect Button :: Emulator
Carret inside Emulator Window
Fn+F5
post #24 'Do you see any errors in the Chrome dev console?'
Yes
index.js:93405 GET https://www.espruino.com/serial/ports 404 (Not Found) (anonymous) @ index.js:93405 cb @ index.js:92877 getGitHub @ index.js:101341 cb @ index.js:92875 callProcessor @ index.js:92880 getURL @ index.js:93383 getJSONURL @ index.js:93468 getPorts @ index.js:96520 (anonymous) @ index.js:95156 getPorts @ index.js:95154 getPorts @ index.js:99411 showPortSelector @ index.js:99462 toggleConnection @ index.js:99385 index.js:92937 getURL("/serial/ports") error : HTTP 404 console.error @ index.js:92937 (anonymous) @ index.js:93396 load (async) (anonymous) @ index.js:93392 cb @ index.js:92877 getGitHub @ index.js:101341 cb @ index.js:92875 callProcessor @ index.js:92880 getURL @ index.js:93383 getJSONURL @ index.js:93468 getPorts @ index.js:96520 (anonymous) @ index.js:95156 getPorts @ index.js:95154 getPorts @ index.js:99411 showPortSelector @ index.js:99462 toggleConnection @ index.js:99385 VM3 serviceworker.js:1 Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed VM3 serviceworker.js:1 Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed serviceworker.js:1 Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed serviceworker.js:1 Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed
To recover have to disconnect and re-connect to Emulator
Same steps but refreshing just the main page and not emulator windowserviceworker.js:1 Uncaught (in promise) TypeError: Failed to fetch analytics.js:39 POST https://stats.g.doubleclick.net/j/collect?t=dc&aip=1&_r=3&v=1&_v=j92&tid=UA-46537227-2&cid=1087963641.1561050839&jid=1010657704&gjid=365500369&_gid=57781162.1628450740&_u=AACCAEAAAAAAAC~&z=2076022948 net::ERR_FAILED wd @ analytics.js:39 pe @ analytics.js:38 oc @ analytics.js:39 Ea @ analytics.js:39 g.onreadystatechange @ analytics.js:38 XMLHttpRequest.send (async) wd @ analytics.js:39 pe @ analytics.js:38 Sa @ analytics.js:43 Ha.D @ analytics.js:41 pc.send @ analytics.js:76 X.b.<computed> @ analytics.js:56 Z.v @ analytics.js:92 Z.D @ analytics.js:91 N.N @ analytics.js:94 rc @ analytics.js:86 z @ analytics.js:86 (anonymous) @ analytics.js:94 (anonymous) @ analytics.js:94 serviceworker.js:1 Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed serviceworker.js:1 Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed
Also running Windows10 Chrome Version 92.0.4515.131
How long does it take to load, its just white screen for me.
https://www.espruino.com/ide/emu_banglejs.html
Strange cos it worked for me one time, but not sure what I did to get it working...