From 54cbc3288b6869f8007e8c9df92d12a698cc3d50 Mon Sep 17 00:00:00 2001 From: Jack Shao Date: Fri, 26 Mar 2021 18:15:41 +0800 Subject: [PATCH] feat: add support for PM2.5 & PM10, i.e. G4 --- package.json | 2 +- src/global-defines.js | 17 ++++++++++++++-- src/views/Settings.vue | 45 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 84b75da..60d13cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sensecap_one_cfg_tool", - "version": "1.1.2", + "version": "1.2.0", "private": true, "description": "SenseCAP One Configuration Tool", "author": "Jack Shao ", diff --git a/src/global-defines.js b/src/global-defines.js index 073c681..c427722 100644 --- a/src/global-defines.js +++ b/src/global-defines.js @@ -18,7 +18,9 @@ exports.grpNameTransZh = { "Rain Peak Intensity": "降雨强度峰值", "Misc.": "其他", "Heating Temperature": "加热区域温度", - "Tilt Status": "倾倒状态" + "Tilt Status": "倾倒状态", + "Particulate Matter": "颗粒物", + "GlobalDefinesEnd": "-" } exports.changableUnitsMeasMap = { @@ -89,8 +91,19 @@ exports.slaveGroupDefines = { } } ], - "2": [], + "2": [ + { + grpNameShort: "G4", + grpName: "Particulate Matter", + meas: { + "PM2.5": { name: "PM2.5", unit: 'ug/m³', unitSuffix: '' }, + "PM10": { name: "PM10", unit: 'ug/m³', unitSuffix: '' }, + } + } + ], "3": [], + "41": [], + "42": [], } diff --git a/src/views/Settings.vue b/src/views/Settings.vue index b434bad..b689844 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -23,6 +23,10 @@ "AL": "Valid range [10, 80000], current unit.", "DL": "Valid range [100, 2000000]." }, + "G4": { + "ol": "The output list for G4 poll, this also affects the data updating for main page.", + "IDUST": "Valid range [1, 3600]." + }, "G9": { "ol": "The output list for G9 poll, this also affects the data updating for main page.", "uih": "Valid range [15, 3600], if heating is enabled, this interval is set to 15 seconds implicitly.", @@ -92,6 +96,11 @@ "AL": "有效范围 [10, 80000], 当前单位。", "DL": "有效范围 [100, 2000000]." }, + "Particulate Matter (G4)": "颗粒物 (G4)", + "G4": { + "ol": "G4数据组的输出列表(同时影响主页面的数据更新)。", + "IDUST": "有效范围 [1, 3600]。" + }, "Counter Reset Mode": "计数清零模式", "Rain Accumulation Limit": "累计降雨量极限值", "Rain Duration Limit": "累计降雨时间极限值", @@ -441,6 +450,30 @@ +
+ +
+ {{$t('Particulate Matter (G4)')}} +
+ + + + +
{{$t('G4.ol')}}
+
+ + + + +
{{$t('G4.IDUST')}}
+
+
+
@@ -670,6 +703,9 @@ export default { 'G2', 'IW', 'AW', 'DO', 'US', 'G3', 'IR', 'CR', 'AL', 'DL', 'UR', ], + "2": [ + 'G4', 'IDUST' + ] } this.G9Regs = { //"G9" = ORed these regs @@ -714,6 +750,7 @@ export default { showS1G1: false, showS1G2: false, showS1G3: false, + showS2G4: false, showG9: false, showG9Ht: false, showG9Tilt: false, @@ -756,6 +793,7 @@ export default { {value: 4, label: "4Hz"}, ], optionsS1G3: [], + optionsS2G4: [], optionsG9: [], configMap: { @@ -789,6 +827,9 @@ export default { DL: 2000000, UR: 'M', + G4: [], + IDUST: 1, + G9: [], // IH: 15, HC: 'N', @@ -870,6 +911,7 @@ export default { this.optionsS1G1 = [] this.optionsS1G2 = [] this.optionsS1G3 = [] + this.optionsS2G4 = [] this.optionsG9 = [] // this.configMap.G0 = [] // this.configMap.G1 = [] @@ -891,6 +933,8 @@ export default { } else if (i2cAddr === '1' && grp.grpNameShort === 'G3') { this.optionsS1G3.push(optionItem) // this.configMap.G3.push(measName) + } else if (i2cAddr === '2' && grp.grpNameShort === 'G4') { + this.optionsS2G4.push(optionItem) } } } @@ -922,6 +966,7 @@ export default { this.unitOptions = unitOptions1 this.showG0 = this.optionsG0.length > 0 this.showS1G1 = this.showS1G2 = this.showS1G3 = '1' in this.i2cAddrInCurrentCfg + this.showS2G4 = '2' in this.i2cAddrInCurrentCfg this.showG9 = this.showG9Ht || this.showG9Tilt this.guiRendered = true },