minor updates

This commit is contained in:
proddy
2018-06-06 17:56:30 +02:00
parent 15a6aed200
commit 895175d03a
3 changed files with 35 additions and 31 deletions

View File

@@ -18,9 +18,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with ESPHelper. If not, see <http://www.gnu.org/licenses/>. along with ESPHelper. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once
#ifndef __ESPHelper_H
#define __ESPHelper_H
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino #include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
@@ -208,5 +206,3 @@ class ESPHelper : public Print {
char bufferPrint[BUFFER_PRINT]; char bufferPrint[BUFFER_PRINT];
}; };
#endif

View File

@@ -4,8 +4,7 @@
* You shouldn't need to change much in this file * You shouldn't need to change much in this file
*/ */
#ifndef __EMS_H #pragma once
#define __EMS_H
#include <Arduino.h> #include <Arduino.h>
@@ -68,6 +67,9 @@ typedef enum {
EMS_TX_VALIDATE // do a validate after a write EMS_TX_VALIDATE // do a validate after a write
} _EMS_TX_ACTION; } _EMS_TX_ACTION;
/* EMS UART logging */
typedef enum { EMS_SYS_LOGGING_NONE, EMS_SYS_LOGGING_BASIC, EMS_SYS_LOGGING_VERBOSE } _EMS_SYS_LOGGING;
// status/counters since last power on // status/counters since last power on
typedef struct { typedef struct {
_EMS_RX_STATUS emsRxStatus; _EMS_RX_STATUS emsRxStatus;
@@ -77,7 +79,7 @@ typedef struct {
uint16_t emxCrcErr; // CRC errors uint16_t emxCrcErr; // CRC errors
bool emsPollEnabled; // flag enable the response to poll messages bool emsPollEnabled; // flag enable the response to poll messages
bool emsThermostatEnabled; // if there is a RCxx thermostat active bool emsThermostatEnabled; // if there is a RCxx thermostat active
bool emsLogVerbose; // Verbose logging _EMS_SYS_LOGGING emsLogging; // logging
unsigned long emsLastPoll; // in ms, last time we received a poll unsigned long emsLastPoll; // in ms, last time we received a poll
unsigned long emsLastRx; // timings unsigned long emsLastRx; // timings
unsigned long emsLastTx; // timings unsigned long emsLastTx; // timings
@@ -161,6 +163,17 @@ typedef struct {
EMS_processType_cb processType_cb; EMS_processType_cb processType_cb;
} _EMS_Types; } _EMS_Types;
// ANSI Colors
#define COLOR_RESET "\x1B[0m"
#define COLOR_BLACK "\x1B[0;30m"
#define COLOR_RED "\x1B[0;31m"
#define COLOR_GREEN "\x1B[0;32m"
#define COLOR_YELLOW "\x1B[0;33m"
#define COLOR_BLUE "\x1B[0;34m"
#define COLOR_MAGENTA "\x1B[0;35m"
#define COLOR_CYAN "\x1B[0;36m"
#define COLOR_WHITE "\x1B[0;37m"
// function definitions // function definitions
extern void ems_parseTelegram(uint8_t * telegram, uint8_t len); extern void ems_parseTelegram(uint8_t * telegram, uint8_t len);
void ems_init(); void ems_init();
@@ -174,8 +187,8 @@ void ems_setPoll(bool b);
bool ems_getPoll(); bool ems_getPoll();
bool ems_getThermostatEnabled(); bool ems_getThermostatEnabled();
void ems_setThermostatEnabled(bool b); void ems_setThermostatEnabled(bool b);
bool ems_getLogVerbose(); _EMS_SYS_LOGGING ems_getLogging();
void ems_setLogVerbose(bool b); void ems_setLogging(_EMS_SYS_LOGGING loglevel);
// private functions // private functions
uint8_t _crcCalculator(uint8_t * data, uint8_t len); uint8_t _crcCalculator(uint8_t * data, uint8_t len);
@@ -194,5 +207,3 @@ extern _EMS_Sys_Status EMS_Sys_Status;
extern _EMS_TxTelegram EMS_TxTelegram; extern _EMS_TxTelegram EMS_TxTelegram;
extern _EMS_Boiler EMS_Boiler; extern _EMS_Boiler EMS_Boiler;
extern _EMS_Thermostat EMS_Thermostat; extern _EMS_Thermostat EMS_Thermostat;
#endif

View File

@@ -3,8 +3,7 @@
* Header file for emsuart.cpp * Header file for emsuart.cpp
* Paul Derbyshire - https://github.com/proddy/EMS-ESP-Boiler * Paul Derbyshire - https://github.com/proddy/EMS-ESP-Boiler
*/ */
#ifndef __EMSUART_H #pragma once
#define __EMSUART_H
#include <Arduino.h> #include <Arduino.h>
@@ -32,5 +31,3 @@ void ICACHE_FLASH_ATTR emsuart_init();
void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len); void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len);
void ICACHE_FLASH_ATTR emsaurt_tx_poll(); void ICACHE_FLASH_ATTR emsaurt_tx_poll();
void ICACHE_FLASH_ATTR emsuart_tx_brk(); void ICACHE_FLASH_ATTR emsuart_tx_brk();
#endif