Skip to content

Commit 44441a7

Browse files
authored
Merge pull request #652 from entrylabs/develop-hw
하드웨어 1.9.45 버전업
2 parents 0755272 + 3793a25 commit 44441a7

21 files changed

+6833
-2215
lines changed

app/firmwares/aiot.hex

Lines changed: 930 additions & 0 deletions
Large diffs are not rendered by default.

app/firmwares/roborobo_cube.hex

Lines changed: 1970 additions & 0 deletions
Large diffs are not rendered by default.

app/firmwares/roborobo_roe.hex

Lines changed: 1785 additions & 1780 deletions
Large diffs are not rendered by default.

app/modules/aiot.js

Lines changed: 716 additions & 0 deletions
Large diffs are not rendered by default.

app/modules/aiot.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"id": "260201",
3+
"name": {
4+
"ko": "AIoT 보드",
5+
"en": "AIoT Board"
6+
},
7+
"category": "board",
8+
"platform": ["win32", "darwin"],
9+
"icon" : "aiot.png",
10+
"module": "aiot.js",
11+
"url": "http://wonn.co.kr",
12+
"email": "[email protected]",
13+
"driver": {
14+
"win32-ia32": "CDM21226_Setup/CDM21226_Setup.exe",
15+
"win32-x64": "CDM21226_Setup/CDM21226_Setup.exe"
16+
},
17+
"reconnect" : true,
18+
"firmware": "aiot",
19+
"hardware": {
20+
"type": "serial",
21+
"control": "slave",
22+
"duration": 32,
23+
"vendor": ["Arduino", "wch.cn", "FTDI"],
24+
"baudRate": 115200,
25+
"firmwarecheck" : false
26+
}
27+
}

app/modules/aiot.png

1.32 MB
Loading

app/modules/asomekit.js

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
const _ = global.$;
2+
const BaseModule = require('./baseModule');
3+
4+
class AsomeKit extends BaseModule {
5+
constructor() {
6+
super();
7+
8+
this.isDraing = false;
9+
this.sendBuffer = [];
10+
11+
this.receivedText = "";
12+
13+
this.msg_id = '';
14+
this.sendToEntry = {
15+
msg_id: "",
16+
distance: 0,
17+
udp_msg: "",
18+
};
19+
}
20+
21+
connect() {
22+
}
23+
24+
socketReconnection() {
25+
this.socket.send(this.handler.encode());
26+
}
27+
28+
requestInitialData() {
29+
console.log("requestInitialData");
30+
31+
var init_str = "import button;";
32+
// var init_str = "import button; import music; import dht11; import tm1637; import vibration_sensor; import hcsr04; light = AnalogPin(1); vs = vibration_sensor.create(1, 1000); tm1637.open(3, 4); ht = dht11.create(5); bt = button.create(6); hcsr04.open(7, 8); buzzer = OutputPin(11); music.open(12);";
33+
return Buffer.from(init_str, "ascii");
34+
}
35+
36+
setSerialPort(sp) {
37+
this.sp = sp;
38+
}
39+
40+
setSocket(socket) {
41+
this.socket = socket;
42+
}
43+
44+
checkInitialData(data, config) {
45+
return true;
46+
}
47+
48+
validateLocalData(data) {
49+
return true;
50+
}
51+
52+
requestRemoteData(handler) {
53+
var sendToEntry = this.sendToEntry;
54+
// console.log("to Entry: ", sendToEntry);
55+
56+
for (var key in sendToEntry) {
57+
handler.write(key, sendToEntry[key]);
58+
}
59+
return;
60+
}
61+
62+
handleRemoteData({ receiveHandler = {} }) {
63+
const { data: handlerData } = receiveHandler;
64+
if (_.isEmpty(handlerData)) {
65+
return;
66+
}
67+
68+
if (handlerData.msg_id == undefined) {
69+
console.log("from handlerData.msg_id == undefined", handlerData);
70+
return;
71+
}
72+
73+
if (handlerData.msg_id != this.msg_id) {
74+
console.log("from Entry: ", handlerData);
75+
76+
this.msg_id = handlerData.msg_id;
77+
this.sendBuffer.push(Buffer.from(handlerData.msg + "\r", 'ascii'));
78+
this.sendBuffer.push(Buffer.from("'#I'" + "'D " + handlerData.msg_id + "'\r", 'ascii'));
79+
}
80+
}
81+
82+
requestLocalData() {
83+
var self = this;
84+
85+
if (!this.isDraing && this.sendBuffer.length > 0) {
86+
this.isDraing = true;
87+
var msg = this.sendBuffer.shift();
88+
console.log("to AsomeBot: ", msg.toString(), this.sendBuffer.length);
89+
this.sp.write(msg, function() {
90+
if (self.sp) {
91+
self.sp.drain(function() {
92+
self.isDraing = false;
93+
});
94+
}
95+
});
96+
}
97+
98+
return null;
99+
}
100+
101+
handleLocalData(data) {
102+
// console.log("handleLocalData: ", this.receivedText);
103+
104+
this.receivedText = this.receivedText + data.toString();
105+
106+
var index = this.receivedText.indexOf('\r');
107+
while (index >= 0) {
108+
var line = this.receivedText.substring(0, index);
109+
this.receivedText = this.receivedText.substring(index + 1);
110+
111+
console.log("from AsomeBot: ", line);
112+
113+
if (line.indexOf('#DT') >= 0) {
114+
var values = line.split(" ");
115+
if (values.length > 1) this.sendToEntry.distance = values[1];
116+
}
117+
if (line.indexOf('#UDP') >= 0) {
118+
var values = line.split(" ");
119+
if (values.length > 1) {
120+
this.sendToEntry.udp_id = this.msg_id;
121+
this.sendToEntry.udp_msg = values[1];
122+
}
123+
}
124+
if (line.indexOf('#ID') >= 0) this.sendToEntry.msg_id = line;
125+
126+
index = this.receivedText.indexOf('\r');
127+
}
128+
}
129+
130+
setSocketData({ socketData, data }) {
131+
}
132+
133+
lostController() { }
134+
135+
disconnect(connect) {
136+
connect.close();
137+
this.sp = null;
138+
}
139+
140+
reset() {
141+
this.sp = null;
142+
this.sendBuffer = [];
143+
this.receivedText = "";
144+
}
145+
}
146+
147+
module.exports = new AsomeKit();

app/modules/asomekit.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"id": "320201",
3+
"name": {
4+
"en": "AsomeKit",
5+
"ko": "AsomeKit"
6+
},
7+
"category": "robot",
8+
"platform": [
9+
"win32",
10+
"darwin"
11+
],
12+
"icon": "asomekit.png",
13+
"module": "asomekit.js",
14+
"driver": {
15+
"win32-ia32": "CP210x_VCP_Windows/CP210xVCPInstaller_x86.exe",
16+
"win32-x64": "CP210x_VCP_Windows/CP210xVCPInstaller_x64.exe",
17+
"darwin-x64": "Mac_OSX_VCP_Driver/SiLabsUSBDriverDisk.dmg"
18+
},
19+
"selectPort": true,
20+
"reconnect": true,
21+
"hardware": {
22+
"type": "serial",
23+
"control": "slave",
24+
"duration": 32,
25+
"vendor": "Silicon Labs",
26+
"baudRate": 115200,
27+
"lostTimer": 1000,
28+
"firmwarecheck": false
29+
}
30+
}

app/modules/asomekit.png

61.3 KB
Loading

0 commit comments

Comments
 (0)