Ftlab gdk101 Gamma Radiation Sensor Module support (#18390)

* Support for GDK101.

* GDK101 driver rework

---------

Co-authored-by: PetrNovacek <39201428+r21m@users.noreply.github.com>
This commit is contained in:
Szewcson 2023-04-14 15:29:00 +02:00 committed by GitHub
parent 36ae802924
commit 4fdd1ad94d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 425 additions and 2 deletions

View File

@ -146,6 +146,7 @@ Note: `minimal` variant is not listed as it shouldn't be used outside of the [up
| USE_PCF8574 | - | - / - | - | - | - | - |
| USE_PMSA003I | - | - / - | - | - | - | - |
| USE_LOX_O2 | - | - / x | - | x | - | - |
| USE_GDK101 | - | - / - | - | x | - | - |
| | | | | | | |
| Feature or Sensor | l | t | k | s | i | d | Remarks
| USE_HIH6 | - | - / x | - | x | - | - |

View File

@ -204,6 +204,7 @@ In addition to @arendst the following code is mainly owned by:
| xsns_103_sen5x | @tyeth
| xsns_104_pmsa003i | Jean-Pierre Deschamps
| xsns_105_lox_o2 | @ACE1046
| xsns_106_gdk101 | @Szewcson
| |
| Libraries |
| |

View File

@ -113,4 +113,5 @@ Index | Define | Driver | Device | Address(es) | Description
75 | USE_PCA9632 | xdrv_64 | PCA9632 | 0x60 | 4-channel 4-bit pwm driver
76 | USE_SEN5X | xsns_103 | SEN5X | 0x69 | Gas (VOC/NOx index) and air quality (PPM <1,<2.5,<4,<10)
77 | USE_MCP23XXX_DRV | xdrv_67 | MCP23x17 | 0x20 - 0x26 | 16-bit I/O expander as virtual button/switch/relay
78 | USE_PMSA003I | xsns_104 | PMSA003I | 0x12 | PM2.5 Air Quality Sensor with I2C Interface
78 | USE_PMSA003I | xsns_104 | PMSA003I | 0x12 | PM2.5 Air Quality Sensor with I2C Interface
79 | USE_GDK101 | xsns_106 | GDK101 | 0x18 - 0x1B | Gamma Radiation Sensor

View File

@ -934,6 +934,7 @@ const char HTTP_SNS_STANDARD_CONCENTRATION[] PROGMEM = "{s}%s " D_STANDAR
const char HTTP_SNS_ENVIRONMENTAL_CONCENTRATION[] PROGMEM = "{s}%s " D_ENVIRONMENTAL_CONCENTRATION " %s " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}";
const char HTTP_SNS_F_ENVIRONMENTAL_CONCENTRATION[] PROGMEM = "{s}%s " D_ENVIRONMENTAL_CONCENTRATION " %s " D_UNIT_MICROMETER "{m}%1_f " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}";
const char HTTP_SNS_PARTICALS_BEYOND[] PROGMEM = "{s}%s " D_PARTICALS_BEYOND " %s " D_UNIT_MICROMETER "{m}%d " D_UNIT_PARTS_PER_DECILITER "{e}";
const char HTTP_SNS_AVG_RAD_DOSE[] PROGMEM = "{s}%s " D_AVG_RAD_DOSE " %s " D_UNIT_MINUTE "{m}%d.%02d " D_UNIT_US_H "{e}";
const char HTTP_SNS_VOLTAGE[] PROGMEM = "{s}" D_VOLTAGE "{m}%s " D_UNIT_VOLT "{e}";
const char HTTP_SNS_CURRENT[] PROGMEM = "{s}" D_CURRENT "{m}%s " D_UNIT_AMPERE "{e}";

View File

@ -163,6 +163,7 @@
//#define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code)
//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code)
//#define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+1k8 code)
#define USE_GDK101 // [I2cDriver79] Enable GDK101 sensor (I2C addresses 0x18 - 0x1B) (+1k2 code)
//#define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one
// #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code)

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "te laag"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pomptyd oorskry"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "Gemiddelde Stralingsdosis"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_AF_AF_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "твърде ниско"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "превишено време за помпане"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "средна доза радиация"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_BG_BG_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "massa baix"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "temps de bomba excedit"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "dosi mitjana de radiació"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_CA_AD_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "průměrná dávka záření"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_CS_CZ_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "zu niedrig"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "Pumpzeit überschritten"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "durchschnittliche Strahlendosis"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_DE_DE_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "μέση δόση ακτινοβολίας"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_EL_GR_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "Average Radiation Dose"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_EN_GB_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "muy bajo"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "tiempo de bomba excedido"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "dosis media de radiación"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_ES_ES_H_

View File

@ -1190,4 +1190,8 @@
#define D_NEOPOOL_PH_LOW "Trop bas"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "durée pompage expirée"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "dose moyenne de rayonnement"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_FR_FR_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "gemiddelde stralingsdosis"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_FY_NL_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "מינון קרינה ממוצע"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_HE_HE_H_

View File

@ -1192,4 +1192,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "átlagos sugárdózis"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_HU_HU_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "troppo basso"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "tempo pompa superato"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "dose media di radiazioni"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_IT_IT_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "average radiation dose"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_KO_KO_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "te laag"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pomptijd bereikt"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "gemiddelde stralingsdosis"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_NL_NL_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "czas pompowania przekroczony"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "Średnia Dawka Promieniowania"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_PL_PL_D_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "Muito baixo"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "tempo da bomba excedido"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "dose média de radiação"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_PT_BR_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "Muito baixo"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "tempo da bomba excedido"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "dose média de radiação"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_PT_PT_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "doza medie de radiație"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_RO_RO_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "средняя доза облучения"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_RU_RU_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "priemerná dávka žiarenia"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_SK_SK_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "genomsnittlig stråldos"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_SV_SE_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "ortalama radyasyon dozu"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_TR_TR_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "середня доза радіації"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_UK_UA_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "liều bức xạ trung bình"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_VI_VN_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "平均辐射剂量"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_ZH_CN_H_

View File

@ -1189,4 +1189,8 @@
#define D_NEOPOOL_PH_LOW "too low"
#define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded"
// xsns_106_gdk101.ino
#define D_AVG_RAD_DOSE "平均輻射劑量"
#define D_UNIT_US_H "uSv/h"
#endif // _LANGUAGE_ZH_TW_H_

View File

@ -701,6 +701,12 @@
// #define INA3221_MAX_COUNT // change the number of devices to search for (default 4).
// // Both settings together allow to limit searching for INA3221 to only a subset of addresses
// #define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+1k8 code)
// #define USE_GDK101 // [I2cDriver79] Enable GDK101 sensor (I2C addresses 0x18 - 0x1B) (+1k2 code)
// #define GDK101_SHOW_FW_VERSION
// #define GDK101_SHOW_STATUS
// #define GDK101_SHOW_VIBRATION_STATUS
// #define GDK101_SHOW_MEAS_TIME
// #define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one
// #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code)

View File

@ -885,8 +885,10 @@ void ResponseAppendFeatures(void)
#ifdef USE_LOX_O2
feature9 |= 0x00080000; // xsns_105_lox_o2.ino
#endif
#if defined(USE_I2C) && defined(USE_GDK101)
feature9 |= 0x00100000; // xsns_106_gdk101.ino
#endif
// feature9 |= 0x00100000;
// feature9 |= 0x00200000;
// feature9 |= 0x00400000;
// feature9 |= 0x00800000;

View File

@ -0,0 +1,302 @@
/*
xsns_106_gdk101.ino - Support for GDK101 gamma radiation sensor
Copyright (C) 2019 Petr Novacek
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef USE_I2C
#ifdef USE_GDK101
/*********************************************************************************************\
* GDK101 gamma radiation sensor ftlab.co.kr
*
* For background information see http://allsmartlab.com/eng/294-2/
*
* I2C Address:
* A0 Short, A1 Short : 0x18
* A0 Open, A1 Short : 0x19
* A0 Short, A1 Open : 0x1A
* A0 Open, A1 Open : 0x1B
\*********************************************************************************************/
#define XSNS_106 106
#define XI2C_79 79 // See I2CDEVICES.md
// I2C adresses
#define GDK101_ADDRESS1 0x18
#define GDK101_ADDRESS2 0x19
#define GDK101_ADDRESS3 0x1A
#define GDK101_ADDRESS4 0x1B
// I2C register
#define READ_FIRMWARE 0xB4
#define RESET 0xA0
#define READ_STATUS 0xB0
#define READ_MEASURING_TIME 0xB1
#define READ_10MIN_AVG 0xB2
#define READ_1MIN_AVG 0xB3
// gdk101 variables
uint8_t gdk101_address;
uint8_t gdk101_addresses[] = { GDK101_ADDRESS1, GDK101_ADDRESS2, GDK101_ADDRESS3, GDK101_ADDRESS4 };
uint8_t gdk101_discovered = false;
typedef enum {
GDK_STATUS_READY,
GDK_STATUS_UNDER_10_MINUTES,
GDK_STATUS_NORMAL,
GDK_STATUS_INVALID,
} gdk_status_t;
typedef struct gdk_status_data {
gdk_status_t status;
bool vibration;
} gdk_status_data_t;
typedef struct gdk_measuring_time {
uint8_t min;
uint8_t sec;
} gdk_measuring_time_t;
typedef struct gdk_fW_version {
uint8_t major;
uint8_t minor;
} gdk_fW_version_t;
typedef struct gdk_avg_dose {
uint8_t integral;
uint8_t fractional;
} gdk_avg_dose_t;
bool gdk_ready = false;
gdk_fW_version_t fw_version;
gdk_avg_dose_t mea_10min_avg;
gdk_avg_dose_t mea_1min_avg;
gdk_status_data_t gdk_status = {GDK_STATUS_INVALID, false};
gdk_measuring_time_t gdk_time = {0, 0};
uint8_t evr10 = 0;
// uint8_t vibr = 0;
#ifdef USE_WEBSERVER
const char HTTP_GDK101_FW[] PROGMEM = "{s}%s " "FW Version" "{m}%d.%d{e}";
const char HTTP_GDK101_STATUS[] PROGMEM = "{s}%s " "Status" "{m}%d{e}";
const char HTTP_GDK101_VIB_STATUS[] PROGMEM = "{s}%s " "Vibration Status" "{m}%d{e}";
const char HTTP_GDK101_MEAS_TIME[] PROGMEM = "{s}%s " "Measurement Time" "{m}%d:%02d{e}";
#endif // USE_WEBSERVER
bool gdk101_reset(bool *reset);
void gdk101_err_log(bool ret) {
if(!ret) {
DEBUG_SENSOR_LOG("GDK101: I2C read error");
}
}
void gdk101_detect(void)
{
bool ret = false;
bool reset = false;
for (uint32_t i = 0; i < sizeof(gdk101_addresses); i++) {
gdk101_address = gdk101_addresses[i];
if (!I2cSetDevice(gdk101_address)) {
continue; // do not make the next step without a confirmed device on the bus
}
ret = gdk101_reset(&reset);
if(ret) {
if(reset) {
delay(10);
I2cSetActiveFound(gdk101_address, "GDK101");
ret = gdk101_get_fw_version(&fw_version);
gdk101_err_log(ret);
gdk_ready = true;
break;
}
}
}
}
void gdk101_init() {
if (gdk_ready) return;
gdk101_detect();
}
bool gdk101_reset(bool *reset) {
uint8_t buf;
bool ret = false;
ret = I2cValidRead8(&buf, gdk101_address, RESET);
if (ret) {
*reset = (bool) buf;
}
return ret;
}
bool gdk101_get_fw_version(struct gdk_fW_version *fw) {
uint8_t buf[2];
bool ret = false;
ret = I2cValidRead16LE((uint16_t*) buf, gdk101_address, READ_FIRMWARE);
if (ret) {
fw->major = buf[0];
fw->minor = buf[1];
}
return ret;
}
bool gdk101_get_10min_avg(struct gdk_avg_dose *avg) {
uint8_t buf[2];
bool ret = false;
ret = I2cValidRead16LE((uint16_t*) buf, gdk101_address, READ_10MIN_AVG);
if (ret) {
avg->integral = buf[0];
avg->fractional = buf[1];
}
return ret;
}
bool gdk101_get_1min_avg(struct gdk_avg_dose *avg) {
uint8_t buf[2];
bool ret = false;
ret = I2cValidRead16LE((uint16_t*) buf, gdk101_address, READ_1MIN_AVG);
if (ret) {
avg->integral = buf[0];
avg->fractional = buf[1];
}
return ret;
}
bool gdk101_get_status(struct gdk_status_data *status) {
uint8_t buf[2];
bool ret = false;
ret = I2cValidRead16LE((uint16_t*) buf, gdk101_address, READ_STATUS);
if (ret) {
status->status = (gdk_status_t) buf[0];
status->vibration = (bool) buf[1];
}
return ret;
}
bool gdk101_get_measuring_time(struct gdk_measuring_time *meas_time) {
uint8_t buf[2];
bool ret = false;
ret = I2cValidRead16LE((uint16_t*) buf, gdk101_address, READ_MEASURING_TIME);
if (ret) {
meas_time->min = buf[0];
meas_time->sec = buf[1];
}
return ret;
}
void every_second(void) {
if (!gdk_ready) return;
gdk101_every_second();
if (evr10 == 10) {
gdk101_every_10_second();
evr10 = 1;
}
else {
evr10++;
}
}
void gdk101_every_second(void) {
bool ret = false;
ret = gdk101_get_status(&gdk_status);
gdk101_err_log(ret);
}
void gdk101_every_10_second(void) {
bool ret = false;
ret = gdk101_get_10min_avg(&mea_10min_avg);
gdk101_err_log(ret);
ret = gdk101_get_1min_avg(&mea_1min_avg);
gdk101_err_log(ret);
ret = gdk101_get_measuring_time(&gdk_time);
gdk101_err_log(ret);
}
void gdk101_show(uint8_t json) {
char types[16];
strcpy_P(types, PSTR("GDK101"));
if (!gdk_ready) return;
if (json) {
ResponseAppend_P(PSTR(",\"%s\":{"), types);
ResponseAppend_P(PSTR("\"FW_V\":%i.%i,"), fw_version.major, fw_version.minor);
ResponseAppend_P(PSTR("\"10MIN_AVG\":%i.%02i,"), mea_10min_avg.integral, mea_10min_avg.fractional);
ResponseAppend_P(PSTR("\"1MIN_AVG\":%i.%02i,"), mea_1min_avg.integral, mea_1min_avg.fractional);
ResponseAppend_P(PSTR("\"STATUS\":%i,"), gdk_status.status);
ResponseAppend_P(PSTR("\"VIBRATION\":%i,"), gdk_status.vibration);
ResponseAppend_P(PSTR("\"MEAS_TIME\":\"%i:%02i\""), gdk_time.min, gdk_time.sec);
ResponseJsonEnd();
#ifdef USE_WEBSERVER
} else {
#ifdef GDK101_SHOW_FW_VERSION
WSContentSend_PD(HTTP_GDK101_FW, types, fw_version.major, fw_version.minor);
#endif
WSContentSend_PD(HTTP_SNS_AVG_RAD_DOSE, types, "@10", mea_10min_avg.integral, mea_10min_avg.fractional);
WSContentSend_PD(HTTP_SNS_AVG_RAD_DOSE, types, "@1", mea_1min_avg.integral, mea_1min_avg.fractional);
#ifdef GDK101_SHOW_STATUS
WSContentSend_PD(HTTP_GDK101_STATUS, types, gdk_status.status);
#endif
#ifdef GDK101_SHOW_VIBRATION_STATUS
WSContentSend_PD(HTTP_GDK101_VIB_STATUS, types, gdk_status.vibration);
#endif
#ifdef GDK101_SHOW_MEAS_TIME
WSContentSend_PD(HTTP_GDK101_MEAS_TIME, types, gdk_time.min, gdk_time.sec);
#endif
#endif // USE_WEBSERVER
}
}
/*********************************************************************************************\
Interface
\*********************************************************************************************/
bool Xsns106(uint32_t function)
{
bool result = false;
if (!I2cEnabled(XI2C_79)) { return false; }
switch (function) {
case FUNC_INIT:
gdk101_init();
break;
case FUNC_EVERY_SECOND:
every_second();
break;
case FUNC_JSON_APPEND:
gdk101_show(1);
break;
#ifdef USE_WEBSERVER
case FUNC_WEB_SENSOR:
gdk101_show(0);
break;
#endif // USE_WEBSERVER
}
return result;
}
#endif // USE_GDK
#endif // USE_I2C