allow more I2C devices at grove ports

This commit is contained in:
andreas 2024-03-21 18:13:37 +01:00
parent 4a62e65a29
commit 8bbe1fd192
3 changed files with 83 additions and 16 deletions

View File

@ -65,7 +65,7 @@
#GROVE #GROVE
//example: -DSHT3XG1_A : defines STH3Xn1 on grove A - x depends on the other devices //example: -DSHT3XG1_A : defines STH3Xn1 on grove A - x depends on the other devices
#ifdef SHT3XG1$GS$ #ifdef GWSHT3XG1$GS$
#ifndef M5_GROOVEIIC$GS$ #ifndef M5_GROOVEIIC$GS$
#define M5_GROOVEIIC$GS$ #define M5_GROOVEIIC$GS$
#endif #endif
@ -74,7 +74,7 @@
#endif #endif
#GROVE #GROVE
#ifdef SHT3XG2$GS$ #ifdef GWSHT3XG2$GS$
#ifndef M5_GROOVEIIC$GS$ #ifndef M5_GROOVEIIC$GS$
#define M5_GROOVEIIC$GS$ #define M5_GROOVEIIC$GS$
#endif #endif
@ -83,7 +83,7 @@
#endif #endif
#GROVE #GROVE
#ifdef QMP6988G1$GS$ #ifdef GWQMP6988G1$GS$
#ifndef M5_GROOVEIIC$GS$ #ifndef M5_GROOVEIIC$GS$
#define M5_GROOVEIIC$GS$ #define M5_GROOVEIIC$GS$
#endif #endif
@ -92,7 +92,7 @@
#endif #endif
#GROVE #GROVE
#ifdef QMP6988G2$GS$ #ifdef GWQMP6988G2$GS$
#ifndef M5_GROOVEIIC$GS$ #ifndef M5_GROOVEIIC$GS$
#define M5_GROOVEIIC$GS$ #define M5_GROOVEIIC$GS$
#endif #endif
@ -101,7 +101,7 @@
#endif #endif
#GROVE #GROVE
#ifdef BME280G1$GS$ #ifdef GWBME280G1$GS$
#ifndef M5_GROOVEIIC$GS$ #ifndef M5_GROOVEIIC$GS$
#define M5_GROOVEIIC$GS$ #define M5_GROOVEIIC$GS$
#endif #endif
@ -110,7 +110,7 @@
#endif #endif
#GROVE #GROVE
#ifdef BME280G2$GS$ #ifdef GWBME280G2$GS$
#ifndef M5_GROOVEIIC$GS$ #ifndef M5_GROOVEIIC$GS$
#define M5_GROOVEIIC$GS$ #define M5_GROOVEIIC$GS$
#endif #endif

View File

@ -50,6 +50,69 @@ types:
values: values:
- value: M5_ENV3#grv# - value: M5_ENV3#grv#
key: true key: true
resource: qmp69881#grv#1,sht3x#grv#1
- type: checkbox
label: SHT3X-1
description: "SHT30 temperature and humidity sensor 0x44"
key: sht3xg1
target: define
url: "https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/SHT3x_Datasheet_digital.pdf"
values:
- key: true
value: GWSHT3XG1#grv#
resource: sht3x#grv#1
- type: checkbox
label: SHT3X-2
description: "SHT30 temperature and humidity sensor 0x45"
key: sht3xg2
target: define
url: "https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/SHT3x_Datasheet_digital.pdf"
values:
- key: true
value: GWSHT3XG2#grv#
resource: sht3x#grv#2
- type: checkbox
label: QMP6988-1
description: "QMP6988 pressure sensor addr 86"
key: qmp69881g1
target: define
url: "https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/enviii/QMP6988%20Datasheet.pdf"
values:
- key: true
value: GWQMP6988G1#grv#
resource: qmp69881#grv#1
- type: checkbox
label: QMP6988-2
description: "QMP6988 pressure sensor addr 112"
key: qmp69882g2
target: define
url: "https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/enviii/QMP6988%20Datasheet.pdf"
values:
- key: true
value: GWQMP6988G2#grv#
resource: qmp69881#grv#2
- type: checkbox
label: BME280-1
description: "BME280 temperature/humidity/pressure sensor 0x76"
key: bme2801g1
target: define
url: "https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf"
values:
- key: true
value: GWBME280G1#grv#
resource: bme280#grv#1
- type: checkbox
label: BME280-2
description: "BME280 temperature/humidity/pressure sensor 0x77"
key: bme2802
target: define
url: "https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf"
values:
- key: true
value: GWBME280G2#grv#
resource: bme280#grv#2
- &m5groovecan - &m5groovecan
type: select type: select
key: m5groovecan#grv# key: m5groovecan#grv#

View File

@ -652,12 +652,15 @@ class PipelineInfo{
} }
if (round < 1) continue; if (round < 1) continue;
if (struct.resource){ if (struct.resource){
let resList=currentResources[struct.resource]; let splitted=struct.resource.split(",");
if (! resList){ splitted.forEach((resource) => {
resList=[]; let resList = currentResources[resource];
currentResources[struct.resource]=resList; if (!resList) {
} resList = [];
resList.push(struct); currentResources[resource] = resList;
}
resList.push(struct);
});
} }
if (target === 'define') { if (target === 'define') {
flags += " -D" + struct.value; flags += " -D" + struct.value;
@ -680,11 +683,12 @@ class PipelineInfo{
for (let k in currentResources){ for (let k in currentResources){
let ak=k.replace(/:.*/,''); let ak=k.replace(/:.*/,'');
let resList=currentResources[k]; let resList=currentResources[k];
if (allowedResources[ak] !== undefined){ let allowed=allowedResources[ak];
if (resList.length > allowedResources[ak]){ if (allowed === undefined) allowed=1;
errors+=" more than "+allowedResources[ak]+" "+k+" device(s) used"; if (resList.length > allowed){
} errors+=" more than "+allowed+" "+k+" device(s) used";
} }
} }
if (errors){ if (errors){
setValue('configError',errors); setValue('configError',errors);