Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.9.58 PR #773

Merged
merged 20 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,413 changes: 1,413 additions & 0 deletions app/firmwares/alux_nemo.hex

Large diffs are not rendered by default.

673 changes: 323 additions & 350 deletions app/modules/ProboConnect.js

Large diffs are not rendered by default.

727 changes: 727 additions & 0 deletions app/modules/alux_nemo.js

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions app/modules/alux_nemo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"id": "630101",
"name": {
"en": "NEMO",
"ko": "네모"
},
"category": "module",
"platform": ["win32", "darwin"],
"icon": "alux_nemo.png",
"module": "alux_nemo.js",
"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"
},
"url": "https://www.aluxonline.com/",
"firmware": "alux_nemo",
"firmwareBaudRate": 115200,
"email": "[email protected]",
"reconnect": true,
"selectPort": true,
"hardware": {
"type": "serial",
"control": "slave",
"duration": 50,
"vendor": "wch.cn",
"baudRate": 115200,
"lostTimer": 1000,
"softwareReset": false,
"firmwarecheck": false
}
}
Binary file added app/modules/alux_nemo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
263 changes: 141 additions & 122 deletions app/modules/choco.js

Large diffs are not rendered by default.

263 changes: 141 additions & 122 deletions app/modules/choco2.js

Large diffs are not rendered by default.

98 changes: 78 additions & 20 deletions app/modules/neo_cannon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function Module() {
this.tx_max_len = 14;
this.tx_max_len = 68;
this.tx_data = new Array(this.tx_max_len);
this.PIXEL_NUM = 18;

this.sensor_data = {
vibe: 0,
Expand All @@ -16,6 +17,26 @@ function Module() {
d9: 0,
d10: 0,
angle_state: 0,
neopixel: [
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
{ r: 0, g: 0, b: 0 },
],
};

this.sensorValueSize = {
Expand All @@ -38,53 +59,55 @@ const NEOCANNON = {
D9: 'd9',
D10: 'd10',
ANGLE_STATE: 'angleState',
NEOPIXEL: 'neopixel',
};

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

Module.prototype.setSerialPort = function(sp) {
Module.prototype.setSerialPort = function (sp) {
this.sp = sp;
};

Module.prototype.requestInitialData = function() {
Module.prototype.requestInitialData = function () {
const txData = this.tx_data;
const dataLen = this.tx_max_len;
txData[0] = 0xff;
txData[1] = 0x0e;
txData[1] = 0x44;
txData[2] = 0x01;
txData[3] = 0x03;
for (let i = 4; i < this.tx_max_len - 2; i++) {
for (let i = 4; i < dataLen - 2; i++) {
txData[i] = 0;
}
txData[12] = 0x4;
txData[13] = 0xa;
txData[dataLen - 2] = 0x4;
txData[dataLen - 1] = 0xa;
return txData;
};

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

Module.prototype.afterConnect = function(that, cb) {
Module.prototype.afterConnect = function (that, cb) {
that.connected = true;
if (cb) {
cb('connected');
}
};

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

/* 엔트리HW -> 엔트리JS */
Module.prototype.requestRemoteData = function(handler) {
Module.prototype.requestRemoteData = function (handler) {
const sensorData = this.sensor_data;
for (const key in sensorData) {
handler.write(key, sensorData[key]);
}
};

/** 엔트리JS -> 엔트리HW */
Module.prototype.handleRemoteData = function(handler) {
Module.prototype.handleRemoteData = function (handler) {
const workerData = this.worker_data;
let newValue;

Expand Down Expand Up @@ -136,18 +159,46 @@ Module.prototype.handleRemoteData = function(handler) {
workerData.angle_state = newValue;
}

if (handler.e(NEOCANNON.NEOPIXEL)) {
newValue = handler.read(NEOCANNON.NEOPIXEL);
if (newValue.data) {
const red = newValue.data.red;
const green = newValue.data.green;
const blue = newValue.data.blue;

if (newValue.data.num !== undefined) {
const num = newValue.data.num;
workerData.neopixel[num].r = red;
workerData.neopixel[num].g = green;
workerData.neopixel[num].b = blue;
} else {
for (let i = 0; i < this.PIXEL_NUM; i++) {
workerData.neopixel[i].r = red;
workerData.neopixel[i].g = green;
workerData.neopixel[i].b = blue;
}
}
} else {
for (let i = 0; i < this.PIXEL_NUM; i++) {
workerData.neopixel[i].r = 0;
workerData.neopixel[i].g = 0;
workerData.neopixel[i].b = 0;
}
}
}

this.worker_data = workerData;
};

/* 엔트리HW -> 교구 */
Module.prototype.requestLocalData = function() {
Module.prototype.requestLocalData = function () {
const workerData = this.worker_data;
const txData = this.tx_data;
let checkSum = 0;
const dataLen = txData.length;

txData[0] = 0xff;
txData[1] = 0x0e;
txData[1] = 0x44;
txData[2] = 0x01;
txData[3] = 0x03;
txData[4] = workerData.buz_octave;
Expand All @@ -158,7 +209,14 @@ Module.prototype.requestLocalData = function() {
txData[9] = workerData.d9;
txData[10] = workerData.d10;
txData[11] = workerData.angle_state;
txData[13] = 0xa;

for (let i = 0; i < this.PIXEL_NUM; i++) {
txData[i * 3 + 12] = workerData.neopixel[i].r;
txData[i * 3 + 13] = workerData.neopixel[i].g;
txData[i * 3 + 14] = workerData.neopixel[i].b;
}

txData[dataLen - 1] = 0xa;

for (let i = 2; i < dataLen - 2; i++) {
checkSum += txData[i];
Expand All @@ -171,7 +229,7 @@ Module.prototype.requestLocalData = function() {
};

/* 교구 -> 엔트리HW */
Module.prototype.handleLocalData = function(data) {
Module.prototype.handleLocalData = function (data) {
const datas = this.getDataByBuffer(data);
const sensorData = this.sensor_data;

Expand Down Expand Up @@ -199,7 +257,7 @@ Module.prototype.handleLocalData = function(data) {
this.sensor_data = sensorData;
};

Module.prototype.getDataByBuffer = function(buffer) {
Module.prototype.getDataByBuffer = function (buffer) {
const datas = [];
let lastIndex = 0;
buffer.forEach((value, idx) => {
Expand All @@ -211,14 +269,14 @@ Module.prototype.getDataByBuffer = function(buffer) {
return datas;
};

Module.prototype.disconnect = function(connect) {
Module.prototype.disconnect = function (connect) {
connect.close();
if (this.sp) {
delete this.sp;
}
};

Module.prototype.reset = function() {
Module.prototype.reset = function () {
this.lastTime = 0;
this.lastSendTime = 0;
};
Expand Down
92 changes: 52 additions & 40 deletions app/modules/robotis_RB100_practice.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,29 +569,40 @@ Module.prototype.handleLocalData = function(data) { // data: Native Buffer
}
}

const dxlPositionStartAddr =
addrMap[addrMap.length - 1][0] + addrMap[addrMap.length - 1][1];

// DXL Position
for (let i = 0; i < 20; i++) {
const currentId = rxPacket.data[2 + 83 + (3 * i)];
const currentPos = rxPacket.data[2 + 83 + (3 * i) + 1] +
(rxPacket.data[2 + 83 + (3 * i) + 2] << 8);
if (currentId != 0xFF && currentPos != 0xFFFF) {
const currentId =
rxPacket.data[2 + dxlPositionStartAddr + 3 * i];
const currentPos =
rxPacket.data[2 + dxlPositionStartAddr + 3 * i + 1] +
(rxPacket.data[2 + dxlPositionStartAddr + 3 * i + 2] << 8);
if (currentId != 0xff && currentPos != 0xffff) {
this.dxlPositions[currentId] = currentPos;
}
}

const lineCategoryStartAddr = dxlPositionStartAddr + 3 * 20;

// line category
this.dataBuffer[5201] = rxPacket.data[2 + 143];

const sensorStartAddr = lineCategoryStartAddr + 1;

// 온습도+조도+동작감지센서값
this.pirPir[0] = rxPacket.data[2 + 144];
this.pirTemperature[0] = rxPacket.data[2 + 145];
this.pirHumidity[0] = rxPacket.data[2 + 146];
this.pirBrightness[0] = rxPacket.data[2 + 147];
this.pirPir[0] = rxPacket.data[2 + sensorStartAddr];
this.pirTemperature[0] = rxPacket.data[2 + sensorStartAddr + 1];
this.pirHumidity[0] = rxPacket.data[2 + sensorStartAddr + 2];
this.pirBrightness[0] = rxPacket.data[2 + sensorStartAddr + 3];

// 거리+버튼+조도센서값
this.distanceDistance[0] = rxPacket.data[2 + 148] + (rxPacket.data[2 + 149] << 8);
this.distanceButton[0] = rxPacket.data[2 + 150];
this.distanceBrightness[0] = rxPacket.data[2 + 151];
this.distanceDistance[0] =
rxPacket.data[2 + sensorStartAddr + 4] +
(rxPacket.data[2 + sensorStartAddr + 5] << 8);
this.distanceButton[0] = rxPacket.data[2 + sensorStartAddr + 6];
this.distanceBrightness[0] = rxPacket.data[2 + sensorStartAddr + 7];

for (let i = 0; i < addrMap2.length; i++) {
switch (addrMap2[i][1]) {
Expand Down Expand Up @@ -842,39 +853,40 @@ const addrMap = [
[69,8,502],
[77,1,700],
[78,1,810],
[79,1,5015],
[80,1,5030],
[81,1,5031],
[82,1,5040],
[79,1,2134],
[80,1,5015],
[81,1,5030],
[82,1,5031],
[83,1,5040],
];


const addrMap2 = [
[152,1,4000],
[153,2,4003],
[155,1,4005],
[156,1,4006],
[157,2,4009],
[159,2,4011],
[161,2,4013],
[163,2,4015],
[165,2,4017],
[167,2,4019],
[169,2,4021],
[171,2,4023],
[173,2,4025],
[175,2,4027],
[177,1,4031],
[178,1,4032],
[179,1,4033],
[180,2,4036],
[182,2,4038],
[184,2,4040],
[186,2,4042],
[188,2,4044],
[190,2,4046],
[192,2,4048],
[194,2,4050],
[153,1,4000],
[154,2,4003],
[156,1,4005],
[157,1,4006],
[158,2,4009],
[160,2,4011],
[162,2,4013],
[164,2,4015],
[166,2,4017],
[168,2,4019],
[170,2,4021],
[172,2,4023],
[174,2,4025],
[176,2,4027],
[178,1,4031],
[179,1,4032],
[180,1,4033],
[181,2,4036],
[183,2,4038],
[185,2,4040],
[187,2,4042],
[189,2,4044],
[191,2,4046],
[193,2,4048],
[195,2,4050],
];

//const rxPacket = Object.assign({}, packet);
Expand Down
Binary file modified app/server/mac/server.txt
Binary file not shown.
Binary file modified app/server/win/server.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions app/src/main/electron/serverProcessManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class ServerProcessManager {
this._sendToChild('addRoomId', roomId);
}

connectHardwareSuccess() {
this._sendToChild('connectHardwareSuccess');
connectHardwareSuccess(hardwareId: string) {
this._sendToChild('connectHardwareSuccess', hardwareId);
}

connectHardwareFailed() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/mainRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface IEntryServer {
setRouter: (router: MainRouter) => void;
open: () => void;
disconnectHardware: () => void;
connectHardwareSuccess: () => void;
connectHardwareSuccess: (hardwareId: String) => void;
connectHardwareFailed: () => void;
addRoomIdsOnSecondInstance: (roomId: string) => void;
send: (data: any) => void;
Expand Down Expand Up @@ -320,7 +320,7 @@ class MainRouter {
logger.verbose('entryServer, connector connection');
this.handler = new DataHandler(this.config.id);
this._connectToServer();
this.server.connectHardwareSuccess();
this.server.connectHardwareSuccess(this.config.id);
this.connector.connect(); // router 설정 후 실제 기기와의 통신 시작
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/entry-hw.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
!define PRODUCT_NAME "Entry_HW"
!define PROTOCOL_NAME "entryhw"
!define APP_NAME "Entry_HW.exe"
!define PRODUCT_VERSION "1.9.57"
!define PRODUCT_VERSION "1.9.58"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "https://www.playentry.org/"

Expand Down
Loading
Loading