Skip to content

Commit 601622a

Browse files
committed
FW 0.6.0 compat
1 parent 2cde135 commit 601622a

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

gulpfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ gulp.task('electron-copy', ['sass', 'scripts'], function() {
132132
'node_modules/intel-hex/**/*',
133133
'node_modules/electron-squirrel-startup/**/*',
134134
'node_modules/chip.avr.avr109/**/*',
135+
'node_modules/semver/**/*',
135136
];
136137

137138

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"electron-squirrel-startup": "^0.1.4",
3939
"intel-hex": "^0.1.1",
4040
"noble": "^1.1.0",
41+
"semver": "^5.1.0",
4142
"serialport": "^2.0.6"
4243
}
4344
}

www/js/app/services/HardwareService.js

+24-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ angular.module('cbt')
1717
USB:'usb',
1818
BT:'bt'
1919
},
20+
semver = require('semver'),
2021
hardwareInfo = {version:'0.4.0'};
2122

2223

@@ -44,7 +45,6 @@ angular.module('cbt')
4445

4546

4647

47-
4848
/*
4949
* Enable/Disable hardware search
5050
* @param {Boolean} b
@@ -325,6 +325,29 @@ angular.module('cbt')
325325

326326
function setHardwareInfo(obj){
327327
hardwareInfo = obj;
328+
updateCommands();
329+
}
330+
331+
332+
/*
333+
* Update command array for various firmware versions
334+
*/
335+
336+
function updateCommands(){
337+
338+
switch(true){
339+
case semver.satisfies(hardwareInfo.version, '>=0.6.0'):
340+
commands.bus1logOn = [0x03, 0x01, 0x02];
341+
commands.bus2logOn = [0x03, 0x02, 0x02];
342+
commands.bus3logOn = [0x03, 0x03, 0x02];
343+
break;
344+
case semver.satisfies(hardwareInfo.version, '<0.6.0'):
345+
commands.bus1logOn = [0x03, 0x01, 0x01];
346+
commands.bus2logOn = [0x03, 0x02, 0x01];
347+
commands.bus3logOn = [0x03, 0x03, 0x01];
348+
break;
349+
}
350+
328351
}
329352

330353

www/js/scripts.js

+26-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ autoUpdater.on('update-downloaded', function(event, releaseNotes, releaseName, r
2121
quitAndUpdate();
2222
console.log('Notification clicked')
2323
}
24-
2524
// quitAndUpdate();
2625
});
2726

@@ -3508,6 +3507,7 @@ angular.module('cbt')
35083507
USB:'usb',
35093508
BT:'bt'
35103509
},
3510+
semver = require('semver'),
35113511
hardwareInfo = {version:'0.4.0'};
35123512

35133513

@@ -3535,7 +3535,6 @@ angular.module('cbt')
35353535

35363536

35373537

3538-
35393538
/*
35403539
* Enable/Disable hardware search
35413540
* @param {Boolean} b
@@ -3816,6 +3815,31 @@ angular.module('cbt')
38163815

38173816
function setHardwareInfo(obj){
38183817
hardwareInfo = obj;
3818+
updateCommands();
3819+
}
3820+
3821+
3822+
/*
3823+
* Update command array for various firmware versions
3824+
*/
3825+
3826+
function updateCommands(){
3827+
3828+
switch(true){
3829+
case semver.satisfies(hardwareInfo.version, '>=0.6.0'):
3830+
commands.bus1logOn = [0x03, 0x01, 0x02];
3831+
commands.bus2logOn = [0x03, 0x02, 0x02];
3832+
commands.bus3logOn = [0x03, 0x03, 0x02];
3833+
break;
3834+
case semver.satisfies(hardwareInfo.version, '<0.6.0'):
3835+
commands.bus1logOn = [0x03, 0x01, 0x01];
3836+
commands.bus2logOn = [0x03, 0x02, 0x01];
3837+
commands.bus3logOn = [0x03, 0x03, 0x01];
3838+
break;
3839+
}
3840+
3841+
console.log(commands);
3842+
38193843
}
38203844

38213845

0 commit comments

Comments
 (0)