Bangle Emulator #2769
Replies: 63 comments
-
Posted at 2021-05-24 by d3nd3-o0 Which version of espruino does the emulator run atm? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0 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? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by @fanoush
run
You can also just go to regular IDE https://www.espruino.com/ide/ |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0 Yes that is what I use, but I can't get it to load. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by @gfwilliams 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? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0 From |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0 I attached a log of console tab in settings from webide. Maybe it suggests something?
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0 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 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0 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:
in the Emulator, but its out of my scope. Let me know if its strange or not |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by @gfwilliams 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 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0
EMSCRIPTEN.py |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by @fanoush 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 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0
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 :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0 Ye I just launched chrome with |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-25 by @gfwilliams 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 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by Robin Sun 2021.08.29 Hi @TTBangler and thank you for your input.
Does this mean the Pop-up Emulator Window does in fact appear, but it's canvas never renders any content? Are you able to confirm that the default code block that is loaded is the same as I posted in #49 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by Robin Sun 2021.08.29
Yes. As @gfwilliams also pointed out in post #26 We are attempting to understand what event is causing the refresh on your PC. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by sebi That day I was experimenting with the 2x3 Pixel Clock accessible at https://banglejs.com/apps/#clock. Just click on the Try in Emulator icon and it will bring you there. Code line number 28 will match. But really, my issue occurs whatever the code in the right hand side panel is (the panel can be empty). It occurs when I want to connect the WebIDE to the Emulator (Connect / Disconnect plug icon > Emulator). At this stage, I am not uploading any code from the right hand side panel into the emulator yet.
What I see is the latest code I played with: currently it is code of the 2x3 Pixel Clock. If I clear cookies and other site data from Chrome, I get this in the WebIDE right hand side panel: var on = false;
setInterval(function() {
on = !on;
LED1.write(on);
}, 500); ...which is the panel default content I guess. But when trying to connect to the Emulator, the problem of getting a white emulator window still occurs. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by Robin Reply to post #52
Thank you, that clears that up.
Now this statement might be key here. As when I click the Orange 'Connect' button and then select 'Emulator' from the modal dialog, the code block on the R-Hand editor side of the IDE is then viewable in the pop-up Emulator Window. Please try cut-n-paste the following:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by Robin Sun 2021.08.29
@gfwilliams I launched the same in Edge, but the Emulator screen never populates. Could this |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by sebi
Still getting a white emulator window. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by Robin As I explained in post #53 as soon as I click the 'Emulator' button, and as the Emulator pop-up opens, it's canvas is immediately populated with viewable content. @gfwilliams usually will respond early in the week. Maybe he'll suggest some ideas on how to proceed. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by sebi
You mean with viewable content coming from your code right? Not the default Bangle.js boot content? What I remember for sure is that I was able to experiment typing some operations in the WebIDE's REPL directly (left hand side panel) once connected to the emulator, which currently I can't. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by Robin I just tried your suggestion from post #52 https://banglejs.com/apps/#clock When I click on the 'Try in Emulator' button, I'll agree that the Emulator Pop-up Window doesn't immediately show. I have to dismiss the 'connecting' modal dialog, then refresh the entire page as @gfwilliams had previously pointed out. At that point the Emulator Window becomes visible with the clock clearly visible. I never need the upload button. I then block copied the content from post #53 into the R-Hand editor and clicked the 'Upload' button. The animations then immediately execute in the Emulator. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-29 by TTBangler Yes, the pop-up emulator appears but with blank content. There's also another "SELECT A PORT..." pop-up window the reads "CONNECTING...". I've tried refreshing the emulator window and closing it and refreshing the main IDE page and connecting to the emulator again but still get the same result. I don't think any code from the right-side of the IDE is being loaded, presumably because the connection to the emulator never succeeds. Chrome seems to cache whatever was last entered into the right-hand side, so the content of my right-hand pane is different from yours (and is the code I most recently uploaded to my watch). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-31 by @gfwilliams
Yes, seems so. I think things are getting a bit confused here. As far as I can tell @SEBI and @TTBangler are having the exact same problem: The emulator window is blank. When the window is blank, there won't be a connection to the IDE, so what's in the left or right hand side of the IDE has no effect whatsoever. I took another look at this and I think I might have spotted a problem. Please can you refresh the IDE and try again now? I was opening the window and then waiting 500ms and sending a message to it to initialise it. I think what's happened is maybe Chrome has changed and now throws away any posed messages if they are sent before the window has initialised - so if the emulator takes more than 500ms to load it doesn't initialise. It worked fine for me basically all the time because I'm based in the UK and I get a fast connection to the UK-hosted espruino.com, but for some others especially if you have a slow connection or the computer is slower the window can take longer than 500ms to load. I've now tweaked things to add an 'onload' handler and I hope everything will be more reliable |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-31 by sebi Hurray!! You are a boss Gordon!! It is working again! Indeed for a year only, I moved to a place with a low speed connection, certainly when I noticed the problem... Thank you! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-31 by @gfwilliams Great! Glad it's finally all sorted! edit: this also explains why a refresh worked for me - everything would already have been cached by the second reload, even if I could get it to break the very first time I tried it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-31 by TTBangler I am also pleased to report that the emulator is now working for me too (in the States). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-31 by sebi
It's not that important now that the emulator is working again, but still, I wonder why this trick didn't work for me too... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-24 by d3nd3-o0
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...
Beta Was this translation helpful? Give feedback.
All reactions