mirror of
https://github.com/GrKoR/esphome_aux_ac_component.git
synced 2025-12-06 03:26:56 +03:00
fix: esp8266 compatibility
This commit is contained in:
@@ -6,9 +6,6 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <cinttypes>
|
||||
#ifndef F
|
||||
#define F(string_literal) (string_literal)
|
||||
#endif
|
||||
|
||||
#include "esphome.h"
|
||||
#include "esphome/components/binary_sensor/binary_sensor.h"
|
||||
@@ -19,6 +16,11 @@
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
|
||||
#ifndef USE_ARDUINO
|
||||
using String = std::string;
|
||||
#define F(string_literal) (string_literal)
|
||||
#endif
|
||||
|
||||
// весь функционал сохранения пресетов прячу под дефайн
|
||||
// #define PRESETS_SAVING
|
||||
#ifdef PRESETS_SAVING
|
||||
@@ -1667,7 +1669,7 @@ namespace esphome
|
||||
* msg - сообщение, выводимое в лог
|
||||
* line - строка, на которой произошел вызов (удобно при отладке)
|
||||
*/
|
||||
void _debugMsg(const std::string &msg, uint8_t dbgLevel = ESPHOME_LOG_LEVEL_DEBUG, unsigned int line = 0, ...)
|
||||
void _debugMsg(const String &msg, uint8_t dbgLevel = ESPHOME_LOG_LEVEL_DEBUG, unsigned int line = 0, ...)
|
||||
{
|
||||
if (dbgLevel < ESPHOME_LOG_LEVEL_NONE)
|
||||
dbgLevel = ESPHOME_LOG_LEVEL_NONE;
|
||||
@@ -1708,7 +1710,7 @@ namespace esphome
|
||||
if ((!notAPacket) && (!HOLMES_WORKS))
|
||||
return;
|
||||
|
||||
std::string st = "";
|
||||
String st = "";
|
||||
char textBuf[11];
|
||||
|
||||
// заполняем время получения пакета
|
||||
@@ -3584,7 +3586,9 @@ namespace esphome
|
||||
if (set_on)
|
||||
{
|
||||
_debugMsg(F("powerLimitationSetSequence: loaded (state = %02X, power limit = %02X)"), ESPHOME_LOG_LEVEL_VERBOSE, __LINE__, cmd.power_lim_state, power_limit);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
_debugMsg(F("powerLimitationSetSequence: loaded (power limit = %02X)"), ESPHOME_LOG_LEVEL_VERBOSE, __LINE__, power_limit);
|
||||
}
|
||||
return true;
|
||||
@@ -3609,9 +3613,12 @@ namespace esphome
|
||||
// формируем команду
|
||||
ac_command_t cmd;
|
||||
_clearCommand(&cmd); // не забываем очищать, а то будет мусор
|
||||
if(enable_limit){
|
||||
if (enable_limit)
|
||||
{
|
||||
cmd.power_lim_state = AC_POWLIMSTAT_ON; // включить ограничение мощности
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.power_lim_state = AC_POWLIMSTAT_OFF; // отключить ограничение мощности
|
||||
}
|
||||
// добавляем команду в последовательность
|
||||
|
||||
Reference in New Issue
Block a user