1st step loading config

This commit is contained in:
andreas 2023-09-30 18:08:57 +02:00
parent 4f2a630687
commit 1882afc09a
2 changed files with 70 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { setButtons,fillValues, setValue, buildUrl, fetchJson, setVisible, enableEl, setValues, getParam, fillSelect, forEachEl } from "./helper.js";
import {load as yamlLoad} from "https://cdn.skypack.dev/js-yaml@4.1.0";
(function(){
const STATUS_INTERVAL=2000;
const CURRENT_PIPELINE='pipeline';
@ -128,7 +129,11 @@ import { setButtons,fillValues, setValue, buildUrl, fetchJson, setVisible, enabl
'm5stack-atoms3-generic',
'nodemcu-generic'
];
window.onload=()=>{
const loadConfig=async (url)=>{
let config=await fetch(url).then((r)=>r.text());
let parsed=yamlLoad(config);
}
window.onload=async ()=>{
setButtons(btConfig);
forEachEl('#environment',(el)=>el.addEventListener('change',hideResults));
forEachEl('#buildflags',(el)=>el.addEventListener('change',hideResults));
@ -139,5 +144,6 @@ import { setButtons,fillValues, setValue, buildUrl, fetchJson, setVisible, enabl
fetchStatus(true);
setRunning(true);
}
await loadConfig("testconfig.yaml");
}
})();

View File

@ -0,0 +1,63 @@
types:
- &m5base
type: select
target: define
label: 'M5 Atom light Base'
values:
- label: "CAN KIT"
value: M5_CAN_KIT
description: "M5 Stack CAN Kit"
url: "http://docs.m5stack.com/en/atom/atom_can"
- value: M5_SERIAL_KIT_232
description: "M5 Stack RS232 Base"
label: "Atomic RS232 Base"
url: "http://docs.m5stack.com/en/atom/Atomic%20RS232%20Base"
- value: M5_SERIAL_KIT_485
description: "M5 Stack RS484 Base"
label: "Atomic RS485 Base"
url: "http://docs.m5stack.com/en/atom/Atomic%20RS485%20Base"
- &m5groove
type: select
label: 'M5 groove type'
values:
- label: 'CAN'
children:
- label: 'I2C'
children:
- *m5groovei2c
- label: 'Serial'
children:
- *m5grooveserial
- &m5groovei2c
type: multi
label: "M5 I2C groove units"
values:
- &m5grooveserial
type: select
label: "M5 Serial Unit"
target: define
values:
- label: "RS485"
value: SERIAL_GROOVE_485
description: "M5 RS485 unit"
url: "http://docs.m5stack.com/en/unit/rs485"
- label: "Tail485"
value: SERIAL_GROOVE_485
description: "M5 Tail 485"
url: "http://docs.m5stack.com/en/atom/tail485"
config:
board:
type: select
target: environment
label: 'Board'
values:
- value: m5stack-atom-generic
label: m5stack-atom
description: "M5 Stack Atom light"
url: "http://docs.m5stack.com/en/core/atom_lite"
children:
- *m5base
- *m5groove