Add support for CHIRP soil moisture sensor by Christian Baars

Add support for CHIRP soil moisture sensor by Christian Baars
This commit is contained in:
Theo Arends 2019-08-07 12:08:13 +02:00
parent 6adfed6dd1
commit afb39aa680
10 changed files with 19 additions and 13 deletions

View File

@ -1,8 +1,10 @@
/*********************************************************************************************\
* 6.6.0.4 20190806
* Add support for CHIRP soil moisture sensor by Christian Baars
*
* 6.6.0.3 20190725
* Change filename of configuration backup from using FriendlyName1 to Hostname solving diacritic issues (#2422)
* Change Store AWS IoT Private Key and Certificate in SPI Flash avoiding device-specific compilations
* Upgrade library IRRemoteEsp8266 to 2.6.4, now using sendPioneer()
* Add support for MAX31865 Thermocouple sensor by Alberto Lopez Siemens
* Add option 0 to Width1 (Marker), Width2 (Second), Width3 (Minute) and Width4 (Hour) disabling display (#6152)
@ -10,7 +12,6 @@
* Add define USE_ENERGY_MARGIN_DETECTION to disable Energy Margin and Power Limit detection
* Add define USE_ENERGY_POWER_LIMIT to disable Energy Power Limit detection while Energy Margin detection is active
* Add allow repeat/longpress for IRSend raw, introduced IRSend<r> option (#6074)
* Change Store AWS IoT Private Key and Certificate in SPI Flash avoiding device-specific compilations
* Add SetOption68 to enable multi-channel PWM instead of a single light (#6134)
*
* 6.6.0.2 20190714

View File

@ -367,6 +367,7 @@
#define USE_ADE7953 // Enable ADE7953 Energy monitor as used on Shelly 2.5 (I2C address 0x38) (+1k5)
// #define USE_VL53L0X // Enable VL53L0x time of flight sensor (I2C address 0x29) (+4k code)
// #define USE_MLX90614 // Enable MLX90614 ir temp sensor (I2C address 0x5a) (+0.6k code)
// #define USE_CHIRP // Enable CHIRP soil moisture sensor (variable I2C address, default 0x20)
// #define USE_DISPLAY // Add I2C Display Support (+2k code)
#define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0

View File

@ -81,7 +81,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t tuya_show_dimmer : 1; // bit 15 (v6.5.0.15) - SetOption65 - Enable or Disable Dimmer slider control
uint32_t tuya_dimmer_range_255 : 1; // bit 16 (v6.6.0.1) - SetOption66 - Enable or Disable Dimmer range 255 slider control
uint32_t buzzer_enable : 1; // bit 17 (v6.6.0.1) - SetOption67 - Enable buzzer when available
uint32_t pmw_multi_channels : 1; // bit 18 (v6.6.0.3) - SetOption68 - Enable multi-channels PWM insteas of Color PWM
uint32_t pwm_multi_channels : 1; // bit 18 (v6.6.0.3) - SetOption68 - Enable multi-channels PWM instead of Color PWM
uint32_t spare19 : 1;
uint32_t spare20 : 1;
uint32_t spare21 : 1;

View File

@ -59,7 +59,6 @@ const uint8_t MAX_COUNTERS = 4; // Max number of counter sensors
const uint8_t MAX_TIMERS = 16; // Max number of Timers
const uint8_t MAX_PULSETIMERS = 8; // Max number of supported pulse timers
const uint8_t MAX_FRIENDLYNAMES = 4; // Max number of Friendly names
const uint8_t MAX_HUE_DEVICES = 15; // Max number of Philips Hue device per emulation
const uint8_t MAX_DOMOTICZ_IDX = 4; // Max number of Domoticz device, key and switch indices
const uint8_t MAX_DOMOTICZ_SNS_IDX = 12; // Max number of Domoticz sensors indices
const uint8_t MAX_KNX_GA = 10; // Max number of KNX Group Addresses to read that can be set
@ -72,6 +71,8 @@ const uint8_t MAX_RULE_MEMS = 5; // Max number of saved vars
const uint8_t MAX_RULE_SETS = 3; // Max number of rule sets of size 512 characters
const uint16_t MAX_RULE_SIZE = 512; // Max number of characters in rules
const uint8_t MAX_HUE_DEVICES = 15; // Max number of Philips Hue device per emulation
const char MQTT_TOKEN_PREFIX[] PROGMEM = "%prefix%"; // To be substituted by mqtt_prefix[x]
const char MQTT_TOKEN_TOPIC[] PROGMEM = "%topic%"; // To be substituted by mqtt_topic, mqtt_grptopic, mqtt_buttontopic, mqtt_switchtopic
const char WIFI_HOSTNAME[] = "%s-%04d"; // Expands to <MQTT_TOPIC>-<last 4 decimal chars of MAC address>

View File

@ -1453,9 +1453,9 @@ void GpioInit(void)
#endif // USE_SM16716
// post-process for lights
if (Settings.flag3.pmw_multi_channels) {
if (Settings.flag3.pwm_multi_channels) {
uint32_t pwm_channels = (light_type & 7) > LST_MAX ? LST_MAX : (light_type & 7);
if (0 == pwm_channels) pwm_channels = 1;
if (0 == pwm_channels) { pwm_channels = 1; }
devices_present += pwm_channels - 1; // add the pwm channels controls at the end
}
#endif // USE_LIGHT

View File

@ -131,7 +131,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#define USE_ADE7953 // Enable ADE7953 Energy monitor as used on Shelly 2.5 (I2C address 0x38) (+1k5)
//#define USE_VL53L0X // Enable VL53L0x time of flight sensor (I2C address 0x29) (+4k code)
//#define USE_MLX90614 // Enable MLX90614 ir temp sensor (I2C address 0x5a) (+0.6k code)
//#define USE_CHIRP // Enable CHIRP soil moisture sensor (variable I2C address)
//#define USE_CHIRP // Enable CHIRP soil moisture sensor (variable I2C address, default 0x20)
#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)

View File

@ -415,7 +415,9 @@ void GetFeatures(void)
#ifdef USE_MAX31865
feature_sns2 |= 0x10000000;
#endif
// feature_sns2 |= 0x20000000;
#ifdef USE_CHIRP
feature_sns2 |= 0x20000000;
#endif
// feature_sns2 |= 0x40000000;
// feature_sns2 |= 0x80000000;

View File

@ -1359,7 +1359,7 @@ void LightInit(void)
light_device = devices_present;
light_subtype = (light_type & 7) > LST_MAX ? LST_MAX : (light_type & 7); // Always 0 - LST_MAX (5)
light_pwm_multi_channels = Settings.flag3.pmw_multi_channels;
light_pwm_multi_channels = Settings.flag3.pwm_multi_channels;
#if defined(USE_WS2812) && (USE_WS2812_CTYPE > NEO_3LED)
if (LT_WS2812 == light_type) {

View File

@ -246,7 +246,7 @@ char prev_y_str[24] = "\0";
uint8_t getLocalLightSubtype(uint8_t device) {
if (light_type) {
if (device >= light_device) {
if (Settings.flag3.pmw_multi_channels) {
if (Settings.flag3.pwm_multi_channels) {
return LST_SINGLE; // If SetOption68, each channel acts like a dimmer
} else {
return light_subtype; // the actual light
@ -511,7 +511,7 @@ void HueLights(String *path)
}
if (light_type && (local_light_subtype >= LST_SINGLE)) {
if (!Settings.flag3.pmw_multi_channels) {
if (!Settings.flag3.pwm_multi_channels) {
light_state.getHSB(&hue, &sat, nullptr);
bri = light_state.getBri(); // get the combined bri for CT and RGB, not only the RGB one
ct = light_state.getCT();
@ -614,7 +614,7 @@ void HueLights(String *path)
}
if (change) {
if (light_type && (local_light_subtype > LST_NONE)) { // not relay
if (!Settings.flag3.pmw_multi_channels) {
if (!Settings.flag3.pwm_multi_channels) {
if (g_gotct) {
light_controller.changeCTB(ct, bri);
} else {

View File

@ -116,7 +116,8 @@ a_setoption = [[
"Disable Dimmer slider control",
"Disable Dimmer range 255 slider control",
"Enable buzzer when available",
"","",
"Enable multi-channels PWM instead of Color PWM",
"",
"","","","",
"","","","",
"","","",""
@ -157,7 +158,7 @@ a_features = [[
"USE_THEO_V2","USE_ALECTO_V2","USE_AZ7798","USE_MAX31855",
"USE_PN532_I2C","USE_MAX44009","USE_SCD30","USE_HRE",
"USE_ADE7953","USE_SPS30","USE_VL53L0X","USE_MLX90614",
"USE_MAX31865","","",""]]
"USE_MAX31865","USE_CHIRP","",""]]
usage = "usage: decode-status {-d | -f} arg"
parser = OptionParser(usage)