-
Sat 2019.10.05
@DBovey would you mind posting the link to the original official badge.js code please so that we may follow along with that source which originally worked.
What are the results of
process.env
When viewing your uploaded code in the WebIDE, are there any red error indicators on the Right-Hand side editor window? It appears the code file may have a typo or missing trailing line of code terminator.
Could this - Cube Badge be the source?Post #1 comment L56 indicates
onInit()
called at start up. There isn't a reference to that function. Would it make more sense to manually save() after all edits have been performed, and change L71 to call onInit()?
-
*> @DBovey would you mind posting the link to the original official badge.js code please so that we may follow along with that source which originally worked.
Writing an effective forum post*
Thanks for the advice, I'm a noob in the forums etc and maker universe
@Robin I took badge.js from git, downloaded to my pc, changed NAME variable and recopied to https://github.com/dbovey/espruino/blob/master/Badge_original.js but cannot for the universe's sake find where it was originally on git or somewhere else (it was between 2 and 3AM)...
(I'm really new to all the git stuff, I will have to ask to my colleague to get an understanding of the whys and hows of git. Bit more used to svn but I'm basically a HW guy)
What are the results of process.env
process.env
={
VERSION: "2v04",
GIT_COMMIT: "3956264e",
BOARD: "PIXLJS",
FLASH: 524288, RAM: 65536,
SERIAL: "88eb467e-a9e672fe",
CONSOLE: "Bluetooth",
MODULES: "Flash,Storage,hea" ... "el,graphical_menu",
EXPTR: 536882408 }Could this - Cube Badge be the source?
no
I did a dump() and the result is interesting:dump();
Graphics.prototype.setFont8x16 = function () {this.setFontCustom(a,32,b,16)};
var NAME = [
"First Last",
"Organisation"
];
var cityscape = { "width": 128, "height": 16, "bpp": 1,
"buffer": new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 2, 0, 0, 32, 0, 0, 4, 0, 0, 0, 0, 0, 252, 0, 128, 0, 7, 0, 0, 112, 0, 0, 4, 0, 0, 0, 0, 0, 252, 0, 128, 0, 7, 0, 0, 248, 0, 0, 12, 0, 0, 0, 0, 0, 252, 0, 128, 0, 7, 0, 0, 248, 0, 0, 12, 0, 0, 0, 7, 0, 252, 0, 128, 0, 7, 0, 0, 248, 0, 16, 12, 0, 0, 0, 7, 8, 252, 1, 192, 3, 199, 0, 0, 248, 0, 56, 12, 0, 0, 0, 7, 28, 252, 1, 192, 3, 199, 62, 0, 249, 224, 124, 12, 1, 224, 0, 7, 62, 255, 195, 224, 3, 199, 62, 0, 249, 224, 254, 13, 249, 224, 24, 31, 62, 255, 195, 224, 3, 199, 62, 0, 255, 224, 254, 13, 249, 224, 126, 31, 62, 255, 199, 247, 195, 199, 62, 62, 255, 224, 254, 13, 249, 225, 255, 159, 62, 255, 199, 247, 255, 199, 62, 62, 255, 248, 255, 205, 249, 227, 255, 223, 62, 255, 199, 255, 255, 199, 62, 62, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]).buffer
};
var ctlogo = { "width": 31, "height": 15, "bpp": 1,
"buffer": new Uint8Array([7, 224, 15, 254, 48, 48, 0, 0, 143, 0, 63, 250, 97, 128, 5, 5, 0, 0, 10, 18, 0, 0, 20, 40, 0, 0, 40, 80, 0, 0, 80, 160, 0, 0, 161, 32, 0, 1, 65, 64, 0, 2, 130, 97, 128, 5, 2, 60, 0, 10, 3, 3, 24, 20, 1, 248, 48, 40, 0]).buffer
};
var n = 0;
function draw() {?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255]}
function onInit() {?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255]}
=undefinedI opened the badge_original with notepad++ and I cannot see the issue at function draw() at L41 of the code. the issue is exactly the same in my badge_simple.js which has just a couple of graphical changes to center the displayed NAME.
And after playing with the badge extensively, it doesn't execute the code official badge.js code any more. Although some variables are set, see left-hand window log below.
The code is at:
https://github.com/dbovey/espruino/blob/master/Badge_simple.js
It is just the badge.js code with minor modifications.
Running onInit()...
Uncaught SyntaxError: Got ?[255] expected EOF
at line 1 col 4808
...?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255]...
at line 1 col 1
?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255] ?[255]...
in function called from system