Skip to content

Commit 9dfdbab

Browse files
committed
Replace Math.clip with E.clip
1 parent 3afe52b commit 9dfdbab

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

devices/BME280.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ BME280.prototype.calibration_H = function(adc_H) {
126126
(((v_x1 * (dH[3])) >> 11) + (32768))) >> 10) + (2097152)) *
127127
(dH[2]) + 8192) >> 14));
128128
v_x1 = (v_x1 - (((((v_x1 >> 15) * (v_x1 >> 15)) >> 7) * (dH[1])) >> 4));
129-
v_x1 = Math.clip(v_x1,0,419430400);
129+
v_x1 = E.clip(v_x1,0,419430400);
130130
return (v_x1 >> 12);
131131
};
132132

devices/MPU9250.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ MPU9250.prototype.initMPU9250 = function() {
278278
mpu.w(C.CONFIG, 0x03);
279279

280280
// Set sample rate = gyroscope output rate/(1 + SMPLRT_DIV)
281-
mpu.w(C.SMPLRT_DIV, Math.clip(Math.round(1000/mpu.samplerate)-1,0,255));
281+
mpu.w(C.SMPLRT_DIV, E.clip(Math.round(1000/mpu.samplerate)-1,0,255));
282282

283283
// Set gyroscope full scale range
284284
// Range selects FS_SEL and AFS_SEL are 0 - 3, so 2-bit values are

modules/USBTablet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ exports.BUTTONS = {
6161

6262
// Move to absolute location, x and y both between 0 and 1, B for buttons
6363
exports.send = function(x,y,b) {
64-
var rx = Math.clip(x*32767,0,32767)|0;
65-
var ry = Math.clip(y*32767,0,32767)|0;
64+
var rx = E.clip(x*32767,0,32767)|0;
65+
var ry = E.clip(y*32767,0,32767)|0;
6666
E.sendUSBHID([b&7,rx,rx>>8,ry,ry>>8]);
6767
};

modules/graphical_menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ exports.list = function(g, items) {
8181
if (item.max!==undefined && item.value>item.max) item.value = item.max;
8282
if (item.onchange) item.onchange(item.value);
8383
} else
84-
options.selected = 0|Math.clip(options.selected+dir,0,menuItems.length-1);
84+
options.selected = 0|E.clip(options.selected+dir,0,menuItems.length-1);
8585
l.draw();
8686
}
8787
};

0 commit comments

Comments
 (0)