* Gear S2 Firmware JS interpreter ERROR! ( in HTML canvas from JS on EMULATOR and on real DEVICE S2 in same code)

* Gear S2 Firmware JS interpreter ERROR! ( in HTML canvas from JS on EMULATOR and on real DEVICE S2 in same code)

BY 26 Sep 2016 Web Application Development

huge difference in result screens with HTML canvas from JS on EMULATOR and on real DEVICE S2 ?

Why?

same condition,
same code ,

SDK Version : 2.4.0_Rev8 (Emulator S2)

Real S2 classic BT  SM-R732 (R732XXU2DPFB)

 

this part of code simple like this (I try different variants, but result the same):

for (jx = 1; jx <= 24; jx++) {
                //angle = (jx-1) * (Math.PI * 2) / 24;
    	        angle = DegToRad((jx-1) * 360 / 24);
                drawTextAlongArc(contextBase, jx.toString(), 180, 180, 145, (angle));
    }
    
function drawTextAlongArc(contextT, str, centerX, centerY, radius, angle){
    contextT.save();
    contextT.translate(centerX, centerY);      
    contextT.rotate(angle); 
    contextT.font = 'bold 20px Courier';
    contextT.fillStyle = '#ffffff';
    contextT.translate(0, -1 * radius);                     
    contextT.fillText(str, 0, 0);                                       
    contextT.restore(); 
} 

function DegToRad(d) {
    // Converts degrees to radians
    return d * 0.0174532925199432957;
}

Attached 2 screenshot       1-24 is all ok  – is EMULATOR , ont ok – is S2 real

REAL S2  :  wrong numbers and angles !!!

 

    

Written by