Execute GPIO-only, special modes, or main RPC test loop. Returns exit code (0 = success, 1 = failure, 130 = interrupted).
(ctx: RunContext, qctx: QuietContext)
| 1225 | |
| 1226 | |
| 1227 | async def _run_tests_or_special_mode(ctx: RunContext, qctx: QuietContext) -> int: |
| 1228 | """Execute GPIO-only, special modes, or main RPC test loop. |
| 1229 | |
| 1230 | Returns exit code (0 = success, 1 = failure, 130 = interrupted). |
| 1231 | """ |
| 1232 | upload_port = ctx.upload_port |
| 1233 | assert upload_port is not None |
| 1234 | serial_iface = ctx.serial_iface |
| 1235 | use_fbuild = ctx.use_fbuild |
| 1236 | |
| 1237 | # Low-memory ARM bring-up mode short-circuit. LPC845/LPC804 boards run a |
| 1238 | # JSON-RPC echo verification (examples/AutoResearchLpc/) instead of the |
| 1239 | # GPIO + LED-protocol matrix that ESP32/Teensy targets use. Must come |
| 1240 | # BEFORE the gpio_only_mode early-return so the harness actually runs the |
| 1241 | # echo check instead of bailing with a "no tests requested" success. |
| 1242 | bring_up_envs = {"lpc845brk", "lpcxpresso845max", "lpcxpresso804"} |
| 1243 | if ctx.final_environment in bring_up_envs: |
| 1244 | # FastLED #3021 Phase 1: --pin-toggle-rx runs the SCT-RX |
| 1245 | # loopback bench instead of the default echo bring-up. |
| 1246 | if getattr(ctx.args, "pin_toggle_rx", False): |
| 1247 | return await _run_lpc_pin_toggle_rx_tests(ctx) |
| 1248 | # FastLED #3021 Phase 2: --ws2812-loopback runs the WS2812 |
| 1249 | # byte-match loopback bench. Requires the sketch to be |
| 1250 | # rebuilt with -DFASTLED_LPC_RX_SCT_WS2812=1 (gated due to |
| 1251 | # flash budget — see issue #3002). |
| 1252 | if getattr(ctx.args, "ws2812_loopback", False): |
| 1253 | return await _run_lpc_ws2812_loopback_tests(ctx) |
| 1254 | return await _run_bring_up_tests(ctx) |
| 1255 | |
| 1256 | # GPIO-only mode |
| 1257 | if ctx.gpio_only_mode: |
| 1258 | print() |
| 1259 | print("=" * 60) |
| 1260 | print(f"{Fore.GREEN}\u2713 GPIO-ONLY AUTORESEARCH SUCCEEDED{Style.RESET_ALL}") |
| 1261 | print("=" * 60) |
| 1262 | print("Pin discovery and GPIO connectivity pre-test passed.") |
| 1263 | print("No driver tests requested \u2014 skipping RPC test matrix.") |
| 1264 | print() |
| 1265 | return 0 |
| 1266 | |
| 1267 | # Fall back to loopback for no-WiFi platforms |
| 1268 | net_server_mode = ctx.net_server_mode |
| 1269 | net_client_mode = ctx.net_client_mode |
| 1270 | net_loopback_mode = ctx.net_loopback_mode |
| 1271 | |
| 1272 | if (net_server_mode or net_client_mode) and ctx.final_environment: |
| 1273 | if not environment_has_wifi(ctx.final_environment): |
| 1274 | mode_name = "--net-server" if net_server_mode else "--net-client" |
| 1275 | print( |
| 1276 | f"\n\u26a0\ufe0f {ctx.final_environment} does not have WiFi hardware" |
| 1277 | ) |
| 1278 | print(f" Falling back from {mode_name} to --net (loopback) mode") |
| 1279 | net_server_mode = False |
| 1280 | net_client_mode = False |
| 1281 | net_loopback_mode = True |
| 1282 | |
| 1283 | # Network mode |
| 1284 | if net_server_mode or net_client_mode: |