mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
clang style formatting
This commit is contained in:
@@ -564,8 +564,10 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
uint8_t first_value = data[0];
|
||||
if (((first_value & 0x7F) == txservice_.ems_bus_id()) && (length > 1)) {
|
||||
// if we ask ourself at roomcontrol for version e.g. 0B 98 02 ...
|
||||
Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data, length);
|
||||
rxservice_.add(data, length); // just for logging
|
||||
Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data);
|
||||
#ifdef EMSESP_DEBUG
|
||||
rxservice_.add(data, length); // just for logging, if compiled with additional debugging
|
||||
#endif
|
||||
return; // it's an echo
|
||||
}
|
||||
|
||||
@@ -627,7 +629,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
return;
|
||||
} else {
|
||||
// check if there is a message for the roomcontroller
|
||||
Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data, length);
|
||||
Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data);
|
||||
// add to RxQueue, what ever it is.
|
||||
rxservice_.add(data, length);
|
||||
}
|
||||
|
||||
@@ -18,15 +18,12 @@
|
||||
|
||||
#include "roomcontrol.h"
|
||||
|
||||
MAKE_PSTR(logger_name, "roomctrl")
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
uint32_t rc_time_ = 0;
|
||||
uint16_t hc_ = EMS_VALUE_USHORT_NOTSET;
|
||||
int16_t remotetemp[4] = {
|
||||
EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET
|
||||
};
|
||||
int16_t remotetemp[4] = {EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET};
|
||||
|
||||
/**
|
||||
* set the temperature,
|
||||
*/
|
||||
@@ -47,8 +44,8 @@ void Roomctrl::send(uint8_t addr) {
|
||||
if (remotetemp[hc_] == EMS_VALUE_SHORT_NOTSET) {
|
||||
return;
|
||||
}
|
||||
if (millis() - rc_time_ > 60000) { // send every minute
|
||||
rc_time_ = millis();
|
||||
if (uuid::get_uptime() - rc_time_ > SEND_INTERVAL) { // send every minute
|
||||
rc_time_ = uuid::get_uptime(); // use EMS-ESP's millis() to prevent overhead
|
||||
temperature(addr, 0x00); // send to all
|
||||
} else {
|
||||
// acknowledge every poll, otherwise the master shows error A11-822
|
||||
@@ -59,16 +56,19 @@ void Roomctrl::send(uint8_t addr) {
|
||||
/**
|
||||
* check if there is a message for the remote room controller
|
||||
*/
|
||||
void Roomctrl::check(uint8_t addr, uint8_t * data, const uint8_t length) {
|
||||
void Roomctrl::check(uint8_t addr, uint8_t * data) {
|
||||
uint8_t hc_num = addr - ADDR;
|
||||
|
||||
// check address, reply only on addresses 0x18..0x1B
|
||||
if (hc_num > 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
// no reply if the temperature is not set
|
||||
if (remotetemp[hc_num] == EMS_VALUE_SHORT_NOTSET) {
|
||||
return;
|
||||
}
|
||||
|
||||
// for now we only reply to version and remote temperature
|
||||
if (data[2] == 0x02) {
|
||||
version(addr, data[0]);
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EMSESP_ROOMCTRL_H
|
||||
#define EMSESP_ROOMCTRL_H
|
||||
#ifndef EMSESP_ROOMCONTROL_H
|
||||
#define EMSESP_ROOMCONTROL_H
|
||||
|
||||
#include "emsesp.h"
|
||||
#include "telegram.h"
|
||||
@@ -29,15 +29,16 @@ namespace emsesp {
|
||||
class Roomctrl {
|
||||
public:
|
||||
static void send(uint8_t addr);
|
||||
static void check(uint8_t addr, uint8_t * data, const uint8_t length);
|
||||
static void check(uint8_t addr, uint8_t * data);
|
||||
static void set_remotetemp(uint8_t hc, int16_t temp);
|
||||
|
||||
private:
|
||||
#define ADDR 0x18
|
||||
static constexpr uint8_t ADDR = 0x18;
|
||||
static constexpr uint32_t SEND_INTERVAL = 60000; // 1 minute
|
||||
|
||||
static void version(uint8_t addr, uint8_t dst);
|
||||
static void unknown(uint8_t addr, uint8_t dst, uint8_t type, uint8_t offset);
|
||||
static void temperature(uint8_t addr, uint8_t dst);
|
||||
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
Reference in New Issue
Block a user