From ebf0824d5e7f0f0d9ab1bfa640ceca8ca1441018 Mon Sep 17 00:00:00 2001 From: andreas Date: Sun, 3 Mar 2024 20:22:54 +0100 Subject: [PATCH] add m5 proto hub to build service --- lib/hardware/GwHardware.h | 18 ++++++++ webinstall/build.yaml | 96 +++++++++++++++++++++++++++------------ webinstall/cibuild.js | 18 ++++++-- 3 files changed, 99 insertions(+), 33 deletions(-) diff --git a/lib/hardware/GwHardware.h b/lib/hardware/GwHardware.h index 18d6084..6680e3c 100644 --- a/lib/hardware/GwHardware.h +++ b/lib/hardware/GwHardware.h @@ -42,6 +42,10 @@ #define GWBUTTON_PULLUPDOWN #define BOARD_LEFT1 GPIO_NUM_22 #define BOARD_LEFT2 GPIO_NUM_19 + #define BOARD_LEFT3 GPIO_NUM_23 + #define BOARD_LEFT4 GPIO_NUM_33 + #define BOARD_RIGHT1 GPIO_NUM_21 + #define BOARD_RIGHT2 GPIO_NUM_25 #define USBSerial Serial #endif //general definitiones for M5AtomS3 @@ -59,6 +63,10 @@ #define GWBUTTON_PULLUPDOWN #define BOARD_LEFT1 GPIO_NUM_5 #define BOARD_LEFT2 GPIO_NUM_6 + #define BOARD_LEFT3 GPIO_NUM_7 + #define BOARD_LEFT4 GPIO_NUM_8 + #define BOARD_RIGHT1 GPIO_NUM_39 + #define BOARD_RIGHT2 GPIO_NUM_38 #endif //M5Stick C @@ -167,6 +175,16 @@ #define CFGMODE_serialBaud GwConfigInterface::READONLY #endif +//M5 ProtoHub +#ifdef M5_PROTO_HUB + #define PPIN22 BOARD_LEFT1 + #define PPIN19 BOARD_LEFT2 + #define PPIN23 BOARD_LEFT3 + #define PPIN33 BOARD_LEFT4 + #define PPIN21 BOARD_RIGHT1 + #define PPIN25 BOARD_RIGHT2 +#endif + //below we define the final device config based on the above //boards and peripherals //this allows us to easily also set them from outside diff --git a/webinstall/build.yaml b/webinstall/build.yaml index 300ffcd..9177f89 100644 --- a/webinstall/build.yaml +++ b/webinstall/build.yaml @@ -36,33 +36,6 @@ # # types: - - &m5base - type: select - target: define - label: 'M5 Atom light Base' - key: m5lightbase - values: - - label: "CAN KIT" - value: M5_CAN_KIT - description: "M5 Stack CAN Kit" - url: "https://docs.m5stack.com/en/atom/atom_can" - resource: can - - value: M5_SERIAL_KIT_232 - description: "M5 Stack RS232 Base" - label: "Atomic RS232 Base" - url: "https://docs.m5stack.com/en/atom/Atomic%20RS232%20Base" - resource: serial - - value: M5_SERIAL_KIT_485 - description: "M5 Stack RS485 Base" - label: "Atomic RS485 Base" - url: "https://docs.m5stack.com/en/atom/Atomic%20RS485%20Base" - resource: serial - - value: M5_GPS_KIT - description: "M5 Stack Gps Kit" - label: "Gps Base" - url: "https://docs.m5stack.com/en/atom/atomicgps" - resource: serial - - &m5groovei2c type: frame key: m5groovei2c @@ -131,7 +104,9 @@ types: type: dropdown resource: "gpio:" help: 'Select the number of the GPIO pin for this function' - values: + values: "#gpiopinv#" + + - &gpiopinv - {label: unset,value:} - {label: "0: Low at boot!",value: 0} - 1 @@ -164,7 +139,9 @@ types: type: dropdown resource: "gpio:" help: 'Select the number of the GPIO pin for this function' - values: + values: "#gpiopinv#" + + - &gpioinputv - {label: unset,value:} - {label: "0: Low at boot!",value: 0} - 1 @@ -197,6 +174,15 @@ types: - 38 - 39 + - &protogpio + - {label: unset,value:} + - PPIN19 + - PPIN21 + - PPIN22 + - PPIN23 + - PPIN25 + - PPIN33 + - &serialRX <<: *gpioinput key: RX @@ -442,7 +428,56 @@ types: values: - key: true value: GWBME280#busname#2 + - &m5protochildren + - *serial1 + - *serial2 + - *can + - <<: *iicsensors + base: + busname: "1" + bus: "" + - <<: *iicsensors + base: + busname: "2" + bus: "2" + + + - &m5base + type: select + target: define + label: 'M5 Atom light Base' + key: m5lightbase + values: + - label: "CAN KIT" + value: M5_CAN_KIT + description: "M5 Stack CAN Kit" + url: "https://docs.m5stack.com/en/atom/atom_can" + resource: can + - value: M5_SERIAL_KIT_232 + description: "M5 Stack RS232 Base" + label: "Atomic RS232 Base" + url: "https://docs.m5stack.com/en/atom/Atomic%20RS232%20Base" + resource: serial + - value: M5_SERIAL_KIT_485 + description: "M5 Stack RS485 Base" + label: "Atomic RS485 Base" + url: "https://docs.m5stack.com/en/atom/Atomic%20RS485%20Base" + resource: serial + - value: M5_GPS_KIT + description: "M5 Stack Gps Kit" + label: "Gps Base" + url: "https://docs.m5stack.com/en/atom/atomicgps" + resource: serial + - value: M5_PROTO_HUB + description: "M5 Stack HUB PROTO" + url: "https://docs.m5stack.com/en/atom/atomhub" + label: "Hub Proto" + base: + gpioinputv: *protogpio + gpiopinv: *protogpio + children: + *m5protochildren resources: default: &esp32default @@ -457,6 +492,9 @@ config: target: environment label: 'Board' key: board + base: + gpiopinv: *gpiopinv + gpioinputv: *gpioinputv values: - value: m5stack-atom-generic label: m5stack-atom diff --git a/webinstall/cibuild.js b/webinstall/cibuild.js index e1ebc2f..60220c9 100644 --- a/webinstall/cibuild.js +++ b/webinstall/cibuild.js @@ -573,7 +573,7 @@ class PipelineInfo{ (child,initial,opt_frame)=>{ if(cfg.key !== undefined) removeSelectors(name,!initial); if (! initial) isModified=true; - buildSelectors(name,child.children,initial,currentBase,opt_frame||childFrame); + buildSelectors(name,child.children,initial,Object.assign({},currentBase,child.base),opt_frame||childFrame); if (cfg.key !== undefined) configStruct[name]={cfg:child,base:currentBase}; buildValues(initial); }) @@ -583,8 +583,17 @@ class PipelineInfo{ if (! base) return str; if (typeof(str) === 'string'){ for (let k in base){ - let r=new RegExp("#"+k+"#","g"); - str=str.replace(r,base[k]); + if (typeof(base[k]) !== 'string'){ + //special replacement + //for complete parts + if (str === '#'+k+'#'){ + return base[k]; + } + } + else{ + let r=new RegExp("#"+k+"#","g"); + str=str.replace(r,base[k]); + } } return str; } @@ -598,7 +607,8 @@ class PipelineInfo{ if (str instanceof Object){ let rt={}; for (let k in str){ - rt[k]=replaceValues(str[k],base); + if (k == 'children') rt[k]=str[k]; + else rt[k]=replaceValues(str[k],base); } return rt; }