Skip to content

Commit

Permalink
feat(esp32): update esp-idf version to support latest Moddable SDK (#156
Browse files Browse the repository at this point in the history
)
  • Loading branch information
HipsterBrown committed Jan 4, 2024
1 parent 8a07669 commit 11c9ff5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/toolbox/setup/esp32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function(): Promise<void> {
const isWindows = OS === "windows_nt"
const ESP_IDF_REPO = 'https://github.com/espressif/esp-idf.git'
const ESP_BRANCH_V4 = 'v4.4.3'
const ESP_BRANCH_V5 = 'v5.1.1'
const ESP_BRANCH_V5 = 'v5.1.2'
const ESP32_DIR = filesystem.resolve(INSTALL_DIR, 'esp32')
const IDF_PATH = filesystem.resolve(ESP32_DIR, 'esp-idf')

Expand Down
8 changes: 7 additions & 1 deletion src/toolbox/update/esp32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { sourceEnvironment } from '../system/exec'
export default async function(): Promise<void> {
const OS = platformType().toLowerCase()
const ESP_BRANCH_V4 = 'v4.4.3'
const ESP_BRANCH_V5 = 'v5.1.1'
const ESP_BRANCH_V5 = 'v5.1.2'
const ESP32_DIR = filesystem.resolve(INSTALL_DIR, 'esp32')
const IDF_PATH = filesystem.resolve(ESP32_DIR, 'esp-idf')

Expand Down Expand Up @@ -44,6 +44,12 @@ export default async function(): Promise<void> {
spinner.start('Updating esp-idf repo')
const moddableVersion = await getModdableVersion() ?? ''
const branch = (moddableVersion.includes("branch") || semver.satisfies(moddableVersion ?? '', '>= 4.2.x')) ? ESP_BRANCH_V5 : ESP_BRANCH_V4

if (branch === ESP_BRANCH_V5 && !semver.satisfies(moddableVersion ?? '', '>= 4.3.8')) {
spinner.fail('Latest Moddable SDK is required before updating ESP-IDF. Run `xs-dev update` before trying again.')
process.exit(1)
}

await system.spawn(`git fetch --all --tags`, { cwd: IDF_PATH })
await system.spawn(`git checkout ${branch}`, { cwd: IDF_PATH })
await system.spawn(`git submodule update --init --recursive`, {
Expand Down

0 comments on commit 11c9ff5

Please sign in to comment.