Class: Prremote::Commands::Install

Inherits:
Object
  • Object
show all
Defined in:
lib/prremote/commands/install.rb

Instance Method Summary collapse

Constructor Details

#initialize(version: RUNTIME_VERSION) ⇒ Install

Returns a new instance of Install.



6
7
8
# File 'lib/prremote/commands/install.rb', line 6

def initialize(version: RUNTIME_VERSION)
  @version = version
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/prremote/commands/install.rb', line 10

def call
  uf2_path = RuntimeManager.fetch(@version)

  puts 'Put the Pico W into BOOTSEL mode:'
  puts '  1. Hold the BOOTSEL button'
  puts '  2. Connect USB (or press RUN while holding BOOTSEL)'
  puts '  3. Release BOOTSEL — RPI-RP2 should appear as a USB drive'
  puts
  puts 'Waiting for RPI-RP2...'

  volume = wait_for_volume
  puts "Copying firmware to #{volume}..."
  FileUtils.cp(uf2_path, File.join(volume, File.basename(uf2_path)))

  puts 'Waiting for device to reboot...'
  wait_for_unmount(volume)

  puts "Done. Runtime #{@version} installed."
end