2017-05-13 12:02:10 +01:00
|
|
|
/*
|
|
|
|
settings.h - setting variables for Sonoff-Tasmota
|
|
|
|
|
2017-12-22 13:55:24 +00:00
|
|
|
Copyright (C) 2018 Theo Arends
|
2017-05-13 12:02:10 +01:00
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
2017-02-19 16:49:17 +00:00
|
|
|
|
2017-10-18 17:22:34 +01:00
|
|
|
#ifndef _SETTINGS_H_
|
|
|
|
#define _SETTINGS_H_
|
|
|
|
|
2018-07-03 11:48:56 +01:00
|
|
|
#define PARAM8_SIZE 18 // Number of param bytes (SetOption)
|
2017-06-16 13:33:49 +01:00
|
|
|
|
2017-09-02 13:37:02 +01:00
|
|
|
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
|
2017-06-06 22:23:23 +01:00
|
|
|
uint32_t data; // Allow bit manipulation using SetOption
|
2018-07-03 11:48:56 +01:00
|
|
|
struct { // SetOption0 .. SetOption31
|
2017-10-18 17:22:34 +01:00
|
|
|
uint32_t save_state : 1; // bit 0
|
2017-06-06 22:23:23 +01:00
|
|
|
uint32_t button_restrict : 1; // bit 1
|
|
|
|
uint32_t value_units : 1; // bit 2
|
2017-06-16 13:33:49 +01:00
|
|
|
uint32_t mqtt_enabled : 1; // bit 3
|
2017-06-06 22:23:23 +01:00
|
|
|
uint32_t mqtt_response : 1; // bit 4
|
2018-07-03 11:48:56 +01:00
|
|
|
uint32_t mqtt_power_retain : 1; // CMND_POWERRETAIN
|
|
|
|
uint32_t mqtt_button_retain : 1; // CMND_BUTTONRETAIN
|
|
|
|
uint32_t mqtt_switch_retain : 1; // CMND_SWITCHRETAIN
|
2017-06-06 22:23:23 +01:00
|
|
|
uint32_t temperature_conversion : 1; // bit 8
|
2018-07-03 11:48:56 +01:00
|
|
|
uint32_t mqtt_sensor_retain : 1; // CMND_SENSORRETAIN
|
2017-06-06 22:23:23 +01:00
|
|
|
uint32_t mqtt_offline : 1; // bit 10
|
|
|
|
uint32_t button_swap : 1; // bit 11 (v5.1.6)
|
2017-06-19 21:54:49 +01:00
|
|
|
uint32_t stop_flash_rotate : 1; // bit 12 (v5.2.0)
|
2017-07-25 17:05:47 +01:00
|
|
|
uint32_t button_single : 1; // bit 13 (v5.4.0)
|
2017-08-18 17:04:49 +01:00
|
|
|
uint32_t interlock : 1; // bit 14 (v5.6.0)
|
2017-10-01 13:32:36 +01:00
|
|
|
uint32_t pwm_control : 1; // bit 15 (v5.8.1)
|
2017-10-23 11:18:15 +01:00
|
|
|
uint32_t ws_clock_reverse : 1; // bit 16 (v5.8.1)
|
|
|
|
uint32_t decimal_text : 1; // bit 17 (v5.8.1)
|
2017-12-27 13:10:55 +00:00
|
|
|
uint32_t light_signal : 1; // bit 18 (v5.10.0c)
|
2018-01-13 14:53:02 +00:00
|
|
|
uint32_t hass_discovery : 1; // bit 19 (v5.11.1a)
|
2018-01-27 16:52:48 +00:00
|
|
|
uint32_t not_power_linked : 1; // bit 20 (v5.11.1f)
|
2018-02-04 17:09:09 +00:00
|
|
|
uint32_t no_power_on_check : 1; // bit 21 (v5.11.1i)
|
2018-03-18 12:47:30 +00:00
|
|
|
uint32_t mqtt_serial : 1; // bit 22 (v5.12.0f)
|
2018-05-24 13:25:52 +01:00
|
|
|
uint32_t rules_enabled : 1; // bit 23 (v5.12.0j) - free since v5.14.0b
|
|
|
|
uint32_t rules_once : 1; // bit 24 (v5.12.0k) - free since v5.14.0b
|
2018-04-17 14:34:18 +01:00
|
|
|
uint32_t knx_enabled : 1; // bit 25 (v5.12.0l) KNX
|
2018-05-13 16:38:44 +01:00
|
|
|
uint32_t device_index_enable : 1; // bit 26 (v5.13.1a)
|
2018-05-16 09:56:09 +01:00
|
|
|
uint32_t knx_enable_enhancement : 1; // bit 27 (v5.14.0a) KNX
|
2018-06-25 11:33:23 +01:00
|
|
|
uint32_t rf_receive_decimal : 1; // bit 28 (v6.0.0a)
|
|
|
|
uint32_t ir_receive_decimal : 1; // bit 29 (v6.0.0a)
|
2018-06-29 10:15:27 +01:00
|
|
|
uint32_t hass_light : 1; // bit 30 (v6.0.0b)
|
2018-07-07 16:30:58 +01:00
|
|
|
uint32_t global_state : 1; // bit 31 (v6.1.0)
|
2017-05-11 16:47:34 +01:00
|
|
|
};
|
2017-10-18 17:22:34 +01:00
|
|
|
} SysBitfield;
|
2017-05-03 17:19:13 +01:00
|
|
|
|
2018-07-03 11:48:56 +01:00
|
|
|
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
|
2017-11-11 11:33:30 +00:00
|
|
|
uint32_t data; // Allow bit manipulation using SetOption
|
2018-07-03 11:48:56 +01:00
|
|
|
struct { // SetOption50 .. SetOption81
|
2018-07-20 15:12:37 +01:00
|
|
|
uint32_t timers_enable : 1; // bit 0 (v6.1.1b)
|
2018-07-03 11:48:56 +01:00
|
|
|
uint32_t spare01 : 1;
|
|
|
|
uint32_t spare02 : 1;
|
|
|
|
uint32_t spare03 : 1;
|
|
|
|
uint32_t spare04 : 1;
|
|
|
|
uint32_t spare05 : 1;
|
|
|
|
uint32_t spare06 : 1;
|
|
|
|
uint32_t spare07 : 1;
|
|
|
|
uint32_t spare08 : 1;
|
|
|
|
uint32_t spare09 : 1;
|
|
|
|
uint32_t spare10 : 1;
|
|
|
|
uint32_t spare11 : 1;
|
|
|
|
uint32_t spare12 : 1;
|
|
|
|
uint32_t spare13 : 1;
|
|
|
|
uint32_t spare14 : 1;
|
|
|
|
uint32_t spare15 : 1;
|
|
|
|
uint32_t spare16 : 1;
|
|
|
|
uint32_t spare17 : 1;
|
|
|
|
uint32_t spare18 : 1;
|
|
|
|
uint32_t spare19 : 1;
|
|
|
|
uint32_t spare20 : 1;
|
|
|
|
uint32_t spare21 : 1;
|
|
|
|
uint32_t spare22 : 1;
|
|
|
|
uint32_t spare23 : 1;
|
|
|
|
uint32_t spare24 : 1;
|
|
|
|
uint32_t spare25 : 1;
|
|
|
|
uint32_t spare26 : 1;
|
|
|
|
uint32_t spare27 : 1;
|
|
|
|
uint32_t spare28 : 1;
|
|
|
|
uint32_t spare29 : 1;
|
|
|
|
uint32_t spare30 : 1;
|
|
|
|
uint32_t spare31 : 1;
|
|
|
|
};
|
|
|
|
} SysBitfield3;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
uint32_t data; // Allow bit manipulation
|
2017-11-11 11:33:30 +00:00
|
|
|
struct {
|
|
|
|
uint32_t spare00 : 1;
|
|
|
|
uint32_t spare01 : 1;
|
|
|
|
uint32_t spare02 : 1;
|
|
|
|
uint32_t spare03 : 1;
|
|
|
|
uint32_t spare04 : 1;
|
|
|
|
uint32_t spare05 : 1;
|
|
|
|
uint32_t spare06 : 1;
|
|
|
|
uint32_t spare07 : 1;
|
|
|
|
uint32_t spare08 : 1;
|
|
|
|
uint32_t spare09 : 1;
|
|
|
|
uint32_t spare10 : 1;
|
|
|
|
uint32_t spare11 : 1;
|
|
|
|
uint32_t spare12 : 1;
|
|
|
|
uint32_t spare13 : 1;
|
|
|
|
uint32_t spare14 : 1;
|
|
|
|
uint32_t current_resolution : 2;
|
|
|
|
uint32_t voltage_resolution : 2;
|
|
|
|
uint32_t wattage_resolution : 2;
|
|
|
|
uint32_t emulation : 2;
|
|
|
|
uint32_t energy_resolution : 3;
|
|
|
|
uint32_t pressure_resolution : 2;
|
|
|
|
uint32_t humidity_resolution : 2;
|
|
|
|
uint32_t temperature_resolution : 2;
|
|
|
|
};
|
|
|
|
} SysBitfield2;
|
|
|
|
|
2018-05-13 17:54:21 +01:00
|
|
|
typedef union {
|
|
|
|
uint16_t data;
|
|
|
|
struct {
|
|
|
|
uint16_t hemis : 1; // bit 0 = 0=Northern, 1=Southern Hemisphere (=Opposite DST/STD)
|
|
|
|
uint16_t week : 3; // bits 1 - 3 = 0=Last week of the month, 1=First, 2=Second, 3=Third, 4=Fourth
|
|
|
|
uint16_t month : 4; // bits 4 - 7 = 1=Jan, 2=Feb, ... 12=Dec
|
|
|
|
uint16_t dow : 3; // bits 8 - 10 = day of week, 1=Sun, 2=Mon, ... 7=Sat
|
|
|
|
uint16_t hour : 5; // bits 11 - 15 = 0-23
|
|
|
|
};
|
|
|
|
} TimeRule;
|
|
|
|
|
2018-03-23 16:20:20 +00:00
|
|
|
typedef union {
|
|
|
|
uint32_t data;
|
|
|
|
struct {
|
2018-04-18 16:28:45 +01:00
|
|
|
uint32_t time : 11; // bits 0 - 10 = minutes in a day
|
|
|
|
uint32_t window : 4; // bits 11 - 14 = minutes random window
|
|
|
|
uint32_t repeat : 1; // bit 15
|
|
|
|
uint32_t days : 7; // bits 16 - 22 = week day mask
|
|
|
|
uint32_t device : 4; // bits 23 - 26 = 16 devices
|
|
|
|
uint32_t power : 2; // bits 27 - 28 = 4 power states - Off, On, Toggle, Blink or Rule
|
2018-04-25 16:27:40 +01:00
|
|
|
uint32_t mode : 2; // bits 29 - 30 = timer modes - 0 = Scheduler, 1 = Sunrise, 2 = Sunset
|
2018-04-18 16:28:45 +01:00
|
|
|
uint32_t arm : 1; // bit 31
|
2018-03-23 16:20:20 +00:00
|
|
|
};
|
|
|
|
} Timer;
|
|
|
|
|
2018-07-02 09:22:01 +01:00
|
|
|
typedef union {
|
|
|
|
uint8_t data;
|
|
|
|
struct {
|
2018-07-21 17:06:24 +01:00
|
|
|
uint8_t pinmode : 3; // Enable INPUT
|
2018-07-02 09:22:01 +01:00
|
|
|
uint8_t pullup : 1; // Enable internal weak pull-up resistor
|
2018-07-21 17:06:24 +01:00
|
|
|
uint8_t b4 : 1;
|
2018-07-02 09:22:01 +01:00
|
|
|
uint8_t b5 : 1;
|
|
|
|
uint8_t b6 : 1;
|
|
|
|
uint8_t b7 : 1;
|
|
|
|
};
|
|
|
|
} Mcp230xxCfg;
|
|
|
|
|
2018-06-02 15:59:09 +01:00
|
|
|
/*
|
2017-02-19 16:49:17 +00:00
|
|
|
struct SYSCFG {
|
2018-06-02 15:59:09 +01:00
|
|
|
unsigned long cfg_holder; // 000 Pre v6 header
|
2017-10-18 17:22:34 +01:00
|
|
|
unsigned long save_flag; // 004
|
2017-10-10 14:40:02 +01:00
|
|
|
unsigned long version; // 008
|
|
|
|
unsigned long bootcount; // 00C
|
2018-06-02 15:59:09 +01:00
|
|
|
*/
|
|
|
|
struct SYSCFG {
|
|
|
|
uint16_t cfg_holder; // 000 v6 header
|
|
|
|
uint16_t cfg_size; // 002
|
|
|
|
unsigned long save_flag; // 004
|
|
|
|
unsigned long version; // 008
|
|
|
|
uint16_t bootcount; // 00C
|
|
|
|
uint16_t cfg_crc; // 00E
|
|
|
|
SysBitfield flag; // 010
|
2017-10-18 17:22:34 +01:00
|
|
|
int16_t save_data; // 014
|
2017-10-10 14:40:02 +01:00
|
|
|
int8_t timezone; // 016
|
2017-10-18 17:22:34 +01:00
|
|
|
char ota_url[101]; // 017
|
2017-10-10 14:40:02 +01:00
|
|
|
char mqtt_prefix[3][11]; // 07C
|
2018-03-18 12:47:30 +00:00
|
|
|
uint8_t baudrate; // 09D
|
2017-10-10 14:40:02 +01:00
|
|
|
byte seriallog_level; // 09E
|
|
|
|
uint8_t sta_config; // 09F
|
|
|
|
byte sta_active; // 0A0
|
|
|
|
char sta_ssid[2][33]; // 0A1
|
|
|
|
char sta_pwd[2][65]; // 0E3
|
|
|
|
char hostname[33]; // 165
|
|
|
|
char syslog_host[33]; // 186
|
|
|
|
|
|
|
|
byte free_1A7[1]; // 1A7
|
|
|
|
|
|
|
|
uint16_t syslog_port; // 1A8
|
|
|
|
byte syslog_level; // 1AA
|
|
|
|
uint8_t webserver; // 1AB
|
|
|
|
byte weblog_level; // 1AC
|
2018-03-09 17:08:17 +00:00
|
|
|
uint8_t mqtt_fingerprint[2][20]; // 1AD
|
|
|
|
|
2018-03-10 16:58:54 +00:00
|
|
|
byte free_1D5[20]; // 1D5 Free since 5.12.0e
|
2018-03-09 17:08:17 +00:00
|
|
|
|
2017-10-10 14:40:02 +01:00
|
|
|
char mqtt_host[33]; // 1E9
|
|
|
|
uint16_t mqtt_port; // 20A
|
|
|
|
char mqtt_client[33]; // 20C
|
|
|
|
char mqtt_user[33]; // 22D
|
|
|
|
char mqtt_pwd[33]; // 24E
|
|
|
|
char mqtt_topic[33]; // 26F
|
|
|
|
char button_topic[33]; // 290
|
|
|
|
char mqtt_grptopic[33]; // 2B1
|
2018-01-05 11:26:19 +00:00
|
|
|
uint8_t display_model; // 2D2
|
|
|
|
uint8_t display_mode; // 2D3
|
|
|
|
uint8_t display_refresh; // 2D4
|
|
|
|
uint8_t display_rows; // 2D5
|
|
|
|
uint8_t display_cols[2]; // 2D6
|
|
|
|
uint8_t display_address[8]; // 2D8
|
|
|
|
uint8_t display_dimmer; // 2E0
|
|
|
|
uint8_t display_size; // 2E1
|
2018-05-14 22:22:29 +01:00
|
|
|
TimeRule tflag[2]; // 2E2
|
2017-10-18 17:22:34 +01:00
|
|
|
uint16_t pwm_frequency; // 2E6
|
2017-10-10 14:40:02 +01:00
|
|
|
power_t power; // 2E8
|
2017-10-18 17:22:34 +01:00
|
|
|
uint16_t pwm_value[MAX_PWMS]; // 2EC
|
2018-06-02 15:59:09 +01:00
|
|
|
int16_t altitude; // 2F6
|
2017-10-10 14:40:02 +01:00
|
|
|
uint16_t tele_period; // 2F8
|
2018-06-02 15:59:09 +01:00
|
|
|
|
|
|
|
byte free_2fa[1]; // 2FA
|
|
|
|
|
2017-10-10 14:40:02 +01:00
|
|
|
uint8_t ledstate; // 2FB
|
2018-07-03 11:48:56 +01:00
|
|
|
uint8_t param[PARAM8_SIZE]; // 2FC SetOption32 .. SetOption49
|
2018-05-14 22:22:29 +01:00
|
|
|
int16_t toffset[2]; // 30E
|
|
|
|
|
|
|
|
byte free_312[1]; // 312
|
|
|
|
|
2017-10-10 14:40:02 +01:00
|
|
|
char state_text[4][11]; // 313
|
2018-03-14 13:32:51 +00:00
|
|
|
uint8_t energy_power_delta; // 33F
|
2017-10-10 14:40:02 +01:00
|
|
|
uint16_t domoticz_update_timer; // 340
|
2017-10-18 17:22:34 +01:00
|
|
|
uint16_t pwm_range; // 342
|
2018-02-03 22:25:05 +00:00
|
|
|
unsigned long domoticz_relay_idx[MAX_DOMOTICZ_IDX]; // 344
|
|
|
|
unsigned long domoticz_key_idx[MAX_DOMOTICZ_IDX]; // 354
|
|
|
|
unsigned long energy_power_calibration; // 364
|
|
|
|
unsigned long energy_voltage_calibration; // 368
|
|
|
|
unsigned long energy_current_calibration; // 36C
|
2017-12-16 14:51:45 +00:00
|
|
|
unsigned long energy_kWhtoday; // 370
|
|
|
|
unsigned long energy_kWhyesterday; // 374
|
|
|
|
uint16_t energy_kWhdoy; // 378
|
|
|
|
uint16_t energy_min_power; // 37A
|
|
|
|
uint16_t energy_max_power; // 37C
|
|
|
|
uint16_t energy_min_voltage; // 37E
|
|
|
|
uint16_t energy_max_voltage; // 380
|
|
|
|
uint16_t energy_min_current; // 382
|
|
|
|
uint16_t energy_max_current; // 384
|
|
|
|
uint16_t energy_max_power_limit; // 386 MaxPowerLimit
|
2018-02-03 22:25:05 +00:00
|
|
|
uint16_t energy_max_power_limit_hold; // 388 MaxPowerLimitHold
|
|
|
|
uint16_t energy_max_power_limit_window; // 38A MaxPowerLimitWindow
|
|
|
|
uint16_t energy_max_power_safe_limit; // 38C MaxSafePowerLimit
|
|
|
|
uint16_t energy_max_power_safe_limit_hold; // 38E MaxSafePowerLimitHold
|
|
|
|
uint16_t energy_max_power_safe_limit_window; // 390 MaxSafePowerLimitWindow
|
2017-12-16 14:51:45 +00:00
|
|
|
uint16_t energy_max_energy; // 392 MaxEnergy
|
|
|
|
uint16_t energy_max_energy_start; // 394 MaxEnergyStart
|
2017-10-10 14:40:02 +01:00
|
|
|
uint16_t mqtt_retry; // 396
|
|
|
|
uint8_t poweronstate; // 398
|
2017-11-15 22:07:45 +00:00
|
|
|
uint8_t last_module; // 399
|
2017-10-10 14:40:02 +01:00
|
|
|
uint16_t blinktime; // 39A
|
|
|
|
uint16_t blinkcount; // 39C
|
2018-03-10 16:58:54 +00:00
|
|
|
uint16_t light_rotation; // 39E
|
2018-07-03 11:48:56 +01:00
|
|
|
SysBitfield3 flag3; // 3A0
|
2018-06-28 13:28:14 +01:00
|
|
|
uint8_t switchmode[MAX_SWITCHES]; // 3A4 (6.0.0b - moved from 0x4CA)
|
2017-10-12 10:29:40 +01:00
|
|
|
char friendlyname[MAX_FRIENDLYNAMES][33]; // 3AC
|
2017-10-10 14:40:02 +01:00
|
|
|
char switch_topic[33]; // 430
|
2018-03-20 13:31:11 +00:00
|
|
|
char serial_delimiter; // 451
|
|
|
|
uint8_t sbaudrate; // 452
|
2017-10-10 14:40:02 +01:00
|
|
|
uint8_t sleep; // 453
|
2017-12-22 13:55:24 +00:00
|
|
|
uint16_t domoticz_switch_idx[MAX_DOMOTICZ_IDX]; // 454
|
|
|
|
uint16_t domoticz_sensor_idx[MAX_DOMOTICZ_SNS_IDX]; // 45C
|
2017-10-10 14:40:02 +01:00
|
|
|
uint8_t module; // 474
|
2017-10-23 11:18:15 +01:00
|
|
|
uint8_t ws_color[4][3]; // 475
|
|
|
|
uint8_t ws_width[3]; // 481
|
2017-10-10 14:40:02 +01:00
|
|
|
myio my_gp; // 484
|
2017-10-26 15:33:33 +01:00
|
|
|
uint16_t light_pixels; // 496
|
|
|
|
uint8_t light_color[5]; // 498
|
|
|
|
uint8_t light_correction; // 49D
|
|
|
|
uint8_t light_dimmer; // 49E
|
2018-05-24 13:25:52 +01:00
|
|
|
uint8_t rule_enabled; // 49F
|
|
|
|
uint8_t rule_once; // 4A0
|
2017-10-26 15:33:33 +01:00
|
|
|
uint8_t light_fade; // 4A1
|
|
|
|
uint8_t light_speed; // 4A2
|
|
|
|
uint8_t light_scheme; // 4A3
|
|
|
|
uint8_t light_width; // 4A4
|
2018-04-17 14:34:18 +01:00
|
|
|
byte knx_GA_registered; // 4A5 Number of Group Address to read
|
2017-10-26 15:33:33 +01:00
|
|
|
uint16_t light_wakeup; // 4A6
|
2018-04-17 14:34:18 +01:00
|
|
|
byte knx_CB_registered; // 4A8 Number of Group Address to write
|
2017-10-10 14:40:02 +01:00
|
|
|
char web_password[33]; // 4A9
|
2018-06-28 13:28:14 +01:00
|
|
|
|
|
|
|
uint8_t ex_switchmode[4]; // 4CA Free since 6.0.0a
|
|
|
|
|
2017-10-10 14:40:02 +01:00
|
|
|
char ntp_server[3][33]; // 4CE
|
2017-11-11 11:33:30 +00:00
|
|
|
byte ina219_mode; // 531
|
2017-10-18 17:22:34 +01:00
|
|
|
uint16_t pulse_timer[MAX_PULSETIMERS]; // 532
|
2018-05-14 22:22:29 +01:00
|
|
|
|
|
|
|
byte free_542[2]; // 542
|
|
|
|
|
2017-10-10 14:40:02 +01:00
|
|
|
uint32_t ip_address[4]; // 544
|
2018-06-02 15:59:09 +01:00
|
|
|
unsigned long energy_kWhtotal; // 554
|
2017-11-11 11:33:30 +00:00
|
|
|
char mqtt_fulltopic[100]; // 558
|
2018-06-02 15:59:09 +01:00
|
|
|
SysBitfield2 flag2; // 5BC
|
2017-10-18 17:22:34 +01:00
|
|
|
unsigned long pulse_counter[MAX_COUNTERS]; // 5C0
|
|
|
|
uint16_t pulse_counter_type; // 5D0
|
|
|
|
uint16_t pulse_counter_debounce; // 5D2
|
|
|
|
uint8_t rf_code[17][9]; // 5D4
|
2017-07-30 16:55:37 +01:00
|
|
|
|
2018-05-14 22:22:29 +01:00
|
|
|
byte free_66d[3]; // 66D
|
2018-03-23 16:20:20 +00:00
|
|
|
|
|
|
|
Timer timer[MAX_TIMERS]; // 670
|
2018-04-05 11:49:43 +01:00
|
|
|
int latitude; // 6B0
|
|
|
|
int longitude; // 6B4
|
2018-04-17 14:34:18 +01:00
|
|
|
uint16_t knx_physsical_addr; // 6B8 (address_t is a uint16_t)
|
|
|
|
uint16_t knx_GA_addr[MAX_KNX_GA]; // 6BA (address_t is a uint16_t) x KNX_max_GA
|
|
|
|
uint16_t knx_CB_addr[MAX_KNX_CB]; // 6CE (address_t is a uint16_t) x KNX_max_CB
|
|
|
|
byte knx_GA_param[MAX_KNX_GA]; // 6E2 Type of Input (relay changed, button pressed, sensor read <-teleperiod)
|
|
|
|
byte knx_CB_param[MAX_KNX_CB]; // 6EC Type of Output (set relay, toggle relay, reply sensor value)
|
2018-07-02 09:22:01 +01:00
|
|
|
Mcp230xxCfg mcp230xx_config[16]; // 6F6
|
2018-04-17 14:34:18 +01:00
|
|
|
|
2018-07-02 09:22:01 +01:00
|
|
|
byte free_6f6[200]; // 706
|
2018-04-10 10:45:53 +01:00
|
|
|
|
2018-05-20 16:46:00 +01:00
|
|
|
char mems[RULES_MAX_MEMS][10]; // 7CE
|
2018-05-24 13:25:52 +01:00
|
|
|
// 800 Full - no more free locations
|
|
|
|
|
|
|
|
char rules[MAX_RULE_SETS][MAX_RULE_SIZE]; // 800 uses 512 bytes in v5.12.0m, 3 x 512 bytes in v5.14.0b
|
2018-04-10 10:45:53 +01:00
|
|
|
|
2018-05-24 13:25:52 +01:00
|
|
|
// E00 - FFF free locations
|
2017-10-18 17:22:34 +01:00
|
|
|
} Settings;
|
2017-02-19 16:49:17 +00:00
|
|
|
|
2017-02-28 15:01:48 +00:00
|
|
|
struct RTCMEM {
|
2017-10-10 14:40:02 +01:00
|
|
|
uint16_t valid; // 000
|
2017-10-18 17:22:34 +01:00
|
|
|
byte oswatch_blocked_loop; // 002
|
2018-01-10 13:10:25 +00:00
|
|
|
uint8_t ota_loader; // 003
|
2017-12-16 14:51:45 +00:00
|
|
|
unsigned long energy_kWhtoday; // 004
|
|
|
|
unsigned long energy_kWhtotal; // 008
|
2017-10-18 17:22:34 +01:00
|
|
|
unsigned long pulse_counter[MAX_COUNTERS]; // 00C
|
2017-10-10 14:40:02 +01:00
|
|
|
power_t power; // 01C
|
2018-05-20 16:46:00 +01:00
|
|
|
// 020 next free location
|
2017-10-18 17:22:34 +01:00
|
|
|
} RtcSettings;
|
|
|
|
|
|
|
|
struct TIME_T {
|
|
|
|
uint8_t second;
|
|
|
|
uint8_t minute;
|
|
|
|
uint8_t hour;
|
|
|
|
uint8_t day_of_week; // sunday is day 1
|
|
|
|
uint8_t day_of_month;
|
|
|
|
uint8_t month;
|
|
|
|
char name_of_month[4];
|
|
|
|
uint16_t day_of_year;
|
|
|
|
uint16_t year;
|
2018-02-07 16:50:02 +00:00
|
|
|
unsigned long days;
|
2017-10-18 17:22:34 +01:00
|
|
|
unsigned long valid;
|
|
|
|
} RtcTime;
|
|
|
|
|
2018-01-05 11:26:19 +00:00
|
|
|
struct XDRVMAILBOX {
|
|
|
|
uint16_t valid;
|
|
|
|
uint16_t index;
|
|
|
|
uint16_t data_len;
|
2018-02-27 13:59:46 +00:00
|
|
|
uint16_t payload16;
|
2018-01-05 11:26:19 +00:00
|
|
|
int16_t payload;
|
2018-02-27 13:59:46 +00:00
|
|
|
uint8_t grpflg;
|
|
|
|
uint8_t notused;
|
2018-01-05 11:26:19 +00:00
|
|
|
char *topic;
|
|
|
|
char *data;
|
|
|
|
} XdrvMailbox;
|
|
|
|
|
2018-06-25 17:00:20 +01:00
|
|
|
#define MAX_RULES_FLAG 5 // Number of bits used in RulesBitfield (tricky I know...)
|
|
|
|
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
|
|
|
|
uint16_t data; // Allow bit manipulation
|
|
|
|
struct {
|
|
|
|
uint16_t system_boot : 1;
|
|
|
|
uint16_t time_init : 1;
|
|
|
|
uint16_t time_set : 1;
|
|
|
|
uint16_t mqtt_connected : 1;
|
|
|
|
uint16_t mqtt_disconnected : 1;
|
|
|
|
uint16_t spare05 : 1;
|
|
|
|
uint16_t spare06 : 1;
|
|
|
|
uint16_t spare07 : 1;
|
|
|
|
uint16_t spare08 : 1;
|
|
|
|
uint16_t spare09 : 1;
|
|
|
|
uint16_t spare10 : 1;
|
|
|
|
uint16_t spare11 : 1;
|
|
|
|
uint16_t spare12 : 1;
|
|
|
|
uint16_t spare13 : 1;
|
|
|
|
uint16_t spare14 : 1;
|
|
|
|
uint16_t spare15 : 1;
|
|
|
|
};
|
|
|
|
} RulesBitfield;
|
|
|
|
|
2018-07-07 16:30:58 +01:00
|
|
|
typedef union {
|
|
|
|
uint8_t data;
|
|
|
|
struct {
|
|
|
|
uint8_t wifi_down : 1;
|
|
|
|
uint8_t mqtt_down : 1;
|
|
|
|
uint8_t spare02 : 1;
|
|
|
|
uint8_t spare03 : 1;
|
|
|
|
uint8_t spare04 : 1;
|
|
|
|
uint8_t spare05 : 1;
|
|
|
|
uint8_t spare06 : 1;
|
|
|
|
uint8_t spare07 : 1;
|
|
|
|
};
|
|
|
|
} StateBitfield;
|
|
|
|
|
2017-09-02 13:37:02 +01:00
|
|
|
// See issue https://github.com/esp8266/Arduino/issues/2913
|
2017-03-14 17:03:25 +00:00
|
|
|
#ifdef USE_ADC_VCC
|
2017-09-02 13:37:02 +01:00
|
|
|
ADC_MODE(ADC_VCC); // Set ADC input for Power Supply Voltage usage
|
2017-03-14 17:03:25 +00:00
|
|
|
#endif
|
2017-10-18 17:22:34 +01:00
|
|
|
|
2018-07-21 17:06:24 +01:00
|
|
|
#endif // _SETTINGS_H_
|