|
17 | 17 | if target_name == "FRSKY_TX_R9M_VIA_STLINK_OLD_BOOTLOADER_DEPRECATED": |
18 | 18 | print("you are using the old bootloader, please update this will be removed soon") |
19 | 19 | env.AddPostAction("buildprog", opentx.gen_frsky) |
20 | | - elif "APLHA_900_TX" in target_name: |
21 | | - env.Replace(UPLOADCMD=upload_via_esp8266_backpack.on_upload) |
22 | | - elif "_R9M_" in target_name or "ES915TX" in target_name or "GHOST_2400_TX" in target_name or \ |
23 | | - "NAMIMNORC_VOYAGER" in target_name or "NAMIMNORC_FLASH" in target_name: |
| 20 | + |
| 21 | + # Check whether the target is using WIFI (backpack logger) upload |
| 22 | + elif "_WIFI" in target_name: |
| 23 | + # Generate 'firmware.elrs' file to be used for uploading (prio to bin file). |
| 24 | + # This enables support for OTA updates with the "overlay double" R9M module |
| 25 | + # bootloader. Bin file upload also requires the correct FLASH_OFFSET value |
| 26 | + # and that can be ignored when '.elrs' file is used. |
24 | 27 | env.AddPostAction("buildprog", opentx.gen_elrs) |
25 | 28 | env.AddPreAction("upload", opentx.gen_elrs) |
26 | | - if "WIFI" in target_name: |
27 | | - env.Replace(UPLOADCMD=upload_via_esp8266_backpack.on_upload) |
28 | | - else: |
29 | | - env.Replace(UPLOADCMD=stlink.on_upload) |
30 | | - elif "_STLINK" in target_name: |
31 | | - env.Replace(UPLOADCMD=stlink.on_upload) |
| 29 | + env.Replace(UPLOADCMD=upload_via_esp8266_backpack.on_upload) |
| 30 | + |
| 31 | + # Check whether the target is using FC passthrough upload (receivers) |
32 | 32 | elif "_BETAFLIGHTPASSTHROUGH" in target_name: |
33 | 33 | env.Replace(UPLOADCMD=UARTupload.on_upload) |
| 34 | + |
| 35 | + # Check whether the target is using DFU upload |
34 | 36 | elif "_DFU" in target_name: |
35 | 37 | board = env.BoardConfig() |
36 | 38 | # PIO's ststm32 forces stm32f103 to upload via maple_upload, |
37 | | - # but we really actually truly want dfu-util |
| 39 | + # but we really actually truly want dfu-util. |
38 | 40 | env.Replace(UPLOADER="dfu-util", UPLOADERFLAGS=["-d", "0483:df11", |
39 | 41 | "-s", "%s:leave" % board.get("upload.offset_address", "0x08001000"), |
40 | 42 | "-D"], UPLOADCMD='$UPLOADER $UPLOADERFLAGS "${SOURCE.get_abspath()}"') |
| 43 | + |
| 44 | + # Default to ST-Link uploading |
| 45 | + # Note: this target is also used to build 'firmware.elrs' binary |
| 46 | + # for handset flashing |
| 47 | + else: |
| 48 | + if "_TX_" in target_name: |
| 49 | + # Generate 'firmware.elrs' file for TX targets only |
| 50 | + env.AddPostAction("buildprog", opentx.gen_elrs) |
| 51 | + env.AddPreAction("upload", opentx.gen_elrs) |
| 52 | + env.Replace(UPLOADCMD=stlink.on_upload) |
| 53 | + |
41 | 54 | elif platform in ['espressif8266']: |
42 | 55 | env.AddPostAction("buildprog", esp_compress.compressFirmware) |
43 | 56 | env.AddPreAction("${BUILD_DIR}/spiffs.bin", |
|
0 commit comments