Skip to content

Commit

Permalink
Merge pull request #113 from pkendall64/master
Browse files Browse the repository at this point in the history
All C3 targets should be at least 3.5.0
  • Loading branch information
JyeSmith authored Oct 14, 2024
2 parents 632fe08 + 694eee4 commit 0c77ba1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
21 changes: 17 additions & 4 deletions .github/targets_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,21 @@ def validate_esp(vendor, type, devname, device):
# could validate overlay
if 'prior_target_name' not in device:
warn(f'device "{vendor}.{type}.{devname}" should have a "prior_target_name" child element')

# Validate the platform matches the firmware file
if device['platform'] == 'esp32-c3':
if device['min_version'] < '3.5':
error(f'device "{vendor}.{type}.{devname}" "min_version" must be at least 3.5.0')
if '_ESP32C3_' not in device['firmware']:
error(f'device "{vendor}.{type}.{devname}" firmware and platform MUST match')
if device['platform'] == 'esp32-s3':
if '_ESP32S3_' not in device['firmware']:
error(f'device "{vendor}.{type}.{devname}" firmware and platform MUST match')
if device['platform'] == 'esp32':
if '_ESP32_' not in device['firmware']:
error(f'device "{vendor}.{type}.{devname}" firmware and platform MUST match')
if device['platform'] == 'esp8285':
if '_ESP8285_' not in device['firmware']:
error(f'device "{vendor}.{type}.{devname}" firmware and platform MUST match')

def validate_esp32(vendor, type, devname, device):
for method in device['upload_methods']:
Expand Down Expand Up @@ -94,9 +108,9 @@ def validate_devices(vendor, type, devname, device):
firmware = device['firmware']
if len(firmwares) != 0 and firmware not in firmwares:
error(f'device "{vendor}.{type}.{devname}" has an invalid firmware file "{firmware}"')
elif (firmware.endswith('_TX') and 'tx_' not in type):
elif firmware.endswith('_TX') and 'tx_' not in type:
error(f'device "{vendor}.{type}.{devname}" has an invalid firmware file "{firmware}", it must be a TX target firmware')
elif (firmware.endswith('_RX') and 'rx_' not in type):
elif firmware.endswith('_RX') and 'rx_' not in type:
error(f'device "{vendor}.{type}.{devname}" has an invalid firmware file "{firmware}", it must be an RX target firmware')

if 'platform' not in device:
Expand Down Expand Up @@ -137,7 +151,6 @@ def validate_vendor(name, types):
args = parser.parse_args()
warnEnabled = args.warn

targets = {}
with open('targets.json') as f:
targets = json.load(f)

Expand Down
18 changes: 9 additions & 9 deletions targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"vbat_atten": 7
},
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_2400_RX"
}
Expand Down Expand Up @@ -976,7 +976,7 @@
"lua_name": "C3 2400RX",
"layout_file": "Generic C3 2400.json",
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_2400_RX"
},
Expand All @@ -985,7 +985,7 @@
"lua_name": "C3 2400 PA RX",
"layout_file": "Generic C3 2400 PA.json",
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_2400_RX"
},
Expand All @@ -994,7 +994,7 @@
"lua_name": "C3 TD 2400RX",
"layout_file": "Generic C3 2400 True Diversity.json",
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_2400_RX"
},
Expand All @@ -1003,7 +1003,7 @@
"lua_name": "C3 PWM 2400RX",
"layout_file": "Generic C3 2400 PWM.json",
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_2400_RX"
},
Expand Down Expand Up @@ -1187,7 +1187,7 @@
"lua_name": "C3 GemX RX",
"layout_file": "Generic C3 LR1121 True Diversity.json",
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_LR1121_RX"
},
Expand All @@ -1196,7 +1196,7 @@
"lua_name": "C3 LR1121 RX",
"layout_file": "Generic C3 LR1121.json",
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_LR1121_RX"
},
Expand All @@ -1205,7 +1205,7 @@
"lua_name": "C3 LR1121 PWM RX",
"layout_file": "Generic C3 LR1121 PWM.json",
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_LR1121_RX"
}
Expand Down Expand Up @@ -2000,7 +2000,7 @@
"vbat_scale": 396
},
"upload_methods": ["uart", "wifi", "betaflight"],
"min_version": "3.4.0",
"min_version": "3.5.0",
"platform": "esp32-c3",
"firmware": "Unified_ESP32C3_2400_RX"
}
Expand Down

0 comments on commit 0c77ba1

Please sign in to comment.