front: переход на новую схему конфигураций, удаление ЦЗС пароля в tdma, добавление firmware fpga version
This commit is contained in:
@@ -3,8 +3,30 @@ from jinja2 import Environment, FileSystemLoader
|
||||
import sys
|
||||
import os
|
||||
|
||||
with open('render-params.json') as f:
|
||||
GLOBAL_CONFIG = json.load(f)
|
||||
|
||||
CONFIG_DIR = "config"
|
||||
MODEM_TYPES = {}
|
||||
|
||||
for _fname in os.listdir(CONFIG_DIR):
|
||||
if not _fname.endswith(".json"):
|
||||
continue
|
||||
|
||||
path = os.path.join(CONFIG_DIR, _fname)
|
||||
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
except Exception as e:
|
||||
print(f"[WARN] Failed to read {path}: {e}")
|
||||
continue
|
||||
|
||||
modem_type = data.get("modem_type")
|
||||
if modem_type is None:
|
||||
print(f"[WARN] {_fname} ignored: no 'modem_type' field")
|
||||
continue
|
||||
|
||||
MODEM_TYPES[modem_type] = data
|
||||
|
||||
|
||||
|
||||
def extract_param_names(mc):
|
||||
@@ -78,10 +100,10 @@ def extract_param_groups(mc):
|
||||
|
||||
|
||||
def build_modem_env(modem):
|
||||
if modem not in GLOBAL_CONFIG['modem_types']:
|
||||
if modem not in MODEM_TYPES:
|
||||
raise RuntimeError(f"Modem '{modem}' is not exist in config!")
|
||||
|
||||
mc = GLOBAL_CONFIG['modem_types'][modem]
|
||||
mc = MODEM_TYPES[modem]
|
||||
|
||||
add_submit_widgets(mc['params'])
|
||||
|
||||
@@ -109,7 +131,7 @@ def render_modem(modem):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for mt in GLOBAL_CONFIG['modem_types']:
|
||||
for mt in MODEM_TYPES:
|
||||
print(f'Generating {mt} modem...')
|
||||
render_modem(mt)
|
||||
os.system(f'cp -u main-{mt}.html ../static')
|
||||
|
||||
Reference in New Issue
Block a user