You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • I'm not sure about the effort of conversion... even with a nice integrated development environment and a Espruino (or alike connected), there is not really a hot-swap possible. A single step is for sure there - @Gordon would for sure know. I use Chrome as my JS development runtime environment, Apache as my server environment, and some useful text editor (with less or more JavaScript and other support - such as TextWrangler...Brackets). I edit my files directly in a subfolder of Apache's Documents folder when using plain text editor/TextWranlger, Brackets has nice (preview) server integrated...

    Getting to a setup for a cross develpment makes it fun: you will be able to run the very same app on the browser as well as in Espruino with - in kind of .c terms - just to load different #ifDef'd header files... Since you care most about the Canvas and its context, emulating that is not much that is needed.

    Looking at your code I see that it is bottom line a set of functions. Making them objects would be my first step... it makes it more robust, easier to extend, and also easier to debug.

    I pulled all your files... notice that the departure board is the last loaded js file and is the driver... (like in an SPA...). It makes the ajax request and gets all the things going. I assume that you have some php that actually goes and gets the data, because I cannot see any cross domain enablement CORS in the html page... this allows you to go directly after the data sourcing server and you do not need to go through php as the proxy server to respect the browsers sandbox / same origin policy (for security/safety purposes).

    I also see that the departure board has DOM things in it... pulling this out makes it Espruino ready.

    So there is some restructuring to be done, but - imho - it is useful and very helpful for moving on, also with extensions.

    Since I do not have a LED panel, but I have a 320x240 TFT LCD display w/ touch screen, I'm thinking of making this my board and trying to get that done. I'm looking at my display as the canvas... so my adapter will take the Canvas commands/method calls and translate/adapt them into the Espruino Graphics methods/calls an run the same on my TFT LCD display as you run on your LED panel. The controller of my display has a scroll modus too - like the controler your thinking about - so refactoring/extracting the code and have it scrolled in code / canvas / screen controller is an interesting task. After all, the hardware and software are just subsystems communicating with each other. The interface stays the same, the implementation is platform dependent.


Avatar for allObjects @allObjects started