Skip to content

Commit

Permalink
Merge pull request #7 from tadfmac/gc201712
Browse files Browse the repository at this point in the history
20171204 polyfill update (fix GPIO 18 issue) and i2c-grove-accelerometer.js update
  • Loading branch information
gurezo authored Dec 4, 2017
2 parents 8fd9ac2 + c9e9cc4 commit f44c097
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 65 deletions.
2 changes: 1 addition & 1 deletion _gc/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CHIRIMEN for Raspberry Pi 3 emv.version : 17/11/10:11:35:14
CHIRIMEN for Raspberry Pi 3 emv.version : 17/12/04:20:26:12
Binary file added _gc/wallpaper/wallpaper-1440x900.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _gc/wallpaper/wallpaper-720P.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 28 additions & 29 deletions gc/drivers/i2c-grove-accelerometer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ var GROVEACCELEROMETER = function(i2cPort,slaveAddress){

GROVEACCELEROMETER.prototype = {
EARTH_GRAVITY_MS2:9.80665,
SCALE_MULTIPLIER:0.004,
SCALE_MULTIPLIER:0.0039,
init: function(){
return new Promise((resolve, reject)=>{
this.i2cPort.open(this.slaveAddress).then(async (i2cSlave)=>{
await i2cSlave.write8(0x2d,0x00);
await i2cSlave.write8(0x2d,0x16);
await i2cSlave.write8(0x2d,0x08);
await i2cSlave.write8(0x2d,0x00); // stop sample
await i2cSlave.write8(0x31,0x08); // FULL_RES , +/-2g
await i2cSlave.write8(0x2d,0x08); // start 8Hz sample
this.i2cSlave = i2cSlave;
resolve();
},(err)=>{
Expand All @@ -25,34 +25,33 @@ GROVEACCELEROMETER.prototype = {
if(this.i2cSlave == null){
reject("i2cSlave Address does'nt yet open!");
}else{
var v = new Array();
v.push(await this.i2cSlave.read8(0x32));
v.push(await this.i2cSlave.read8(0x33));
v.push(await this.i2cSlave.read8(0x34));
v.push(await this.i2cSlave.read8(0x35));
v.push(await this.i2cSlave.read8(0x36));
v.push(await this.i2cSlave.read8(0x37));
var x = v[0] + (v[1] << 8);
if(x & (1 << 16 - 1)){x = x - (1<<16);}
var y = v[2] + (v[3] << 8);
if(y & (1 << 16 - 1)){y = y - (1<<16);}
var z = v[4] + (v[5] << 8);
if(z & (1 << 16 - 1)){z = z - (1<<16);}
await this.i2cSlave.writeByte(0x32);
this.i2cSlave.readBytes(6).then((v)=>{
var x = v[0] + (v[1] << 8);
if(x & (1 << 16 - 1)){x = x - (1<<16);}
var y = v[2] + (v[3] << 8);
if(y & (1 << 16 - 1)){y = y - (1<<16);}
var z = v[4] + (v[5] << 8);
if(z & (1 << 16 - 1)){z = z - (1<<16);}

x = x*this.SCALE_MULTIPLIER;
y = y*this.SCALE_MULTIPLIER;
z = z*this.SCALE_MULTIPLIER;
x = x*this.EARTH_GRAVITY_MS2;
y = y*this.EARTH_GRAVITY_MS2;
z = z*this.EARTH_GRAVITY_MS2;
x = x*this.SCALE_MULTIPLIER;
y = y*this.SCALE_MULTIPLIER;
z = z*this.SCALE_MULTIPLIER;
x = x*this.EARTH_GRAVITY_MS2;
y = y*this.EARTH_GRAVITY_MS2;
z = z*this.EARTH_GRAVITY_MS2;

x=Math.round(x*10000)/10000;
y=Math.round(y*10000)/10000;
z=Math.round(z*10000)/10000;
x=Math.round(x*10000)/10000;
y=Math.round(y*10000)/10000;
z=Math.round(z*10000)/10000;

var values = {"x": x, "y": y, "z": z};
resolve(values);
var values = {"x": x, "y": y, "z": z};
resolve(values);
},(err)=>{
reject(err);

});
}
});
}
};
};
4 changes: 2 additions & 2 deletions gc/polyfill/polyfill.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Version 2017.10.17
// Version 2017.12.04

(function(){

Expand Down Expand Up @@ -174,7 +174,7 @@ bone = (()=> {
// Raspberry Pi GPIO Port Number

// todo: add portName and pinName
var gpioPorts = [4,17,27,22,23,24,25,5,6,12,13,19,16,26,20,21];
var gpioPorts = [4,17,18,27,22,23,24,25,5,6,12,13,19,16,26,20,21];

var GPIOAccess = function () {
this.init();
Expand Down
2 changes: 1 addition & 1 deletion gc/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CHIRIMEN for Raspberry Pi 3 emv.version : 17/11/10:11:35:14
CHIRIMEN for Raspberry Pi 3 emv.version : 17/12/04:20:26:12
57 changes: 28 additions & 29 deletions release/cdn/i2c-grove-accelerometer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ var GROVEACCELEROMETER = function(i2cPort,slaveAddress){

GROVEACCELEROMETER.prototype = {
EARTH_GRAVITY_MS2:9.80665,
SCALE_MULTIPLIER:0.004,
SCALE_MULTIPLIER:0.0039,
init: function(){
return new Promise((resolve, reject)=>{
this.i2cPort.open(this.slaveAddress).then(async (i2cSlave)=>{
await i2cSlave.write8(0x2d,0x00);
await i2cSlave.write8(0x2d,0x16);
await i2cSlave.write8(0x2d,0x08);
await i2cSlave.write8(0x2d,0x00); // stop sample
await i2cSlave.write8(0x31,0x08); // FULL_RES , +/-2g
await i2cSlave.write8(0x2d,0x08); // start 8Hz sample
this.i2cSlave = i2cSlave;
resolve();
},(err)=>{
Expand All @@ -25,34 +25,33 @@ GROVEACCELEROMETER.prototype = {
if(this.i2cSlave == null){
reject("i2cSlave Address does'nt yet open!");
}else{
var v = new Array();
v.push(await this.i2cSlave.read8(0x32));
v.push(await this.i2cSlave.read8(0x33));
v.push(await this.i2cSlave.read8(0x34));
v.push(await this.i2cSlave.read8(0x35));
v.push(await this.i2cSlave.read8(0x36));
v.push(await this.i2cSlave.read8(0x37));
var x = v[0] + (v[1] << 8);
if(x & (1 << 16 - 1)){x = x - (1<<16);}
var y = v[2] + (v[3] << 8);
if(y & (1 << 16 - 1)){y = y - (1<<16);}
var z = v[4] + (v[5] << 8);
if(z & (1 << 16 - 1)){z = z - (1<<16);}
await this.i2cSlave.writeByte(0x32);
this.i2cSlave.readBytes(6).then((v)=>{
var x = v[0] + (v[1] << 8);
if(x & (1 << 16 - 1)){x = x - (1<<16);}
var y = v[2] + (v[3] << 8);
if(y & (1 << 16 - 1)){y = y - (1<<16);}
var z = v[4] + (v[5] << 8);
if(z & (1 << 16 - 1)){z = z - (1<<16);}

x = x*this.SCALE_MULTIPLIER;
y = y*this.SCALE_MULTIPLIER;
z = z*this.SCALE_MULTIPLIER;
x = x*this.EARTH_GRAVITY_MS2;
y = y*this.EARTH_GRAVITY_MS2;
z = z*this.EARTH_GRAVITY_MS2;
x = x*this.SCALE_MULTIPLIER;
y = y*this.SCALE_MULTIPLIER;
z = z*this.SCALE_MULTIPLIER;
x = x*this.EARTH_GRAVITY_MS2;
y = y*this.EARTH_GRAVITY_MS2;
z = z*this.EARTH_GRAVITY_MS2;

x=Math.round(x*10000)/10000;
y=Math.round(y*10000)/10000;
z=Math.round(z*10000)/10000;
x=Math.round(x*10000)/10000;
y=Math.round(y*10000)/10000;
z=Math.round(z*10000)/10000;

var values = {"x": x, "y": y, "z": z};
resolve(values);
var values = {"x": x, "y": y, "z": z};
resolve(values);
},(err)=>{
reject(err);

});
}
});
}
};
};
4 changes: 2 additions & 2 deletions release/cdn/polyfill.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Version 2017.10.17
// Version 2017.12.04

(function(){

Expand Down Expand Up @@ -174,7 +174,7 @@ bone = (()=> {
// Raspberry Pi GPIO Port Number

// todo: add portName and pinName
var gpioPorts = [4,17,27,22,23,24,25,5,6,12,13,19,16,26,20,21];
var gpioPorts = [4,17,18,27,22,23,24,25,5,6,12,13,19,16,26,20,21];

var GPIOAccess = function () {
this.init();
Expand Down
Binary file modified release/env/_gc.zip
Binary file not shown.
Binary file modified release/env/gc.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion release/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CHIRIMEN for Raspberry Pi 3 emv.version : 17/11/10:11:35:14
CHIRIMEN for Raspberry Pi 3 emv.version : 17/12/04:20:26:12

0 comments on commit f44c097

Please sign in to comment.