Skip to content

Commit

Permalink
dfu supports validation just affects gen 2
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomontero committed Oct 16, 2023
1 parent 0512001 commit e8a2a3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/flash-helper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const _ = require('lodash');
const usbUtils = require('../cmd/usb-util');
const deviceConstants = require('@particle/device-constants');
const { delay } = require('./utilities');
const { PLATFORMS } =require('./platform');
const { PLATFORMS, platformForId } =require('./platform');
const { moduleTypeToString, sortBinariesByDependency } = require('./dependency-walker');
const { HalModuleParser: ModuleParser, ModuleInfo } = require('binary-version-reader');
const path = require('path');
Expand Down Expand Up @@ -279,7 +280,8 @@ async function createFlashSteps({ modules, isInDfuMode, factory, platformId }) {
}

function validateDFUSupport({ device, ui }) {
if (!device.isInDfuMode && (!semver.valid(device.firmwareVersion) || semver.lt(device.firmwareVersion, '2.0.0'))) {
const platform = platformForId(device._info.id);
if (!device.isInDfuMode && (!semver.valid(device.firmwareVersion) || semver.lt(device.firmwareVersion, '2.0.0')) && platform.generation === 2) {
ui.logDFUModeRequired({ showVersionWarning: true });
throw new Error('Put the device in DFU mode and try again');
}
Expand Down

0 comments on commit e8a2a3b

Please sign in to comment.