Parse CLI args, validate modes, build JSON-RPC command list. Pure computation — no hardware I/O. Returns RunContext on success, int exit code on validation failure.
(args: Args)
| 169 | |
| 170 | |
| 171 | def _parse_args_and_build_commands(args: Args) -> RunContext | int: |
| 172 | """Parse CLI args, validate modes, build JSON-RPC command list. |
| 173 | |
| 174 | Pure computation — no hardware I/O. |
| 175 | Returns RunContext on success, int exit code on validation failure. |
| 176 | """ |
| 177 | final_environment = args.environment_positional or args.environment |
| 178 | |
| 179 | if args.lcd and not final_environment: |
| 180 | final_environment = "esp32s3" |
| 181 | print( |
| 182 | "\u2139\ufe0f --lcd flag requires ESP32-S3, auto-selecting 'esp32s3' environment" |
| 183 | ) |
| 184 | |
| 185 | if args.lcd_spi and not final_environment: |
| 186 | final_environment = "esp32s3" |
| 187 | print( |
| 188 | "\u2139\ufe0f --lcd-spi flag requires ESP32-S3, auto-selecting 'esp32s3' environment" |
| 189 | ) |
| 190 | |
| 191 | if args.lcd_rgb and not final_environment: |
| 192 | final_environment = "esp32p4" |
| 193 | print( |
| 194 | "\u2139\ufe0f --lcd-rgb flag requires ESP32-P4, auto-selecting 'esp32p4' environment" |
| 195 | ) |
| 196 | |
| 197 | # Driver selection |
| 198 | drivers: list[str] = [] |
| 199 | simd_test_mode = args.simd |
| 200 | coroutine_test_mode = args.coroutine |
| 201 | |
| 202 | if args.all: |
| 203 | drivers = [ |
| 204 | "PARLIO", |
| 205 | "RMT", |
| 206 | "SPI", |
| 207 | "UART", |
| 208 | "LCD_CLOCKLESS", |
| 209 | "LCD_SPI", |
| 210 | "LCD_RGB", |
| 211 | "OBJECT_FLED", |
| 212 | "FLEX_IO", |
| 213 | "LPUART", |
| 214 | ] |
| 215 | else: |
| 216 | if args.parlio: |
| 217 | drivers.append("PARLIO") |
| 218 | if args.rmt: |
| 219 | drivers.append("RMT") |
| 220 | if args.spi: |
| 221 | drivers.append("SPI") |
| 222 | if args.uart: |
| 223 | drivers.append("UART") |
| 224 | if args.lcd: |
| 225 | drivers.append("LCD_CLOCKLESS") |
| 226 | if args.lcd_spi: |
| 227 | drivers.append("LCD_SPI") |
| 228 | if args.lcd_rgb: |