mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
merge with txmode2 branch
This commit is contained in:
36
CHANGELOG.md
36
CHANGELOG.md
@@ -5,15 +5,13 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.9.0b2_web] 2019-08-11
|
||||
## Important!! Known Issues with the latest web version:
|
||||
|
||||
### Changed
|
||||
|
||||
- Merged with @susisstrolch's TxMode2 branch for improved support for sending EMS packages
|
||||
|
||||
## [1.9.0b1_web] 2019-08-02
|
||||
|
||||
### Breaking changes for first time use
|
||||
- TODO: SPIFFS event log may wear out ROM. This could be a problem so needs investigating.
|
||||
- TODO: Timezone not fully implemented in javascript yet
|
||||
- TODO: Building with EEPROM (-DCRASH option) causes web to fail so its disabled for now, meaning no stacks for debugging
|
||||
- TODO: firmware size is getting too big, the heap is huge with all the web so need to shrink it.
|
||||
## How to install for first time use
|
||||
- Make sure you update your local platformio.ini using the example one and set the target to 'debug'
|
||||
- On first boot it will re-build the SPIFFS config file so all <1.9 settings will be lost. Connect to AP 'ems-esp' and use the web to enter your wifi settings.
|
||||
- Default web admin password is 'admin'
|
||||
@@ -28,6 +26,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- `npm install ws` (from https://github.com/websockets/ws)
|
||||
- `./run` (win) or `./run.sh` (linux/osx) will start the mock web server. Follow the instructions shown.
|
||||
|
||||
---
|
||||
|
||||
## [1.9.0b2_web] 2019-08-11
|
||||
|
||||
### Changed
|
||||
|
||||
- Merged with @susisstrolch's TxMode2 branch for improved support for sending EMS packages, and removed tx_mode command
|
||||
- Renamed heartbeat to mqtt_heartbeat
|
||||
|
||||
## [1.9.0b1_web] 2019-08-02
|
||||
|
||||
### Breaking changes for first time use
|
||||
|
||||
|
||||
### Added
|
||||
|
||||
- New web code
|
||||
@@ -38,14 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- reboot command renamed to restart to keep consistent with web
|
||||
|
||||
### Know issues
|
||||
|
||||
- SPIFFS event log may wear out ROM. This could be a problem so needs investigating.
|
||||
- Still getting WDT resets between 10-20mins with Tx (with `set listen_mode off` it's stable) in all modes.
|
||||
- Timezone not working 100%. Have a fix that'll go in soon.
|
||||
- Building with EEPROM (-DCRASH option) causes web to fail so its disabled. Means no stacks!
|
||||
- firmware size is getting too big, the heap is huge with all the web so need to shrink it.
|
||||
|
||||
## [1.8.1] 2019-07-27
|
||||
|
||||
### Added
|
||||
|
||||
@@ -35,6 +35,8 @@ MyESP::MyESP() {
|
||||
_general_hostname = strdup("myesp");
|
||||
_app_name = strdup("MyESP");
|
||||
_app_version = strdup(MYESP_VERSION);
|
||||
_app_helpurl = nullptr;
|
||||
_app_updateurl = nullptr;
|
||||
|
||||
// general
|
||||
_timerequest = false;
|
||||
@@ -633,6 +635,7 @@ void MyESP::_printSetCommands() {
|
||||
myDebug_P(PSTR(" set <wifi_ssid | wifi_password> [value]"));
|
||||
myDebug_P(PSTR(" set mqtt_enabled <on | off>"));
|
||||
myDebug_P(PSTR(" set <mqtt_ip | mqtt_username | mqtt_password> [value]"));
|
||||
myDebug_P(PSTR(" set mqtt_heartbeat <on | off>"));
|
||||
myDebug_P(PSTR(" set mqtt_base [value]"));
|
||||
myDebug_P(PSTR(" set mqtt_port [value]"));
|
||||
myDebug_P(PSTR(" set ntp_enabled <on | off>"));
|
||||
@@ -687,9 +690,9 @@ void MyESP::_printSetCommands() {
|
||||
myDebug_P(PSTR(" mqtt_base="));
|
||||
}
|
||||
myDebug_P(PSTR(" mqtt_port=%d"), _mqtt_port);
|
||||
myDebug_P(PSTR(" mqtt_heartbeat=%s"), (_mqtt_heartbeat) ? "on" : "off");
|
||||
|
||||
myDebug_P(PSTR(" serial=%s"), (_general_serial) ? "on" : "off");
|
||||
myDebug_P(PSTR(" heartbeat=%s"), (_mqtt_heartbeat) ? "on" : "off");
|
||||
myDebug_P(PSTR(" ntp_enabled=%s"), (_ntp_enabled) ? "on" : "off");
|
||||
|
||||
// print any custom settings
|
||||
@@ -825,7 +828,7 @@ bool MyESP::_changeSetting(uint8_t wc, const char * setting, const char * value)
|
||||
}
|
||||
}
|
||||
|
||||
} else if (strcmp(setting, "heartbeat") == 0) {
|
||||
} else if (strcmp(setting, "mqtt_heartbeat") == 0) {
|
||||
save_config = true;
|
||||
if (value) {
|
||||
if (strcmp(value, "on") == 0) {
|
||||
@@ -2362,8 +2365,8 @@ void MyESP::_sendStatus() {
|
||||
|
||||
char uptime[200];
|
||||
uint32_t t = _getUptime(); // seconds
|
||||
uint32_t d = t / 86400L;
|
||||
uint32_t h = ((t % 86400L) / 3600L) % 60;
|
||||
uint8_t d = t / 86400L;
|
||||
uint8_t h = ((t % 86400L) / 3600L) % 60;
|
||||
uint32_t rem = t % 3600L;
|
||||
uint8_t m = rem / 60;
|
||||
uint8_t sec = rem % 60;
|
||||
|
||||
@@ -33,12 +33,6 @@ time_t now() {
|
||||
return (time_t)sysTime;
|
||||
}
|
||||
|
||||
// indicates if time has been set and recently synchronized
|
||||
timeStatus_t timeStatus() {
|
||||
now(); // required to actually update the status
|
||||
return Status;
|
||||
}
|
||||
|
||||
void setSyncProvider(getExternalTime getTimeFunction) {
|
||||
getTimePtr = getTimeFunction;
|
||||
nextSyncTime = sysTime;
|
||||
@@ -103,37 +97,6 @@ void breakTime(time_t timeInput, tmElements_t & tm) {
|
||||
tm.Day = time + 1; // day of month
|
||||
}
|
||||
|
||||
time_t makeTime(const tmElements_t & tm) {
|
||||
// assemble time elements into time_t
|
||||
// note year argument is offset from 1970 (see macros in time.h to convert to other formats)
|
||||
// previous version used full four digit year (or digits since 2000),i.e. 2009 was 2009 or 9
|
||||
|
||||
int i;
|
||||
uint32_t seconds;
|
||||
|
||||
// seconds from 1970 till 1 jan 00:00:00 of the given year
|
||||
seconds = tm.Year * (SECS_PER_DAY * 365);
|
||||
for (i = 0; i < tm.Year; i++) {
|
||||
if (LEAP_YEAR(i)) {
|
||||
seconds += SECS_PER_DAY; // add extra days for leap years
|
||||
}
|
||||
}
|
||||
|
||||
// add days for this year, months start from 1
|
||||
for (i = 1; i < tm.Month; i++) {
|
||||
if ((i == 2) && LEAP_YEAR(tm.Year)) {
|
||||
seconds += SECS_PER_DAY * 29;
|
||||
} else {
|
||||
seconds += SECS_PER_DAY * monthDays[i - 1]; //monthDay array starts from 0
|
||||
}
|
||||
}
|
||||
seconds += (tm.Day - 1) * SECS_PER_DAY;
|
||||
seconds += tm.Hour * SECS_PER_HOUR;
|
||||
seconds += tm.Minute * SECS_PER_MIN;
|
||||
seconds += tm.Second;
|
||||
return (time_t)seconds;
|
||||
}
|
||||
|
||||
void refreshCache(time_t t) {
|
||||
if (t != cacheTime) {
|
||||
breakTime(t, tm);
|
||||
@@ -166,11 +129,6 @@ int hour(time_t t) { // the hour for the given time
|
||||
return tm.Hour;
|
||||
}
|
||||
|
||||
int weekday(time_t t) {
|
||||
refreshCache(t);
|
||||
return tm.Wday;
|
||||
}
|
||||
|
||||
int year(time_t t) { // the year for the given time
|
||||
refreshCache(t);
|
||||
return tmYearToCalendar(tm.Year);
|
||||
|
||||
22
src/ems.cpp
22
src/ems.cpp
@@ -726,9 +726,6 @@ void ems_dumpBuffer(const char * prefix, uint8_t * telegram, uint8_t length) {
|
||||
static char output_str[200] = {0};
|
||||
static char buffer[16] = {0};
|
||||
|
||||
if (EMS_Sys_Status.emsLogging != EMS_SYS_LOGGING_JABBER)
|
||||
return;
|
||||
|
||||
/*
|
||||
// we only care about known devices
|
||||
if (length) {
|
||||
@@ -779,14 +776,9 @@ void ems_dumpBuffer(const char * prefix, uint8_t * telegram, uint8_t length) {
|
||||
* When a telegram is processed we forcefully erase it from the stack to prevent overflow
|
||||
*/
|
||||
void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
|
||||
static uint32_t _last_emsPollFrequency = 0;
|
||||
|
||||
ems_dumpBuffer("ems_parseTelegram: ", telegram, length);
|
||||
/*
|
||||
* check if we just received a single byte
|
||||
* it could well be a Poll request from the boiler for us, which will have a value of 0x8B (0x0B | 0x80)
|
||||
* or either a return code like 0x01 or 0x04 from the last Write command
|
||||
*/
|
||||
if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_JABBER) {
|
||||
ems_dumpBuffer("ems_parseTelegram: ", telegram, length);
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect the EMS bus type - Buderus or Junkers - and set emsIDMask accordingly.
|
||||
@@ -812,8 +804,14 @@ void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* check if we just received a single byte
|
||||
* it could well be a Poll request from the boiler for us, which will have a value of 0x8B (0x0B | 0x80)
|
||||
* or either a return code like 0x01 or 0x04 from the last Write command
|
||||
*/
|
||||
if (length == 1) {
|
||||
uint8_t value = telegram[0]; // 1st byte of data package
|
||||
uint8_t value = telegram[0]; // 1st byte of data package
|
||||
static uint32_t _last_emsPollFrequency = 0;
|
||||
|
||||
// check first for a Poll for us
|
||||
if ((value ^ 0x80 ^ EMS_Sys_Status.emsIDMask) == EMS_ID_ME) {
|
||||
|
||||
@@ -167,7 +167,6 @@ typedef struct {
|
||||
bool emsTxCapable; // able to send via Tx
|
||||
bool emsTxDisabled; // true to prevent all Tx
|
||||
uint8_t txRetryCount; // # times the last Tx was re-sent
|
||||
uint8_t emsTxMode; // handles Tx logic
|
||||
uint8_t emsIDMask; // Buderus: 0x00, Junkers: 0x80
|
||||
uint8_t emsPollAck[1]; // acknowledge buffer
|
||||
} _EMS_Sys_Status;
|
||||
@@ -409,7 +408,6 @@ void ems_testTelegram(uint8_t test_num);
|
||||
void ems_startupTelegrams();
|
||||
bool ems_checkEMSBUSAlive();
|
||||
void ems_clearDeviceList();
|
||||
void ems_setTxMode(uint8_t mode);
|
||||
|
||||
void ems_setThermostatTemp(float temperature, uint8_t temptype = 0);
|
||||
void ems_setThermostatMode(uint8_t mode);
|
||||
@@ -425,7 +423,6 @@ void ems_setWarmWaterModeComfort(uint8_t comfort);
|
||||
void ems_setModels();
|
||||
void ems_setTxDisabled(bool b);
|
||||
bool ems_getTxDisabled();
|
||||
uint8_t ems_getTxMode();
|
||||
|
||||
char * ems_getThermostatDescription(char * buffer, bool name_only = false);
|
||||
char * ems_getBoilerDescription(char * buffer, bool name_only = false);
|
||||
|
||||
@@ -175,7 +175,11 @@ void ICACHE_FLASH_ATTR emsuart_start() {
|
||||
*/
|
||||
_EMS_TX_STATUS ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
||||
_EMS_TX_STATUS result = EMS_TX_STATUS_OK;
|
||||
ems_dumpBuffer("emsuart_tx_buffer: ", buf, len); // validate and transmit the EMS buffer, excluding the BRK
|
||||
|
||||
if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_JABBER) {
|
||||
ems_dumpBuffer("emsuart_tx_buffer: ", buf, len); // validate and transmit the EMS buffer, excluding the BRK
|
||||
}
|
||||
|
||||
if (len) {
|
||||
LA_PULSE(50);
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user