const typeStore = { b2_uint16_1p: arr => { let dv = new DataView(new Uint8Array(arr).buffer); let decim = dv.getUint16(0); return (decim / 10).toFixed(1); }, b4_float32_: arr2 => { let dv = new DataView(new Uint8Array(arr2).buffer); let decim = dv.getFloat32(0); return decim; }, }
I invoke method like this:
inter.prototype.interpret = function (dataTypeString, dataArr) { return typeStore[dataTypeString](dataArr); };
let md=new Md; md.interpret[b4_float32_](99)
{ VERSION: "2v04.332", GIT_COMMIT: "57da2618", BOARD: "STM32F4DISCOVERY", FLASH: 1048576, RAM: 196608, SERIAL: "32005a00-0c513832-36393630", CONSOLE: "USB", MODULES: "Flash,Storage,hea" ... "S,WIZnet,neopixel", EXPTR: 536871244 }
I can't invoke the second method, in this position, I just can only use the first method, the others just return UNDEFINED。
@user109783 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I invoke method like this:
I can't invoke the second method, in this position, I just can only use the first method, the others just return UNDEFINED。