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

feat(pico): update SDK to v2.0.0 #181

Merged
merged 2 commits into from
Nov 10, 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
7 changes: 3 additions & 4 deletions src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Device } from '../types'
import setupEjectfix from '../toolbox/setup/ejectfix'
import { DEVICE_ALIAS } from '../toolbox/prompt/devices'
import { MODDABLE_REPO } from '../toolbox/setup/constants'
import type { SetupArgs, PlatformSetupArgs } from '../toolbox/setup/types'
import type { SetupArgs } from '../toolbox/setup/types'

interface SetupOptions {
device?: Device
Expand All @@ -28,7 +28,7 @@ const command = buildCommand({
targetBranch = 'latest-release',
sourceRepo = MODDABLE_REPO,
} = flags
let target: Device = device ?? currentPlatform
let target: Device = device ?? DEVICE_ALIAS[currentPlatform]

if (device === undefined && listDevices) {
const choices = [
Expand Down Expand Up @@ -72,8 +72,7 @@ const command = buildCommand({
'lin',
'linux',
]
const setup: (args: SetupArgs | PlatformSetupArgs) => Promise<void> =
await import(`../commands/setup.ts/${target}`)
const { default: setup } = await import(`../toolbox/setup/${target}`)
if (platformDevices.includes(target)) {
await setup({ targetBranch, sourceRepo })
} else {
Expand Down
7 changes: 5 additions & 2 deletions src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ const command = buildCommand({
},
async func(this: LocalContext, flags: UpdateOptions) {
const currentPlatform: Device = platformType().toLowerCase() as Device
const { device = currentPlatform, targetBranch = 'latest-release' } = flags
const update = await import(`../toolbox/update/${device}`)
const {
device = DEVICE_ALIAS[currentPlatform],
targetBranch = 'latest-release',
} = flags
const { default: update } = await import(`../toolbox/update/${device}`)
await update({ targetBranch })
},
parameters: {
Expand Down
2 changes: 1 addition & 1 deletion src/toolbox/prompt/devices.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Device } from '../../types'

export const DEVICE_ALIAS: Record<Device | 'esp8266', string> = Object.freeze({
export const DEVICE_ALIAS: Record<Device | 'esp8266', Device> = Object.freeze({
esp8266: 'esp',
darwin: 'mac',
mac: 'mac',
Expand Down
2 changes: 1 addition & 1 deletion src/toolbox/setup/pico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { sourceEnvironment } from '../system/exec'

export default async function (): Promise<void> {
const OS = platformType().toLowerCase()
const PICO_BRANCH = '1.5.0'
const PICO_BRANCH = '2.0.0'
const PICO_SDK_REPO = 'https://github.com/raspberrypi/pico-sdk'
const PICO_EXTRAS_REPO = 'https://github.com/raspberrypi/pico-extras'
const PICO_EXAMPLES_REPO = 'https://github.com/raspberrypi/pico-examples'
Expand Down
2 changes: 1 addition & 1 deletion src/toolbox/update/pico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { sourceEnvironment } from '../system/exec'

export default async function (): Promise<void> {
const OS = platformType().toLowerCase()
const PICO_BRANCH = '1.5.0'
const PICO_BRANCH = '2.0.0'
const PICO_EXTRAS_REPO = 'https://github.com/raspberrypi/pico-extras'
const PICO_ROOT =
process.env.PICO_ROOT ?? filesystem.resolve(INSTALL_DIR, 'pico')
Expand Down