Skip to content

Commit

Permalink
Humidity Offset
Browse files Browse the repository at this point in the history
  • Loading branch information
effelle committed Mar 16, 2020
1 parent 6ec768e commit 5ba2678
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions tasmota/i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
#define D_JSON_FLAG "FLAG"
#define D_JSON_BASE "BASE"
#define D_CMND_TEMPOFFSET "TempOffset"
#define D_CMND_HUMOFFSET "HumOffset"

// Commands xdrv_01_mqtt.ino
#define D_CMND_MQTTLOG "MqttLog"
Expand Down
3 changes: 2 additions & 1 deletion tasmota/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,9 @@ struct SYSCFG {
uint8_t bri_min; // F05
uint8_t bri_preset_low; // F06
uint8_t bri_preset_high; // F07
int8_t hum_comp; // F08

uint8_t free_f08[180]; // F08
uint8_t free_f09[179]; // F09

uint32_t keeloq_master_msb; // FBC
uint32_t keeloq_master_lsb; // FC0
Expand Down
6 changes: 5 additions & 1 deletion tasmota/support.ino
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,14 @@ char TempUnit(void)

float ConvertHumidity(float h)
{
float result = h;

global_update = uptime;
global_humidity = h;

result = result + (0.1 * Settings.hum_comp);

return h;
return result;
}

float CalcTempHumToDew(float t, float h)
Expand Down
15 changes: 13 additions & 2 deletions tasmota/support_command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix
D_CMND_BUTTONDEBOUNCE "|" D_CMND_SWITCHDEBOUNCE "|" D_CMND_SYSLOG "|" D_CMND_LOGHOST "|" D_CMND_LOGPORT "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALCONFIG "|"
D_CMND_SERIALDELIMITER "|" D_CMND_IPADDRESS "|" D_CMND_NTPSERVER "|" D_CMND_AP "|" D_CMND_SSID "|" D_CMND_PASSWORD "|" D_CMND_HOSTNAME "|" D_CMND_WIFICONFIG "|"
D_CMND_FRIENDLYNAME "|" D_CMND_SWITCHMODE "|" D_CMND_INTERLOCK "|" D_CMND_TELEPERIOD "|" D_CMND_RESET "|" D_CMND_TIME "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|"
D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|" D_CMND_LEDMASK "|" D_CMND_WIFIPOWER "|" D_CMND_TEMPOFFSET "|"
D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|" D_CMND_LEDMASK "|" D_CMND_WIFIPOWER "|" D_CMND_TEMPOFFSET "|" D_CMND_HUMOFFSET "|"
D_CMND_SPEEDUNIT "|"
#ifdef USE_I2C
D_CMND_I2CSCAN "|" D_CMND_I2CDRIVER "|"
Expand All @@ -45,7 +45,7 @@ void (* const TasmotaCommand[])(void) PROGMEM = {
&CmndButtonDebounce, &CmndSwitchDebounce, &CmndSyslog, &CmndLoghost, &CmndLogport, &CmndSerialSend, &CmndBaudrate, &CmndSerialConfig,
&CmndSerialDelimiter, &CmndIpAddress, &CmndNtpServer, &CmndAp, &CmndSsid, &CmndPassword, &CmndHostname, &CmndWifiConfig,
&CmndFriendlyname, &CmndSwitchMode, &CmndInterlock, &CmndTeleperiod, &CmndReset, &CmndTime, &CmndTimezone, &CmndTimeStd,
&CmndTimeDst, &CmndAltitude, &CmndLedPower, &CmndLedState, &CmndLedMask, &CmndWifiPower, &CmndTempOffset,
&CmndTimeDst, &CmndAltitude, &CmndLedPower, &CmndLedState, &CmndLedMask, &CmndWifiPower, &CmndTempOffset, &CmndHumOffset,
&CmndSpeedUnit,
#ifdef USE_I2C
&CmndI2cScan, CmndI2cDriver,
Expand Down Expand Up @@ -538,6 +538,17 @@ void CmndTempOffset(void)
ResponseCmndFloat((float)(Settings.temp_comp) / 10, 1);
}

void CmndHumOffset(void)
{
if (XdrvMailbox.data_len > 0) {
int value = (int)(CharToFloat(XdrvMailbox.data) * 10);
if ((value > -101) && (value < 101)) {
Settings.hum_comp = value;
}
}
ResponseCmndFloat((float)(Settings.hum_comp) / 10, 1);
}

void CmndSleep(void)
{
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 251)) {
Expand Down

0 comments on commit 5ba2678

Please sign in to comment.