v5.10.0a - Fixes ADS1115 and Sonoff Dual R2

5.10.0a
 * Add (experimental) support for sensor SHT3x
 * Change ADS1115
default voltage range from +/-2V to +/-4V (#1289)
 * Add multipress
support and more user configurable options to Sonoff Dual R2 (#1291)
This commit is contained in:
arendst 2017-12-02 12:40:33 +01:00
parent 5731c975e4
commit c102fc5f9e
6 changed files with 38 additions and 35 deletions

View File

@ -1,5 +1,7 @@
/* 5.10.0a /* 5.10.0a
* Add (experimental) support for sensor SHT3x * Add (experimental) support for sensor SHT3x
* Change ADS1115 default voltage range from +/-2V to +/-4V (#1289)
* Add multipress support and more user configurable options to Sonoff Dual R2 (#1291)
* *
* 5.10.0 20171201 * 5.10.0 20171201
* Upgrade library ArduinoJson to 5.11.2 * Upgrade library ArduinoJson to 5.11.2

View File

@ -2008,7 +2008,7 @@ void ButtonHandler()
if (!restart_flag && !holdbutton[i] && (multipress[i] > 0) && (multipress[i] < MAX_BUTTON_COMMANDS +3)) { if (!restart_flag && !holdbutton[i] && (multipress[i] > 0) && (multipress[i] < MAX_BUTTON_COMMANDS +3)) {
boolean single_press = false; boolean single_press = false;
if (multipress[i] < 3) { // Single or Double press if (multipress[i] < 3) { // Single or Double press
if ((SONOFF_DUAL == Settings.module) || (CH4 == Settings.module)) { if ((SONOFF_DUAL_R2 == Settings.module) || (SONOFF_DUAL == Settings.module) || (CH4 == Settings.module)) {
single_press = true; single_press = true;
} else { } else {
single_press = (Settings.flag.button_swap +1 == multipress[i]); single_press = (Settings.flag.button_swap +1 == multipress[i]);

View File

@ -765,15 +765,15 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0 0, 0
}, },
{ "Sonoff Dual R2", // Sonoff Dual R2 (ESP8285) { "Sonoff Dual R2", // Sonoff Dual R2 (ESP8285)
GPIO_SWT1, // GPIO00 Button 1 on header GPIO_USER, // GPIO00 Button 0 on header (0 = On, 1 = Off)
GPIO_USER, // GPIO01 Serial RXD and Optional sensor GPIO_USER, // GPIO01 Serial RXD and Optional sensor
0, 0,
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0,
GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On)
0, 0, 0, // Flash connection 0, 0, 0, // Flash connection
GPIO_SWT2, // GPIO09 Button 2 on header GPIO_USER, // GPIO09 Button 1 on header (0 = On, 1 = Off)
GPIO_KEY1, // GPIO10 Button 3 on casing GPIO_KEY1, // GPIO10 Button on casing
0, // Flash connection 0, // Flash connection
GPIO_REL1, // GPIO12 Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Relay 1 (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)

View File

@ -33,8 +33,8 @@
* ADS1115 * ADS1115
* ------- * -------
* ADS1115_REG_CONFIG_PGA_6_144V // 2/3x gain +/- 6.144V 1 bit = 0.1875mV * ADS1115_REG_CONFIG_PGA_6_144V // 2/3x gain +/- 6.144V 1 bit = 0.1875mV
* ADS1115_REG_CONFIG_PGA_4_096V // 1x gain +/- 4.096V 1 bit = 0.125mV * ADS1115_REG_CONFIG_PGA_4_096V // 1x gain +/- 4.096V 1 bit = 0.125mV (default)
* ADS1115_REG_CONFIG_PGA_2_048V // 2x gain +/- 2.048V 1 bit = 0.0625mV (default) * ADS1115_REG_CONFIG_PGA_2_048V // 2x gain +/- 2.048V 1 bit = 0.0625mV
* ADS1115_REG_CONFIG_PGA_1_024V // 4x gain +/- 1.024V 1 bit = 0.03125mV * ADS1115_REG_CONFIG_PGA_1_024V // 4x gain +/- 1.024V 1 bit = 0.03125mV
* ADS1115_REG_CONFIG_PGA_0_512V // 8x gain +/- 0.512V 1 bit = 0.015625mV * ADS1115_REG_CONFIG_PGA_0_512V // 8x gain +/- 0.512V 1 bit = 0.015625mV
* ADS1115_REG_CONFIG_PGA_0_256V // 16x gain +/- 0.256V 1 bit = 0.0078125mV * ADS1115_REG_CONFIG_PGA_0_256V // 16x gain +/- 0.256V 1 bit = 0.0078125mV
@ -126,7 +126,7 @@ void Ads1115StartComparator(uint8_t channel, uint16_t mode)
uint16_t config = mode | uint16_t config = mode |
ADS1115_REG_CONFIG_CQUE_NONE | // Comparator enabled and asserts on 1 match ADS1115_REG_CONFIG_CQUE_NONE | // Comparator enabled and asserts on 1 match
ADS1115_REG_CONFIG_CLAT_NONLAT | // Non Latching mode ADS1115_REG_CONFIG_CLAT_NONLAT | // Non Latching mode
ADS1115_REG_CONFIG_PGA_2_048V | // ADC Input voltage range (Gain) ADS1115_REG_CONFIG_PGA_4_096V | // ADC Input voltage range (Gain)
ADS1115_REG_CONFIG_CPOL_ACTVLOW | // Alert/Rdy active low (default val) ADS1115_REG_CONFIG_CPOL_ACTVLOW | // Alert/Rdy active low (default val)
ADS1115_REG_CONFIG_CMODE_TRAD | // Traditional comparator (default val) ADS1115_REG_CONFIG_CMODE_TRAD | // Traditional comparator (default val)
ADS1115_REG_CONFIG_DR_6000SPS; // 6000 samples per second ADS1115_REG_CONFIG_DR_6000SPS; // 6000 samples per second

View File

@ -84,7 +84,7 @@ void Ads1115Detect()
ADS1115 adc0(ads1115_address); ADS1115 adc0(ads1115_address);
if (adc0.testConnection()) { if (adc0.testConnection()) {
adc0.initialize(); adc0.initialize();
adc0.setGain(ADS1115_PGA_2P048); // Set the gain (PGA) +/-4.096V adc0.setGain(ADS1115_PGA_4P096); // Set the gain (PGA) +/-4.096V
adc0.setRate(ADS1115_RATE_860); adc0.setRate(ADS1115_RATE_860);
adc0.setMode(ADS1115_MODE_CONTINUOUS); adc0.setMode(ADS1115_MODE_CONTINUOUS);
ads1115_type = 1; ads1115_type = 1;

View File

@ -1,7 +1,7 @@
/* /*
xsns_15SHT3X.ino - WeMos SHT30 Shield xsns_14_sht3x.ino - SHT3X temperature and humidity sensor support for Sonoff-Tasmota
Copyright (C) 2017 Palich2000 Copyright (C) 2017 Theo Arends
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -20,10 +20,11 @@
#ifdef USE_I2C #ifdef USE_I2C
#ifdef USE_SHT3X #ifdef USE_SHT3X
/*********************************************************************************************\ /*********************************************************************************************\
* WeMos SHT30 Shield * SHT3X - Temperature and Humidy
* https://wiki.wemos.cc/products:d1_mini_shields:sht30_shield
* *
* https://github.com/wemos/WEMOS_SHT3x_Arduino_Library * Required library: none but based on Adafruit Industries SHT31 library
*
* I2C Address: 0x44 or 0x45
\*********************************************************************************************/ \*********************************************************************************************/
#define SHT3X_ADDR_GND 0x44 // address pin low (GND) #define SHT3X_ADDR_GND 0x44 // address pin low (GND)