30..53 provided a new module base on existing one that allows to set a customized calculation function
- 30 shows the default - pass through function - which accepts the raw coordinates and the read data. Read data is pass just in case...
- 41 shows the calculation invocation with the pre-calculation of the raw coordinates (same as known from existing modules: highByte * 256 + lowByte)
- 48 and 49 are noteworthy where context of module / touch singleton is bound in order to use this.calc(...) function in nested anonymous watch and interval functions.
- 176..187 raw values are collected while touching the calibration marks from top left to bottom right.
- 97 starts the actual calibration calculations...
- 98..117 calculates raw value per pixel based on known coordinates of the markers and measured values: scale value (raw value) / pixel = read value difference divided by pixel delta of the markers
- 118..128 calculates the offset for each axis.
- 126 and 127 show the calculated scale and offset values.
- 128..132 calculates the new values from the initially read values (1..5 console output) with given scaling and offset and shows them in the console for verification (117..121 console output)
- 134..141 sets the new calibrated calculation function in touch singleton
- 143 switches into regular mode for verification of the calc function (touching/tapping the markers again shows new calculated values as expected.
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.
Here it is, the calibration, resulting in a new module and a calibration function:
Related console output:
The calibration goes as follows:
30..53
provided a new module base on existing one that allows to set a customized calculation function-
30
shows the default - pass through function - which accepts the raw coordinates and the read data. Read data is pass just in case...-
41
shows the calculation invocation with the pre-calculation of the raw coordinates (same as known from existing modules: highByte * 256 + lowByte)-
48 and 49
are noteworthy where context of module / touch singleton is bound in order to usethis.calc(...)
function in nested anonymous watch and interval functions.-
176..187
raw values are collected while touching the calibration marks from top left to bottom right.-
97
starts the actual calibration calculations...-
98..117
calculates raw value per pixel based on known coordinates of the markers and measured values: scale value (raw value) / pixel = read value difference divided by pixel delta of the markers-
118..128
calculates the offset for each axis.-
126 and 127
show the calculated scale and offset values.-
128..132
calculates the new values from the initially read values (1..5
console output) with given scaling and offset and shows them in the console for verification (117..121
console output)-
134..141
sets the new calibrated calculation function in touch singleton-
143
switches into regular mode for verification of the calc function (touching/tapping the markers again shows new calculated values as expected.1 Attachment