Skip to content

Commit

Permalink
Merge pull request #683 from songjoonsuk/develop-hw
Browse files Browse the repository at this point in the history
신규 보드 (센서우노/센서우노블루투스) 등록건
  • Loading branch information
Tnks2U authored Nov 15, 2023
2 parents e42732d + 36b5d57 commit aea10bf
Show file tree
Hide file tree
Showing 8 changed files with 1,138 additions and 0 deletions.
398 changes: 398 additions & 0 deletions app/firmwares/suno.hex

Large diffs are not rendered by default.

454 changes: 454 additions & 0 deletions app/firmwares/sunobt.hex

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions app/modules/suno.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
function Module() {
this.digitalValue = new Array(12);
this.analogValue = new Array(8);
this.remoteDigitalValue = [0,0,0,0,0,0,0,0,0,0,0,0];
this.readablePorts = null;
this.remainValue = null;
}

Module.prototype.init = function(handler, config) {
};


Module.prototype.requestInitialData = function() {
return null;
};

Module.prototype.checkInitialData = function(data, config) {
return true;
};

Module.prototype.validateLocalData = function(data) {
return true;
};


Module.prototype.handleRemoteData = function(handler) {
this.readablePorts = handler.read('readablePorts');
var digitalValue = this.remoteDigitalValue;
for (var port = 0; port < 12; port++) {
digitalValue[port] = handler.read(port);
}
};

Module.prototype.requestLocalData = function() {
var queryString = [];

var readablePorts = this.readablePorts;
if (readablePorts) {
for (var i in readablePorts) {
var query = (5 << 5) + (readablePorts[i] << 1);
queryString.push(query);
}
}

var digitalValue = this.remoteDigitalValue;
for (var port = 0; port < 12; port++) {
var value = digitalValue[port];
if (value === 255 || value === 0) {
var query = (7 << 5) + (port << 1) + (value == 255 ? 1 : 0);
queryString.push(query);
} else if (value > 0 && value < 255) {
var query = (6 << 5) + (port << 1) + (value >> 7);
queryString.push(query);
query = value & 127;
queryString.push(query);
}
}
return queryString;
};

Module.prototype.handleLocalData = function(data) { // data: Native Buffer
var pointer = 0;
for (var i = 0; i < 32; i++) {
var chunk;
if(!this.remainValue) {
chunk = data[i];
} else {
chunk = this.remainValue;
i--;
}
if (chunk >> 7) {
if ((chunk >> 6) & 1) {
var nextChunk = data[i + 1];
if(!nextChunk && nextChunk !== 0) {
this.remainValue = chunk;
}
else {
this.remainValue = null;

var port = (chunk >> 3) & 7;
this.analogValue[port] = ((chunk & 7) << 7) +
(nextChunk & 127);
}
i++;
}
else {
var port = (chunk >> 2) & 15;
this.digitalValue[port] = chunk & 1;
}
}
}
};

Module.prototype.requestRemoteData = function(handler) {
for (var i = 0; i < this.analogValue.length; i++) {
var value = this.analogValue[i];
handler.write('a' + i, value);
}
for (var i = 0; i < this.digitalValue.length; i++) {
var value = this.digitalValue[i];
handler.write(i, value);
}
};

Module.prototype.reset = function() {
};

module.exports = new Module();
48 changes: 48 additions & 0 deletions app/modules/suno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"id": "570101",
"name": {
"en": "Sensor Uno",
"ko": "센서우노(USB)"
},
"category": "board",
"platform": ["win32", "darwin"],
"icon": "suno.png",
"module": "suno.js",
"url": "https://excitetouch.com",
"email": "[email protected]",
"driver": [
{
"win32-ia32": "CH34x_Install_Windows_v3_4/CH34x_Install_Windows_v3_4.EXE",
"win32-x64": "CH34x_Install_Windows_v3_4/CH34x_Install_Windows_v3_4.EXE",
"darwin-x64": "https://entrylabs.github.io/docs/files/drivers/CH34x_Install_MAC_10_9_AND_ABOVE/CH34x_Install_V1.3.pkg",
"translate": "드라이버 (유선용)"
},
{
"win32-ia32": "SUNOBT/CP210xVCPInstaller_x86.exe",
"win32-x64": "SUNOBT/CP210xVCPInstaller_x64.exe",
"darwin-x64": "Mac_OSX_VCP_Driver/SiLabsUSBDriverDisk.dmg",
"translate": "드라이버 (블루투스)"
}
],
"reconnect": true,
"firmware": [
{
"name": "suno",
"translate": "펌웨어 (USB케이블)"
},
{
"name": "sunobt",
"translate": "펌웨어 (블루투스)"
}
],
"hardware": {
"type": "serial",
"control": "slave",
"duration": 48,
"vendor": {
"win32": ["wch.cn", "Arduino"]
},
"baudRate": 57600

}
}
Binary file added app/modules/suno.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions app/modules/sunobt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
function Module() {
this.digitalValue = new Array(12);
this.analogValue = new Array(8);
this.remoteDigitalValue = [0,0,0,0,0,0,0,0,0,0,0,0];
this.readablePorts = null;
this.remainValue = null;
}

Module.prototype.init = function(handler, config) {
};


Module.prototype.requestInitialData = function() {
return null;
};

Module.prototype.checkInitialData = function(data, config) {
return true;
};

Module.prototype.validateLocalData = function(data) {
return true;
};


Module.prototype.handleRemoteData = function(handler) {
this.readablePorts = handler.read('readablePorts');
var digitalValue = this.remoteDigitalValue;
for (var port = 0; port < 12; port++) {
digitalValue[port] = handler.read(port);
}
};

Module.prototype.requestLocalData = function() {
var queryString = [];

var readablePorts = this.readablePorts;
if (readablePorts) {
for (var i in readablePorts) {
var query = (5 << 5) + (readablePorts[i] << 1);
queryString.push(query);
}
}

var digitalValue = this.remoteDigitalValue;
for (var port = 0; port < 12; port++) {
var value = digitalValue[port];
if (value === 255 || value === 0) {
var query = (7 << 5) + (port << 1) + (value == 255 ? 1 : 0);
queryString.push(query);
} else if (value > 0 && value < 255) {
var query = (6 << 5) + (port << 1) + (value >> 7);
queryString.push(query);
query = value & 127;
queryString.push(query);
}
}
return queryString;
};

Module.prototype.handleLocalData = function(data) { // data: Native Buffer
var pointer = 0;
for (var i = 0; i < 32; i++) {
var chunk;
if(!this.remainValue) {
chunk = data[i];
} else {
chunk = this.remainValue;
i--;
}
if (chunk >> 7) {
if ((chunk >> 6) & 1) {
var nextChunk = data[i + 1];
if(!nextChunk && nextChunk !== 0) {
this.remainValue = chunk;
}
else {
this.remainValue = null;

var port = (chunk >> 3) & 7;
this.analogValue[port] = ((chunk & 7) << 7) +
(nextChunk & 127);
}
i++;
}
else {
var port = (chunk >> 2) & 15;
this.digitalValue[port] = chunk & 1;
}
}
}
};

Module.prototype.requestRemoteData = function(handler) {
for (var i = 0; i < this.analogValue.length; i++) {
var value = this.analogValue[i];
handler.write('a' + i, value);
}
for (var i = 0; i < this.digitalValue.length; i++) {
var value = this.digitalValue[i];
handler.write(i, value);
}
};

Module.prototype.reset = function() {
};

module.exports = new Module();
22 changes: 22 additions & 0 deletions app/modules/sunobt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"id": "570102",
"name": {
"en": "Sensor Uno (Bluetooth)",
"ko": "센서우노(블루투스)"
},
"category": "board",
"platform": ["win32", "darwin"],
"icon": "sunobt.png",
"module": "sunobt.js",
"url": "https://excitetouch.com",
"email": "[email protected]",
"reconnect": true,
"selectPort": true,
"hardware": {
"type": "bluetooth",
"control": "slave",
"duration": 48,
"vendor": "Microsoft",
"baudRate": 57600
}
}
Binary file added app/modules/sunobt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit aea10bf

Please sign in to comment.