Skip to content

Commit

Permalink
Merge pull request #650 from entrylabs/develop-hw
Browse files Browse the repository at this point in the history
1.9.44 버전업
  • Loading branch information
Tnks2U authored Jul 26, 2023
2 parents 95020df + b41305d commit 4acc388
Show file tree
Hide file tree
Showing 11 changed files with 1,283 additions and 1,121 deletions.
Binary file added app/firmwares/DynamixelCsDll.dll
Binary file not shown.
Binary file added app/firmwares/OpenCM7.0.bin
Binary file not shown.
2,250 changes: 1,138 additions & 1,112 deletions app/firmwares/dalgona.hex

Large diffs are not rendered by default.

Binary file added app/firmwares/opencm7Dfu.exe
Binary file not shown.
17 changes: 11 additions & 6 deletions app/modules/dalgona.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
"module": "dalgona.js",
"url": "https://dalgonaedu.co.kr/",
"email": "[email protected]",
"driver": {
"win32-ia32": "ftdi/dpinst-x86.exe",
"win32-x64": "ftdi/dpinst-amd64.exe",
"darwin-x64": "https://entrylabs.github.io/docs/files/drivers/FTDIUSBSerial/FTDIUSBSerial.pkg"
},
"driver": [{
"win32-ia32": "ftdi/dpinst-x86.exe",
"win32-x64": "ftdi/dpinst-amd64.exe",
"translate" : "FTDI 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",
"translate" : "CH340 Driver"
}],
"selectPort": true,
"reconnect": true,
"firmware": "dalgona",
Expand All @@ -26,4 +31,4 @@
"baudRate": 115200,
"firmwarecheck": false
}
}
}
8 changes: 8 additions & 0 deletions app/modules/robotis_openCM70EDU.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
"win32-x64": "ROBOTIS/ROBOTIS CDC Driver.bat"
},
"selectPort" : true,
"firmware": {
"type": "opencm7",
"offset": "0x8004000",
"name": "OpenCM7.0",
"translate" : "실과로봇 펌웨어 업데이트",
"latest_version": 21
},
"firmwareBaudRate": 57600,
"hardware": {
"type": "serial",
"control": "slave",
Expand Down
98 changes: 98 additions & 0 deletions app/src/main/core/serial/flasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,102 @@ class Flasher {
});
}

private _flashOpenCM7(
firmware: IOpenCM7TypeFirmware,
port: string,
options: {
baudRate?: number;
MCUType?: string;
}
): Promise<any[]> {
return new Promise((resolve) => {
const cmd = [
'opencm7Dfu.exe',
' opencm7',
` ${port}`,
` ${firmware.name}.bin`,
].join('');

logger.info(`OpenCM7.0 board firmware requested.\nparameter is ${cmd}`);
try {
this.flasherProcess = exec(
cmd,
{
cwd: directoryPaths.firmware(),
},
(...args) => {
resolve(args);
}
).on('exit', code => {
if (code != null)
{
if (code > 2147483647)
{
code = code - 4294967296;
}
}
console.log('final exit code is', code);
}
);
}
catch (error) {

}
});
}

checkOpenCM7Version(
port: string,
latest_version: number,
): Promise<any[]> {
return new Promise((resolve) => {
const cmd = [
'opencm7Dfu.exe',
' opencm7',
` ${port}`,
' version',
].join('');

logger.info(`Read OpenCM7.0 board firmware version.\nparameter is ${cmd}`);
try {
this.flasherProcess = exec(
cmd,
{
cwd: directoryPaths.firmware(),
},
(...args) => {
resolve(args);
}
).on('exit', code => {
if (code != null)
{
console.log('code is', code);
if (code > 2147483647)
{
code = code - 4294967296;
}
}
if (code)
{
if (code < latest_version)
{
dialog.showMessageBox({
type: 'info',
title: `펌웨어 업데이트 안내 (v${latest_version})`,
message: '새로운 펌웨어가 배포되었습니다.\n펌웨어를 업데이트 해주세요.\nNew firmware is available.\nPlease update the firmware.\n'
});
}
}
console.log('final exit code is', code);
}
);
}
catch (error) {

}
});
}

flash(
firmware: IFirmwareInfo,
port: string,
Expand All @@ -149,6 +245,8 @@ class Flasher {
return this._flashCopy(firmware as ICopyTypeFirmware);
} else if ((firmware as IESP32TypeFirmware).type === 'esp32') {
return this._flashESP(firmware as IESP32TypeFirmware, port, options);
} else if ((firmware as IOpenCM7TypeFirmware).type === 'opencm7') {
return this._flashOpenCM7(firmware as IOpenCM7TypeFirmware, port, options);
} else {
return Promise.reject(new Error());
}
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/core/serial/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {CloudModeTypes} from '../../../common/constants';
import BaseScanner from '../baseScanner';
import SerialConnector from './connector';
import createLogger from '../../electron/functions/createLogger';
import Flasher from './flasher';

const logger = createLogger('core/SerialScanner.ts');

Expand All @@ -18,6 +19,7 @@ const logger = createLogger('core/SerialScanner.ts');
*/
class SerialScanner extends BaseScanner<SerialConnector> {
private isScanning = false;
private flasher = new Flasher();

static get SCAN_INTERVAL_MILLS() {
return 1500;
Expand Down Expand Up @@ -100,6 +102,20 @@ class SerialScanner extends BaseScanner<SerialConnector> {
return;
}


const firmware = this.config.firmware;

if (firmware)
{
if ((firmware as IOpenCM7TypeFirmware).type === 'opencm7')
{
if (selectedPorts[0] != null)
{
await this.flasher.checkOpenCM7Version(selectedPorts[0], (this.config.firmware as IOpenCM7TypeFirmware).latest_version);
}
}
}

const electedConnector = await electPort(selectedPorts, hardware, this.hwModule,
(connector) => {
if (this.config && this.config.firmware) {
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.43"
!define PRODUCT_VERSION "1.9.44"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "https://www.playentry.org/"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "entry-hw",
"version": "1.9.43",
"version": "1.9.44",
"description": "엔트리 하드웨어 연결 프로그램",
"author": "EntryLabs",
"main": "./app/src/index.bundle.js",
Expand Down
11 changes: 10 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ declare type IESP32TypeFirmware = {
afterDelay?: number;
translate?: string;
};
declare type IOpenCM7TypeFirmware = {
type: string;
offset: string;
name: string;
latest_version: number;
afterDelay?: number;
translate?: string;
};
declare type IFirmwareInfo =
| string
| [{ name: string; translate: string }]
| ICopyTypeFirmware
| IESP32TypeFirmware;
| IESP32TypeFirmware
| IOpenCM7TypeFirmware;
declare type ICustomButtonInfo =
| string
| { key: string; translate: string }
Expand Down

0 comments on commit 4acc388

Please sign in to comment.