MCPcopy Create free account
hub / github.com/FastLED/FastLED / deploy

Method deploy

ci/compiler/pio.py:1068–1212  ·  view source on GitHub ↗

Deploy (upload) a specific example to the target device. Args: example: Name of the example to deploy upload_port: Optional specific port for upload (e.g., "/dev/ttyUSB0", "COM3") monitor: If True, attach to device monitor after successful upload

(
        self, example: str, upload_port: Optional[str] = None, monitor: bool = False
    )

Source from the content-addressed store, hash-verified

1066 print(f"✅ No global core directory found for {self.board.board_name}")
1067
1068 def deploy(
1069 self, example: str, upload_port: Optional[str] = None, monitor: bool = False
1070 ) -> SketchResult:
1071 """Deploy (upload) a specific example to the target device.
1072
1073 Args:
1074 example: Name of the example to deploy
1075 upload_port: Optional specific port for upload (e.g., "/dev/ttyUSB0", "COM3")
1076 monitor: If True, attach to device monitor after successful upload
1077 """
1078 print(f"Deploying {example} to {self.board.board_name}...")
1079
1080 try:
1081 # Ensure the build is initialized and the example is built
1082 if not self.initialized:
1083 init_result = self._internal_init_build_no_lock(example)
1084 if not init_result.success:
1085 return SketchResult(
1086 success=False,
1087 output=init_result.output,
1088 build_dir=init_result.build_dir,
1089 example=example,
1090 )
1091 else:
1092 # Build the example first (ensures it's up to date)
1093 build_result = self._build_internal(example)
1094 if not build_result.success:
1095 return build_result
1096
1097 # Run PlatformIO upload command
1098 upload_cmd: list[str] = [
1099 "pio",
1100 "run",
1101 "--project-dir",
1102 str(self.build_dir),
1103 "--target",
1104 "upload",
1105 ]
1106
1107 if upload_port:
1108 upload_cmd.extend(["--upload-port", upload_port])
1109
1110 if self.verbose:
1111 upload_cmd.append("--verbose")
1112
1113 print(f"Running upload command: {subprocess.list2cmdline(upload_cmd)}")
1114
1115 # Create formatter for upload output
1116 formatter = create_sketch_path_formatter(example)
1117
1118 running_process = RunningProcess(
1119 upload_cmd,
1120 cwd=self.build_dir,
1121 auto_run=True,
1122 output_formatter=formatter,
1123 env=get_pio_execution_env(),
1124 )
1125 try:

Callers 2

fbuild_build_and_uploadFunction · 0.45
run_fbuild_uploadFunction · 0.45

Calls 10

_build_internalMethod · 0.95
SketchResultClass · 0.90
get_pio_execution_envFunction · 0.90
terminateMethod · 0.80
printFunction · 0.50
appendMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected