mirror of https://github.com/arendst/Tasmota.git
Consolidate `AddLog_P`
Consolidate `AddLog_P` into `AddLog_P2` and rename to `AddLog_P`
This commit is contained in:
parent
488a360d5b
commit
fa7fdbd51a
|
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
|||
### Changed
|
||||
- Core library from v2.7.4.5 to v2.7.4.7
|
||||
- Platformio compiler option `no target align` enabled (#9749)
|
||||
- Consolidate `AddLog_P` into `AddLog_P2` and rename to `AddLog_P`
|
||||
|
||||
### Fixed
|
||||
- NTP fallback server functionality (#9739)
|
||||
|
|
|
@ -745,9 +745,6 @@ const char JSON_SNS_GNGPM[] PROGMEM = ",\"%s\":{\"" D_JSON_TOTAL_USAGE "\":%s,\"
|
|||
|
||||
const char S_LOG_I2C_FOUND_AT[] PROGMEM = D_LOG_I2C "%s " D_FOUND_AT " 0x%x";
|
||||
|
||||
const char S_LOG_HTTP[] PROGMEM = D_LOG_HTTP;
|
||||
const char S_LOG_WIFI[] PROGMEM = D_LOG_WIFI;
|
||||
const char S_LOG_MQTT[] PROGMEM = D_LOG_MQTT;
|
||||
const char S_RSLT_POWER[] PROGMEM = D_RSLT_POWER;
|
||||
const char S_RSLT_RESULT[] PROGMEM = D_RSLT_RESULT;
|
||||
const char S_RSLT_WARNING[] PROGMEM = D_RSLT_WARNING;
|
||||
|
@ -797,22 +794,6 @@ const char HTTP_SNS_DO[] PROGMEM = "{s}%s " D_DO "{
|
|||
const char HTTP_SNS_COLOR_RED[] PROGMEM = "{s}%s " D_COLOR_RED "{m}%u " "{e}";
|
||||
const char HTTP_SNS_COLOR_GREEN[] PROGMEM = "{s}%s " D_COLOR_GREEN "{m}%u " "{e}";
|
||||
const char HTTP_SNS_COLOR_BLUE[] PROGMEM = "{s}%s " D_COLOR_BLUE "{m}%u " "{e}";
|
||||
|
||||
const char S_MAIN_MENU[] PROGMEM = D_MAIN_MENU;
|
||||
const char S_CONFIGURATION[] PROGMEM = D_CONFIGURATION;
|
||||
const char S_CONFIGURE_TEMPLATE[] PROGMEM = D_CONFIGURE_TEMPLATE;
|
||||
const char S_CONFIGURE_MODULE[] PROGMEM = D_CONFIGURE_MODULE;
|
||||
const char S_CONFIGURE_WIFI[] PROGMEM = D_CONFIGURE_WIFI;
|
||||
const char S_NO_NETWORKS_FOUND[] PROGMEM = D_NO_NETWORKS_FOUND;
|
||||
const char S_CONFIGURE_LOGGING[] PROGMEM = D_CONFIGURE_LOGGING;
|
||||
const char S_CONFIGURE_OTHER[] PROGMEM = D_CONFIGURE_OTHER;
|
||||
const char S_SAVE_CONFIGURATION[] PROGMEM = D_SAVE_CONFIGURATION;
|
||||
const char S_RESET_CONFIGURATION[] PROGMEM = D_RESET_CONFIGURATION;
|
||||
const char S_RESTORE_CONFIGURATION[] PROGMEM = D_RESTORE_CONFIGURATION;
|
||||
const char S_FIRMWARE_UPGRADE[] PROGMEM = D_FIRMWARE_UPGRADE;
|
||||
const char S_CONSOLE[] PROGMEM = D_CONSOLE;
|
||||
const char S_INFORMATION[] PROGMEM = D_INFORMATION;
|
||||
const char S_RESTART[] PROGMEM = D_RESTART;
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
const uint32_t MARKER_START = 0x5AA55AA5;
|
||||
|
|
|
@ -80,7 +80,7 @@ uint16_t SendMail(char *buffer) {
|
|||
cmd=endcmd+1;
|
||||
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("mailsize: %d"),blen);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("mailsize: %d"),blen);
|
||||
#endif
|
||||
|
||||
mserv=strtok(params,":");
|
||||
|
@ -148,7 +148,7 @@ uint16_t SendMail(char *buffer) {
|
|||
|
||||
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s - %d - %s - %s"),mserv,port,user,passwd);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s - %d - %s - %s"),mserv,port,user,passwd);
|
||||
#endif
|
||||
|
||||
// 2 seconds timeout
|
||||
|
@ -164,7 +164,7 @@ uint16_t SendMail(char *buffer) {
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s - %s - %s - %s"),from,to,subject,cmd);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s - %s - %s - %s"),from,to,subject,cmd);
|
||||
#endif
|
||||
|
||||
if (mail) {
|
||||
|
@ -215,7 +215,7 @@ String buffer;
|
|||
client->setTimeout(timeout);
|
||||
// smtp connect
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("Connecting: %s on port %d"),host.c_str(),port);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("Connecting: %s on port %d"),host.c_str(),port);
|
||||
#endif
|
||||
|
||||
if (!client->connect(host.c_str(), port)) {
|
||||
|
@ -227,7 +227,7 @@ String buffer;
|
|||
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("220"))) {
|
||||
goto exit;
|
||||
|
@ -238,11 +238,11 @@ String buffer;
|
|||
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("250"))) {
|
||||
goto exit;
|
||||
|
@ -252,11 +252,11 @@ String buffer;
|
|||
buffer = F("AUTH LOGIN");
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("334")))
|
||||
{
|
||||
|
@ -267,11 +267,11 @@ String buffer;
|
|||
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("334"))) {
|
||||
goto exit;
|
||||
|
@ -279,11 +279,11 @@ String buffer;
|
|||
buffer = b.encode(passwd);
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("235"))) {
|
||||
goto exit;
|
||||
|
@ -295,11 +295,11 @@ String buffer;
|
|||
buffer += from;
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("250"))) {
|
||||
goto exit;
|
||||
|
@ -308,11 +308,11 @@ String buffer;
|
|||
buffer += to;
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("250"))) {
|
||||
goto exit;
|
||||
|
@ -321,11 +321,11 @@ String buffer;
|
|||
buffer = F("DATA");
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = readClient();
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
if (!buffer.startsWith(F("354"))) {
|
||||
goto exit;
|
||||
|
@ -340,20 +340,20 @@ String buffer;
|
|||
buffer += from;
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = F("To: ");
|
||||
buffer += to;
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
buffer = F("Subject: ");
|
||||
buffer += subject;
|
||||
buffer += F("\r\n");
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -369,13 +369,13 @@ String buffer;
|
|||
#endif
|
||||
client->println('.');
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
|
||||
buffer = F("QUIT");
|
||||
client->println(buffer);
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str());
|
||||
#endif
|
||||
|
||||
status=true;
|
||||
|
@ -386,7 +386,7 @@ exit:
|
|||
|
||||
void xsend_message_txt(char *msg) {
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),msg);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s"),msg);
|
||||
#endif
|
||||
#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)
|
||||
if (*msg=='@') {
|
||||
|
@ -457,7 +457,7 @@ void attach_Array(char *aname) {
|
|||
g_client->print(F("Content-Type: text/plain\r\n"));
|
||||
if (array && alen) {
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("array found %d"),alen);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("array found %d"),alen);
|
||||
#endif
|
||||
char buff[64];
|
||||
sprintf_P(buff,PSTR("Content-Disposition: attachment; filename=\"%s.txt\"\r\n\r\n"), aname);
|
||||
|
@ -544,7 +544,7 @@ uint16_t SendMail(char *buffer) {
|
|||
|
||||
// return if not enough memory
|
||||
uint32_t mem=ESP.getFreeHeap();
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("heap: %d"),mem);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("heap: %d"),mem);
|
||||
if (mem<SEND_MAIL32_MINRAM) {
|
||||
return 4;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ uint16_t SendMail(char *buffer) {
|
|||
|
||||
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("mailsize: %d"),blen);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("mailsize: %d"),blen);
|
||||
#endif
|
||||
|
||||
mserv=strtok(params,":");
|
||||
|
@ -647,7 +647,7 @@ uint16_t SendMail(char *buffer) {
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s - %d - %s - %s"),mserv,port,user,passwd);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s - %d - %s - %s"),mserv,port,user,passwd);
|
||||
#endif
|
||||
|
||||
#ifdef EMAIL_FROM
|
||||
|
@ -657,7 +657,7 @@ uint16_t SendMail(char *buffer) {
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%s - %s - %s - %s"),from,to,subject,cmd);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%s - %s - %s - %s"),from,to,subject,cmd);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -730,7 +730,7 @@ uint16_t SendMail(char *buffer) {
|
|||
//Start sending Email, can be set callback function to track the status
|
||||
if (!MailClient.sendMail(smtpData)) {
|
||||
//Serial.println("Error sending Email, " + MailClient.smtpErrorReason());
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("Error sending Email, %s"), MailClient.smtpErrorReason().c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("Error sending Email, %s"), MailClient.smtpErrorReason().c_str());
|
||||
|
||||
} else {
|
||||
status=0;
|
||||
|
|
|
@ -251,7 +251,7 @@ bool VersionCompatible(void)
|
|||
|
||||
if (!found) { version[1] = 0; }
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("OTA: Version 0x%08X, Compatible 0x%08X"), version[1], VERSION_COMPATIBLE);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("OTA: Version 0x%08X, Compatible 0x%08X"), version[1], VERSION_COMPATIBLE);
|
||||
|
||||
if (version[1] < VERSION_COMPATIBLE) {
|
||||
uint32_t eboot_magic = 0; // Abandon OTA result
|
||||
|
@ -356,7 +356,7 @@ void UpdateQuickPowerCycle(bool update) {
|
|||
} else {
|
||||
qpc_buffer[0] = 0;
|
||||
ESP.flashWrite(qpc_location + (counter * 4), (uint32*)&qpc_buffer, 4);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter);
|
||||
}
|
||||
}
|
||||
else if ((qpc_buffer[0] != QPC_SIGNATURE) || (0 == qpc_buffer[1])) {
|
||||
|
@ -364,7 +364,7 @@ void UpdateQuickPowerCycle(bool update) {
|
|||
// Assume flash is default all ones and setting a bit to zero does not need an erase
|
||||
if (ESP.flashEraseSector(qpc_sector)) {
|
||||
ESP.flashWrite(qpc_location, (uint32*)&qpc_buffer, 4);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("QPC: Reset"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Reset"));
|
||||
}
|
||||
}
|
||||
#else // ESP32
|
||||
|
@ -380,13 +380,13 @@ void UpdateQuickPowerCycle(bool update) {
|
|||
} else {
|
||||
pc_register = 0xFFA55AF0 | counter;
|
||||
QPCWrite(&pc_register, sizeof(pc_register));
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Count %d"), counter);
|
||||
}
|
||||
}
|
||||
else if (pc_register != QPC_SIGNATURE) {
|
||||
pc_register = QPC_SIGNATURE;
|
||||
QPCWrite(&pc_register, sizeof(pc_register));
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("QPC: Reset"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("QPC: Reset"));
|
||||
}
|
||||
#endif // ESP8266 or ESP32
|
||||
|
||||
|
@ -447,12 +447,12 @@ bool SettingsUpdateText(uint32_t index, const char* replace_me) {
|
|||
uint32_t current_len = end_pos - start_pos;
|
||||
int diff = replace_len - current_len;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TST: start %d, end %d, len %d, current %d, replace %d, diff %d"),
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TST: start %d, end %d, len %d, current %d, replace %d, diff %d"),
|
||||
// start_pos, end_pos, char_len, current_len, replace_len, diff);
|
||||
|
||||
int too_long = (char_len + diff) - settings_text_size;
|
||||
if (too_long > 0) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG "Text overflow by %d char(s)"), too_long);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG "Text overflow by %d char(s)"), too_long);
|
||||
return false; // Replace text too long
|
||||
}
|
||||
|
||||
|
@ -474,9 +474,9 @@ bool SettingsUpdateText(uint32_t index, const char* replace_me) {
|
|||
}
|
||||
|
||||
#ifdef DEBUG_FUNC_SETTINGSUPDATETEXT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d, Id %02d = \"%s\""), GetSettingsTextLen(), settings_text_size, settings_text_busy_count, index_save, replace);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d, Id %02d = \"%s\""), GetSettingsTextLen(), settings_text_size, settings_text_busy_count, index_save, replace);
|
||||
#else
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d"), GetSettingsTextLen(), settings_text_size, settings_text_busy_count);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "CR %d/%d, Busy %d"), GetSettingsTextLen(), settings_text_size, settings_text_busy_count);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -561,10 +561,10 @@ void SettingsSave(uint8_t rotate)
|
|||
delay(1);
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG D_SAVED_TO_FLASH_AT " %X, " D_COUNT " %d, " D_BYTES " %d"), settings_location, Settings.save_flag, sizeof(Settings));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG D_SAVED_TO_FLASH_AT " %X, " D_COUNT " %d, " D_BYTES " %d"), settings_location, Settings.save_flag, sizeof(Settings));
|
||||
#else // ESP32
|
||||
SettingsWrite(&Settings, sizeof(Settings));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "Saved, " D_COUNT " %d, " D_BYTES " %d"), Settings.save_flag, sizeof(Settings));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG "Saved, " D_COUNT " %d, " D_BYTES " %d"), Settings.save_flag, sizeof(Settings));
|
||||
#endif // ESP8266
|
||||
|
||||
settings_crc32 = Settings.cfg_crc32;
|
||||
|
@ -596,11 +596,11 @@ void SettingsLoad(void) {
|
|||
}
|
||||
if (settings_location > 0) {
|
||||
ESP.flashRead(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(Settings));
|
||||
AddLog_P2(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings.save_flag);
|
||||
AddLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings.save_flag);
|
||||
}
|
||||
#else // ESP32
|
||||
SettingsRead(&Settings, sizeof(Settings));
|
||||
AddLog_P2(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded, " D_COUNT " %lu"), Settings.save_flag);
|
||||
AddLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded, " D_COUNT " %lu"), Settings.save_flag);
|
||||
#endif // ESP8266 - ESP32
|
||||
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
|
@ -681,7 +681,7 @@ void SettingsErase(uint8_t type)
|
|||
return;
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " from 0x%08X to 0x%08X"), _sectorStart * SPI_FLASH_SEC_SIZE, (_sectorEnd * SPI_FLASH_SEC_SIZE) -1);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " from 0x%08X to 0x%08X"), _sectorStart * SPI_FLASH_SEC_SIZE, (_sectorEnd * SPI_FLASH_SEC_SIZE) -1);
|
||||
|
||||
// EspErase(_sectorStart, _sectorEnd); // Arduino core and SDK - erases flash as seen by SDK
|
||||
EsptoolErase(_sectorStart, _sectorEnd); // Esptool - erases flash completely
|
||||
|
|
|
@ -52,7 +52,7 @@ void OsWatchTicker(void)
|
|||
|
||||
#ifdef DEBUG_THEO
|
||||
int32_t rssi = WiFi.RSSI();
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d %% (%d dBm), last_run %d"), ESP_getFreeHeap(), WifiGetRssiAsQuality(rssi), rssi, last_run);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d %% (%d dBm), last_run %d"), ESP_getFreeHeap(), WifiGetRssiAsQuality(rssi), rssi, last_run);
|
||||
#endif // DEBUG_THEO
|
||||
if (last_run >= (OSWATCH_RESET_TIME * 1000)) {
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING)); // Save iram space
|
||||
|
@ -911,7 +911,7 @@ String GetSerialConfig(void) {
|
|||
|
||||
void SetSerialBegin(void) {
|
||||
TasmotaGlobal.baudrate = Settings.baudrate * 300;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate);
|
||||
Serial.flush();
|
||||
#ifdef ESP8266
|
||||
Serial.begin(TasmotaGlobal.baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings.serial_config));
|
||||
|
@ -1000,7 +1000,7 @@ void ShowSource(uint32_t source)
|
|||
{
|
||||
if ((source > 0) && (source < SRC_MAX)) {
|
||||
char stemp1[20];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SRC: %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SRC: %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1189,7 +1189,7 @@ void TemplateConvert(uint8_t template8[], uint16_t template16[]) {
|
|||
}
|
||||
template16[(sizeof(mytmplt) / 2) -2] = Adc0Convert(template8[sizeof(mytmplt8285) -1]);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("FNC: TemplateConvert"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("FNC: TemplateConvert"));
|
||||
// AddLogBuffer(LOG_LEVEL_DEBUG, template8, sizeof(mytmplt8285));
|
||||
// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)template16, sizeof(mytmplt) / 2, 2);
|
||||
}
|
||||
|
@ -1205,7 +1205,7 @@ void ConvertGpios(void) {
|
|||
Settings.my_gp.io[(sizeof(myio) / 2) -1] = Adc0Convert(Settings.ex_my_adc0);
|
||||
Settings.gpio16_converted = 0xF5A0;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("FNC: ConvertGpios"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("FNC: ConvertGpios"));
|
||||
// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)&Settings.ex_my_gp8.io, sizeof(myio8));
|
||||
// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t *)&Settings.my_gp.io, sizeof(myio) / 2, 2);
|
||||
}
|
||||
|
@ -1342,7 +1342,7 @@ String ModuleName(void)
|
|||
void GetInternalTemplate(void* ptr, uint32_t module, uint32_t option) {
|
||||
uint8_t module_template = pgm_read_byte(kModuleTemplateList + module);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: Template %d, Option %d"), module_template, option);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Template %d, Option %d"), module_template, option);
|
||||
|
||||
// template8 = GPIO 0,1,2,3,4,5,9,10,12,13,14,15,16,Adc
|
||||
uint8_t template8[sizeof(mytmplt8285)] = { GPIO_NONE };
|
||||
|
@ -1374,7 +1374,7 @@ void GetInternalTemplate(void* ptr, uint32_t module, uint32_t option) {
|
|||
}
|
||||
memcpy(ptr, &template16[index], size);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("FNC: GetInternalTemplate option %d"), option);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("FNC: GetInternalTemplate option %d"), option);
|
||||
// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t *)ptr, size / 2, 2);
|
||||
}
|
||||
#endif // ESP8266
|
||||
|
@ -1542,7 +1542,7 @@ bool JsonTemplate(char* dataBuf)
|
|||
// Old: {"NAME":"Shelly 2.5","GPIO":[56,0,17,0,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}
|
||||
// New: {"NAME":"Shelly 2.5","GPIO":[320,0,32,0,224,193,0,0,640,192,608,225,3456,4736],"FLAG":0,"BASE":18}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TPL: |%s|"), dataBuf);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TPL: |%s|"), dataBuf);
|
||||
|
||||
if (strlen(dataBuf) < 9) { return false; } // Workaround exception if empty JSON like {} - Needs checks
|
||||
|
||||
|
@ -1607,7 +1607,7 @@ bool JsonTemplate(char* dataBuf)
|
|||
Settings.user_template_base = base -1; // Default WEMOS
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TPL: Converted"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TPL: Converted"));
|
||||
// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)&Settings.user_template, sizeof(Settings.user_template) / 2, 2);
|
||||
|
||||
return true;
|
||||
|
@ -1615,7 +1615,7 @@ bool JsonTemplate(char* dataBuf)
|
|||
|
||||
void TemplateJson(void)
|
||||
{
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TPL: Show"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TPL: Show"));
|
||||
// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)&Settings.user_template, sizeof(Settings.user_template) / 2, 2);
|
||||
|
||||
Response_P(PSTR("{\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), SettingsText(SET_TEMPLATE_NAME));
|
||||
|
@ -1888,7 +1888,7 @@ void I2cResetActive(uint32_t addr, uint32_t count = 1)
|
|||
i2c_active[addr / 32] &= ~(1 << (addr % 32));
|
||||
addr++;
|
||||
}
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]);
|
||||
}
|
||||
|
||||
void I2cSetActive(uint32_t addr, uint32_t count = 1)
|
||||
|
@ -1899,13 +1899,13 @@ void I2cSetActive(uint32_t addr, uint32_t count = 1)
|
|||
i2c_active[addr / 32] |= (1 << (addr % 32));
|
||||
addr++;
|
||||
}
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("I2C: Active %08X,%08X,%08X,%08X"), i2c_active[0], i2c_active[1], i2c_active[2], i2c_active[3]);
|
||||
}
|
||||
|
||||
void I2cSetActiveFound(uint32_t addr, const char *types)
|
||||
{
|
||||
I2cSetActive(addr);
|
||||
AddLog_P2(LOG_LEVEL_INFO, S_LOG_I2C_FOUND_AT, types, addr);
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_I2C_FOUND_AT, types, addr);
|
||||
}
|
||||
|
||||
bool I2cActive(uint32_t addr)
|
||||
|
@ -1932,7 +1932,7 @@ bool I2cSetDevice(uint32_t addr)
|
|||
* Syslog
|
||||
*
|
||||
* Example:
|
||||
* AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_LOG "Any value %d"), value);
|
||||
* AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_LOG "Any value %d"), value);
|
||||
*
|
||||
\*********************************************************************************************/
|
||||
|
||||
|
@ -1997,7 +1997,7 @@ void Syslog(void)
|
|||
} else {
|
||||
TasmotaGlobal.syslog_level = 0;
|
||||
TasmotaGlobal.syslog_timer = SYSLOG_TIMER;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2048,23 +2048,7 @@ void AddLog(uint32_t loglevel)
|
|||
TasmotaGlobal.prepped_loglevel = 0;
|
||||
}
|
||||
|
||||
void AddLog_P(uint32_t loglevel, const char *formatP)
|
||||
{
|
||||
snprintf_P(TasmotaGlobal.log_data, sizeof(TasmotaGlobal.log_data), formatP);
|
||||
AddLog(loglevel);
|
||||
}
|
||||
|
||||
void AddLog_P(uint32_t loglevel, const char *formatP, const char *formatP2)
|
||||
{
|
||||
char message[sizeof(TasmotaGlobal.log_data)];
|
||||
|
||||
snprintf_P(TasmotaGlobal.log_data, sizeof(TasmotaGlobal.log_data), formatP);
|
||||
snprintf_P(message, sizeof(message), formatP2);
|
||||
strncat(TasmotaGlobal.log_data, message, sizeof(TasmotaGlobal.log_data) - strlen(TasmotaGlobal.log_data) -1);
|
||||
AddLog(loglevel);
|
||||
}
|
||||
|
||||
void PrepLog_P2(uint32_t loglevel, PGM_P formatP, ...)
|
||||
void PrepLog_P(uint32_t loglevel, PGM_P formatP, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, formatP);
|
||||
|
@ -2074,7 +2058,7 @@ void PrepLog_P2(uint32_t loglevel, PGM_P formatP, ...)
|
|||
TasmotaGlobal.prepped_loglevel = loglevel;
|
||||
}
|
||||
|
||||
void AddLog_P2(uint32_t loglevel, PGM_P formatP, ...)
|
||||
void AddLog_P(uint32_t loglevel, PGM_P formatP, ...)
|
||||
{
|
||||
if (TasmotaGlobal.prepped_loglevel) {
|
||||
AddLog(TasmotaGlobal.prepped_loglevel);
|
||||
|
@ -2113,7 +2097,7 @@ void AddLogBuffer(uint32_t loglevel, uint8_t *buffer, uint32_t count)
|
|||
AddLog(loglevel);
|
||||
*/
|
||||
char hex_char[(count * 3) + 2];
|
||||
AddLog_P2(loglevel, PSTR("DMP: %s"), ToHex_P(buffer, count, hex_char, sizeof(hex_char), ' '));
|
||||
AddLog_P(loglevel, PSTR("DMP: %s"), ToHex_P(buffer, count, hex_char, sizeof(hex_char), ' '));
|
||||
}
|
||||
|
||||
void AddLogSerial(uint32_t loglevel)
|
||||
|
@ -2123,7 +2107,7 @@ void AddLogSerial(uint32_t loglevel)
|
|||
|
||||
void AddLogMissed(const char *sensor, uint32_t misses)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SNS: %s missed %d"), sensor, SENSOR_MAX_MISS - misses);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SNS: %s missed %d"), sensor, SENSOR_MAX_MISS - misses);
|
||||
}
|
||||
|
||||
void AddLogBufferSize(uint32_t loglevel, uint8_t *buffer, uint32_t count, uint32_t size) {
|
||||
|
|
|
@ -145,7 +145,7 @@ void ButtonHandler(void) {
|
|||
if (!button_index && ((SONOFF_DUAL == TasmotaGlobal.module_type) || (CH4 == TasmotaGlobal.module_type))) {
|
||||
button_present = 1;
|
||||
if (Button.dual_code) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON " " D_CODE " %04X"), Button.dual_code);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON " " D_CODE " %04X"), Button.dual_code);
|
||||
button = PRESSED;
|
||||
if (0xF500 == Button.dual_code) { // Button hold
|
||||
Button.hold_timer[button_index] = (loops_per_second * Settings.param[P_HOLD_TIME] / 10) -1; // SetOption32 (40)
|
||||
|
@ -175,7 +175,7 @@ void ButtonHandler(void) {
|
|||
Button.touch_hits[button_index] = 0;
|
||||
}
|
||||
if (bitRead(TOUCH_BUTTON.calibration, button_index+1)) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("PLOT: %u, %u, %u,"), button_index+1, _value, Button.touch_hits[button_index]); // Button number (1..4), value, continuous hits under threshold
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("PLOT: %u, %u, %u,"), button_index+1, _value, Button.touch_hits[button_index]); // Button number (1..4), value, continuous hits under threshold
|
||||
}
|
||||
} else
|
||||
#endif // ESP32
|
||||
|
@ -205,12 +205,12 @@ void ButtonHandler(void) {
|
|||
|
||||
bool button_pressed = false;
|
||||
if ((PRESSED == button) && (NOT_PRESSED == Button.last_state[button_index])) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1);
|
||||
Button.hold_timer[button_index] = loops_per_second;
|
||||
button_pressed = true;
|
||||
}
|
||||
if ((NOT_PRESSED == button) && (PRESSED == Button.last_state[button_index])) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_01), button_index +1);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_01), button_index +1);
|
||||
if (!Button.hold_timer[button_index]) { button_pressed = true; } // Do not allow within 1 second
|
||||
}
|
||||
if (button_pressed) {
|
||||
|
@ -229,7 +229,7 @@ void ButtonHandler(void) {
|
|||
|
||||
if (Settings.flag.button_single) { // SetOption13 (0) - Allow only single button press for immediate action,
|
||||
if (!Settings.flag3.mqtt_buttons) { // SetOption73 (0) - Decouple button from relay and send just mqtt topic
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1);
|
||||
if (!SendKey(KEY_BUTTON, button_index +1, POWER_TOGGLE)) { // Execute Toggle command via MQTT if ButtonTopic is set
|
||||
ExecuteCommandPower(button_index +1, POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ void ButtonHandler(void) {
|
|||
}
|
||||
} else {
|
||||
Button.press_counter[button_index] = (Button.window_timer[button_index]) ? Button.press_counter[button_index] +1 : 1;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_MULTI_PRESS " %d"), button_index +1, Button.press_counter[button_index]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_MULTI_PRESS " %d"), button_index +1, Button.press_counter[button_index]);
|
||||
Button.window_timer[button_index] = loops_per_second / 2; // 0.5 second multi press window
|
||||
}
|
||||
TasmotaGlobal.blinks = 201;
|
||||
|
@ -319,7 +319,7 @@ void ButtonHandler(void) {
|
|||
#endif // ESP8266
|
||||
if ((Button.press_counter[button_index] > 1) && valid_relay && (Button.press_counter[button_index] <= MAX_RELAY_BUTTON1)) {
|
||||
ExecuteCommandPower(button_index + Button.press_counter[button_index], POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: Relay%d found on GPIO%d"), Button.press_counter[button_index], Pin(GPIO_REL1, Button.press_counter[button_index]-1));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Relay%d found on GPIO%d"), Button.press_counter[button_index], Pin(GPIO_REL1, Button.press_counter[button_index]-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
|
|||
type[i] = '\0';
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CMD: " D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " \"%s\", " D_DATA " \"%s\""), grpflg, index, type, dataBuf);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CMD: " D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " \"%s\", " D_DATA " \"%s\""), grpflg, index, type, dataBuf);
|
||||
|
||||
if (type != nullptr) {
|
||||
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}"));
|
||||
|
@ -2077,7 +2077,7 @@ void CmndTouchCal(void)
|
|||
}
|
||||
Response_P(PSTR("{\"" D_CMND_TOUCH_CAL "\": %u"), TOUCH_BUTTON.calibration);
|
||||
ResponseJsonEnd();
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("Button Touchvalue Hits,"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("Button Touchvalue Hits,"));
|
||||
}
|
||||
|
||||
void CmndTouchThres(void)
|
||||
|
|
|
@ -136,7 +136,7 @@ void DeviceGroupsInit(void)
|
|||
// Initialize the device information for each device group.
|
||||
device_groups = (struct device_group *)calloc(device_group_count, sizeof(struct device_group));
|
||||
if (!device_groups) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating %u-element array"), device_group_count);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating %u-element array"), device_group_count);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ void DeviceGroupsStart()
|
|||
|
||||
// Subscribe to device groups multicasts.
|
||||
if (!device_groups_udp.beginMulticast(WiFi.localIP(), IPAddress(DEVICE_GROUPS_ADDRESS), DEVICE_GROUPS_PORT)) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("DGR: Error subscribing"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error subscribing"));
|
||||
return;
|
||||
}
|
||||
device_groups_up = true;
|
||||
|
@ -192,7 +192,7 @@ void DeviceGroupsStart()
|
|||
device_group->initial_status_requests_remaining = 10;
|
||||
device_group->next_ack_check_time = next_check_time;
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: (Re)discovering members"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: (Re)discovering members"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de
|
|||
case DGR_ITEM_LIGHT_CHANNELS:
|
||||
break;
|
||||
default:
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("DGR: *** Invalid item=%u"), item);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: *** Invalid item=%u"), item);
|
||||
}
|
||||
#endif // DEVICE_GROUPS_DEBUG
|
||||
|
||||
|
@ -446,7 +446,7 @@ write_log:
|
|||
}
|
||||
delay(10);
|
||||
}
|
||||
if (attempt > 5) AddLog_P2(LOG_LEVEL_ERROR, PSTR("DGR: Error sending message"));
|
||||
if (attempt > 5) AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error sending message"));
|
||||
}
|
||||
goto cleanup;
|
||||
|
||||
|
@ -483,7 +483,7 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes
|
|||
|
||||
// Load the message header, sequence and flags.
|
||||
#ifdef DEVICE_GROUPS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Building %s %spacket"), device_group->group_name, (message_type == DGR_MSGTYP_FULL_STATUS ? PSTR("full status ") : PSTR("")));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Building %s %spacket"), device_group->group_name, (message_type == DGR_MSGTYP_FULL_STATUS ? PSTR("full status ") : PSTR("")));
|
||||
#endif // DEVICE_GROUPS_DEBUG
|
||||
uint16_t original_sequence = device_group->outgoing_sequence;
|
||||
uint16_t flags = 0;
|
||||
|
@ -654,7 +654,7 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes
|
|||
previous_message_ptr += value;
|
||||
}
|
||||
#ifdef DEVICE_GROUPS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: %u items carried over"), kept_item_count);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: %u items carried over"), kept_item_count);
|
||||
#endif // DEVICE_GROUPS_DEBUG
|
||||
}
|
||||
|
||||
|
@ -772,12 +772,12 @@ void ProcessDeviceGroupMessage(uint8_t * message, int message_length)
|
|||
if (!device_group_member) {
|
||||
device_group_member = (struct device_group_member *)calloc(1, sizeof(struct device_group_member));
|
||||
if (device_group_member == nullptr) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating member block"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("DGR: Error allocating member block"));
|
||||
return;
|
||||
}
|
||||
device_group_member->ip_address = remote_ip;
|
||||
*flink = device_group_member;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s added"), IPAddressToString(remote_ip));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s added"), IPAddressToString(remote_ip));
|
||||
break;
|
||||
}
|
||||
else if (device_group_member->ip_address == remote_ip) {
|
||||
|
@ -824,7 +824,7 @@ void DeviceGroupsLoop(void)
|
|||
// If it's time to check on things, iterate through the device groups.
|
||||
if ((long)(now - next_check_time) >= 0) {
|
||||
#ifdef DEVICE_GROUPS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next_check_time, now);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next_check_time, now);
|
||||
#endif // DEVICE_GROUPS_DEBUG
|
||||
next_check_time = now + DGR_ANNOUNCEMENT_INTERVAL * 2;
|
||||
|
||||
|
@ -841,7 +841,7 @@ AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), nex
|
|||
if (device_group->initial_status_requests_remaining) {
|
||||
if (--device_group->initial_status_requests_remaining) {
|
||||
#ifdef DEVICE_GROUPS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Sending initial status request for group %s"), device_group->group_name);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Sending initial status request for group %s"), device_group->group_name);
|
||||
#endif // DEVICE_GROUPS_DEBUG
|
||||
SendReceiveDeviceGroupMessage(device_group, nullptr, device_group->message, device_group->message_length, false);
|
||||
device_group->message[device_group->message_header_length + 2] = DGR_FLAG_STATUS_REQUEST; // The reset flag is on only for the first packet - turn it off now
|
||||
|
@ -859,7 +859,7 @@ AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), nex
|
|||
// If we're done initializing, iterate through the group memebers, ...
|
||||
else {
|
||||
#ifdef DEVICE_GROUPS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Checking for ack's"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking for ack's"));
|
||||
#endif // DEVICE_GROUPS_DEBUG
|
||||
bool acked = true;
|
||||
struct device_group_member ** flink = &device_group->device_group_members;
|
||||
|
@ -874,7 +874,7 @@ AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), nex
|
|||
if ((long)(now - device_group->member_timeout_time) >= 0) {
|
||||
*flink = device_group_member->flink;
|
||||
free(device_group_member);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s removed"), IPAddressToString(device_group_member->ip_address));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s removed"), IPAddressToString(device_group_member->ip_address));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -912,7 +912,7 @@ AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), nex
|
|||
// announcement interval plus a random number of milliseconds so that even if all the devices
|
||||
// booted at the same time, they don't all multicast their announcements at the same time.
|
||||
#ifdef DEVICE_GROUPS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DGR: next_announcement_time=%u, now=%u"), device_group->next_announcement_time, now);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: next_announcement_time=%u, now=%u"), device_group->next_announcement_time, now);
|
||||
#endif // DEVICE_GROUPS_DEBUG
|
||||
if ((long)(now - device_group->next_announcement_time) >= 0) {
|
||||
SendReceiveDeviceGroupMessage(device_group, nullptr, device_group->message, BeginDeviceGroupMessage(device_group, DGR_FLAG_ANNOUNCEMENT, true) - device_group->message, false);
|
||||
|
|
|
@ -126,7 +126,7 @@ void SettingsErase(uint8_t type) {
|
|||
|
||||
NvmErase("main");
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " t=%d"), type);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " t=%d"), type);
|
||||
}
|
||||
|
||||
void SettingsRead(void *data, size_t size) {
|
||||
|
|
|
@ -136,7 +136,7 @@ double TaylorLog(double x)
|
|||
dtostrfd(log1, 8, log1s);
|
||||
char log2s[33];
|
||||
dtostrfd(totalValue, 8, log2s);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("input %s, log %s, taylor %s"), logxs, log1s, log2s);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("input %s, log %s, taylor %s"), logxs, log1s, log2s);
|
||||
*/
|
||||
return totalValue;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ void StartMdns(void) {
|
|||
// } else {
|
||||
// mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START];
|
||||
Mdns.begun = (uint8_t)MDNS.begin(TasmotaGlobal.hostname);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS "%s"), (Mdns.begun) ? D_INITIALIZED : D_FAILED);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS "%s"), (Mdns.begun) ? D_INITIALIZED : D_FAILED);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void MqttDiscoverServer(void)
|
|||
|
||||
int n = MDNS.queryService("mqtt", "tcp"); // Search for mqtt service
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_QUERY_DONE " %d"), n);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_QUERY_DONE " %d"), n);
|
||||
|
||||
if (n > 0) {
|
||||
uint32_t i = 0; // If the hostname isn't set, use the first record found.
|
||||
|
@ -64,7 +64,7 @@ void MqttDiscoverServer(void)
|
|||
SettingsUpdateText(SET_MQTT_HOST, MDNS.IP(i).toString().c_str());
|
||||
Settings.mqtt_port = MDNS.port(i);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_MQTT_SERVICE_FOUND " %s, " D_IP_ADDRESS " %s, " D_PORT " %d"), MDNS.hostname(i).c_str(), SettingsText(SET_MQTT_HOST), Settings.mqtt_port);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_MQTT_SERVICE_FOUND " %s, " D_IP_ADDRESS " %s, " D_PORT " %d"), MDNS.hostname(i).c_str(), SettingsText(SET_MQTT_HOST), Settings.mqtt_port);
|
||||
}
|
||||
}
|
||||
#endif // MQTT_HOST_DISCOVERY
|
||||
|
@ -81,7 +81,7 @@ void MdnsAddServiceHttp(void) {
|
|||
void MdnsUpdate(void) {
|
||||
if (2 == Mdns.begun) {
|
||||
MDNS.update();
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, D_LOG_MDNS, "MDNS.update");
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MDNS "MDNS.update"));
|
||||
}
|
||||
}
|
||||
#endif // WEBSERVER_ADVERTISE
|
||||
|
|
|
@ -186,7 +186,7 @@ void RotaryHandler(void) {
|
|||
|
||||
bool button_pressed = (Button.hold_timer[index]); // Button is pressed: set color temperature
|
||||
if (button_pressed) { Encoder[index].changed = true; }
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: Button1 %d, Position %d"), button_pressed, rotary_position);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("ROT: Button1 %d, Position %d"), button_pressed, rotary_position);
|
||||
|
||||
#ifdef USE_LIGHT
|
||||
if (!Settings.flag4.rotary_uses_rules) { // SetOption98 - Use rules instead of light control
|
||||
|
|
|
@ -389,8 +389,8 @@ void RtcSecond(void)
|
|||
Rtc.daylight_saving_time = RuleToTime(Settings.tflag[1], RtcTime.year);
|
||||
Rtc.standard_time = RuleToTime(Settings.tflag[0], RtcTime.year);
|
||||
|
||||
// Do not use AddLog_P2 here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P2(LOG_LEVEL_DEBUG, PSTR("RTC: " D_UTC_TIME " %s, " D_DST_TIME " %s, " D_STD_TIME " %s"),
|
||||
// Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P(LOG_LEVEL_DEBUG, PSTR("RTC: " D_UTC_TIME " %s, " D_DST_TIME " %s, " D_STD_TIME " %s"),
|
||||
GetDateAndTime(DT_UTC).c_str(), GetDateAndTime(DT_DST).c_str(), GetDateAndTime(DT_STD).c_str());
|
||||
|
||||
if (Rtc.local_time < START_VALID_TIME) { // 2016-01-01
|
||||
|
@ -400,8 +400,8 @@ void RtcSecond(void)
|
|||
}
|
||||
}
|
||||
if ((Rtc.utc_time > (2 * 60 * 60)) && (last_sync < Rtc.utc_time - (2 * 60 * 60))) { // Every two hours a warning
|
||||
// Do not use AddLog_P2 here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P2(LOG_LEVEL_DEBUG, PSTR("RTC: Not synced"));
|
||||
// Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P(LOG_LEVEL_DEBUG, PSTR("RTC: Not synced"));
|
||||
last_sync = Rtc.utc_time;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -812,7 +812,7 @@ void PerformEverySecond(void)
|
|||
if (!(DeepSleepEnabled() && !Settings.flag3.bootcount_update)) {
|
||||
#endif
|
||||
Settings.bootcount++; // Moved to here to stop flash writes during start-up
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount);
|
||||
#ifdef USE_DEEPSLEEP
|
||||
}
|
||||
#endif
|
||||
|
@ -1035,7 +1035,7 @@ void Every250mSeconds(void)
|
|||
char *ech = strchr(bch, '.'); // Find file type in filename (none, .ino.bin, .ino.bin.gz, .bin, .bin.gz or .gz)
|
||||
if (ech == nullptr) { ech = TasmotaGlobal.mqtt_data + strlen(TasmotaGlobal.mqtt_data); } // Point to '/0' at end of mqtt_data becoming an empty string
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("OTA: File type [%s]"), ech);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("OTA: File type [%s]"), ech);
|
||||
|
||||
char ota_url_type[strlen(ech) +1];
|
||||
strncpy(ota_url_type, ech, sizeof(ota_url_type)); // Either empty, .ino.bin, .ino.bin.gz, .bin, .bin.gz or .gz
|
||||
|
@ -1046,7 +1046,7 @@ void Every250mSeconds(void)
|
|||
snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("%s-" D_JSON_MINIMAL "%s"), TasmotaGlobal.mqtt_data, ota_url_type); // Minimal filename must be filename-minimal
|
||||
}
|
||||
#endif // FIRMWARE_MINIMAL
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "%s"), TasmotaGlobal.mqtt_data);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "%s"), TasmotaGlobal.mqtt_data);
|
||||
WiFiClient OTAclient;
|
||||
ota_result = (HTTP_UPDATE_FAILED != ESPhttpUpdate.update(OTAclient, TasmotaGlobal.mqtt_data));
|
||||
if (!ota_result) {
|
||||
|
@ -1169,7 +1169,7 @@ void Every250mSeconds(void)
|
|||
}
|
||||
TasmotaGlobal.restart_flag--;
|
||||
if (TasmotaGlobal.restart_flag <= 0) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "%s"), (TasmotaGlobal.restart_halt) ? "Halted" : D_RESTARTING);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "%s"), (TasmotaGlobal.restart_halt) ? "Halted" : D_RESTARTING);
|
||||
EspRestart();
|
||||
}
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ void ArduinoOTAInit(void)
|
|||
if (Settings.flag.mqtt_enabled) {
|
||||
MqttDisconnect(); // SetOption3 - Enable MQTT
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_UPLOAD_STARTED));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_UPLOAD_STARTED));
|
||||
arduino_ota_triggered = true;
|
||||
arduino_ota_progress_dot_count = 0;
|
||||
delay(100); // Allow time for message xfer
|
||||
|
@ -1310,19 +1310,19 @@ void ArduinoOTAInit(void)
|
|||
default:
|
||||
snprintf_P(error_str, sizeof(error_str), PSTR(D_UPLOAD_ERROR_CODE " %d"), error);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA %s. " D_RESTARTING), error_str);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA %s. " D_RESTARTING), error_str);
|
||||
EspRestart();
|
||||
});
|
||||
|
||||
ArduinoOTA.onEnd([]()
|
||||
{
|
||||
if ((LOG_LEVEL_DEBUG <= TasmotaGlobal.seriallog_level)) { Serial.println(); }
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_SUCCESSFUL ". " D_RESTARTING));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_SUCCESSFUL ". " D_RESTARTING));
|
||||
EspRestart();
|
||||
});
|
||||
|
||||
ArduinoOTA.begin();
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_ENABLED " " D_PORT " 8266"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_ENABLED " " D_PORT " 8266"));
|
||||
}
|
||||
|
||||
void ArduinoOtaLoop(void)
|
||||
|
@ -1430,9 +1430,9 @@ void SerialInput(void)
|
|||
TasmotaGlobal.serial_in_buffer[TasmotaGlobal.serial_in_byte_counter] = 0; // Serial data completed
|
||||
TasmotaGlobal.seriallog_level = (Settings.seriallog_level < LOG_LEVEL_INFO) ? (uint8_t)LOG_LEVEL_INFO : Settings.seriallog_level;
|
||||
if (serial_buffer_overrun) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "Serial buffer overrun"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "Serial buffer overrun"));
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), TasmotaGlobal.serial_in_buffer);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), TasmotaGlobal.serial_in_buffer);
|
||||
ExecuteCommand(TasmotaGlobal.serial_in_buffer, SRC_SERIAL);
|
||||
}
|
||||
TasmotaGlobal.serial_in_byte_counter = 0;
|
||||
|
@ -1505,7 +1505,7 @@ void GpioInit(void)
|
|||
SetSerialBegin();
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: Used GPIOs %d"), GPIO_SENSOR_END);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: Used GPIOs %d"), GPIO_SENSOR_END);
|
||||
|
||||
#ifdef ESP8266
|
||||
ConvertGpios();
|
||||
|
@ -1606,7 +1606,7 @@ void GpioInit(void)
|
|||
SetPin(13, GPIO_SPI_MOSI);
|
||||
TasmotaGlobal.my_module.io[14] = GPIO_SPI_CLK;
|
||||
SetPin(14, GPIO_SPI_CLK);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO12(MISO), GPIO13(MOSI) and GPIO14(CLK)"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO12(MISO), GPIO13(MOSI) and GPIO14(CLK)"));
|
||||
}
|
||||
#endif // USE_SPI
|
||||
#else // ESP32
|
||||
|
@ -1647,15 +1647,15 @@ void GpioInit(void)
|
|||
TasmotaGlobal.spi_enabled = (PinUsed(GPIO_SPI_CLK) && (PinUsed(GPIO_SPI_MOSI) || PinUsed(GPIO_SPI_MISO)));
|
||||
if (TasmotaGlobal.spi_enabled) {
|
||||
if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_MISO)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO), GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO), GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
||||
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
||||
}
|
||||
else if (PinUsed(GPIO_SPI_MOSI)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
||||
Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
||||
}
|
||||
else if (PinUsed(GPIO_SPI_MISO)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO) and GPIO%02d(CLK)"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO) and GPIO%02d(CLK)"),
|
||||
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_CLK));
|
||||
}
|
||||
}
|
||||
|
@ -1666,7 +1666,7 @@ void GpioInit(void)
|
|||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(TasmotaGlobal.my_module.io); i++) {
|
||||
uint32_t mpin = ValidPin(i, TasmotaGlobal.my_module.io[i]);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("INI: gpio pin %d, mpin %d"), i, mpin);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("INI: gpio pin %d, mpin %d"), i, mpin);
|
||||
if (AGPIO(GPIO_OUTPUT_HI) == mpin) {
|
||||
pinMode(i, OUTPUT);
|
||||
digitalWrite(i, 1);
|
||||
|
|
|
@ -125,8 +125,8 @@ void PollUdp(void)
|
|||
int32_t len = PortUdp.read(packet_buffer, UDP_BUFFER_SIZE -1);
|
||||
packet_buffer[len] = 0;
|
||||
#endif
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), packet_buffer);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), packet_buffer);
|
||||
|
||||
// Simple Service Discovery Protocol (SSDP)
|
||||
if (Settings.flag2.emulation) {
|
||||
|
@ -145,7 +145,7 @@ void PollUdp(void)
|
|||
udp_remote_port = PortUdp.remotePort();
|
||||
#endif
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: M-SEARCH Packet from %s:%d\n%s"),
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: M-SEARCH Packet from %s:%d\n%s"),
|
||||
// udp_remote_ip.toString().c_str(), udp_remote_port, packet_buffer);
|
||||
|
||||
uint32_t response_delay = UDP_MSEARCH_SEND_DELAY + ((millis() &0x7) * 100); // 1500 - 2200 msec
|
||||
|
|
|
@ -102,11 +102,11 @@ void WifiConfig(uint8_t type)
|
|||
TasmotaGlobal.restart_flag = 2;
|
||||
}
|
||||
else if (WIFI_SERIAL == Wifi.config_type) {
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_6_SERIAL " " D_ACTIVE_FOR_3_MINUTES));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_6_SERIAL " " D_ACTIVE_FOR_3_MINUTES));
|
||||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
else if (WIFI_MANAGER == Wifi.config_type || WIFI_MANAGER_RESET_ONLY == Wifi.config_type) {
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES));
|
||||
WifiManagerBegin(WIFI_MANAGER_RESET_ONLY == Wifi.config_type);
|
||||
}
|
||||
#endif // USE_WEBSERVER
|
||||
|
@ -125,7 +125,7 @@ void WifiSetMode(WiFiMode_t wifi_mode)
|
|||
|
||||
uint32_t retry = 2;
|
||||
while (!WiFi.mode(wifi_mode) && retry--) {
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR("Retry set Mode..."));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Retry set Mode..."));
|
||||
delay(100);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ void WifiBegin(uint8_t flag, uint8_t channel)
|
|||
} else {
|
||||
WiFi.begin(SettingsText(SET_STASSID1 + Settings.sta_active), SettingsText(SET_STAPWD1 + Settings.sta_active));
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " 11%c " D_AS " %s..."),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " 11%c " D_AS " %s..."),
|
||||
Settings.sta_active +1, SettingsText(SET_STASSID1 + Settings.sta_active), stemp, kWifiPhyMode[WiFi.getPhyMode() & 0x3], TasmotaGlobal.hostname);
|
||||
|
||||
#if LWIP_IPV6
|
||||
|
@ -212,7 +212,7 @@ void WifiBegin(uint8_t flag, uint8_t channel)
|
|||
uint16_t cfgcnt = 0;
|
||||
for (auto addr : addrList) {
|
||||
if ((configured = !addr.isLocal() && addr.isV6()) || cfgcnt==30) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Got IPv6 global address %s"), addr.toString().c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Got IPv6 global address %s"), addr.toString().c_str());
|
||||
break; // IPv6 is mandatory but stop after 15 seconds
|
||||
}
|
||||
delay(500); // Loop until real IPv6 address is aquired or too many tries failed
|
||||
|
@ -247,7 +247,7 @@ void WifiBeginAfterScan(void)
|
|||
if (WiFi.scanComplete() != WIFI_SCAN_RUNNING) {
|
||||
WiFi.scanNetworks(true); // Start wifi scan async
|
||||
Wifi.scan_state++;
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, PSTR("Network (re)scan started..."));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network (re)scan started..."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ void WifiBeginAfterScan(void)
|
|||
}
|
||||
}
|
||||
char hex_char[18];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network %d, AP%c, SSId %s, Channel %d, BSSId %s, RSSI %d, Encryption %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network %d, AP%c, SSId %s, Channel %d, BSSId %s, RSSI %d, Encryption %d"),
|
||||
i,
|
||||
(known) ? (j) ? '2' : '1' : '-',
|
||||
ssid_scan.c_str(),
|
||||
|
@ -389,7 +389,7 @@ void WifiCheckIp(void)
|
|||
Wifi.counter = WIFI_CHECK_SEC;
|
||||
Wifi.retry = Wifi.retry_init;
|
||||
if (Wifi.status != WL_CONNECTED) {
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECTED));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTED));
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Set IP addresses"));
|
||||
Settings.ip_address[1] = (uint32_t)WiFi.gatewayIP();
|
||||
Settings.ip_address[2] = (uint32_t)WiFi.subnetMask();
|
||||
|
@ -412,12 +412,12 @@ void WifiCheckIp(void)
|
|||
Wifi.status = WiFi.status();
|
||||
switch (Wifi.status) {
|
||||
case WL_CONNECTED:
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_NO_IP_ADDRESS));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_NO_IP_ADDRESS));
|
||||
Wifi.status = 0;
|
||||
Wifi.retry = Wifi.retry_init;
|
||||
break;
|
||||
case WL_NO_SSID_AVAIL:
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_NOT_REACHED));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_AP_NOT_REACHED));
|
||||
Settings.wifi_channel = 0; // Disable stored AP
|
||||
if (WIFI_WAIT == Settings.sta_config) {
|
||||
Wifi.retry = Wifi.retry_init;
|
||||
|
@ -431,7 +431,7 @@ void WifiCheckIp(void)
|
|||
}
|
||||
break;
|
||||
case WL_CONNECT_FAILED:
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_WRONG_PASSWORD));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_WRONG_PASSWORD));
|
||||
Settings.wifi_channel = 0; // Disable stored AP
|
||||
if (Wifi.retry > (Wifi.retry_init / 2)) {
|
||||
Wifi.retry = Wifi.retry_init / 2;
|
||||
|
@ -442,7 +442,7 @@ void WifiCheckIp(void)
|
|||
break;
|
||||
default: // WL_IDLE_STATUS and WL_DISCONNECTED
|
||||
if (!Wifi.retry || ((Wifi.retry_init / 2) == Wifi.retry)) {
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_TIMEOUT));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_AP_TIMEOUT));
|
||||
Settings.wifi_channel = 0; // Disable stored AP
|
||||
} else {
|
||||
if (!strlen(SettingsText(SET_STASSID1)) && !strlen(SettingsText(SET_STASSID2))) {
|
||||
|
@ -450,7 +450,7 @@ void WifiCheckIp(void)
|
|||
wifi_config_tool = WIFI_MANAGER; // Skip empty SSIDs and start Wifi config tool
|
||||
Wifi.retry = 0;
|
||||
} else {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, PSTR(D_ATTEMPTING_CONNECTION));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_ATTEMPTING_CONNECTION));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ void WifiCheck(uint8_t param)
|
|||
SettingsUpdateText(SET_STAPWD1, WiFi.psk().c_str());
|
||||
}
|
||||
Settings.sta_active = 0;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER D_CMND_SSID "1 %s"), SettingsText(SET_STASSID1));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER D_CMND_SSID "1 %s"), SettingsText(SET_STASSID1));
|
||||
}
|
||||
}
|
||||
if (!Wifi.config_counter) {
|
||||
|
@ -509,7 +509,7 @@ void WifiCheck(uint8_t param)
|
|||
if (Wifi.scan_state) { WifiBeginAfterScan(); }
|
||||
|
||||
if (Wifi.counter <= 0) {
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, S_LOG_WIFI, PSTR(D_CHECKING_CONNECTION));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI D_CHECKING_CONNECTION));
|
||||
Wifi.counter = WIFI_CHECK_SEC;
|
||||
WifiCheckIp();
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ void WifiConnect(void)
|
|||
|
||||
#ifdef WIFI_RF_PRE_INIT
|
||||
if (rf_pre_init_flag) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Pre-init done"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Pre-init done"));
|
||||
}
|
||||
#endif // WIFI_RF_PRE_INIT
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
void stationKeepAliveNow(void) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI "Sending Gratuitous ARP"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI "Sending Gratuitous ARP"));
|
||||
for (netif* interface = netif_list; interface != nullptr; interface = interface->next)
|
||||
if (
|
||||
(interface->flags & NETIF_FLAG_LINK_UP)
|
||||
|
@ -724,7 +724,7 @@ void WifiPollNtp() {
|
|||
ntp_sync_minute = 60; // Sync so block further requests
|
||||
Rtc.time_synced = true;
|
||||
RtcSecond();
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NTP: Synced"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: Synced"));
|
||||
} else {
|
||||
ntp_sync_minute++; // Try again in next minute
|
||||
}
|
||||
|
@ -750,11 +750,11 @@ uint32_t WifiGetNtp(void) {
|
|||
if (ntp_server_id > 2) { ntp_server_id = 0; }
|
||||
}
|
||||
if (!resolved_ip) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NTP: No server found"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: No server found"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NTP: Name %s, IP %s"), ntp_server, time_server_ip.toString().c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: Name %s, IP %s"), ntp_server, time_server_ip.toString().c_str());
|
||||
|
||||
WiFiUDP udp;
|
||||
|
||||
|
@ -805,7 +805,7 @@ uint32_t WifiGetNtp(void) {
|
|||
if ((packet_buffer[0] & 0b11000000) == 0b11000000) {
|
||||
// Leap-Indicator: unknown (clock unsynchronized)
|
||||
// See: https://github.com/letscontrolit/ESPEasy/issues/2886#issuecomment-586656384
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NTP: IP %s unsynched"), time_server_ip.toString().c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: IP %s unsynched"), time_server_ip.toString().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ uint32_t WifiGetNtp(void) {
|
|||
delay(10);
|
||||
}
|
||||
// Timeout.
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NTP: No reply"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("NTP: No reply"));
|
||||
udp.stop();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ void setup(void) {
|
|||
Settings.module = Settings.fallback_module; // Reset module to fallback module
|
||||
// Settings.last_module = Settings.fallback_module;
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("FRC: " D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("FRC: " D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,9 +296,9 @@ void setup(void) {
|
|||
|
||||
SetPowerOnState();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_CORE_RELEASE), PROJECT, SettingsText(SET_DEVICENAME), TasmotaGlobal.version, TasmotaGlobal.image_name);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_CORE_RELEASE), PROJECT, SettingsText(SET_DEVICENAME), TasmotaGlobal.version, TasmotaGlobal.image_name);
|
||||
#ifdef FIRMWARE_MINIMAL
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_WARNING_MINIMAL_VERSION));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_WARNING_MINIMAL_VERSION));
|
||||
#endif // FIRMWARE_MINIMAL
|
||||
|
||||
memcpy_P(TasmotaGlobal.log_data, VERSION_MARKER, 1); // Dummy for compiler saving VERSION_MARKER
|
||||
|
|
|
@ -833,7 +833,7 @@ void ShowWebSource(uint32_t source)
|
|||
{
|
||||
if ((source > 0) && (source < SRC_MAX)) {
|
||||
char stemp1[20];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SRC: %s from %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource), Webserver->client().remoteIP().toString().c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SRC: %s from %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource), Webserver->client().remoteIP().toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -915,14 +915,14 @@ void StartWebserver(int type, IPAddress ipweb)
|
|||
#if LWIP_IPV6
|
||||
String ipv6_addr = WifiGetIPv6();
|
||||
if (ipv6_addr!="") {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s and IPv6 global address %s "),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s and IPv6 global address %s "),
|
||||
NetworkHostname(), (Mdns.begun) ? ".local" : "", ipweb.toString().c_str(), ipv6_addr.c_str());
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"),
|
||||
NetworkHostname(), (Mdns.begun) ? ".local" : "", ipweb.toString().c_str());
|
||||
}
|
||||
#else
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"),
|
||||
NetworkHostname(), (Mdns.begun) ? ".local" : "", ipweb.toString().c_str());
|
||||
#endif // LWIP_IPV6 = 1
|
||||
TasmotaGlobal.rules_flag.http_init = 1;
|
||||
|
@ -1263,11 +1263,11 @@ void WebRestart(uint32_t type)
|
|||
// type 0 = restart
|
||||
// type 1 = restart after config change
|
||||
// type 2 = restart after config change with possible ip address change too
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_RESTART);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESTART));
|
||||
|
||||
bool reset_only = (HTTP_MANAGER_RESET_ONLY == Web.state);
|
||||
|
||||
WSContentStart_P((type) ? S_SAVE_CONFIGURATION : S_RESTART, !reset_only);
|
||||
WSContentStart_P((type) ? PSTR(D_SAVE_CONFIGURATION) : PSTR(D_RESTART), !reset_only);
|
||||
WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, HTTP_RESTART_RECONNECT_TIME);
|
||||
WSContentSendStyle();
|
||||
if (type) {
|
||||
|
@ -1293,7 +1293,7 @@ void WebRestart(uint32_t type)
|
|||
|
||||
void HandleWifiLogin(void)
|
||||
{
|
||||
WSContentStart_P(S_CONFIGURE_WIFI, false); // false means show page no matter if the client has or has not credentials
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_WIFI), false); // false means show page no matter if the client has or has not credentials
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_LOGIN);
|
||||
|
||||
|
@ -1349,11 +1349,11 @@ void HandleRoot(void)
|
|||
return;
|
||||
}
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_MAIN_MENU);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_MAIN_MENU));
|
||||
|
||||
char stemp[33];
|
||||
|
||||
WSContentStart_P(S_MAIN_MENU);
|
||||
WSContentStart_P(PSTR(D_MAIN_MENU));
|
||||
#ifdef USE_SCRIPT_WEB_DISPLAY
|
||||
WSContentSend_P(HTTP_SCRIPT_ROOT, Settings.web_refresh, Settings.web_refresh);
|
||||
#else
|
||||
|
@ -1748,9 +1748,9 @@ void HandleConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURATION);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURATION));
|
||||
|
||||
WSContentStart_P(S_CONFIGURATION);
|
||||
WSContentStart_P(PSTR(D_CONFIGURATION));
|
||||
WSContentSendStyle();
|
||||
|
||||
WSContentButton(BUTTON_MODULE);
|
||||
|
@ -1864,9 +1864,9 @@ void HandleTemplateConfiguration(void)
|
|||
return;
|
||||
}
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_TEMPLATE);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_TEMPLATE));
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_TEMPLATE);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_TEMPLATE));
|
||||
WSContentSend_P(HTTP_SCRIPT_MODULE_TEMPLATE);
|
||||
|
||||
WSContentSend_P(HTTP_SCRIPT_TEMPLATE);
|
||||
|
@ -1973,14 +1973,14 @@ void HandleModuleConfiguration(void)
|
|||
return;
|
||||
}
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_MODULE);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_MODULE));
|
||||
|
||||
char stemp[30]; // Sensor name
|
||||
uint32_t midx;
|
||||
myio cmodule;
|
||||
ModuleGpios(&cmodule);
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_MODULE);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_MODULE));
|
||||
WSContentSend_P(HTTP_SCRIPT_MODULE_TEMPLATE);
|
||||
|
||||
WSContentSend_P(PSTR("function sl(){os=\""));
|
||||
|
@ -2053,7 +2053,7 @@ void ModuleSaveSettings(void)
|
|||
}
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str());
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
|
@ -2084,7 +2084,7 @@ void HandleWifiConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess(!WifiIsInManagerMode())) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_WIFI);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_WIFI));
|
||||
|
||||
if (Webserver->hasArg("save") && HTTP_MANAGER_RESET_ONLY != Web.state) {
|
||||
WifiSaveSettings();
|
||||
|
@ -2092,7 +2092,7 @@ void HandleWifiConfiguration(void)
|
|||
return;
|
||||
}
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_WIFI, !WifiIsInManagerMode());
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_WIFI), !WifiIsInManagerMode());
|
||||
WSContentSend_P(HTTP_SCRIPT_WIFI);
|
||||
WSContentSendStyle();
|
||||
|
||||
|
@ -2105,8 +2105,8 @@ void HandleWifiConfiguration(void)
|
|||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SCAN_DONE));
|
||||
|
||||
if (0 == n) {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, S_NO_NETWORKS_FOUND);
|
||||
WSContentSend_P(S_NO_NETWORKS_FOUND);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_NO_NETWORKS_FOUND));
|
||||
WSContentSend_P(PSTR(D_NO_NETWORKS_FOUND));
|
||||
WSContentSend_P(PSTR(". " D_REFRESH_TO_SCAN_AGAIN "."));
|
||||
} else {
|
||||
//sort networks
|
||||
|
@ -2198,7 +2198,7 @@ void WifiSaveSettings(void)
|
|||
SettingsUpdateText(SET_STAPWD1, (!strlen(tmp)) ? "" : (strlen(tmp) < 5) ? SettingsText(SET_STAPWD1) : tmp);
|
||||
WebGetArg("p2", tmp, sizeof(tmp));
|
||||
SettingsUpdateText(SET_STAPWD2, (!strlen(tmp)) ? "" : (strlen(tmp) < 5) ? SettingsText(SET_STAPWD2) : tmp);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_SSID "2 %s, " D_CMND_CORS " %s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_SSID "2 %s, " D_CMND_CORS " %s"),
|
||||
SettingsText(SET_HOSTNAME), SettingsText(SET_STASSID1), SettingsText(SET_STASSID2), SettingsText(SET_CORS));
|
||||
}
|
||||
|
||||
|
@ -2208,7 +2208,7 @@ void HandleLoggingConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_LOGGING);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_LOGGING));
|
||||
|
||||
if (Webserver->hasArg("save")) {
|
||||
LoggingSaveSettings();
|
||||
|
@ -2216,7 +2216,7 @@ void HandleLoggingConfiguration(void)
|
|||
return;
|
||||
}
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_LOGGING);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_LOGGING));
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_LOG1);
|
||||
char stemp1[45];
|
||||
|
@ -2263,7 +2263,7 @@ void LoggingSaveSettings(void)
|
|||
if ((Settings.tele_period > 0) && (Settings.tele_period < 10)) {
|
||||
Settings.tele_period = 10; // Do not allow periods < 10 seconds
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_LOG D_CMND_SERIALLOG " %d, " D_CMND_WEBLOG " %d, " D_CMND_MQTTLOG " %d, " D_CMND_SYSLOG " %d, " D_CMND_LOGHOST " %s, " D_CMND_LOGPORT " %d, " D_CMND_TELEPERIOD " %d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_LOG D_CMND_SERIALLOG " %d, " D_CMND_WEBLOG " %d, " D_CMND_MQTTLOG " %d, " D_CMND_SYSLOG " %d, " D_CMND_LOGHOST " %s, " D_CMND_LOGPORT " %d, " D_CMND_TELEPERIOD " %d"),
|
||||
Settings.seriallog_level, Settings.weblog_level, Settings.mqttlog_level, Settings.syslog_level, SettingsText(SET_SYSLOG_HOST), Settings.syslog_port, Settings.tele_period);
|
||||
}
|
||||
|
||||
|
@ -2273,7 +2273,7 @@ void HandleOtherConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_OTHER);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_OTHER));
|
||||
|
||||
if (Webserver->hasArg("save")) {
|
||||
OtherSaveSettings();
|
||||
|
@ -2281,7 +2281,7 @@ void HandleOtherConfiguration(void)
|
|||
return;
|
||||
}
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_OTHER);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_OTHER));
|
||||
WSContentSendStyle();
|
||||
|
||||
TemplateJson();
|
||||
|
@ -2418,9 +2418,9 @@ void HandleResetConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess(!WifiIsInManagerMode())) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_RESET_CONFIGURATION);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESET_CONFIGURATION));
|
||||
|
||||
WSContentStart_P(S_RESET_CONFIGURATION, !WifiIsInManagerMode());
|
||||
WSContentStart_P(PSTR(D_RESET_CONFIGURATION), !WifiIsInManagerMode());
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(PSTR("<div style='text-align:center;'>" D_CONFIGURATION_RESET "</div>"));
|
||||
WSContentSend_P(HTTP_MSG_RSTRT);
|
||||
|
@ -2436,9 +2436,9 @@ void HandleRestoreConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_RESTORE_CONFIGURATION);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESTORE_CONFIGURATION));
|
||||
|
||||
WSContentStart_P(S_RESTORE_CONFIGURATION);
|
||||
WSContentStart_P(PSTR(D_RESTORE_CONFIGURATION));
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_RST);
|
||||
WSContentSend_P(HTTP_FORM_RST_UPG, D_RESTORE);
|
||||
|
@ -2459,13 +2459,13 @@ void HandleInformation(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_INFORMATION);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_INFORMATION));
|
||||
|
||||
char stopic[TOPSZ];
|
||||
|
||||
int freeMem = ESP_getFreeHeap();
|
||||
|
||||
WSContentStart_P(S_INFORMATION);
|
||||
WSContentStart_P(PSTR(D_INFORMATION));
|
||||
// Save 1k of code space replacing table html with javascript replace codes
|
||||
// }1 = </td></tr><tr><th>
|
||||
// }2 = </th><td>
|
||||
|
@ -2606,9 +2606,9 @@ void HandleUpgradeFirmware(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_FIRMWARE_UPGRADE);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_FIRMWARE_UPGRADE));
|
||||
|
||||
WSContentStart_P(S_FIRMWARE_UPGRADE);
|
||||
WSContentStart_P(PSTR(D_FIRMWARE_UPGRADE));
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_UPG, SettingsText(SET_OTAURL));
|
||||
WSContentSend_P(HTTP_FORM_RST_UPG, D_UPGRADE);
|
||||
|
@ -2635,7 +2635,7 @@ void HandleUpgradeFirmwareStart(void)
|
|||
ExecuteWebCommand(command, SRC_WEBGUI);
|
||||
}
|
||||
|
||||
WSContentStart_P(S_INFORMATION);
|
||||
WSContentStart_P(PSTR(D_INFORMATION));
|
||||
WSContentSend_P(HTTP_SCRIPT_RELOAD_TIME, HTTP_OTA_RESTART_RECONNECT_TIME);
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPGRADE_STARTED " ...</b></div>"));
|
||||
|
@ -2672,7 +2672,7 @@ void HandleUploadDone(void)
|
|||
CounterInterruptDisable(false);
|
||||
#endif // USE_COUNTER
|
||||
|
||||
WSContentStart_P(S_INFORMATION);
|
||||
WSContentStart_P(PSTR(D_INFORMATION));
|
||||
if (!Web.upload_error) {
|
||||
uint32_t javascript_settimeout = HTTP_OTA_RESTART_RECONNECT_TIME;
|
||||
#if defined(USE_ZIGBEE) && defined(USE_ZIGBEE_EZSP)
|
||||
|
@ -2746,7 +2746,7 @@ void HandleUploadLoop(void)
|
|||
return;
|
||||
}
|
||||
SettingsSave(1); // Free flash for upload
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_FILE " %s ..."), upload.filename.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_FILE " %s ..."), upload.filename.c_str());
|
||||
if (UPL_SETTINGS == Web.upload_file_type) {
|
||||
if (!SettingsBufferAlloc()) {
|
||||
Web.upload_error = 2; // Not enough space
|
||||
|
@ -2833,7 +2833,7 @@ void HandleUploadLoop(void)
|
|||
// upload.buf[2] = 3; // Force DOUT - ESP8285
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "File type %d"), Web.upload_file_type);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "File type %d"), Web.upload_file_type);
|
||||
}
|
||||
}
|
||||
if (UPL_SETTINGS == Web.upload_file_type) {
|
||||
|
@ -2984,7 +2984,7 @@ void HandleUploadLoop(void)
|
|||
}
|
||||
}
|
||||
if (!Web.upload_error) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes"), upload.totalSize);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes"), upload.totalSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3082,9 +3082,9 @@ void HandleConsole(void)
|
|||
return;
|
||||
}
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONSOLE);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONSOLE));
|
||||
|
||||
WSContentStart_P(S_CONSOLE);
|
||||
WSContentStart_P(PSTR(D_CONSOLE));
|
||||
WSContentSend_P(HTTP_SCRIPT_CONSOL, Settings.web_refresh);
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_CMND);
|
||||
|
@ -3099,7 +3099,7 @@ void HandleConsoleRefresh(void)
|
|||
|
||||
String svalue = Webserver->arg("c1");
|
||||
if (svalue.length() && (svalue.length() < MQTT_MAX_PACKET_SIZE)) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), svalue.c_str());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), svalue.c_str());
|
||||
ExecuteWebCommand((char*)svalue.c_str(), SRC_WEBCONSOLE);
|
||||
}
|
||||
|
||||
|
@ -3142,7 +3142,7 @@ void HandleConsoleRefresh(void)
|
|||
|
||||
void HandleNotFound(void)
|
||||
{
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "Not found (%s)"), Webserver->uri().c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "Not found (%s)"), Webserver->uri().c_str());
|
||||
|
||||
if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the error page.
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ bool MqttPublishLib(const char* topic, bool retained)
|
|||
void MqttDumpData(char* topic, char* data, uint32_t data_len) {
|
||||
char dump_data[data_len +1];
|
||||
memcpy(dump_data, data, sizeof(dump_data)); // Make another copy for removing optional control characters
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MQTT D_DATA_SIZE " %d, \"%s %s\""), data_len, topic, RemoveControlCharacter(dump_data));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MQTT D_DATA_SIZE " %d, \"%s %s\""), data_len, topic, RemoveControlCharacter(dump_data));
|
||||
}
|
||||
|
||||
void MqttDataHandler(char* mqtt_topic, uint8_t* mqtt_data, unsigned int data_len)
|
||||
|
@ -251,7 +251,7 @@ void MqttDataHandler(char* mqtt_topic, uint8_t* mqtt_data, unsigned int data_len
|
|||
char data[data_len +1];
|
||||
memcpy(data, mqtt_data, sizeof(data));
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MQTT D_DATA_SIZE " %d, \"%s %s\""), data_len, topic, data);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_MQTT D_DATA_SIZE " %d, \"%s %s\""), data_len, topic, data);
|
||||
// if (LOG_LEVEL_DEBUG_MORE <= TasmotaGlobal.seriallog_level) { Serial.println(data); }
|
||||
MqttDumpData(topic, data, data_len); // Use a function to save stack space used by dump_data
|
||||
|
||||
|
@ -276,13 +276,13 @@ void MqttRetryCounter(uint8_t value)
|
|||
|
||||
void MqttSubscribe(const char *topic)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_SUBSCRIBE_TO " %s"), topic);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_SUBSCRIBE_TO " %s"), topic);
|
||||
MqttSubscribeLib(topic);
|
||||
}
|
||||
|
||||
void MqttUnsubscribe(const char *topic)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_UNSUBSCRIBE_FROM " %s"), topic);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_UNSUBSCRIBE_FROM " %s"), topic);
|
||||
MqttUnsubscribeLib(topic);
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ void MqttPublishPrefixTopic_P(uint32_t prefix, const char* subtopic, bool retain
|
|||
free(mqtt_save);
|
||||
|
||||
bool result = MqttClient.publish(romram, TasmotaGlobal.mqtt_data, false);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Updated shadow: %s"), romram);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Updated shadow: %s"), romram);
|
||||
yield(); // #3313
|
||||
}
|
||||
#endif // USE_MQTT_AWS_IOT
|
||||
|
@ -484,7 +484,7 @@ void MqttDisconnected(int state)
|
|||
|
||||
MqttClient.disconnect();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND), SettingsText(SET_MQTT_HOST), Settings.mqtt_port, state, Mqtt.retry_counter);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND), SettingsText(SET_MQTT_HOST), Settings.mqtt_port, state, Mqtt.retry_counter);
|
||||
TasmotaGlobal.rules_flag.mqtt_disconnected = 1;
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ void MqttConnected(void)
|
|||
char stopic[TOPSZ];
|
||||
|
||||
if (Mqtt.allowed) {
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_MQTT, PSTR(D_CONNECTED));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECTED));
|
||||
Mqtt.connected = true;
|
||||
Mqtt.retry_counter = 0;
|
||||
Mqtt.connect_count++;
|
||||
|
@ -614,7 +614,7 @@ void MqttReconnect(void)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_MQTT, PSTR(D_ATTEMPTING_CONNECTION));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_ATTEMPTING_CONNECTION));
|
||||
|
||||
char *mqtt_user = nullptr;
|
||||
char *mqtt_pwd = nullptr;
|
||||
|
@ -688,10 +688,10 @@ void MqttReconnect(void)
|
|||
if (MqttClient.connect(TasmotaGlobal.mqtt_client, mqtt_user, mqtt_pwd, stopic, 1, lwt_retain, TasmotaGlobal.mqtt_data, MQTT_CLEAN_SESSION)) {
|
||||
#ifdef USE_MQTT_TLS
|
||||
if (Mqtt.mqtt_tls) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connected in %d ms, max ThunkStack used %d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connected in %d ms, max ThunkStack used %d"),
|
||||
millis() - mqtt_connect_time, tlsClient->getMaxThunkStackUse());
|
||||
if (!tlsClient->getMFLNStatus()) {
|
||||
AddLog_P(LOG_LEVEL_INFO, S_LOG_MQTT, PSTR("MFLN not supported by TLS server"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "MFLN not supported by TLS server"));
|
||||
}
|
||||
#ifndef USE_MQTT_TLS_CA_CERT // don't bother with fingerprints if using CA validation
|
||||
// **** Start patch Castellucci
|
||||
|
@ -699,7 +699,7 @@ void MqttReconnect(void)
|
|||
// create a printable version of the fingerprint received
|
||||
char buf_fingerprint[64];
|
||||
ToHex_P((unsigned char *)tlsClient->getRecvPubKeyFingerprint(), 20, buf_fingerprint, sizeof(buf_fingerprint), ' ');
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Server fingerprint: %s"), buf_fingerprint);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Server fingerprint: %s"), buf_fingerprint);
|
||||
|
||||
if (learn_fingerprint1 || learn_fingerprint2) {
|
||||
// we potentially need to learn the fingerprint just seen
|
||||
|
@ -719,7 +719,7 @@ void MqttReconnect(void)
|
|||
if (learn_fingerprint2) {
|
||||
memcpy(Settings.mqtt_fingerprint[1], recv_fingerprint, 20);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "Fingerprint learned: %s"), buf_fingerprint);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "Fingerprint learned: %s"), buf_fingerprint);
|
||||
|
||||
SettingsSaveAll(); // save settings
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ void MqttReconnect(void)
|
|||
// create a printable version of the fingerprint received
|
||||
char buf_fingerprint[64];
|
||||
ToHex_P(recv_fingerprint, 20, buf_fingerprint, sizeof(buf_fingerprint), ' ');
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Server fingerprint: %s"), buf_fingerprint);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT "Server fingerprint: %s"), buf_fingerprint);
|
||||
|
||||
bool learned = false;
|
||||
|
||||
|
@ -748,7 +748,7 @@ void MqttReconnect(void)
|
|||
}
|
||||
|
||||
if (learned) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "Fingerprint learned: %s"), buf_fingerprint);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "Fingerprint learned: %s"), buf_fingerprint);
|
||||
|
||||
SettingsSaveAll(); // save settings
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ void MqttReconnect(void)
|
|||
} else {
|
||||
#ifdef USE_MQTT_TLS
|
||||
if (Mqtt.mqtt_tls) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connection error: %d"), tlsClient->getLastError());
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT "TLS connection error: %d"), tlsClient->getLastError());
|
||||
}
|
||||
#endif
|
||||
MqttDisconnected(MqttClient.state()); // status codes are documented here http://pubsubclient.knolleary.net/api.html#state
|
||||
|
@ -1218,7 +1218,7 @@ void CmndTlsKey(void) {
|
|||
if (bin_len > 0) {
|
||||
if (bin_len != 32) {
|
||||
// no private key was previously stored, abort
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate must be 32 bytes: %d."), bin_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate must be 32 bytes: %d."), bin_len);
|
||||
free(spi_buffer);
|
||||
free(bin_buf);
|
||||
return;
|
||||
|
@ -1242,7 +1242,7 @@ void CmndTlsKey(void) {
|
|||
}
|
||||
if (bin_len <= 256) {
|
||||
// Certificate lenght too short
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate length too short: %d."), bin_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TLSKey: Certificate length too short: %d."), bin_len);
|
||||
free(spi_buffer);
|
||||
free(bin_buf);
|
||||
return;
|
||||
|
@ -1319,7 +1319,7 @@ void HandleMqttConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_MQTT);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_MQTT));
|
||||
|
||||
if (Webserver->hasArg("save")) {
|
||||
MqttSaveSettings();
|
||||
|
@ -1329,7 +1329,7 @@ void HandleMqttConfiguration(void)
|
|||
|
||||
char str[TOPSZ];
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_MQTT);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_MQTT));
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_MQTT1,
|
||||
SettingsText(SET_MQTT_HOST),
|
||||
|
@ -1375,14 +1375,14 @@ void MqttSaveSettings(void)
|
|||
WebGetArg("mc", tmp, sizeof(tmp));
|
||||
SettingsUpdateText(SET_MQTT_CLIENT, (!strlen(tmp)) ? MQTT_CLIENT_ID : tmp);
|
||||
#if defined(USE_MQTT_TLS) && (defined(USE_MQTT_AWS_IOT) || defined(USE_MQTT_AWS_IOT_LIGHT))
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CMND_MQTTHOST " %s, " D_CMND_MQTTPORT " %d, " D_CMND_MQTTCLIENT " %s, " D_CMND_TOPIC " %s, " D_CMND_FULLTOPIC " %s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CMND_MQTTHOST " %s, " D_CMND_MQTTPORT " %d, " D_CMND_MQTTCLIENT " %s, " D_CMND_TOPIC " %s, " D_CMND_FULLTOPIC " %s"),
|
||||
SettingsText(SET_MQTT_HOST), Settings.mqtt_port, SettingsText(SET_MQTT_CLIENT), SettingsText(SET_MQTT_TOPIC), SettingsText(SET_MQTT_FULLTOPIC));
|
||||
#else // USE_MQTT_AWS_IOT
|
||||
WebGetArg("mu", tmp, sizeof(tmp));
|
||||
SettingsUpdateText(SET_MQTT_USER, (!strlen(tmp)) ? MQTT_USER : (!strcmp(tmp,"0")) ? "" : tmp);
|
||||
WebGetArg("mp", tmp, sizeof(tmp));
|
||||
SettingsUpdateText(SET_MQTT_PWD, (!strlen(tmp)) ? "" : (!strcmp(tmp, D_ASTERISK_PWD)) ? SettingsText(SET_MQTT_PWD) : tmp);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CMND_MQTTHOST " %s, " D_CMND_MQTTPORT " %d, " D_CMND_MQTTCLIENT " %s, " D_CMND_MQTTUSER " %s, " D_CMND_TOPIC " %s, " D_CMND_FULLTOPIC " %s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CMND_MQTTHOST " %s, " D_CMND_MQTTPORT " %d, " D_CMND_MQTTCLIENT " %s, " D_CMND_MQTTUSER " %s, " D_CMND_TOPIC " %s, " D_CMND_FULLTOPIC " %s"),
|
||||
SettingsText(SET_MQTT_HOST), Settings.mqtt_port, SettingsText(SET_MQTT_CLIENT), SettingsText(SET_MQTT_USER), SettingsText(SET_MQTT_TOPIC), SettingsText(SET_MQTT_FULLTOPIC));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ void EnergyUpdateTotal(float value, bool kwh)
|
|||
{
|
||||
// char energy_total_chr[FLOATSZ];
|
||||
// dtostrfd(value, 4, energy_total_chr);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total %s %sWh"), energy_total_chr, (kwh) ? "k" : "");
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total %s %sWh"), energy_total_chr, (kwh) ? "k" : "");
|
||||
|
||||
uint32_t multiplier = (kwh) ? 100000 : 100; // kWh or Wh to deca milli Wh
|
||||
|
||||
|
@ -244,7 +244,7 @@ void EnergyUpdateTotal(float value, bool kwh)
|
|||
Settings.energy_kWhtotal = RtcSettings.energy_kWhtotal;
|
||||
Energy.total = (float)(RtcSettings.energy_kWhtotal + Energy.kWhtoday_offset + Energy.kWhtoday) / 100000;
|
||||
Settings.energy_kWhtotal_time = (!Energy.kWhtoday_offset) ? LocalTime() : Midnight();
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total updated with hardware value"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: Energy Total updated with hardware value"));
|
||||
}
|
||||
EnergyUpdateToday();
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ void EnergyMarginCheck(void)
|
|||
for (uint32_t phase = 0; phase < Energy.phase_count; phase++) {
|
||||
uint16_t active_power = (uint16_t)(Energy.active_power[phase]);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: APower %d, HPower0 %d, HPower1 %d, HPower2 %d"), active_power, Energy.power_history[phase][0], Energy.power_history[phase][1], Energy.power_history[phase][2]);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: APower %d, HPower0 %d, HPower1 %d, HPower2 %d"), active_power, Energy.power_history[phase][0], Energy.power_history[phase][1], Energy.power_history[phase][2]);
|
||||
|
||||
if (Settings.energy_power_delta[phase]) {
|
||||
power_diff[phase] = active_power - Energy.power_history[phase][0];
|
||||
|
@ -509,7 +509,7 @@ void EnergyEverySecond(void)
|
|||
|
||||
char temperature[33];
|
||||
dtostrfd(TasmotaGlobal.temperature_celsius, 1, temperature);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: GlobTemp %s"), temperature);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: GlobTemp %s"), temperature);
|
||||
|
||||
SetAllPower(POWER_ALL_OFF, SRC_OVERTEMP);
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ class LightStateClass {
|
|||
|
||||
public:
|
||||
LightStateClass() {
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::Constructor RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _bri);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::Constructor RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _bri);
|
||||
}
|
||||
|
||||
void setSubType(uint8_t sub_type) {
|
||||
|
@ -434,7 +434,7 @@ class LightStateClass {
|
|||
if (0 == _briCT) { _briCT = maxbri; }
|
||||
}
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setColorMode prev_cm (%d) req_cm (%d) new_cm (%d)", prev_cm, cm, _color_mode);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setColorMode prev_cm (%d) req_cm (%d) new_cm (%d)", prev_cm, cm, _color_mode);
|
||||
#endif
|
||||
return prev_cm;
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ class LightStateClass {
|
|||
setBriRGB(_color_mode & LCM_RGB ? bri : 0);
|
||||
setBriCT(_color_mode & LCM_CT ? bri : 0);
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setBri RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setBri RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -608,7 +608,7 @@ class LightStateClass {
|
|||
addCTMode();
|
||||
}
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCT RGB raw (%d %d %d) HS (%d %d) briRGB (%d) briCT (%d) CT (%d)", _r, _g, _b, _hue, _sat, _briRGB, _briCT, _ct);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCT RGB raw (%d %d %d) HS (%d %d) briRGB (%d) briCT (%d) CT (%d)", _r, _g, _b, _hue, _sat, _briRGB, _briCT, _ct);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -648,7 +648,7 @@ class LightStateClass {
|
|||
if (_color_mode & LCM_CT) { _briCT = free_range ? max : (sum > 255 ? 255 : sum); }
|
||||
}
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCW CW (%d %d) CT (%d) briCT (%d)", c, w, _ct, _briCT);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setCW CW (%d %d) CT (%d) briCT (%d)", c, w, _ct, _briCT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ class LightStateClass {
|
|||
uint16_t hue;
|
||||
uint8_t sat;
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB input (%d %d %d)", r, g, b);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB input (%d %d %d)", r, g, b);
|
||||
#endif
|
||||
|
||||
uint32_t max = (r > g && r > b) ? r : (g > b) ? g : b; // 0..255
|
||||
|
@ -685,7 +685,7 @@ class LightStateClass {
|
|||
_hue = hue;
|
||||
_sat = sat;
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setRGB RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB);
|
||||
#endif
|
||||
return max;
|
||||
}
|
||||
|
@ -700,8 +700,8 @@ class LightStateClass {
|
|||
_sat = sat;
|
||||
addRGBMode();
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS HS (%d %d) rgb (%d %d %d)", hue, sat, r, g, b);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS HS (%d %d) rgb (%d %d %d)", hue, sat, r, g, b);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setHS RGB raw (%d %d %d) HS (%d %d) bri (%d)", _r, _g, _b, _hue, _sat, _briRGB);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -722,10 +722,10 @@ class LightStateClass {
|
|||
setRGB(channels[0], channels[1], channels[2]);
|
||||
setCW(channels[3], channels[4], true); // free range for WC and WW
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels (%d %d %d %d %d)",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels (%d %d %d %d %d)",
|
||||
channels[0], channels[1], channels[2], channels[3], channels[4]);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels CT (%d) briRGB (%d) briCT (%d)", _ct, _briRGB, _briCT);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels Actuals (%d %d %d %d %d)",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels CT (%d) briRGB (%d) briCT (%d)", _ct, _briRGB, _briCT);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightStateClass::setChannels Actuals (%d %d %d %d %d)",
|
||||
_r, _g, _b, _wc, _ww);
|
||||
#endif
|
||||
}
|
||||
|
@ -772,7 +772,7 @@ void LightStateClass::RgbToHsb(uint8_t ir, uint8_t ig, uint8_t ib, uint16_t *r_h
|
|||
if (r_hue) *r_hue = hue;
|
||||
if (r_sat) *r_sat = sat;
|
||||
if (r_bri) *r_bri = bri;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, "RgbToHsb rgb (%d %d %d) hsb (%d %d %d)", r, g, b, hue, sat, bri);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, "RgbToHsb rgb (%d %d %d) hsb (%d %d %d)", r, g, b, hue, sat, bri);
|
||||
}
|
||||
|
||||
void LightStateClass::HsToRgb(uint16_t hue, uint8_t sat, uint8_t *r_r, uint8_t *r_g, uint8_t *r_b) {
|
||||
|
@ -959,9 +959,9 @@ public:
|
|||
void debugLogs() {
|
||||
uint8_t r,g,b,c,w;
|
||||
_state->getActualRGBCW(&r,&g,&b,&c,&w);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs rgb (%d %d %d) cw (%d %d)",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs rgb (%d %d %d) cw (%d %d)",
|
||||
r, g, b, c, w);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs lightCurrent (%d %d %d %d %d)",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::debugLogs lightCurrent (%d %d %d %d %d)",
|
||||
Light.current_color[0], Light.current_color[1], Light.current_color[2],
|
||||
Light.current_color[3], Light.current_color[4]);
|
||||
}
|
||||
|
@ -969,10 +969,10 @@ public:
|
|||
|
||||
void loadSettings() {
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings Settings.light_color (%d %d %d %d %d - %d)",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings Settings.light_color (%d %d %d %d %d - %d)",
|
||||
Settings.light_color[0], Settings.light_color[1], Settings.light_color[2],
|
||||
Settings.light_color[3], Settings.light_color[4], Settings.light_dimmer);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings light_type/sub (%d %d)",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::loadSettings light_type/sub (%d %d)",
|
||||
TasmotaGlobal.light_type, Light.subtype);
|
||||
#endif
|
||||
if (_pwm_multi_channels) {
|
||||
|
@ -1147,7 +1147,7 @@ public:
|
|||
}
|
||||
}
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::saveSettings Settings.light_color (%d %d %d %d %d - %d)",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightControllerClass::saveSettings Settings.light_color (%d %d %d %d %d - %d)",
|
||||
Settings.light_color[0], Settings.light_color[1], Settings.light_color[2],
|
||||
Settings.light_color[3], Settings.light_color[4], Settings.light_dimmer);
|
||||
#endif
|
||||
|
@ -1322,7 +1322,7 @@ void LightCalcPWMRange(void) {
|
|||
|
||||
Light.pwm_min = pwm_min;
|
||||
Light.pwm_max = pwm_max;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("LightCalcPWMRange %d %d - %d %d"), Settings.dimmer_hw_min, Settings.dimmer_hw_max, Light.pwm_min, Light.pwm_max);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("LightCalcPWMRange %d %d - %d %d"), Settings.dimmer_hw_min, Settings.dimmer_hw_max, Light.pwm_min, Light.pwm_max);
|
||||
}
|
||||
|
||||
void LightInit(void)
|
||||
|
@ -1354,7 +1354,7 @@ void LightInit(void)
|
|||
}
|
||||
LightCalcPWMRange();
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightInit Light.pwm_multi_channels=%d Light.subtype=%d Light.device=%d TasmotaGlobal.devices_present=%d",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightInit Light.pwm_multi_channels=%d Light.subtype=%d Light.device=%d TasmotaGlobal.devices_present=%d",
|
||||
Light.pwm_multi_channels, Light.subtype, Light.device, TasmotaGlobal.devices_present);
|
||||
#endif
|
||||
|
||||
|
@ -1430,7 +1430,7 @@ void LightUpdateColorMapping(void)
|
|||
Light.color_remap[4] = tmp[1-param];
|
||||
|
||||
Light.update = true;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%d colors: %d %d %d %d %d") ,Settings.param[P_RGB_REMAP], Light.color_remap[0],Light.color_remap[1],Light.color_remap[2],Light.color_remap[3],Light.color_remap[4]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("%d colors: %d %d %d %d %d") ,Settings.param[P_RGB_REMAP], Light.color_remap[0],Light.color_remap[1],Light.color_remap[2],Light.color_remap[3],Light.color_remap[4]);
|
||||
}
|
||||
|
||||
uint8_t LightGetDimmer(uint8_t dimmer) {
|
||||
|
@ -1551,7 +1551,7 @@ void LightSetSignal(uint16_t lo, uint16_t hi, uint16_t value)
|
|||
*/
|
||||
if (Settings.flag.light_signal) { // SetOption18 - Pair light signal with CO2 sensor
|
||||
uint16_t signal = changeUIntScale(value, lo, hi, 0, 255); // 0..255
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Light signal %d"), signal);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Light signal %d"), signal);
|
||||
light_controller.changeRGB(signal, 255 - signal, 0, true); // keep bri
|
||||
Settings.light_scheme = 0;
|
||||
if (0 == light_state.getBri()) {
|
||||
|
@ -1668,7 +1668,7 @@ void ResponseLightState(uint8_t append)
|
|||
|
||||
void LightPreparePower(power_t channels = 0xFFFFFFFF) { // 1 = only RGB, 2 = only CT, 3 = both RGB and CT
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, "LightPreparePower power=%d Light.power=%d", TasmotaGlobal.power, Light.power);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, "LightPreparePower power=%d Light.power=%d", TasmotaGlobal.power, Light.power);
|
||||
#endif
|
||||
// If multi-channels, then we only switch off channels with a value of zero
|
||||
if (Light.pwm_multi_channels) {
|
||||
|
@ -1731,7 +1731,7 @@ void LightPreparePower(power_t channels = 0xFFFFFFFF) { // 1 = only RGB, 2 =
|
|||
}
|
||||
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, "LightPreparePower End power=%d Light.power=%d", TasmotaGlobal.power, Light.power);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, "LightPreparePower End power=%d Light.power=%d", TasmotaGlobal.power, Light.power);
|
||||
#endif
|
||||
Light.power = TasmotaGlobal.power >> (Light.device - 1); // reset next state, works also with unlinked RGB/CT
|
||||
ResponseLightState(0);
|
||||
|
@ -1788,7 +1788,7 @@ void LightCycleColor(int8_t direction)
|
|||
(Light.random > Light.wheel +128) ? 0 : 1; // Increment or Decrement and roll-over
|
||||
Light.random = (Light.random & 0xFE) | my_dir;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: random %d"), Light.random);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: random %d"), Light.random);
|
||||
}
|
||||
// direction = (Light.random < Light.wheel) ? -1 : 1;
|
||||
direction = (Light.random &0x01) ? 1 : -1;
|
||||
|
@ -1799,7 +1799,7 @@ void LightCycleColor(int8_t direction)
|
|||
Light.wheel += direction;
|
||||
uint16_t hue = changeUIntScale(Light.wheel, 0, 255, 0, 359); // Scale to hue to keep amount of steps low (max 255 instead of 359)
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: random %d, wheel %d, hue %d"), Light.random, Light.wheel, hue);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: random %d, wheel %d, hue %d"), Light.random, Light.wheel, hue);
|
||||
|
||||
if (!Light.pwm_multi_channels) {
|
||||
uint8_t sat;
|
||||
|
@ -1834,7 +1834,7 @@ void LightSetPower(void)
|
|||
Light.wakeup_active--;
|
||||
}
|
||||
#ifdef DEBUG_LIGHT
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, "LightSetPower XdrvMailbox.index=%d Light.old_power=%d Light.power=%d mask=%d shift=%d",
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightSetPower XdrvMailbox.index=%d Light.old_power=%d Light.power=%d mask=%d shift=%d",
|
||||
XdrvMailbox.index, Light.old_power, Light.power, mask, shift);
|
||||
#endif
|
||||
if (Light.power != Light.old_power) {
|
||||
|
@ -1943,7 +1943,7 @@ void LightAnimate(void)
|
|||
// Apply power modifiers to Light.new_color
|
||||
LightApplyPower(Light.new_color, Light.power);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("last_color (%02X%02X%02X%02X%02X) new_color (%02X%02X%02X%02X%02X) power %d"),
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("last_color (%02X%02X%02X%02X%02X) new_color (%02X%02X%02X%02X%02X) power %d"),
|
||||
// Light.last_color[0], Light.last_color[1], Light.last_color[2], Light.last_color[3], Light.last_color[4],
|
||||
// Light.new_color[0], Light.new_color[1], Light.new_color[2], Light.new_color[3], Light.new_color[4],
|
||||
// Light.power
|
||||
|
@ -2055,7 +2055,7 @@ void LightAnimate(void)
|
|||
}
|
||||
if (Light.fade_running) {
|
||||
if (LightApplyFade()) {
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("LightApplyFade %d %d %d %d %d"),
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("LightApplyFade %d %d %d %d %d"),
|
||||
// Light.fade_cur_10[0], Light.fade_cur_10[1], Light.fade_cur_10[2], Light.fade_cur_10[3], Light.fade_cur_10[4]);
|
||||
|
||||
LightSetOutputs(Light.fade_cur_10);
|
||||
|
@ -2134,7 +2134,7 @@ bool LightApplyFade(void) { // did the value chanegd and needs to be applied
|
|||
if (Settings.save_data) {
|
||||
// Also postpone the save_data for the duration of the Fade (in seconds)
|
||||
uint32_t delay_seconds = 1 + (Light.fade_duration + 999) / 1000; // add one more second
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("delay_seconds %d, save_data_counter %d"), delay_seconds, TasmotaGlobal.save_data_counter);
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("delay_seconds %d, save_data_counter %d"), delay_seconds, TasmotaGlobal.save_data_counter);
|
||||
if (TasmotaGlobal.save_data_counter < delay_seconds) {
|
||||
TasmotaGlobal.save_data_counter = delay_seconds; // pospone
|
||||
}
|
||||
|
@ -2184,7 +2184,7 @@ void LightApplyPower(uint8_t new_color[LST_MAX], power_t power) {
|
|||
}
|
||||
}
|
||||
// #ifdef DEBUG_LIGHT
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, "Animate>> Light.power=%d Light.new_color=[%d,%d,%d,%d,%d]",
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, "Animate>> Light.power=%d Light.new_color=[%d,%d,%d,%d,%d]",
|
||||
// Light.power, Light.new_color[0], Light.new_color[1], Light.new_color[2],
|
||||
// Light.new_color[3], Light.new_color[4]);
|
||||
// #endif
|
||||
|
@ -2210,7 +2210,7 @@ void LightSetOutputs(const uint16_t *cur_col_10) {
|
|||
if (TasmotaGlobal.light_type < LT_PWM6) { // only for direct PWM lights, not for Tuya, Armtronix...
|
||||
for (uint32_t i = 0; i < (Light.subtype - Light.pwm_offset); i++) {
|
||||
if (PinUsed(GPIO_PWM1, i)) {
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d 10 bits %d"), i, cur_col_10[i]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d 10 bits %d"), i, cur_col_10[i]);
|
||||
uint16_t cur_col = cur_col_10[i + Light.pwm_offset];
|
||||
if (!isChannelCT(i)) { // if CT don't use pwm_min and pwm_max
|
||||
cur_col = cur_col > 0 ? changeUIntScale(cur_col, 0, Settings.pwm_range, Light.pwm_min, Light.pwm_max) : 0; // shrink to the range of pwm_min..pwm_max
|
||||
|
@ -2223,7 +2223,7 @@ void LightSetOutputs(const uint16_t *cur_col_10) {
|
|||
}
|
||||
|
||||
// char msg[24];
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: Channels %s"), ToHex_P((const unsigned char *)cur_col_10, 10, msg, sizeof(msg)));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: Channels %s"), ToHex_P((const unsigned char *)cur_col_10, 10, msg, sizeof(msg)));
|
||||
|
||||
uint8_t cur_col[LST_MAX];
|
||||
for (uint32_t i = 0; i < LST_MAX; i++) {
|
||||
|
|
|
@ -185,7 +185,7 @@ void IrReceiveCheck(void)
|
|||
Uint64toHex(results.value, hvalue, 32); // UNKNOWN is always 32 bits hash
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_IRR "Echo %d, RawLen %d, Overflow %d, Bits %d, Value 0x%s, Decode %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_IRR "Echo %d, RawLen %d, Overflow %d, Bits %d, Value 0x%s, Decode %d"),
|
||||
irsend_active, results.rawlen, results.overflow, results.bits, hvalue, results.decode_type);
|
||||
|
||||
unsigned long now = millis();
|
||||
|
@ -288,7 +288,7 @@ uint32_t IrRemoteCmndIrSendJson(void)
|
|||
|
||||
char dvalue[64];
|
||||
char hvalue[20];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %s (0x%s), repeat %d, protocol_code %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %s (0x%s), repeat %d, protocol_code %d"),
|
||||
protocol_text, protocol, bits, ulltoa(data, dvalue, 10), Uint64toHex(data, hvalue, bits), repeat, protocol_code);
|
||||
|
||||
irsend_active = true;
|
||||
|
|
|
@ -238,7 +238,7 @@ String sendIRJsonState(const struct decode_results &results) {
|
|||
json += results.bits;
|
||||
|
||||
if (hasACState(results.decode_type)) {
|
||||
json += ",\"" D_JSON_IR_DATA "\":\"0x";
|
||||
json += ",\"" D_JSON_IR_DATA "\":\"";
|
||||
json += resultToHexidecimal(&results);
|
||||
json += "\"";
|
||||
} else {
|
||||
|
@ -394,7 +394,7 @@ uint32_t IrRemoteCmndIrHvacJson(void)
|
|||
{
|
||||
stdAc::state_t state;
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRHVAC: Received %s"), XdrvMailbox.data);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("IRHVAC: Received %s"), XdrvMailbox.data);
|
||||
JsonParser parser(XdrvMailbox.data);
|
||||
JsonParserObject root = parser.getRootObject();
|
||||
if (!root) { return IE_INVALID_JSON; }
|
||||
|
@ -441,7 +441,7 @@ uint32_t IrRemoteCmndIrHvacJson(void)
|
|||
if (val = root[PSTR(D_JSON_IRHVAC_SWINGV)]) { state.swingv = IRac::strToSwingV(val.getStr()); }
|
||||
if (val = root[PSTR(D_JSON_IRHVAC_SWINGH)]) { state.swingh = IRac::strToSwingH(val.getStr()); }
|
||||
state.degrees = root.getFloat(PSTR(D_JSON_IRHVAC_TEMP), state.degrees);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("model %d, mode %d, fanspeed %d, swingv %d, swingh %d"),
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("model %d, mode %d, fanspeed %d, swingv %d, swingh %d"),
|
||||
// state.model, state.mode, state.fanspeed, state.swingv, state.swingh);
|
||||
|
||||
// if and how we should handle the state for IRremote
|
||||
|
@ -525,7 +525,7 @@ uint32_t IrRemoteCmndIrSendJson(void)
|
|||
|
||||
char dvalue[32];
|
||||
char hvalue[32];
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRS: protocol %d, bits %d, data 0x%s (%s), repeat %d"),
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("IRS: protocol %d, bits %d, data 0x%s (%s), repeat %d"),
|
||||
// protocol, bits, ulltoa(data, dvalue, 10), Uint64toHex(data, hvalue, bits), repeat);
|
||||
|
||||
irsend_active = true; // deactivate receive
|
||||
|
@ -609,7 +609,7 @@ uint32_t IrRemoteSendRawFormatted(char ** pp, uint32_t count, uint32_t repeat) {
|
|||
}
|
||||
irsend_active = true;
|
||||
for (uint32_t r = 0; r <= repeat; r++) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("sendRaw count=%d, space=%d, mark=%d, freq=%d"), count, space, mark, freq);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("sendRaw count=%d, space=%d, mark=%d, freq=%d"), count, space, mark, freq);
|
||||
irsend->sendRaw(raw_array, i, freq);
|
||||
if (r < repeat) { // if it's not the last message
|
||||
irsend->space(40000); // since we don't know the inter-message gap, place an arbitrary 40ms gap
|
||||
|
@ -635,7 +635,7 @@ uint32_t IrRemoteSendRawFormatted(char ** pp, uint32_t count, uint32_t repeat) {
|
|||
raw_array[i++] = parm[2]; // Trailing mark
|
||||
irsend_active = true;
|
||||
for (uint32_t r = 0; r <= repeat; r++) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("sendRaw %d %d %d %d %d %d"), raw_array[0], raw_array[1], raw_array[2], raw_array[3], raw_array[4], raw_array[5]);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("sendRaw %d %d %d %d %d %d"), raw_array[0], raw_array[1], raw_array[2], raw_array[3], raw_array[4], raw_array[5]);
|
||||
irsend->sendRaw(raw_array, i, freq);
|
||||
if (r < repeat) { // if it's not the last message
|
||||
irsend->space(inter_message); // since we don't know the inter-message gap, place an arbitrary 40ms gap
|
||||
|
@ -700,13 +700,13 @@ uint32_t IrRemoteSendRawStandard(char ** pp, uint16_t freq, uint32_t count, uint
|
|||
} else {
|
||||
count++;
|
||||
}
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_1 = %d"), count);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_1 = %d"), count);
|
||||
arr = (uint16_t*) malloc(count * sizeof(uint16_t));
|
||||
if (nullptr == arr) { return IE_MEMORY; }
|
||||
|
||||
count = IrRemoteParseRawCompact(*pp, arr, count);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_2 = %d"), count);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Arr %d %d %d %d %d %d %d %d"), arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7]);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("IrRemoteSendRawStandard: count_2 = %d"), count);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("Arr %d %d %d %d %d %d %d %d"), arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7]);
|
||||
if (0 == count) { return IE_INVALID_RAWDATA; }
|
||||
|
||||
irsend_active = true;
|
||||
|
|
|
@ -219,7 +219,7 @@ bool DomoticzMqttData(void) {
|
|||
uint32_t idx = domoticz.getUInt(PSTR("idx"), 0);
|
||||
int16_t nvalue = domoticz.getInt(PSTR("nvalue"), -1);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), idx, nvalue);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), idx, nvalue);
|
||||
|
||||
bool found = false;
|
||||
if ((idx > 0) && (nvalue >= 0) && (nvalue <= 15)) {
|
||||
|
@ -315,7 +315,7 @@ bool DomoticzMqttData(void) {
|
|||
}
|
||||
if (!found) { return true; } // No command received
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ D_RECEIVED_TOPIC " %s, " D_DATA " %s"), XdrvMailbox.topic, XdrvMailbox.data);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ D_RECEIVED_TOPIC " %s, " D_DATA " %s"), XdrvMailbox.topic, XdrvMailbox.data);
|
||||
|
||||
domoticz_update_flag = false;
|
||||
return false; // Process new data
|
||||
|
@ -524,8 +524,6 @@ void CmndDomoticzSend(void) {
|
|||
|
||||
#define WEB_HANDLE_DOMOTICZ "dm"
|
||||
|
||||
const char S_CONFIGURE_DOMOTICZ[] PROGMEM = D_CONFIGURE_DOMOTICZ;
|
||||
|
||||
const char HTTP_BTN_MENU_DOMOTICZ[] PROGMEM =
|
||||
"<p><form action='" WEB_HANDLE_DOMOTICZ "' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form></p>";
|
||||
|
||||
|
@ -546,7 +544,7 @@ const char HTTP_FORM_DOMOTICZ_TIMER[] PROGMEM =
|
|||
void HandleDomoticzConfiguration(void) {
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_DOMOTICZ);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_DOMOTICZ));
|
||||
|
||||
if (Webserver->hasArg("save")) {
|
||||
DomoticzSaveSettings();
|
||||
|
@ -556,7 +554,7 @@ void HandleDomoticzConfiguration(void) {
|
|||
|
||||
char stemp[40];
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_DOMOTICZ);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_DOMOTICZ));
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_DOMOTICZ);
|
||||
for (uint32_t i = 0; i < MAX_DOMOTICZ_IDX; i++) {
|
||||
|
@ -610,7 +608,7 @@ void DomoticzSaveSettings(void) {
|
|||
WebGetArg("ut", tmp, sizeof(tmp));
|
||||
Settings.domoticz_update_timer = (!strlen(tmp)) ? DOMOTICZ_UPDATE_TIMER : atoi(tmp);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_DOMOTICZ D_CMND_IDX " %d,%d,%d,%d, " D_CMND_KEYIDX " %d,%d,%d,%d, " D_CMND_SWITCHIDX " %d,%d,%d,%d, " D_CMND_SENSORIDX " %s, " D_CMND_UPDATETIMER " %d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_DOMOTICZ D_CMND_IDX " %d,%d,%d,%d, " D_CMND_KEYIDX " %d,%d,%d,%d, " D_CMND_SWITCHIDX " %d,%d,%d,%d, " D_CMND_SENSORIDX " %s, " D_CMND_UPDATETIMER " %d"),
|
||||
Settings.domoticz_relay_idx[0], Settings.domoticz_relay_idx[1], Settings.domoticz_relay_idx[2], Settings.domoticz_relay_idx[3],
|
||||
Settings.domoticz_key_idx[0], Settings.domoticz_key_idx[1], Settings.domoticz_key_idx[2], Settings.domoticz_key_idx[3],
|
||||
Settings.domoticz_switch_idx[0], Settings.domoticz_switch_idx[1], Settings.domoticz_switch_idx[2], Settings.domoticz_switch_idx[3],
|
||||
|
|
|
@ -512,8 +512,6 @@ void CmndLatitude(void)
|
|||
|
||||
#define WEB_HANDLE_TIMER "tm"
|
||||
|
||||
const char S_CONFIGURE_TIMER[] PROGMEM = D_CONFIGURE_TIMER;
|
||||
|
||||
const char HTTP_BTN_MENU_TIMER[] PROGMEM =
|
||||
"<p><form action='" WEB_HANDLE_TIMER "' method='get'><button>" D_CONFIGURE_TIMER "</button></form></p>";
|
||||
|
||||
|
@ -843,7 +841,7 @@ void HandleTimerConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_TIMER);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_TIMER));
|
||||
|
||||
if (Webserver->hasArg("save")) {
|
||||
TimerSaveSettings();
|
||||
|
@ -851,7 +849,7 @@ void HandleTimerConfiguration(void)
|
|||
return;
|
||||
}
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_TIMER);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_TIMER));
|
||||
WSContentSend_P(HTTP_TIMER_SCRIPT1);
|
||||
#ifdef USE_SUNRISE
|
||||
WSContentSend_P(HTTP_TIMER_SCRIPT2);
|
||||
|
|
|
@ -354,7 +354,7 @@ int32_t SetRule(uint32_t idx, const char *content, bool append = false) {
|
|||
|
||||
len_uncompressed = strlen(Settings.rules[idx]);
|
||||
len_compressed = compressor.unishox_compress(Settings.rules[idx], len_uncompressed, nullptr /* dry-run */, MAX_RULE_SIZE + 8);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: Stored uncompressed, would compress from %d to %d (-%d%%)"), len_uncompressed, len_compressed, 100 - changeUIntScale(len_compressed, 0, len_uncompressed, 0, 100));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: Stored uncompressed, would compress from %d to %d (-%d%%)"), len_uncompressed, len_compressed, 100 - changeUIntScale(len_compressed, 0, len_uncompressed, 0, 100));
|
||||
}
|
||||
|
||||
#endif // USE_UNISHOX_COMPRESSION
|
||||
|
@ -383,9 +383,9 @@ int32_t SetRule(uint32_t idx, const char *content, bool append = false) {
|
|||
Settings.rules[idx][1] = (len_in + 7) / 8; // store original length in first bytes (4 bytes chuks)
|
||||
memcpy(&Settings.rules[idx][2], buf_out, len_compressed);
|
||||
Settings.rules[idx][len_compressed + 2] = 0; // add NULL termination
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: Compressed from %d to %d (-%d%%)"), len_in, len_compressed, 100 - changeUIntScale(len_compressed, 0, len_in, 0, 100));
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: First bytes: %02X%02X%02X%02X"), Settings.rules[idx][0], Settings.rules[idx][1], Settings.rules[idx][2], Settings.rules[idx][3]);
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: GetRuleLenStorage = %d"), GetRuleLenStorage(idx));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: Compressed from %d to %d (-%d%%)"), len_in, len_compressed, 100 - changeUIntScale(len_compressed, 0, len_in, 0, 100));
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: First bytes: %02X%02X%02X%02X"), Settings.rules[idx][0], Settings.rules[idx][1], Settings.rules[idx][2], Settings.rules[idx][3]);
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: GetRuleLenStorage = %d"), GetRuleLenStorage(idx));
|
||||
} else {
|
||||
len_compressed = -1; // failed
|
||||
// clear rule cache, so it will be reloaded from Settings
|
||||
|
@ -427,7 +427,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||
// rule_param = "0.100" or "%VAR1%"
|
||||
|
||||
#ifdef DEBUG_RULES
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL-RM1: expr %s, name %s, param %s"), rule_expr.c_str(), rule_name.c_str(), rule_param.c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RM1: expr %s, name %s, param %s"), rule_expr.c_str(), rule_name.c_str(), rule_param.c_str());
|
||||
#endif
|
||||
|
||||
char rule_svalue[80] = { 0 };
|
||||
|
@ -503,13 +503,13 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||
|
||||
String buf = event; // copy the string into a new buffer that will be modified
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL-RM2: RulesRuleMatch |%s|"), buf.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RM2: RulesRuleMatch |%s|"), buf.c_str());
|
||||
|
||||
JsonParser parser((char*)buf.c_str());
|
||||
JsonParserObject obj = parser.getRootObject();
|
||||
if (!obj) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Event too long (%d)"), event.length());
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: No valid JSON (%s)"), buf.c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: Event too long (%d)"), event.length());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: No valid JSON (%s)"), buf.c_str());
|
||||
return false; // No valid JSON data
|
||||
}
|
||||
String subtype;
|
||||
|
@ -539,7 +539,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||
}
|
||||
|
||||
#ifdef DEBUG_RULES
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL-RM3: Name %s, Value |%s|, TrigCnt %d, TrigSt %d, Source %s, Json |%s|"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RM3: Name %s, Value |%s|, TrigCnt %d, TrigSt %d, Source %s, Json |%s|"),
|
||||
rule_name.c_str(), rule_svalue, Rules.trigger_count[rule_set], bitRead(Rules.triggers[rule_set],
|
||||
Rules.trigger_count[rule_set]), event.c_str(), (str_value[0] != '\0') ? str_value : "none");
|
||||
#endif
|
||||
|
@ -584,7 +584,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||
|
||||
if (stop_all_rules) { match = false; }
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL-RM4: Match 1 %d, Triggers %08X, TriggerCount %d"), match, Rules.triggers[rule_set], Rules.trigger_count[rule_set]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RM4: Match 1 %d, Triggers %08X, TriggerCount %d"), match, Rules.triggers[rule_set], Rules.trigger_count[rule_set]);
|
||||
|
||||
if (bitRead(Settings.rule_once, rule_set)) {
|
||||
if (match) { // Only allow match state changes
|
||||
|
@ -598,7 +598,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||
}
|
||||
}
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL-RM5: Match 2 %d, Triggers %08X, TriggerCount %d"), match, Rules.triggers[rule_set], Rules.trigger_count[rule_set]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RM5: Match 2 %d, Triggers %08X, TriggerCount %d"), match, Rules.triggers[rule_set], Rules.trigger_count[rule_set]);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
|||
|
||||
delay(0); // Prohibit possible loop software watchdog
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL-RP1: Event = %s, Rule = %s"), event_saved.c_str(), Settings.rules[rule_set]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RP1: Event = %s, Rule = %s"), event_saved.c_str(), Settings.rules[rule_set]);
|
||||
|
||||
String rules = GetRule(rule_set);
|
||||
|
||||
|
@ -704,7 +704,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
|||
String event = event_saved;
|
||||
|
||||
#ifdef DEBUG_RULES
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL-RP2: Event |%s|, Rule |%s|, Command(s) |%s|"), event.c_str(), event_trigger.c_str(), commands.c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RP2: Event |%s|, Rule |%s|, Command(s) |%s|"), event.c_str(), event_trigger.c_str(), commands.c_str());
|
||||
#endif
|
||||
|
||||
if (RulesRuleMatch(rule_set, event, event_trigger, stop_all_rules)) {
|
||||
|
@ -755,7 +755,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
|||
char command[commands.length() +1];
|
||||
strlcpy(command, commands.c_str(), sizeof(command));
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: %s performs \"%s\""), event_trigger.c_str(), command);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: %s performs \"%s\""), event_trigger.c_str(), command);
|
||||
|
||||
// Response_P(S_JSON_COMMAND_SVALUE, D_CMND_RULE, D_JSON_INITIATED);
|
||||
// MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_RULE));
|
||||
|
@ -785,7 +785,7 @@ bool RulesProcessEvent(char *json_event)
|
|||
ShowFreeMem(PSTR("RulesProcessEvent"));
|
||||
#endif
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: ProcessEvent |%s|"), json_event);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: ProcessEvent |%s|"), json_event);
|
||||
|
||||
String event_saved = json_event;
|
||||
// json_event = {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}}
|
||||
|
@ -799,7 +799,7 @@ bool RulesProcessEvent(char *json_event)
|
|||
}
|
||||
event_saved.toUpperCase();
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Event |%s|"), event_saved.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: Event |%s|"), event_saved.c_str());
|
||||
|
||||
for (uint32_t i = 0; i < MAX_RULE_SETS; i++) {
|
||||
if (GetRuleLen(i) && bitRead(Settings.rule_enabled, i)) {
|
||||
|
@ -1035,13 +1035,13 @@ bool RulesMqttData(void)
|
|||
bool serviced = false;
|
||||
String sTopic = XdrvMailbox.topic;
|
||||
String sData = XdrvMailbox.data;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: MQTT Topic %s, Event %s"), XdrvMailbox.topic, XdrvMailbox.data);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: MQTT Topic %s, Event %s"), XdrvMailbox.topic, XdrvMailbox.data);
|
||||
MQTT_Subscription event_item;
|
||||
//Looking for matched topic
|
||||
for (uint32_t index = 0; index < subscriptions.size(); index++) {
|
||||
event_item = subscriptions.get(index);
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Match MQTT message Topic %s with subscription topic %s"), sTopic.c_str(), event_item.Topic.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: Match MQTT message Topic %s with subscription topic %s"), sTopic.c_str(), event_item.Topic.c_str());
|
||||
if (sTopic.startsWith(event_item.Topic)) {
|
||||
//This topic is subscribed by us, so serve it
|
||||
serviced = true;
|
||||
|
@ -1118,7 +1118,7 @@ void CmndSubscribe(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Subscribe command with parameters: %s, %s, %s."), event_name.c_str(), topic.c_str(), key.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: Subscribe command with parameters: %s, %s, %s."), event_name.c_str(), topic.c_str(), key.c_str());
|
||||
event_name.toUpperCase();
|
||||
if (event_name.length() > 0 && topic.length() > 0) {
|
||||
//Search all subscriptions
|
||||
|
@ -1139,7 +1139,7 @@ void CmndSubscribe(void)
|
|||
topic.concat("/#");
|
||||
}
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: New topic: %s."), topic.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL: New topic: %s."), topic.c_str());
|
||||
//MQTT Subscribe
|
||||
subscription_item.Event = event_name;
|
||||
subscription_item.Topic = topic.substring(0, topic.length() - 2); //Remove "/#" so easy to match
|
||||
|
@ -1723,7 +1723,7 @@ bool evaluateLogicalExpression(const char * expression, int len)
|
|||
memcpy(expbuff, expression, len);
|
||||
expbuff[len] = '\0';
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EvalLogic: |%s|"), expbuff);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("EvalLogic: |%s|"), expbuff);
|
||||
char * pointer = expbuff;
|
||||
LinkedList<bool> values;
|
||||
LinkedList<int8_t> logicOperators;
|
||||
|
@ -1849,7 +1849,7 @@ void ExecuteCommandBlock(const char * commands, int len)
|
|||
memcpy(cmdbuff, commands, len);
|
||||
cmdbuff[len] = '\0';
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ExecCmd: |%s|"), cmdbuff);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("ExecCmd: |%s|"), cmdbuff);
|
||||
char oneCommand[len + 1]; //To put one command
|
||||
int insertPosition = 0; //When insert into backlog, we should do it by 0, 1, 2 ...
|
||||
char * pos = cmdbuff;
|
||||
|
@ -2078,7 +2078,7 @@ void CmndRule(void)
|
|||
}
|
||||
int32_t res = SetRule(index - 1, ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, append);
|
||||
if (res < 0) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("RUL: Not enough space"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("RUL: Not enough space"));
|
||||
}
|
||||
}
|
||||
Rules.triggers[index -1] = 0; // Reset once flag
|
||||
|
@ -2098,7 +2098,7 @@ void CmndRule(void)
|
|||
} else {
|
||||
last_index = rule_len; // until the end of the rule
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: Rule%d %s%s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("RUL: Rule%d %s%s"),
|
||||
index, 0 == start_index ? PSTR("") : PSTR("+"),
|
||||
rule.substring(start_index, last_index).c_str());
|
||||
start_index = last_index + 1;
|
||||
|
|
|
@ -820,7 +820,7 @@ char *script;
|
|||
}
|
||||
}
|
||||
// variables usage info
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("Script: nv=%d, tv=%d, vns=%d, ram=%d"), nvars, svars, index, glob_script_mem.script_mem_size);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("Script: nv=%d, tv=%d, vns=%d, ram=%d"), nvars, svars, index, glob_script_mem.script_mem_size);
|
||||
|
||||
// copy string variables
|
||||
char *cp1 = glob_script_mem.glob_snp;
|
||||
|
@ -1041,7 +1041,7 @@ void Script_PollUdp(void) {
|
|||
int32_t len = Script_PortUdp.read(packet_buffer, SCRIPT_UDP_BUFFER_SIZE - 1);
|
||||
packet_buffer[len] = 0;
|
||||
script_udp_remote_ip = Script_PortUdp.remoteIP();
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("UDP: Packet %s - %d - %s"), packet_buffer, len, script_udp_remote_ip.toString().c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("UDP: Packet %s - %d - %s"), packet_buffer, len, script_udp_remote_ip.toString().c_str());
|
||||
char *lp=packet_buffer;
|
||||
if (!strncmp(lp,"=>", 2)) {
|
||||
lp += 2;
|
||||
|
@ -1060,10 +1060,10 @@ void Script_PollUdp(void) {
|
|||
uint32_t index;
|
||||
uint32_t res = match_vars(vnam, &fp, &sp, &index);
|
||||
if (res == NUM_RES) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("num var found - %s - %d - %d"), vnam, res, index);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("num var found - %s - %d - %d"), vnam, res, index);
|
||||
*fp=CharToFloat(cp + 1);
|
||||
} else if (res == STR_RES) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("string var found - %s - %d - %d"), vnam, res, index);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("string var found - %s - %d - %d"), vnam, res, index);
|
||||
strlcpy(sp, cp + 1, SCRIPT_MAXSSIZE);
|
||||
} else {
|
||||
// error var not found
|
||||
|
@ -1097,10 +1097,10 @@ void script_udp_sendvar(char *vname,float *fp,char *sp) {
|
|||
char flstr[16];
|
||||
dtostrfd(*fp, 8, flstr);
|
||||
strcat(sbuf, flstr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("num var updated - %s"), sbuf);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("num var updated - %s"), sbuf);
|
||||
} else {
|
||||
strcat(sbuf, sp);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("string var updated - %s"), sbuf);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("string var updated - %s"), sbuf);
|
||||
}
|
||||
Script_PortUdp.beginPacket(IPAddress(239, 255, 255, 250), SCRIPT_UDP_PORT);
|
||||
// Udp.print(String("RET UC: ") + String(recv_Packet));
|
||||
|
@ -1984,7 +1984,7 @@ chknext:
|
|||
if (!glob_script_mem.file_flags[cnt].is_open) {
|
||||
if (mode==0) {
|
||||
#ifdef DEBUG_FS
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("open file for read %d"), cnt);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("open file for read %d"), cnt);
|
||||
#endif
|
||||
glob_script_mem.files[cnt] = fsp->open(str, FILE_READ);
|
||||
if (glob_script_mem.files[cnt].isDirectory()) {
|
||||
|
@ -1998,12 +1998,12 @@ chknext:
|
|||
if (mode==1) {
|
||||
glob_script_mem.files[cnt] = fsp->open(str,FILE_WRITE);
|
||||
#ifdef DEBUG_FS
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("open file for write %d"), cnt);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("open file for write %d"), cnt);
|
||||
#endif
|
||||
} else {
|
||||
glob_script_mem.files[cnt] = fsp->open(str,FILE_APPEND);
|
||||
#ifdef DEBUG_FS
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("open file for append %d"), cnt);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("open file for append %d"), cnt);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -2026,7 +2026,7 @@ chknext:
|
|||
uint8_t ind = fvar;
|
||||
if (ind>=SFS_MAX) ind = SFS_MAX - 1;
|
||||
#ifdef DEBUG_FS
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("closing file %d"), ind);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("closing file %d"), ind);
|
||||
#endif
|
||||
glob_script_mem.files[ind].close();
|
||||
glob_script_mem.file_flags[ind].is_open = 0;
|
||||
|
@ -2162,7 +2162,7 @@ chknext:
|
|||
} else {
|
||||
fvar = 0;
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("picture save: %d"), len);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("picture save: %d"), len);
|
||||
} else {
|
||||
fvar = 0;
|
||||
}
|
||||
|
@ -4191,7 +4191,7 @@ int16_t Run_script_sub(const char *type, int8_t tlen, JsonParserObject *jo) {
|
|||
} else {
|
||||
if (!sflag) {
|
||||
tasm_cmd_activ = 1;
|
||||
AddLog_P2(glob_script_mem.script_loglevel&0x7f, PSTR("Script: performs \"%s\""), tmp);
|
||||
AddLog_P(glob_script_mem.script_loglevel&0x7f, PSTR("Script: performs \"%s\""), tmp);
|
||||
} else if (sflag==2) {
|
||||
// allow recursive call
|
||||
} else {
|
||||
|
@ -4567,8 +4567,6 @@ void Scripter_save_pvars(void) {
|
|||
|
||||
#define WEB_HANDLE_SCRIPT "s10"
|
||||
|
||||
const char S_CONFIGURE_SCRIPT[] PROGMEM = D_CONFIGURE_SCRIPT;
|
||||
|
||||
const char HTTP_BTN_MENU_RULES[] PROGMEM =
|
||||
"<p><form action='" WEB_HANDLE_SCRIPT "' method='get'><button>" D_CONFIGURE_SCRIPT "</button></form></p>";
|
||||
|
||||
|
@ -4722,7 +4720,7 @@ void script_upload_start(void) {
|
|||
if (upload.status == UPLOAD_FILE_START) {
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("HTP: upload start"));
|
||||
script_ex_ptr = (uint8_t*)glob_script_mem.script_ram;
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("HTP: upload file %s, %d"),upload.filename.c_str(),upload.totalSize);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("HTP: upload file %s, %d"),upload.filename.c_str(),upload.totalSize);
|
||||
|
||||
if (strcmp(upload.filename.c_str(), "execute_script")) {
|
||||
Web.upload_error = 1;
|
||||
|
@ -4754,7 +4752,7 @@ void script_upload_start(void) {
|
|||
script_ex_ptr += csiz;
|
||||
uplsize += csiz;
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("HTP: write %d - %d"),csiz,uplsize);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("HTP: write %d - %d"),csiz,uplsize);
|
||||
}
|
||||
|
||||
//if (upload_file) upload_file.write(upload.buf,upload.currentSize);
|
||||
|
@ -4842,7 +4840,7 @@ void ListDir(char *path, uint8_t depth) {
|
|||
if (lcp) {
|
||||
ep = lcp + 1;
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("entry: %s"),ep);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("entry: %s"),ep);
|
||||
time_t tm = entry.getLastWrite();
|
||||
char tstr[24];
|
||||
strftime(tstr, 22, "%d-%m-%Y - %H:%M:%S ", localtime(&tm));
|
||||
|
@ -4920,7 +4918,7 @@ void Script_FileUploadConfiguration(void) {
|
|||
}
|
||||
|
||||
void ScriptFileUploadSuccess(void) {
|
||||
WSContentStart_P(S_INFORMATION);
|
||||
WSContentStart_P(PSTR(D_INFORMATION));
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPLOAD " <font color='#"));
|
||||
WSContentSend_P(PSTR("%06x'>" D_SUCCESSFUL "</font></b><br/>"), WebColor(COL_TEXT_SUCCESS));
|
||||
|
@ -5038,7 +5036,7 @@ void HandleScriptConfiguration(void) {
|
|||
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_SCRIPT);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_SCRIPT));
|
||||
|
||||
#ifdef USE_SCRIPT_FATFS
|
||||
if (Webserver->hasArg("d1")) {
|
||||
|
@ -5052,7 +5050,7 @@ void HandleScriptConfiguration(void) {
|
|||
}
|
||||
#endif
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_SCRIPT);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_SCRIPT));
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_SCRIPT);
|
||||
|
||||
|
@ -5159,7 +5157,7 @@ void ScriptSaveSettings(void) {
|
|||
strlcpy(glob_script_mem.script_ram, str.c_str(), glob_script_mem.script_size);
|
||||
|
||||
if (glob_script_mem.script_ram[0]!='>' && glob_script_mem.script_ram[1]!='D') {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("script error: must start with >D"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("script error: must start with >D"));
|
||||
bitWrite(Settings.rule_enabled, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -5184,13 +5182,13 @@ void SaveScriptEnd(void) {
|
|||
}
|
||||
|
||||
#ifdef USE_SCRIPT_COMPRESSION
|
||||
//AddLog_P2(LOG_LEVEL_INFO,PSTR("in string: %s len = %d"),glob_script_mem.script_ram,strlen(glob_script_mem.script_ram));
|
||||
//AddLog_P(LOG_LEVEL_INFO,PSTR("in string: %s len = %d"),glob_script_mem.script_ram,strlen(glob_script_mem.script_ram));
|
||||
uint32_t len_compressed = SCRIPT_COMPRESS(glob_script_mem.script_ram, strlen(glob_script_mem.script_ram), Settings.rules[0], MAX_SCRIPT_SIZE-1);
|
||||
if (len_compressed > 0) {
|
||||
Settings.rules[0][len_compressed] = 0;
|
||||
AddLog_P2(LOG_LEVEL_INFO,PSTR("script compressed to %d bytes = %d %%"),len_compressed,len_compressed * 100 / strlen(glob_script_mem.script_ram));
|
||||
AddLog_P(LOG_LEVEL_INFO,PSTR("script compressed to %d bytes = %d %%"),len_compressed,len_compressed * 100 / strlen(glob_script_mem.script_ram));
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("script compress error: %d"), len_compressed);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("script compress error: %d"), len_compressed);
|
||||
}
|
||||
#endif // USE_SCRIPT_COMPRESSION
|
||||
|
||||
|
@ -5200,7 +5198,7 @@ void SaveScriptEnd(void) {
|
|||
|
||||
int16_t res = Init_Scripter();
|
||||
if (res) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("script init error: %d"), res);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("script init error: %d"), res);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5526,7 +5524,7 @@ void Script_Check_Hue(String *response) {
|
|||
}
|
||||
*response += String(EncodeLightId(hue_devs + TasmotaGlobal.devices_present + 1))+"\":";
|
||||
Script_HueStatus(response, hue_devs);
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("Hue: %s - %d "),response->c_str(), hue_devs);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("Hue: %s - %d "),response->c_str(), hue_devs);
|
||||
}
|
||||
|
||||
hue_devs++;
|
||||
|
@ -5541,7 +5539,7 @@ void Script_Check_Hue(String *response) {
|
|||
}
|
||||
#if 0
|
||||
if (response) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Hue: %d"), hue_devs);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Hue: %d"), hue_devs);
|
||||
toLog(">>>>");
|
||||
toLog(response->c_str());
|
||||
toLog(response->c_str()+LOGSZ);
|
||||
|
@ -5686,7 +5684,7 @@ void Script_Handle_Hue(String *path) {
|
|||
} else {
|
||||
response = FPSTR(sHUE_ERROR_JSON);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str());
|
||||
WSSend(code, CT_JSON, response);
|
||||
if (resp) {
|
||||
Run_Scripter(">E", 2, 0);
|
||||
|
@ -5726,7 +5724,7 @@ bool Script_SubCmd(void) {
|
|||
}
|
||||
//toLog(cmdbuff);
|
||||
uint32_t res = Run_Scripter(cmdbuff, tlen + 1, 0);
|
||||
//AddLog_P2(LOG_LEVEL_INFO,">>%d",res);
|
||||
//AddLog_P(LOG_LEVEL_INFO,">>%d",res);
|
||||
if (res) return false;
|
||||
else {
|
||||
if (pl>=0) {
|
||||
|
@ -5874,13 +5872,13 @@ bool ScriptMqttData(void)
|
|||
}
|
||||
String sTopic = XdrvMailbox.topic;
|
||||
String sData = XdrvMailbox.data;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Script: MQTT Topic %s, Event %s"), XdrvMailbox.topic, XdrvMailbox.data);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Script: MQTT Topic %s, Event %s"), XdrvMailbox.topic, XdrvMailbox.data);
|
||||
MQTT_Subscription event_item;
|
||||
//Looking for matched topic
|
||||
for (uint32_t index = 0; index < subscriptions.size(); index++) {
|
||||
event_item = subscriptions.get(index);
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Script: Match MQTT message Topic %s with subscription topic %s"), sTopic.c_str(), event_item.Topic.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Script: Match MQTT message Topic %s with subscription topic %s"), sTopic.c_str(), event_item.Topic.c_str());
|
||||
if (sTopic.startsWith(event_item.Topic)) {
|
||||
//This topic is subscribed by us, so serve it
|
||||
serviced = true;
|
||||
|
@ -5963,7 +5961,7 @@ String ScriptSubscribe(const char *data, int data_len)
|
|||
}
|
||||
}
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Script: Subscribe command with parameters: %s, %s, %s."), event_name.c_str(), topic.c_str(), key.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Script: Subscribe command with parameters: %s, %s, %s."), event_name.c_str(), topic.c_str(), key.c_str());
|
||||
//event_name.toUpperCase();
|
||||
if (event_name.length() > 0 && topic.length() > 0) {
|
||||
//Search all subscriptions
|
||||
|
@ -5984,7 +5982,7 @@ String ScriptSubscribe(const char *data, int data_len)
|
|||
topic.concat("/#");
|
||||
}
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Script: New topic: %s."), topic.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Script: New topic: %s."), topic.c_str());
|
||||
//MQTT Subscribe
|
||||
subscription_item.Event = event_name;
|
||||
subscription_item.Topic = topic.substring(0, topic.length() - 2); //Remove "/#" so easy to match
|
||||
|
@ -7322,7 +7320,7 @@ bool Xdrv10(uint8_t function)
|
|||
if (len_decompressed>0) glob_script_mem.script_ram[len_decompressed] = 0;
|
||||
// indicates scripter use compression
|
||||
bitWrite(Settings.rule_once, 6, 1);
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("decompressed script len %d"),len_decompressed);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("decompressed script len %d"),len_decompressed);
|
||||
#else // USE_SCRIPT_COMPRESSION
|
||||
// indicates scripter does not use compression
|
||||
bitWrite(Settings.rule_once, 6, 0);
|
||||
|
|
|
@ -255,7 +255,7 @@ void KNX_ADD_GA( uint8_t GAop, uint8_t GA_FNUM, uint8_t GA_AREA, uint8_t GA_FDEF
|
|||
|
||||
Settings.knx_GA_registered++;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " GA #%d: %s " D_TO " %d/%d/%d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " GA #%d: %s " D_TO " %d/%d/%d"),
|
||||
Settings.knx_GA_registered,
|
||||
device_param_ga[GAop-1],
|
||||
GA_FNUM, GA_AREA, GA_FDEF );
|
||||
|
@ -304,7 +304,7 @@ void KNX_DEL_GA( uint8_t GAnum )
|
|||
|
||||
Settings.knx_GA_registered--;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " GA #%d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " GA #%d"),
|
||||
GAnum );
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ void KNX_ADD_CB( uint8_t CBop, uint8_t CB_FNUM, uint8_t CB_AREA, uint8_t CB_FDEF
|
|||
|
||||
Settings.knx_CB_registered++;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " CB #%d: %d/%d/%d " D_TO " %s"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " CB #%d: %d/%d/%d " D_TO " %s"),
|
||||
Settings.knx_CB_registered,
|
||||
CB_FNUM, CB_AREA, CB_FDEF,
|
||||
device_param_cb[CBop-1] );
|
||||
|
@ -392,7 +392,7 @@ void KNX_DEL_CB( uint8_t CBnum )
|
|||
device_param[oldparam-1].CB_id = KNX_Empty;
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " CB #%d"), CBnum );
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " CB #%d"), CBnum );
|
||||
}
|
||||
|
||||
|
||||
|
@ -449,7 +449,7 @@ bool KNX_CONFIG_NOT_MATCH(void)
|
|||
void KNXStart(void)
|
||||
{
|
||||
knx.start(nullptr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_START));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_START));
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,7 +530,7 @@ void KNX_INIT(void)
|
|||
if (KNX_CONFIG_NOT_MATCH()) {
|
||||
Settings.knx_GA_registered = 0;
|
||||
Settings.knx_CB_registered = 0;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " " D_KNX_PARAMETERS));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " " D_KNX_PARAMETERS));
|
||||
}
|
||||
|
||||
// Register Group Addresses to listen to
|
||||
|
@ -572,7 +572,7 @@ void KNX_CB_Action(message_t const &msg, void *arg)
|
|||
float tempvar = knx.data_to_2byte_float(msg.data);
|
||||
dtostrfd(tempvar,2,tempchar);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX D_RECEIVED_FROM " %d.%d.%d " D_COMMAND " %s: %s " D_TO " %s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX D_RECEIVED_FROM " %d.%d.%d " D_COMMAND " %s: %s " D_TO " %s"),
|
||||
msg.received_on.ga.area, msg.received_on.ga.line, msg.received_on.ga.member,
|
||||
(msg.ct == KNX_CT_WRITE) ? D_KNX_COMMAND_WRITE : (msg.ct == KNX_CT_READ) ? D_KNX_COMMAND_READ : D_KNX_COMMAND_OTHER,
|
||||
tempchar,
|
||||
|
@ -686,7 +686,7 @@ void KnxUpdatePowerState(uint8_t device, power_t state)
|
|||
knx.write_1bit(KNX_addr, device_param[device -1].last_state);
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
||||
device_param_ga[device -1], device_param[device -1].last_state,
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
||||
|
||||
|
@ -720,7 +720,7 @@ void KnxSendButtonPower(void)
|
|||
knx.write_1bit(KNX_addr, !(state == 0));
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
||||
device_param_ga[device + 7], !(state == 0),
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
||||
|
||||
|
@ -751,7 +751,7 @@ void KnxSensor(uint8_t sensor_type, float value)
|
|||
knx.write_2byte_float(KNX_addr, value);
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d "),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d "),
|
||||
device_param_ga[sensor_type -1],
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
||||
|
||||
|
@ -766,8 +766,6 @@ void KnxSensor(uint8_t sensor_type, float value)
|
|||
|
||||
#ifdef USE_WEBSERVER
|
||||
#ifdef USE_KNX_WEB_MENU
|
||||
const char S_CONFIGURE_KNX[] PROGMEM = D_CONFIGURE_KNX;
|
||||
|
||||
const char HTTP_BTN_MENU_KNX[] PROGMEM =
|
||||
"<p><form action='kn' method='get'><button>" D_CONFIGURE_KNX "</button></form></p>";
|
||||
|
||||
|
@ -826,7 +824,7 @@ void HandleKNXConfiguration(void)
|
|||
{
|
||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_KNX);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_CONFIGURE_KNX));
|
||||
|
||||
char tmp[100];
|
||||
String stmp;
|
||||
|
@ -889,7 +887,7 @@ void HandleKNXConfiguration(void)
|
|||
|
||||
}
|
||||
|
||||
WSContentStart_P(S_CONFIGURE_KNX);
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_KNX));
|
||||
WSContentSend_P(
|
||||
PSTR("function GAwarning()"
|
||||
"{"
|
||||
|
@ -978,7 +976,7 @@ void KNX_Save_Settings(void)
|
|||
|
||||
Settings.flag.knx_enabled = Webserver->hasArg("b1");
|
||||
Settings.flag.knx_enable_enhancement = Webserver->hasArg("b2");
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ENABLED ": %d, " D_KNX_ENHANCEMENT ": %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ENABLED ": %d, " D_KNX_ENHANCEMENT ": %d"),
|
||||
Settings.flag.knx_enabled, Settings.flag.knx_enable_enhancement );
|
||||
|
||||
stmp = Webserver->arg("area");
|
||||
|
@ -989,26 +987,26 @@ void KNX_Save_Settings(void)
|
|||
KNX_addr.pa.member = stmp.toInt();
|
||||
Settings.knx_physsical_addr = KNX_addr.value;
|
||||
knx.physical_address_set( KNX_addr ); // Set Physical KNX Address of the device
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_KNX_PHYSICAL_ADDRESS ": %d.%d.%d "),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_KNX_PHYSICAL_ADDRESS ": %d.%d.%d "),
|
||||
KNX_addr.pa.area, KNX_addr.pa.line, KNX_addr.pa.member );
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA: %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA: %d"),
|
||||
Settings.knx_GA_registered );
|
||||
for (uint32_t i = 0; i < Settings.knx_GA_registered ; ++i)
|
||||
{
|
||||
KNX_addr.value = Settings.knx_GA_addr[i];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA #%d: %s " D_TO " %d/%d/%d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA #%d: %s " D_TO " %d/%d/%d"),
|
||||
i+1, device_param_ga[Settings.knx_GA_param[i]-1],
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member );
|
||||
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB: %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB: %d"),
|
||||
Settings.knx_CB_registered );
|
||||
for (uint32_t i = 0; i < Settings.knx_CB_registered ; ++i)
|
||||
{
|
||||
KNX_addr.value = Settings.knx_CB_addr[i];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB #%d: %d/%d/%d " D_TO " %s"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB #%d: %d/%d/%d " D_TO " %s"),
|
||||
i+1,
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member,
|
||||
device_param_cb[Settings.knx_CB_param[i]-1] );
|
||||
|
@ -1037,7 +1035,7 @@ void CmndKnxTxCmnd(void)
|
|||
knx.write_1bit(KNX_addr, !(XdrvMailbox.payload == 0));
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
||||
device_param_ga[XdrvMailbox.index + KNX_SLOT1 -2], !(XdrvMailbox.payload == 0),
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
||||
|
||||
|
@ -1066,7 +1064,7 @@ void CmndKnxTxVal(void)
|
|||
knx.write_2byte_float(KNX_addr, tempvar);
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"),
|
||||
device_param_ga[XdrvMailbox.index + KNX_SLOT1 -2], XdrvMailbox.data,
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
||||
|
||||
|
@ -1093,7 +1091,7 @@ void CmndKnxTxScene(void)
|
|||
knx.write_1byte_uint(KNX_addr, tempvar);
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"),
|
||||
device_param_ga[KNX_SCENE-1], XdrvMailbox.data,
|
||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
||||
ResponseCmndIdxChar (XdrvMailbox.data);
|
||||
|
|
|
@ -358,7 +358,7 @@ void TryResponseAppend_P(const char *format, ...)
|
|||
int slen = sizeof(TasmotaGlobal.mqtt_data) - 1 - mlen;
|
||||
if (dlen >= slen)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("%s (%u/%u):"), kHAssError1, dlen, slen);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("%s (%u/%u):"), kHAssError1, dlen, slen);
|
||||
va_start(args, format);
|
||||
vsnprintf_P(TasmotaGlobal.log_data, sizeof(TasmotaGlobal.log_data), format, args);
|
||||
AddLog(LOG_LEVEL_ERROR);
|
||||
|
@ -455,7 +455,7 @@ void HAssAnnounceRelayLight(void)
|
|||
// suppress shutter relays
|
||||
} else if ((i < Light.device) && !RelayX) {
|
||||
err_flag = true;
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("%s"), kHAssError2);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("%s"), kHAssError2);
|
||||
} else {
|
||||
if (Settings.flag.hass_discovery && (RelayX || (Light.device > 0) && (max_lights > 0)) && !err_flag )
|
||||
{ // SetOption19 - Control Home Assistant automatic discovery (See SetOption59)
|
||||
|
@ -884,7 +884,7 @@ void HAssAnnounceSensors(void)
|
|||
JsonParserObject root = parser.getRootObject();
|
||||
if (!root)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("%s '%s' (ERR1)"), kHAssError3, sensordata);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("%s '%s' (ERR1)"), kHAssError3, sensordata);
|
||||
continue;
|
||||
}
|
||||
for (auto sensor_key : root)
|
||||
|
@ -895,7 +895,7 @@ void HAssAnnounceSensors(void)
|
|||
|
||||
if (!sensors)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("%s '%s' (ERR2)"), kHAssError3, sensorname);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("%s '%s' (ERR2)"), kHAssError3, sensorname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ void HAssAnnounceDeviceInfoAndStatusSensor(void)
|
|||
|
||||
if (!Settings.flag.hass_discovery) {
|
||||
TasmotaGlobal.masterlog_level = 0;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_LOG "Home Assistant MQTT Discovery disabled."));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_LOG "Home Assistant MQTT Discovery disabled."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1148,7 +1148,7 @@ void DisplayJsonValue(const char* topic, const char* device, const char* mkey, c
|
|||
}
|
||||
snprintf_P(buffer, sizeof(buffer), PSTR("%s %s"), source, svalue);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "mkey [%s], source [%s], value [%s], quantity_code %d, log_buffer [%s]"), mkey, source, value, quantity_code, buffer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "mkey [%s], source [%s], value [%s], quantity_code %d, log_buffer [%s]"), mkey, source, value, quantity_code, buffer);
|
||||
|
||||
DisplayLogBufferAdd(buffer);
|
||||
}
|
||||
|
@ -1285,7 +1285,7 @@ void DisplayInitDriver(void)
|
|||
}
|
||||
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings.display_model);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings.display_model);
|
||||
|
||||
if (Settings.display_model) {
|
||||
TasmotaGlobal.devices_present++;
|
||||
|
@ -1308,7 +1308,7 @@ void DisplaySetPower(void)
|
|||
{
|
||||
disp_power = bitRead(XdrvMailbox.index, disp_device -1);
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DSP: Power %d"), disp_power);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("DSP: Power %d"), disp_power);
|
||||
|
||||
if (Settings.display_model) {
|
||||
if (!renderer) {
|
||||
|
@ -2115,7 +2115,7 @@ uint8_t vbutt=0;
|
|||
|
||||
rotconvert(&pLoc.x, &pLoc.y);
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("touch %d - %d"), pLoc.x, pLoc.y);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("touch %d - %d"), pLoc.x, pLoc.y);
|
||||
// now must compare with defined buttons
|
||||
for (uint8_t count=0; count<MAXBUTTONS; count++) {
|
||||
if (buttons[count] && !buttons[count]->vpower.disable) {
|
||||
|
|
|
@ -150,7 +150,7 @@ void CmndTuyaSend(void) {
|
|||
TuyaRequestState(8);
|
||||
} else if (XdrvMailbox.index == 9) { // TuyaSend Topic Toggle
|
||||
if (Settings.tuyamcu_topic) { Settings.tuyamcu_topic = 0; } else { Settings.tuyamcu_topic = 1; }
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TYA: TuyaMCU Stat Topic %s"), (Settings.tuyamcu_topic ? PSTR("enabled") : PSTR("disabled")));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TYA: TuyaMCU Stat Topic %s"), (Settings.tuyamcu_topic ? PSTR("enabled") : PSTR("disabled")));
|
||||
|
||||
} else {
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
|
@ -197,7 +197,7 @@ void CmndTuyaMcu(void) {
|
|||
// TuyaAddMcuFunc(parm[0], parm[1]);
|
||||
// TasmotaGlobal.restart_flag = 2;
|
||||
// } else {
|
||||
// AddLog_P2(LOG_LEVEL_ERROR, PSTR("TYA: TuyaMcu Invalid function id=%d"), parm[0]);
|
||||
// AddLog_P(LOG_LEVEL_ERROR, PSTR("TYA: TuyaMcu Invalid function id=%d"), parm[0]);
|
||||
// }
|
||||
bool DualDim;
|
||||
if (TUYA_MCU_FUNC_DIMMER2 == parm[0] && parm[1] != 0) {
|
||||
|
@ -214,7 +214,7 @@ void CmndTuyaMcu(void) {
|
|||
TuyaAddMcuFunc(parm[0], parm[1]);
|
||||
TasmotaGlobal.restart_flag = 2;
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("TYA: TuyaMcu Invalid function id=%d"), parm[0]);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("TYA: TuyaMcu Invalid function id=%d"), parm[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ void LightSerialDuty(uint16_t duty, char *hex_char, uint8_t TuyaIdx)
|
|||
} else {
|
||||
duty = changeUIntScale(duty, 0, 100, 0, Settings.dimmer_hw_max);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Send dim skipped value %d for dpid %d"), duty, dpid); // due to 0 or already set
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Send dim skipped value %d for dpid %d"), duty, dpid); // due to 0 or already set
|
||||
} else {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Cannot set dimmer. Dimmer Id unknown")); //
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ void LightSerialDuty(uint16_t duty, char *hex_char, uint8_t TuyaIdx)
|
|||
TuyaSendEnum(TuyaGetDpId(TUYA_MCU_FUNC_MODESET), 1);
|
||||
}
|
||||
TuyaSendString(dpid, hex_char);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: TX RGB hex %s to dpId %d"), hex_char, dpid);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: TX RGB hex %s to dpId %d"), hex_char, dpid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,22 +563,22 @@ void TuyaProcessStatePacket(void) {
|
|||
dpDataLen = Tuya.buffer[dpidStart + 2] << 8 | Tuya.buffer[dpidStart + 3];
|
||||
fnId = TuyaGetFuncId(Tuya.buffer[dpidStart]);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: fnId=%d is set for dpId=%d"), fnId, Tuya.buffer[dpidStart]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: fnId=%d is set for dpId=%d"), fnId, Tuya.buffer[dpidStart]);
|
||||
// if (TuyaFuncIdValid(fnId)) {
|
||||
if (Tuya.buffer[dpidStart + 1] == 1) { // Data Type 1
|
||||
|
||||
if (fnId >= TUYA_MCU_FUNC_REL1 && fnId <= TUYA_MCU_FUNC_REL8) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1 + 1, Tuya.buffer[dpidStart + 4]?"On":"Off",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1)?"On":"Off");
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1 + 1, Tuya.buffer[dpidStart + 4]?"On":"Off",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1)?"On":"Off");
|
||||
if ((TasmotaGlobal.power || Settings.light_dimmer > 0) && (Tuya.buffer[dpidStart + 4] != bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1))) {
|
||||
ExecuteCommandPower(fnId - TUYA_MCU_FUNC_REL1 + 1, Tuya.buffer[dpidStart + 4], SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction
|
||||
}
|
||||
} else if (fnId >= TUYA_MCU_FUNC_REL1_INV && fnId <= TUYA_MCU_FUNC_REL8_INV) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d-Inverted --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1_INV + 1, Tuya.buffer[dpidStart + 4]?"Off":"On",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1_INV) ^ 1?"Off":"On");
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX Relay-%d-Inverted --> MCU State: %s Current State:%s"), fnId - TUYA_MCU_FUNC_REL1_INV + 1, Tuya.buffer[dpidStart + 4]?"Off":"On",bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1_INV) ^ 1?"Off":"On");
|
||||
if (Tuya.buffer[dpidStart + 4] != bitRead(TasmotaGlobal.power, fnId - TUYA_MCU_FUNC_REL1_INV) ^ 1) {
|
||||
ExecuteCommandPower(fnId - TUYA_MCU_FUNC_REL1_INV + 1, Tuya.buffer[dpidStart + 4] ^ 1, SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction
|
||||
}
|
||||
} else if (fnId >= TUYA_MCU_FUNC_SWT1 && fnId <= TUYA_MCU_FUNC_SWT4) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX Switch-%d --> MCU State: %d Current State:%d"),fnId - TUYA_MCU_FUNC_SWT1 + 1,Tuya.buffer[dpidStart + 4], SwitchGetVirtual(fnId - TUYA_MCU_FUNC_SWT1));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX Switch-%d --> MCU State: %d Current State:%d"),fnId - TUYA_MCU_FUNC_SWT1 + 1,Tuya.buffer[dpidStart + 4], SwitchGetVirtual(fnId - TUYA_MCU_FUNC_SWT1));
|
||||
|
||||
if (SwitchGetVirtual(fnId - TUYA_MCU_FUNC_SWT1) != Tuya.buffer[dpidStart + 4]) {
|
||||
SwitchSetVirtual(fnId - TUYA_MCU_FUNC_SWT1, Tuya.buffer[dpidStart + 4]);
|
||||
|
@ -605,7 +605,7 @@ void TuyaProcessStatePacket(void) {
|
|||
Tuya.Levels[dimIndex] = changeUIntScale(packetValue, 0, Settings.dimmer_hw_max, 0, 100);
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX value %d from dpId %d "), packetValue, Tuya.buffer[dpidStart]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX value %d from dpId %d "), packetValue, Tuya.buffer[dpidStart]);
|
||||
|
||||
if ((fnId == TUYA_MCU_FUNC_DIMMER) || (fnId == TUYA_MCU_FUNC_REPORT1) ||
|
||||
(fnId == TUYA_MCU_FUNC_DIMMER2) || (fnId == TUYA_MCU_FUNC_REPORT2) ||
|
||||
|
@ -646,13 +646,13 @@ void TuyaProcessStatePacket(void) {
|
|||
#ifdef USE_ENERGY_SENSOR
|
||||
else if (tuya_energy_enabled && fnId == TUYA_MCU_FUNC_VOLTAGE) {
|
||||
Energy.voltage[0] = (float)packetValue / 10;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Voltage=%d"), Tuya.buffer[dpidStart], packetValue);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Voltage=%d"), Tuya.buffer[dpidStart], packetValue);
|
||||
} else if (tuya_energy_enabled && fnId == TUYA_MCU_FUNC_CURRENT) {
|
||||
Energy.current[0] = (float)packetValue / 1000;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Current=%d"), Tuya.buffer[dpidStart], packetValue);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Current=%d"), Tuya.buffer[dpidStart], packetValue);
|
||||
} else if (tuya_energy_enabled && fnId == TUYA_MCU_FUNC_POWER) {
|
||||
Energy.active_power[0] = (float)packetValue / 10;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Active_Power=%d"), Tuya.buffer[dpidStart], packetValue);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Rx ID=%d Active_Power=%d"), Tuya.buffer[dpidStart], packetValue);
|
||||
|
||||
if (Tuya.lastPowerCheckTime != 0 && Energy.active_power[0] > 0) {
|
||||
Energy.kWhtoday += (float)Energy.active_power[0] * (Rtc.utc_time - Tuya.lastPowerCheckTime) / 36;
|
||||
|
@ -713,7 +713,7 @@ void TuyaLowPowerModePacketProcess(void) {
|
|||
void TuyaHandleProductInfoPacket(void) {
|
||||
uint16_t dataLength = Tuya.buffer[4] << 8 | Tuya.buffer[5];
|
||||
char *data = &Tuya.buffer[6];
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TYA: MCU Product ID: %.*s"), dataLength, data);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TYA: MCU Product ID: %.*s"), dataLength, data);
|
||||
}
|
||||
|
||||
void TuyaSendLowPowerSuccessIfNeeded(void) {
|
||||
|
@ -757,7 +757,7 @@ void TuyaNormalPowerModePacketProcess(void)
|
|||
break;
|
||||
|
||||
case TUYA_CMD_MCU_CONF:
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX MCU configuration Mode=%d"), Tuya.buffer[5]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: RX MCU configuration Mode=%d"), Tuya.buffer[5]);
|
||||
|
||||
if (Tuya.buffer[5] == 2) { // Processing by ESP module mode
|
||||
uint8_t led1_gpio = Tuya.buffer[6];
|
||||
|
@ -866,7 +866,7 @@ void TuyaInit(void)
|
|||
// Get MCU Configuration
|
||||
Tuya.SuspendTopic = true;
|
||||
Tuya.ignore_topic_timeout = millis() + 1000; // suppress /STAT topic for 1000ms to avoid data overflow
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU configuration at %d bps"), baudrate);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU configuration at %d bps"), baudrate);
|
||||
TuyaSendCmd(TUYA_CMD_QUERY_PRODUCT);
|
||||
|
||||
}
|
||||
|
@ -1033,7 +1033,7 @@ uint8_t TuyaGetTuyaWifiState(void) {
|
|||
void TuyaSetWifiLed(void)
|
||||
{
|
||||
Tuya.wifi_state = TuyaGetTuyaWifiState();
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Set WiFi LED %d (%d)"), Tuya.wifi_state, WifiState());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Set WiFi LED %d (%d)"), Tuya.wifi_state, WifiState());
|
||||
|
||||
if (Tuya.low_power_mode) {
|
||||
TuyaSendCmd(TUYA_LOW_POWER_CMD_WIFI_STATE, &Tuya.wifi_state, 1);
|
||||
|
|
|
@ -55,7 +55,7 @@ void RfReceiveCheck(void)
|
|||
int protocol = mySwitch.getReceivedProtocol();
|
||||
int delay = mySwitch.getReceivedDelay();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay);
|
||||
|
||||
uint32_t now = millis();
|
||||
if ((now - rf_lasttime > RF_TIME_AVOID_DUPLICATE) && (data > 0)) {
|
||||
|
|
|
@ -61,11 +61,11 @@ void LightSerial2Duty(uint8_t duty1, uint8_t duty2)
|
|||
ArmtronixSerial->print("\nDimmer2:");
|
||||
ArmtronixSerial->println(duty2);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Send Serial Packet Dim Values=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Send Serial Packet Dim Values=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]);
|
||||
|
||||
} else {
|
||||
Armtronix.ignore_dim = false;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Send Dim Level skipped due to already set. Value=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Send Dim Level skipped due to already set. Value=%d,%d"), Armtronix.dim_state[0],Armtronix.dim_state[1]);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ void ArmtronixSerialInput(void)
|
|||
Armtronix.ignore_dim = true;
|
||||
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_CHANNEL "%d %d"),i+1, temp);
|
||||
ExecuteCommand(scmnd,SRC_SWITCH);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Send CMND_CHANNEL=%s"), scmnd );
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Send CMND_CHANNEL=%s"), scmnd );
|
||||
}
|
||||
commaIndex = answer.indexOf(',',commaIndex+1);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ void ArmtronixSetWifiLed(void)
|
|||
break;
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Set WiFi LED to state %d (%d)"), wifi_state, WifiState());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Set WiFi LED to state %d (%d)"), wifi_state, WifiState());
|
||||
|
||||
char state = '0' + ((wifi_state & 1) > 0);
|
||||
ArmtronixSerial->print("Setled:");
|
||||
|
|
|
@ -43,7 +43,7 @@ struct PS16DZ {
|
|||
|
||||
void PS16DZSerialSend(const char *tx_buffer)
|
||||
{
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Send %s"), tx_buffer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Send %s"), tx_buffer);
|
||||
|
||||
PS16DZSerial->print(tx_buffer);
|
||||
PS16DZSerial->write(0x1B);
|
||||
|
@ -96,7 +96,7 @@ void PS16DZSerialInput(void)
|
|||
Ps16dz.rx_buffer[Ps16dz.byte_counter++] = 0x00;
|
||||
|
||||
// AT+RESULT="sequence":"1554682835320"
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Rcvd %s"), Ps16dz.rx_buffer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Rcvd %s"), Ps16dz.rx_buffer);
|
||||
|
||||
if (!strncmp(Ps16dz.rx_buffer+3, "RESULT", 6)) {
|
||||
|
||||
|
@ -118,7 +118,7 @@ void PS16DZSerialInput(void)
|
|||
if (!strncmp(token2, "\"switch\"", 8)) {
|
||||
bool switch_state = !strncmp(token3, "\"on\"", 4) ? true : false;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Switch %d"), switch_state);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Switch %d"), switch_state);
|
||||
|
||||
is_switch_change = (switch_state != TasmotaGlobal.power);
|
||||
if (is_switch_change) {
|
||||
|
@ -128,7 +128,7 @@ void PS16DZSerialInput(void)
|
|||
else if (!strncmp(token2, "\"bright\"", 8)) {
|
||||
Ps16dz.dimmer = atoi(token3);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Brightness %d"), Ps16dz.dimmer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Brightness %d"), Ps16dz.dimmer);
|
||||
|
||||
is_brightness_change = Ps16dz.dimmer != Settings.light_dimmer;
|
||||
if (TasmotaGlobal.power && (Ps16dz.dimmer > 0) && is_brightness_change) {
|
||||
|
@ -138,7 +138,7 @@ void PS16DZSerialInput(void)
|
|||
}
|
||||
else if (!strncmp(token2, "\"sequence\"", 10)) {
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Sequence %s"), token3);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Sequence %s"), token3);
|
||||
|
||||
}
|
||||
token = strtok_r(nullptr, ",", &end_str);
|
||||
|
@ -146,7 +146,7 @@ void PS16DZSerialInput(void)
|
|||
|
||||
if (!is_brightness_change) {
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Update"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Update"));
|
||||
|
||||
PS16DZSerialSendOk();
|
||||
}
|
||||
|
|
|
@ -103,8 +103,8 @@ void HueRespondToMSearch(void)
|
|||
} else {
|
||||
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
|
||||
}
|
||||
// Do not use AddLog_P2 here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"),
|
||||
// Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"),
|
||||
message, udp_remote_ip.toString().c_str(), udp_remote_port);
|
||||
|
||||
udp_response_mutex = false;
|
||||
|
@ -256,7 +256,7 @@ String GetHueUserId(void)
|
|||
|
||||
void HandleUpnpSetupHue(void)
|
||||
{
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_HUE_BRIDGE_SETUP));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_HUE_BRIDGE_SETUP));
|
||||
String description_xml = Decompress(HUE_DESCRIPTION_XML_COMPRESSED,HUE_DESCRIPTION_XML_SIZE);
|
||||
description_xml.replace("{x1", WiFi.localIP().toString());
|
||||
description_xml.replace("{x2", HueUuid());
|
||||
|
@ -266,7 +266,7 @@ void HandleUpnpSetupHue(void)
|
|||
|
||||
void HueNotImplemented(String *path)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API_NOT_IMPLEMENTED " (%s)"), path->c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API_NOT_IMPLEMENTED " (%s)"), path->c_str());
|
||||
|
||||
WSSend(200, CT_JSON, "{}");
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ void HueAuthentication(String *path)
|
|||
|
||||
snprintf_P(response, sizeof(response), PSTR("[{\"success\":{\"username\":\"%s\"}}]"), GetHueUserId().c_str());
|
||||
WSSend(200, CT_JSON, response);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Authentication Result (%s)"), response);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Authentication Result (%s)"), response);
|
||||
}
|
||||
|
||||
// refactored to remove code duplicates
|
||||
|
@ -627,7 +627,7 @@ void HueLightsCommand(uint8_t device, uint32_t device_id, String &response) {
|
|||
LightStateClass::RgbToHsb(rr, gg, bb, &hue, &sat, nullptr);
|
||||
prev_hue = changeUIntScale(hue, 0, 360, 0, 65535); // calculate back prev_hue
|
||||
prev_sat = (sat > 254 ? 254 : sat);
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, "XY RGB (%d %d %d) HS (%d %d)", rr,gg,bb,hue,sat);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, "XY RGB (%d %d %d) HS (%d %d)", rr,gg,bb,hue,sat);
|
||||
if (resp) { response += ","; }
|
||||
snprintf_P(buf, buf_size,
|
||||
PSTR("{\"success\":{\"/lights/%d/state/xy\":[%s,%s]}}"),
|
||||
|
@ -696,7 +696,7 @@ void HueLightsCommand(uint8_t device, uint32_t device_id, String &response) {
|
|||
if (change) {
|
||||
#ifdef USE_SHUTTER
|
||||
if (ShutterState(device)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Settings.shutter_invert: %d"), Settings.shutter_options[device-1] & 1);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Settings.shutter_invert: %d"), Settings.shutter_options[device-1] & 1);
|
||||
ShutterSetPosition(device, bri * 100.0f );
|
||||
} else
|
||||
#endif
|
||||
|
@ -779,7 +779,7 @@ void HueLights(String *path)
|
|||
|
||||
}
|
||||
else if(path->indexOf(F("/lights/")) >= 0) { // Got /lights/ID
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("/lights path=%s"), path->c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("/lights path=%s"), path->c_str());
|
||||
path->remove(0,8); // Remove /lights/
|
||||
device_id = atoi(path->c_str());
|
||||
device = DecodeLightId(device_id);
|
||||
|
@ -811,7 +811,7 @@ void HueLights(String *path)
|
|||
code = 406;
|
||||
}
|
||||
exit:
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str());
|
||||
WSSend(code, CT_JSON, response);
|
||||
}
|
||||
|
||||
|
@ -822,7 +822,7 @@ void HueGroups(String *path)
|
|||
*/
|
||||
String response = "{}";
|
||||
uint8_t maxhue = (TasmotaGlobal.devices_present > MAX_HUE_DEVICES) ? MAX_HUE_DEVICES : TasmotaGlobal.devices_present;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups (%s)"), path->c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups (%s)"), path->c_str());
|
||||
|
||||
if (path->endsWith("/0")) {
|
||||
response = FPSTR(HUE_GROUP0_STATUS_JSON);
|
||||
|
@ -841,7 +841,7 @@ void HueGroups(String *path)
|
|||
response += F("}");
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups Result (%s)"), path->c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " HueGroups Result (%s)"), path->c_str());
|
||||
WSSend(200, CT_JSON, response);
|
||||
}
|
||||
|
||||
|
@ -863,10 +863,10 @@ void HandleHueApi(String *path)
|
|||
|
||||
path->remove(0, 4); // remove /api
|
||||
uint16_t apilen = path->length();
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API " (%s) from %s"), path->c_str(), Webserver->client().remoteIP().toString().c_str()); // HTP: Hue API (//lights/1/state) from 192.168.1.20
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API " (%s) from %s"), path->c_str(), Webserver->client().remoteIP().toString().c_str()); // HTP: Hue API (//lights/1/state) from 192.168.1.20
|
||||
for (args = 0; args < Webserver->args(); args++) {
|
||||
String json = Webserver->arg(args);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_POST_ARGS " (%s)"), json.c_str()); // HTP: Hue POST args ({"on":false})
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_POST_ARGS " (%s)"), json.c_str()); // HTP: Hue POST args ({"on":false})
|
||||
}
|
||||
|
||||
if (path->endsWith(F("/invalid/"))) {} // Just ignore
|
||||
|
|
|
@ -74,8 +74,8 @@ void WemoRespondToMSearch(int echo_type)
|
|||
} else {
|
||||
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
|
||||
}
|
||||
// Do not use AddLog_P2 here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"),
|
||||
// Do not use AddLog_P( here (interrupt routine) if syslog or mqttlog is enabled. UDP/TCP will force exception 9
|
||||
PrepLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"),
|
||||
echo_type, message, udp_remote_ip.toString().c_str(), udp_remote_port);
|
||||
|
||||
udp_response_mutex = false;
|
||||
|
@ -268,7 +268,7 @@ const char WEMO_SETUP_XML[] PROGMEM =
|
|||
/********************************************************************************************/
|
||||
|
||||
void LogUpnpWithClient(const char *msg) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "%s from %s"), msg, Webserver->client().remoteIP().toString().c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "%s from %s"), msg, Webserver->client().remoteIP().toString().c_str());
|
||||
}
|
||||
|
||||
void HandleUpnpEvent(void)
|
||||
|
@ -278,7 +278,7 @@ void HandleUpnpEvent(void)
|
|||
char event[500];
|
||||
strlcpy(event, Webserver->arg(0).c_str(), sizeof(event));
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), event);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), event);
|
||||
|
||||
//differentiate get and set state
|
||||
char state = 'G';
|
||||
|
|
|
@ -106,7 +106,7 @@ void HueLightStatus2Zigbee(uint16_t shortaddr, String *response)
|
|||
(modelId) ? EscapeJSONString(modelId).c_str() : PSTR("Unknown"),
|
||||
(manufacturerId) ? EscapeJSONString(manufacturerId).c_str() : PSTR("Tasmota"),
|
||||
GetHueDeviceId(shortaddr).c_str());
|
||||
|
||||
|
||||
*response += buf;
|
||||
free(buf);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void ZigbeeHueDimmer(uint16_t shortaddr, uint8_t dimmer) {
|
|||
// CT
|
||||
void ZigbeeHueCT(uint16_t shortaddr, uint16_t ct) {
|
||||
if (ct > 0xFEFF) { ct = 0xFEFF; }
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZigbeeHueCT 0x%04X - %d"), shortaddr, ct);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZigbeeHueCT 0x%04X - %d"), shortaddr, ct);
|
||||
char param[12];
|
||||
snprintf_P(param, sizeof(param), PSTR("%02X%02X0A00"), ct & 0xFF, ct >> 8);
|
||||
uint8_t colormode = 2; // "ct"
|
||||
|
@ -226,7 +226,7 @@ void ZigbeeHandleHue(uint16_t shortaddr, uint32_t device_id, String &response) {
|
|||
|
||||
JsonParser parser((char*) Webserver->arg((Webserver->args())-1).c_str());
|
||||
JsonParserObject root = parser.getRootObject();
|
||||
|
||||
|
||||
JsonParserToken hue_on = root[PSTR("on")];
|
||||
if (hue_on) {
|
||||
on = hue_on.getBool();
|
||||
|
@ -347,7 +347,7 @@ void ZigbeeHandleHue(uint16_t shortaddr, uint32_t device_id, String &response) {
|
|||
else {
|
||||
response = FPSTR(HUE_ERROR_JSON);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE " Result (%s)"), response.c_str());
|
||||
WSSend(code, CT_JSON, response);
|
||||
|
||||
free(buf);
|
||||
|
|
|
@ -191,13 +191,13 @@ class SBuffer hibernateDevices(void) {
|
|||
|
||||
size_t buf_len = buf.len();
|
||||
if (buf_len > 2040) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Devices list too big to fit in Flash (%d)"), buf_len);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Devices list too big to fit in Flash (%d)"), buf_len);
|
||||
}
|
||||
|
||||
// Log
|
||||
char *hex_char = (char*) malloc((buf_len * 2) + 2);
|
||||
if (hex_char) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "ZbFlashStore %s"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "ZbFlashStore %s"),
|
||||
ToHex_P(buf.getBuffer(), buf_len, hex_char, (buf_len * 2) + 2));
|
||||
free(hex_char);
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ void loadZigbeeDevices(void) {
|
|||
// first copy SPI buffer into ram
|
||||
uint8_t *spi_buffer = (uint8_t*) malloc(z_spi_len);
|
||||
if (!spi_buffer) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer"));
|
||||
return;
|
||||
}
|
||||
ZigbeeRead(&spi_buffer, z_spi_len);
|
||||
|
@ -314,8 +314,8 @@ void loadZigbeeDevices(void) {
|
|||
#endif // ESP32
|
||||
Z_Flashentry flashdata;
|
||||
memcpy_P(&flashdata, z_dev_start, sizeof(Z_Flashentry));
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Memory %d"), ESP_getFreeHeap());
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Zigbee signature in Flash: %08X - %d"), flashdata.name, flashdata.len);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Memory %d"), ESP_getFreeHeap());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Zigbee signature in Flash: %08X - %d"), flashdata.name, flashdata.len);
|
||||
|
||||
// Check the signature
|
||||
if ( ((flashdata.name == ZIGB_NAME1) || (flashdata.name == ZIGB_NAME2))
|
||||
|
@ -325,16 +325,16 @@ void loadZigbeeDevices(void) {
|
|||
// parse what seems to be a valid entry
|
||||
SBuffer buf(buf_len);
|
||||
buf.addBuffer(z_dev_start + sizeof(Z_Flashentry), buf_len);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee devices data in Flash v%d (%d bytes)"), version, buf_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee devices data in Flash v%d (%d bytes)"), version, buf_len);
|
||||
// Serial.printf(">> Buffer=");
|
||||
// for (uint32_t i=0; i<buf.len(); i++) Serial.printf("%02X ", buf.get8(i));
|
||||
// Serial.printf("\n");
|
||||
hydrateDevices(buf, version);
|
||||
zigbee_devices.clean(); // don't write back to Flash what we just loaded
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No zigbee devices data in Flash"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "No zigbee devices data in Flash"));
|
||||
}
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Memory %d"), ESP_getFreeHeap());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Memory %d"), ESP_getFreeHeap());
|
||||
#ifdef ESP32
|
||||
free(spi_buffer);
|
||||
#endif // ESP32
|
||||
|
@ -344,14 +344,14 @@ void saveZigbeeDevices(void) {
|
|||
SBuffer buf = hibernateDevices();
|
||||
size_t buf_len = buf.len();
|
||||
if (buf_len > Z_MAX_FLASH) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Buffer too big to fit in Flash (%d bytes)"), buf_len);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Buffer too big to fit in Flash (%d bytes)"), buf_len);
|
||||
return;
|
||||
}
|
||||
|
||||
// first copy SPI buffer into ram
|
||||
uint8_t *spi_buffer = (uint8_t*) malloc(z_spi_len);
|
||||
if (!spi_buffer) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer"));
|
||||
return;
|
||||
}
|
||||
// copy the flash into RAM to make local change, and write back the whole buffer
|
||||
|
@ -373,10 +373,10 @@ void saveZigbeeDevices(void) {
|
|||
if (ESP.flashEraseSector(z_spi_start_sector)) {
|
||||
ESP.flashWrite(z_spi_start_sector * SPI_FLASH_SEC_SIZE, (uint32_t*) spi_buffer, SPI_FLASH_SEC_SIZE);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data store in Flash (0x%08X - %d bytes)"), z_dev_start, buf_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data store in Flash (0x%08X - %d bytes)"), z_dev_start, buf_len);
|
||||
#else // ESP32
|
||||
ZigbeeWrite(&spi_buffer, z_spi_len);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data saved (%d bytes)"), buf_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data saved (%d bytes)"), buf_len);
|
||||
#endif // ESP8266 - ESP32
|
||||
free(spi_buffer);
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ void eraseZigbeeDevices(void) {
|
|||
// first copy SPI buffer into ram
|
||||
uint8_t *spi_buffer = (uint8_t*) malloc(z_spi_len);
|
||||
if (!spi_buffer) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer"));
|
||||
return;
|
||||
}
|
||||
// copy the flash into RAM to make local change, and write back the whole buffer
|
||||
|
@ -403,10 +403,10 @@ void eraseZigbeeDevices(void) {
|
|||
}
|
||||
|
||||
free(spi_buffer);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (0x%08X - %d bytes)"), z_dev_start, z_block_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (0x%08X - %d bytes)"), z_dev_start, z_block_len);
|
||||
#else // ESP32
|
||||
ZigbeeErase();
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (%d bytes)"), z_block_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (%d bytes)"), z_block_len);
|
||||
#endif // ESP8266 - ESP32
|
||||
}
|
||||
|
||||
|
|
|
@ -706,7 +706,7 @@ public:
|
|||
if (Settings.flag3.tuya_serial_mqtt_publish) {
|
||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1831,7 +1831,7 @@ void Z_postProcessAttributes(uint16_t shortaddr, uint16_t src_ep, class Z_attrib
|
|||
uint8_t *attr_address = ((uint8_t*)&data) + sizeof(Z_Data) + map_offset;
|
||||
uint32_t uval32 = attr.getUInt(); // call converter to uint only once
|
||||
int32_t ival32 = attr.getInt(); // call converter to int only once
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Mapping type=%d offset=%d zigbee_type=%02X value=%d\n"), (uint8_t) map_type, map_offset, zigbee_type, ival32);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Mapping type=%d offset=%d zigbee_type=%02X value=%d\n"), (uint8_t) map_type, map_offset, zigbee_type, ival32);
|
||||
switch (zigbee_type) {
|
||||
case Zenum8:
|
||||
case Zmap8:
|
||||
|
@ -1917,7 +1917,7 @@ bool Z_parseAttributeKey(class Z_attribute & attr) {
|
|||
attr.attr_type = type_id;
|
||||
}
|
||||
}
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("cluster_id = 0x%04X, attr_id = 0x%04X"), cluster_id, attr_id);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("cluster_id = 0x%04X, attr_id = 0x%04X"), cluster_id, attr_id);
|
||||
|
||||
// do we already know the type, i.e. attribute and cluster are also known
|
||||
if (Zunk == attr.attr_type) {
|
||||
|
@ -1929,7 +1929,7 @@ bool Z_parseAttributeKey(class Z_attribute & attr) {
|
|||
uint16_t local_cluster_id = CxToCluster(pgm_read_byte(&converter->cluster_short));
|
||||
uint8_t local_type_id = pgm_read_byte(&converter->type);
|
||||
int8_t local_multiplier = CmToMultiplier(pgm_read_byte(&converter->multiplier_idx));
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Try cluster = 0x%04X, attr = 0x%04X, type_id = 0x%02X"), local_cluster_id, local_attr_id, local_type_id);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("Try cluster = 0x%04X, attr = 0x%04X, type_id = 0x%02X"), local_cluster_id, local_attr_id, local_type_id);
|
||||
|
||||
if (!attr.key_is_str) {
|
||||
if ((attr.key.id.cluster == local_cluster_id) && (attr.key.id.attr_id == local_attr_id)) {
|
||||
|
@ -1938,7 +1938,7 @@ bool Z_parseAttributeKey(class Z_attribute & attr) {
|
|||
}
|
||||
} else if (pgm_read_word(&converter->name_offset)) {
|
||||
const char * key = attr.key.key;
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Comparing '%s' with '%s'"), attr_name, converter->name);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("Comparing '%s' with '%s'"), attr_name, converter->name);
|
||||
if (0 == strcasecmp_P(key, Z_strings + pgm_read_word(&converter->name_offset))) {
|
||||
// match
|
||||
attr.setKeyId(local_cluster_id, local_attr_id);
|
||||
|
|
|
@ -277,7 +277,7 @@ void convertClusterSpecific(class Z_attribute_list &attr_list, uint16_t cluster,
|
|||
uint8_t conv_direction;
|
||||
Z_XYZ_Var xyz;
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR(">>> len = %d - %02X%02X%02X"), payload.len(), payload.get8(0), payload.get8(1), payload.get8(2));
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR(">>> len = %d - %02X%02X%02X"), payload.len(), payload.get8(0), payload.get8(1), payload.get8(2));
|
||||
for (uint32_t i = 0; i < sizeof(Z_Commands) / sizeof(Z_Commands[0]); i++) {
|
||||
const Z_CommandConverter *conv = &Z_Commands[i];
|
||||
uint16_t conv_cluster = pgm_read_word(&conv->cluster);
|
||||
|
@ -293,18 +293,18 @@ void convertClusterSpecific(class Z_attribute_list &attr_list, uint16_t cluster,
|
|||
// - payload exactly matches conv->param (conv->param may be longer)
|
||||
// - payload matches conv->param until 'x', 'y' or 'z'
|
||||
const char * p = Z_strings + pgm_read_word(&conv->param_offset);
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR(">>>++1 param = %s"), p);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR(">>>++1 param = %s"), p);
|
||||
bool match = true;
|
||||
for (uint8_t i = 0; i < payload.len(); i++) {
|
||||
const char c1 = pgm_read_byte(p);
|
||||
const char c2 = pgm_read_byte(p+1);
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR(">>>++2 c1 = %c, c2 = %c"), c1, c2);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR(">>>++2 c1 = %c, c2 = %c"), c1, c2);
|
||||
if ((0x00 == c1) || isXYZ(c1)) {
|
||||
break;
|
||||
}
|
||||
const char * p2 = p;
|
||||
uint32_t nextbyte = parseHex_P(&p2, 2);
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR(">>>++3 parseHex_P = %02X"), nextbyte);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR(">>>++3 parseHex_P = %02X"), nextbyte);
|
||||
if (nextbyte != payload.get8(i)) {
|
||||
match = false;
|
||||
break;
|
||||
|
@ -538,7 +538,7 @@ String zigbeeCmdAddParams(const char *zcl_cmd_P, uint32_t x, uint32_t y, uint32_
|
|||
}
|
||||
p++;
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SendZCLCommand_P: zcl_cmd = %s"), zcl_cmd);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SendZCLCommand_P: zcl_cmd = %s"), zcl_cmd);
|
||||
|
||||
return String(zcl_cmd);
|
||||
}
|
||||
|
|
|
@ -771,7 +771,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = {
|
|||
ZI_ON_RECV_UNEXPECTED(&EZ_Recv_Default)
|
||||
ZI_WAIT(10500) // wait for 10 seconds for Tasmota to stabilize
|
||||
|
||||
// Hardware reset
|
||||
// Hardware reset
|
||||
ZI_LOG(LOG_LEVEL_INFO, kResettingDevice) // Log Debug: resetting EZSP device
|
||||
ZI_CALL(&EZ_Reset_Device, 0) // LOW = reset
|
||||
ZI_WAIT(100) // wait for .1 second
|
||||
|
@ -911,10 +911,10 @@ void ZigbeeGotoLabel(uint8_t label) {
|
|||
const Zigbee_Instruction *cur_instr_line = &zb_prog[i];
|
||||
cur_instr = pgm_read_byte(&cur_instr_line->i.i);
|
||||
cur_d8 = pgm_read_byte(&cur_instr_line->i.d8);
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZGB GOTO: pc %d instr %d"), i, cur_instr);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZGB GOTO: pc %d instr %d"), i, cur_instr);
|
||||
|
||||
if (ZGB_INSTR_LABEL == cur_instr) {
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "found label %d at pc %d"), cur_d8, i);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "found label %d at pc %d"), cur_d8, i);
|
||||
if (label == cur_d8) {
|
||||
// label found, goto to this pc
|
||||
zigbee.pc = i;
|
||||
|
@ -928,12 +928,12 @@ void ZigbeeGotoLabel(uint8_t label) {
|
|||
}
|
||||
|
||||
// no label found, abort
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Goto label not found, label=%d pc=%d"), label, zigbee.pc);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Goto label not found, label=%d pc=%d"), label, zigbee.pc);
|
||||
if (ZIGBEE_LABEL_ABORT != label) {
|
||||
// if not already looking for ZIGBEE_LABEL_ABORT, goto ZIGBEE_LABEL_ABORT
|
||||
ZigbeeGotoLabel(ZIGBEE_LABEL_ABORT);
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Label Abort (%d) not present, aborting Zigbee"), ZIGBEE_LABEL_ABORT);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Label Abort (%d) not present, aborting Zigbee"), ZIGBEE_LABEL_ABORT);
|
||||
zigbee.state_machine = false;
|
||||
zigbee.active = false;
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ void ZigbeeStateMachine_Run(void) {
|
|||
// checking if timeout expired
|
||||
if ((zigbee.next_timeout) && (now > zigbee.next_timeout)) { // if next_timeout == 0 then wait forever
|
||||
if (!zigbee.state_no_timeout) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "timeout, goto label %d"), zigbee.on_timeout_goto);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "timeout, goto label %d"), zigbee.on_timeout_goto);
|
||||
ZigbeeGotoLabel(zigbee.on_timeout_goto);
|
||||
} else {
|
||||
zigbee.state_waiting = false; // simply stop waiting
|
||||
|
@ -967,7 +967,7 @@ void ZigbeeStateMachine_Run(void) {
|
|||
zigbee.state_no_timeout = false; // reset the no_timeout for next instruction
|
||||
|
||||
if (zigbee.pc > ARRAY_SIZE(zb_prog)) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Invalid pc: %d, aborting"), zigbee.pc);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Invalid pc: %d, aborting"), zigbee.pc);
|
||||
zigbee.pc = -1;
|
||||
}
|
||||
if (zigbee.pc < 0) {
|
||||
|
@ -1016,7 +1016,7 @@ void ZigbeeStateMachine_Run(void) {
|
|||
case ZGB_INSTR_STOP:
|
||||
zigbee.state_machine = false;
|
||||
if (cur_d8) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Stopping (%d)"), cur_d8);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Stopping (%d)"), cur_d8);
|
||||
}
|
||||
break;
|
||||
case ZGB_INSTR_CALL:
|
||||
|
|
|
@ -193,7 +193,7 @@ int32_t EZ_MessageSent(int32_t res, const class SBuffer &buf) {
|
|||
uint16_t group_addr = buf.get16(13);
|
||||
|
||||
if ((EMBER_OUTGOING_MULTICAST == message_type) && (0xFFFD == dst_addr)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Sniffing group 0x%04X"), group_addr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Sniffing group 0x%04X"), group_addr);
|
||||
}
|
||||
return -1; // ignore
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ int32_t Z_MgmtBindRsp(int32_t res, const class SBuffer &buf) {
|
|||
dstep = buf.get8(idx + 20);
|
||||
idx += 21;
|
||||
} else {
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("ZNP_MgmtBindRsp unknwon address mode %d"), addrmode);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("ZNP_MgmtBindRsp unknwon address mode %d"), addrmode);
|
||||
break; // abort for any other value since we don't know the length of the field
|
||||
}
|
||||
|
||||
|
@ -1279,7 +1279,7 @@ void Z_SendSingleAttributeRead(uint16_t shortaddr, uint16_t groupaddr, uint16_t
|
|||
void Z_AutoBind(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, uint8_t endpoint, uint32_t value) {
|
||||
uint64_t srcLongAddr = zigbee_devices.getDeviceLongAddr(shortaddr);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `ZbBind {\"Device\":\"0x%04X\",\"Endpoint\":%d,\"Cluster\":\"0x%04X\"}`"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `ZbBind {\"Device\":\"0x%04X\",\"Endpoint\":%d,\"Cluster\":\"0x%04X\"}`"),
|
||||
shortaddr, endpoint, cluster);
|
||||
#ifdef USE_ZIGBEE_ZNP
|
||||
SBuffer buf(34);
|
||||
|
@ -1389,7 +1389,7 @@ void Z_AutoConfigReportingForCluster(uint16_t shortaddr, uint16_t groupaddr, uin
|
|||
// encode value
|
||||
int32_t res = encodeSingleAttribute(buf, report_change, "", attr_type);
|
||||
if (res < 0) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "internal error, unsupported attribute type"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "internal error, unsupported attribute type"));
|
||||
} else {
|
||||
Z_attribute attr;
|
||||
attr.setKeyName(PSTR("ReportableChange"), true); // true because in PMEM
|
||||
|
@ -1404,7 +1404,7 @@ void Z_AutoConfigReportingForCluster(uint16_t shortaddr, uint16_t groupaddr, uin
|
|||
ResponseAppend_P(PSTR("}}"));
|
||||
|
||||
if (buf.len() > 0) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `%s`"), TasmotaGlobal.mqtt_data);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `%s`"), TasmotaGlobal.mqtt_data);
|
||||
ZigbeeZCLSend_Raw(ZigbeeZCLSendMessage({
|
||||
shortaddr,
|
||||
0x0000, /* group */
|
||||
|
@ -1507,11 +1507,11 @@ void Z_IncomingMessage(class ZCLFrame &zcl_received) {
|
|||
zcl_received.parseClusterSpecificCommand(attr_list);
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZCL_RAW_RECEIVED ": {\"0x%04X\":{%s}}"), srcaddr, attr_list.toString().c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZCL_RAW_RECEIVED ": {\"0x%04X\":{%s}}"), srcaddr, attr_list.toString().c_str());
|
||||
|
||||
// discard the message if it was sent by us (broadcast or group loopback)
|
||||
if (srcaddr == localShortAddr) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "loopback message, ignoring"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "loopback message, ignoring"));
|
||||
return; // abort the rest of message management
|
||||
}
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ int32_t EZ_IncomingMessage(int32_t res, const class SBuffer &buf) {
|
|||
return EZ_ParentAnnceRsp(res, zdo_buf, true);
|
||||
default:
|
||||
// TODO move later to LOG_LEVEL_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZIG: Internal ZDO message 0x%04X sent from 0x%04X %s"), clusterid, srcaddr, wasbroadcast ? PSTR("(broadcast)") : "");
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZIG: Internal ZDO message 0x%04X sent from 0x%04X %s"), clusterid, srcaddr, wasbroadcast ? PSTR("(broadcast)") : "");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -1975,7 +1975,7 @@ void ZCLFrame::autoResponder(const uint16_t *attr_list_ids, size_t attr_len) {
|
|||
// we have a non-empty output
|
||||
|
||||
// log first
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZIG: Auto-responder: ZbSend {\"Device\":\"0x%04X\""
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZIG: Auto-responder: ZbSend {\"Device\":\"0x%04X\""
|
||||
",\"Cluster\":\"0x%04X\""
|
||||
",\"Endpoint\":%d"
|
||||
",\"Response\":%s}"
|
||||
|
|
|
@ -92,7 +92,7 @@ void ZigbeeInputLoop(void) {
|
|||
while (ZigbeeSerial->available()) {
|
||||
yield();
|
||||
uint8_t zigbee_in_byte = ZigbeeSerial->read();
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZbInput byte=%d len=%d"), zigbee_in_byte, zigbee_buffer->len());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZbInput byte=%d len=%d"), zigbee_in_byte, zigbee_buffer->len());
|
||||
|
||||
if (0 == zigbee_buffer->len()) { // make sure all variables are correctly initialized
|
||||
zigbee_frame_len = 5;
|
||||
|
@ -101,14 +101,14 @@ void ZigbeeInputLoop(void) {
|
|||
// in this case the first bit (lsb) is missed and Tasmota receives 0xFF instead of 0xFE
|
||||
// We forgive this mistake, and next bytes are automatically resynchronized
|
||||
if (ZIGBEE_SOF_ALT == zigbee_in_byte) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZbInput forgiven first byte %02X (only for statistics)"), zigbee_in_byte);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZbInput forgiven first byte %02X (only for statistics)"), zigbee_in_byte);
|
||||
zigbee_in_byte = ZIGBEE_SOF;
|
||||
}
|
||||
}
|
||||
|
||||
if ((0 == zigbee_buffer->len()) && (ZIGBEE_SOF != zigbee_in_byte)) {
|
||||
// waiting for SOF (Start Of Frame) byte, discard anything else
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZbInput discarding byte %02X"), zigbee_in_byte);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZbInput discarding byte %02X"), zigbee_in_byte);
|
||||
continue; // discard
|
||||
}
|
||||
|
||||
|
@ -137,17 +137,17 @@ void ZigbeeInputLoop(void) {
|
|||
char hex_char[(zigbee_buffer->len() * 2) + 2];
|
||||
ToHex_P((unsigned char*)zigbee_buffer->getBuffer(), zigbee_buffer->len(), hex_char, sizeof(hex_char));
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Bytes follow_read_metric = %0d"), ZigbeeSerial->getLoopReadMetric());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Bytes follow_read_metric = %0d"), ZigbeeSerial->getLoopReadMetric());
|
||||
// buffer received, now check integrity
|
||||
if (zigbee_buffer->len() != zigbee_frame_len) {
|
||||
// Len is not correct, log and reject frame
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received frame of wrong size %s, len %d, expected %d"), hex_char, zigbee_buffer->len(), zigbee_frame_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received frame of wrong size %s, len %d, expected %d"), hex_char, zigbee_buffer->len(), zigbee_frame_len);
|
||||
} else if (0x00 != fcs) {
|
||||
// FCS is wrong, packet is corrupt, log and reject frame
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received bad FCS frame %s, %d"), hex_char, fcs);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received bad FCS frame %s, %d"), hex_char, fcs);
|
||||
} else {
|
||||
// frame is correct
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received correct frame %s"), hex_char);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_JSON_ZIGBEEZNPRECEIVED ": received correct frame %s"), hex_char);
|
||||
|
||||
SBuffer znp_buffer = zigbee_buffer->subBuffer(2, zigbee_frame_len - 3); // remove SOF, LEN and FCS
|
||||
|
||||
|
@ -156,7 +156,7 @@ void ZigbeeInputLoop(void) {
|
|||
if (Settings.flag3.tuya_serial_mqtt_publish) {
|
||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||
}
|
||||
// now process the message
|
||||
ZigbeeProcessInput(znp_buffer);
|
||||
|
@ -181,7 +181,7 @@ void ZigbeeInputLoop(void) {
|
|||
|
||||
yield();
|
||||
uint8_t zigbee_in_byte = ZigbeeSerial->read();
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: ZbInput byte=0x%02X len=%d"), zigbee_in_byte, zigbee_buffer->len());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: ZbInput byte=0x%02X len=%d"), zigbee_in_byte, zigbee_buffer->len());
|
||||
|
||||
// if (0 == zigbee_buffer->len()) { // make sure all variables are correctly initialized
|
||||
// escape = false;
|
||||
|
@ -193,13 +193,13 @@ void ZigbeeInputLoop(void) {
|
|||
}
|
||||
|
||||
if (ZIGBEE_EZSP_ESCAPE == zigbee_in_byte) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Escape byte received"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Escape byte received"));
|
||||
escape = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ZIGBEE_EZSP_CANCEL == zigbee_in_byte) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: ZbInput byte=0x1A, cancel byte received, discarding %d bytes"), zigbee_buffer->len());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: ZbInput byte=0x1A, cancel byte received, discarding %d bytes"), zigbee_buffer->len());
|
||||
zigbee_buffer->setLen(0); // empty buffer
|
||||
escape = false;
|
||||
frame_complete = false;
|
||||
|
@ -229,10 +229,10 @@ void ZigbeeInputLoop(void) {
|
|||
char hex_char[frame_len * 2 + 2];
|
||||
ToHex_P((unsigned char*)zigbee_buffer->getBuffer(), zigbee_buffer->len(), hex_char, sizeof(hex_char));
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Bytes follow_read_metric = %0d"), ZigbeeSerial->getLoopReadMetric());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "Bytes follow_read_metric = %0d"), ZigbeeSerial->getLoopReadMetric());
|
||||
if ((frame_complete) && (frame_len >= 3)) {
|
||||
// frame received and has at least 3 bytes (without EOF), checking CRC
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEE_EZSP_RECEIVED ": received raw frame %s"), hex_char);
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEE_EZSP_RECEIVED ": received raw frame %s"), hex_char);
|
||||
uint16_t crc = 0xFFFF; // frame CRC
|
||||
// compute CRC
|
||||
for (uint32_t i=0; i<frame_len-2; i++) {
|
||||
|
@ -250,7 +250,7 @@ void ZigbeeInputLoop(void) {
|
|||
// remove 2 last bytes
|
||||
|
||||
if (crc_received != crc) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEE_EZSP_RECEIVED ": bad crc (received 0x%04X, computed 0x%04X) %s"), crc_received, crc, hex_char);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEE_EZSP_RECEIVED ": bad crc (received 0x%04X, computed 0x%04X) %s"), crc_received, crc, hex_char);
|
||||
} else {
|
||||
// copy buffer
|
||||
SBuffer ezsp_buffer = zigbee_buffer->subBuffer(0, frame_len - 2); // CRC
|
||||
|
@ -267,13 +267,13 @@ void ZigbeeInputLoop(void) {
|
|||
}
|
||||
|
||||
ToHex_P((unsigned char*)ezsp_buffer.getBuffer(), ezsp_buffer.len(), hex_char, sizeof(hex_char));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "{\"" D_JSON_ZIGBEE_EZSP_RECEIVED "2\":\"%s\"}"), hex_char);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "{\"" D_JSON_ZIGBEE_EZSP_RECEIVED "2\":\"%s\"}"), hex_char);
|
||||
// now process the message
|
||||
ZigbeeProcessInputRaw(ezsp_buffer);
|
||||
}
|
||||
} else {
|
||||
// the buffer timed-out, print error and discard
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEE_EZSP_RECEIVED ": time-out, discarding %s, %d"), hex_char);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_JSON_ZIGBEE_EZSP_RECEIVED ": time-out, discarding %s, %d"), hex_char);
|
||||
}
|
||||
zigbee_buffer->setLen(0); // empty buffer
|
||||
escape = false;
|
||||
|
@ -289,10 +289,10 @@ void ZigbeeInputLoop(void) {
|
|||
// Initialize internal structures
|
||||
void ZigbeeInitSerial(void)
|
||||
{
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem1 = %d"), ESP_getFreeHeap());
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem1 = %d"), ESP_getFreeHeap());
|
||||
zigbee.active = false;
|
||||
if (PinUsed(GPIO_ZIGBEE_RX) && PinUsed(GPIO_ZIGBEE_TX)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "GPIOs Rx:%d Tx:%d"), Pin(GPIO_ZIGBEE_RX), Pin(GPIO_ZIGBEE_TX));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "GPIOs Rx:%d Tx:%d"), Pin(GPIO_ZIGBEE_RX), Pin(GPIO_ZIGBEE_TX));
|
||||
// if TasmotaGlobal.seriallog_level is 0, we allow GPIO 13/15 to switch to Hardware Serial
|
||||
ZigbeeSerial = new TasmotaSerial(Pin(GPIO_ZIGBEE_RX), Pin(GPIO_ZIGBEE_TX), TasmotaGlobal.seriallog_level ? 1 : 2, 0, 256); // set a receive buffer of 256 bytes
|
||||
ZigbeeSerial->begin(115200);
|
||||
|
@ -301,9 +301,9 @@ void ZigbeeInitSerial(void)
|
|||
uint32_t aligned_buffer = ((uint32_t)TasmotaGlobal.serial_in_buffer + 3) & ~3;
|
||||
zigbee_buffer = new PreAllocatedSBuffer(sizeof(TasmotaGlobal.serial_in_buffer) - 3, (char*) aligned_buffer);
|
||||
} else {
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem2 = %d"), ESP_getFreeHeap());
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem2 = %d"), ESP_getFreeHeap());
|
||||
zigbee_buffer = new SBuffer(ZIGBEE_BUFFER_SIZE);
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem3 = %d"), ESP_getFreeHeap());
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem3 = %d"), ESP_getFreeHeap());
|
||||
}
|
||||
|
||||
if (PinUsed(GPIO_ZIGBEE_RST)) {
|
||||
|
@ -316,7 +316,7 @@ void ZigbeeInitSerial(void)
|
|||
zigbee.state_machine = true; // start the state machine
|
||||
ZigbeeSerial->flush();
|
||||
}
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem9 = %d"), ESP_getFreeHeap());
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("ZigbeeInit Mem9 = %d"), ESP_getFreeHeap());
|
||||
}
|
||||
|
||||
#ifdef USE_ZIGBEE_ZNP
|
||||
|
@ -327,14 +327,14 @@ void ZigbeeZNPFlush(void) {
|
|||
for (uint32_t i = 0; i < 256; i++) {
|
||||
ZigbeeSerial->write(0xFF);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPSENT " 0xFF x 255"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPSENT " 0xFF x 255"));
|
||||
}
|
||||
}
|
||||
|
||||
void ZigbeeZNPSend(const uint8_t *msg, size_t len) {
|
||||
if ((len < 2) || (len > 252)) {
|
||||
// abort, message cannot be less than 2 bytes for CMD1 and CMD2
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_JSON_ZIGBEEZNPSENT ": bad message len %d"), len);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_JSON_ZIGBEEZNPSENT ": bad message len %d"), len);
|
||||
return;
|
||||
}
|
||||
uint8_t data_len = len - 2; // removing CMD1 and CMD2
|
||||
|
@ -343,21 +343,21 @@ void ZigbeeZNPSend(const uint8_t *msg, size_t len) {
|
|||
uint8_t fcs = data_len;
|
||||
|
||||
ZigbeeSerial->write(ZIGBEE_SOF); // 0xFE
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend SOF %02X"), ZIGBEE_SOF);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend SOF %02X"), ZIGBEE_SOF);
|
||||
ZigbeeSerial->write(data_len);
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend LEN %02X"), data_len);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend LEN %02X"), data_len);
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
uint8_t b = pgm_read_byte(msg + i);
|
||||
ZigbeeSerial->write(b);
|
||||
fcs ^= b;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend byt %02X"), b);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend byt %02X"), b);
|
||||
}
|
||||
ZigbeeSerial->write(fcs); // finally send fcs checksum byte
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend FCS %02X"), fcs);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZNPSend FCS %02X"), fcs);
|
||||
}
|
||||
// Now send a MQTT message to report the sent message
|
||||
char hex_char[(len * 2) + 2];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPSENT " %s"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEEZNPSENT " %s"),
|
||||
ToHex_P(msg, len, hex_char, sizeof(hex_char)));
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ void ZigbeeEZSPSend_Out(uint8_t out_byte) {
|
|||
void ZigbeeEZSPSendRaw(const uint8_t *msg, size_t len, bool send_cancel) {
|
||||
if ((len < 1) || (len > 252)) {
|
||||
// abort, message cannot be less than 2 bytes for CMD1 and CMD2
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_JSON_ZIGBEE_EZSP_SENT ": bad message len %d"), len);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_JSON_ZIGBEE_EZSP_SENT ": bad message len %d"), len);
|
||||
return;
|
||||
}
|
||||
uint8_t data_len = len - 2; // removing CMD1 and CMD2
|
||||
|
@ -493,7 +493,7 @@ void ZigbeeEZSPSendRaw(const uint8_t *msg, size_t len, bool send_cancel) {
|
|||
|
||||
// Now send a MQTT message to report the sent message
|
||||
char hex_char[(len * 2) + 2];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEE_EZSP_SENT_RAW " %s"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE D_JSON_ZIGBEE_EZSP_SENT_RAW " %s"),
|
||||
ToHex_P(msg, len, hex_char, sizeof(hex_char)));
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ void ZigbeeEZSPSendRaw(const uint8_t *msg, size_t len, bool send_cancel) {
|
|||
void ZigbeeEZSPSendCmd(const uint8_t *msg, size_t len) {
|
||||
char hex_char[len*2 + 2];
|
||||
ToHex_P(msg, len, hex_char, sizeof(hex_char));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "ZbEZSPSend %s"), hex_char);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "ZbEZSPSend %s"), hex_char);
|
||||
|
||||
SBuffer cmd(len+3); // prefix with seq number (1 byte) and frame control bytes (2 bytes)
|
||||
|
||||
|
@ -519,7 +519,7 @@ void ZigbeeEZSPSendCmd(const uint8_t *msg, size_t len) {
|
|||
void ZigbeeEZSPSendDATA_frm(bool send_cancel, uint8_t to_frm, uint8_t from_ack) {
|
||||
SBuffer *buf = EZSP_Serial.to_packets[to_frm];
|
||||
if (!buf) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Buffer for packet %d is not allocated"), EZSP_Serial.to_send);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Buffer for packet %d is not allocated"), EZSP_Serial.to_send);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ void ZigbeeEZSPSendDATA(const uint8_t *msg, size_t len) {
|
|||
buf->add8(0x00); // placeholder for control_byte
|
||||
buf->addBuffer(msg, len);
|
||||
//
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: adding packet to_send, to_ack:%d, to_send:%d, to_end:%d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: adding packet to_send, to_ack:%d, to_send:%d, to_end:%d"),
|
||||
EZSP_Serial.to_ack, EZSP_Serial.to_send, EZSP_Serial.to_end);
|
||||
uint8_t to_frm = EZSP_Serial.to_end;
|
||||
if (EZSP_Serial.to_packets[to_frm]) {
|
||||
|
@ -564,7 +564,7 @@ int32_t ZigbeeProcessInputEZSP(class SBuffer &buf) {
|
|||
bool callbackPending = frame_control & 0x04;
|
||||
bool security_enabled = frame_control & 0x8000;
|
||||
if (truncated || overflow || security_enabled) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZIG: specific frame_control 0x%04X"), frame_control);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZIG: specific frame_control 0x%04X"), frame_control);
|
||||
}
|
||||
|
||||
// remove first 2 bytes, be
|
||||
|
@ -609,7 +609,7 @@ int32_t ZigbeeProcessInputEZSP(class SBuffer &buf) {
|
|||
log_level = LOG_LEVEL_DEBUG;
|
||||
break;
|
||||
}
|
||||
AddLog_P2(log_level, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data); // TODO move to LOG_LEVEL_DEBUG when stable
|
||||
AddLog_P(log_level, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data); // TODO move to LOG_LEVEL_DEBUG when stable
|
||||
}
|
||||
|
||||
// Pass message to state machine
|
||||
|
@ -619,14 +619,14 @@ int32_t ZigbeeProcessInputEZSP(class SBuffer &buf) {
|
|||
// Check if we advanced in the ACKed frames, and free from memory packets acknowledged
|
||||
void EZSP_HandleAck(uint8_t new_ack) {
|
||||
if (EZSP_Serial.to_ack != new_ack) { // new ack receveid
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: new ack/data received, was %d now %d"), EZSP_Serial.to_ack, new_ack);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: new ack/data received, was %d now %d"), EZSP_Serial.to_ack, new_ack);
|
||||
uint32_t i = EZSP_Serial.to_ack;
|
||||
do {
|
||||
if (EZSP_Serial.to_packets[i]) {
|
||||
delete EZSP_Serial.to_packets[i];
|
||||
EZSP_Serial.to_packets[i] = nullptr;
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: freeing packet %d from memory"), i);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: freeing packet %d from memory"), i);
|
||||
i = (i + 1) & 0x07;
|
||||
} while (i != new_ack);
|
||||
EZSP_Serial.to_ack = new_ack;
|
||||
|
@ -647,10 +647,10 @@ int32_t ZigbeeProcessInputRaw(class SBuffer &buf) {
|
|||
} else if (frame_type == 0xA0) {
|
||||
|
||||
// NAK
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Received NAK %d, to_ack:%d, to_send:%d, to_end:%d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Received NAK %d, to_ack:%d, to_send:%d, to_end:%d"),
|
||||
ack_num, EZSP_Serial.to_ack, EZSP_Serial.to_send, EZSP_Serial.to_end);
|
||||
EZSP_Serial.to_send = ack_num;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZIG: NAK, resending packet %d"), ack_num);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZIG: NAK, resending packet %d"), ack_num);
|
||||
} else if (control_byte == 0xC1) {
|
||||
|
||||
// RSTACK
|
||||
|
@ -676,7 +676,7 @@ int32_t ZigbeeProcessInputRaw(class SBuffer &buf) {
|
|||
} else {
|
||||
|
||||
// Unknown
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZIG: Received unknown control byte 0x%02X"), control_byte);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZIG: Received unknown control byte 0x%02X"), control_byte);
|
||||
}
|
||||
} else { // DATA Frame
|
||||
|
||||
|
@ -883,7 +883,7 @@ void ZigbeeOutputLoop(void) {
|
|||
#ifdef USE_ZIGBEE_EZSP
|
||||
// while (EZSP_Serial.to_send != EZSP_Serial.to_end) {
|
||||
if (EZSP_Serial.to_send != EZSP_Serial.to_end) { // we send only one packet per tick to lower the chance of NAK
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Something to_send, to_ack:%d, to_send:%d, to_end:%d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ZIG: Something to_send, to_ack:%d, to_send:%d, to_end:%d"),
|
||||
EZSP_Serial.to_ack, EZSP_Serial.to_send, EZSP_Serial.to_end);
|
||||
// we have a frame waiting to be sent
|
||||
ZigbeeEZSPSendDATA_frm(true, EZSP_Serial.to_send, EZSP_Serial.from_ack);
|
||||
|
|
|
@ -251,7 +251,7 @@ bool ZigbeeUploadBootloaderPrompt(void) {
|
|||
if (buf_len) {
|
||||
char hex_char[256];
|
||||
ToHex_P(serial_buffer, buf_len, hex_char, 256);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd %s"), hex_char);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("XMD: Rcvd %s"), hex_char);
|
||||
}
|
||||
|
||||
return ((4 == ZbUpload.byte_counter) && (millis() > XModem.flush_delay));
|
||||
|
@ -264,7 +264,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
}
|
||||
#ifdef ZIGBEE_BOOTLOADER_SOFTWARE_RESET_FIRST
|
||||
case ZBU_INIT: { // *** Init ESF32 bootloader
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader"));
|
||||
ZbUpload.ota_step = ZBU_SOFTWARE_RESET;
|
||||
return false; // Keep Zigbee serial active
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
}
|
||||
case ZBU_SOFTWARE_SEND: {
|
||||
if (millis() > XModem.timeout) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset send timeout"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset send timeout"));
|
||||
ZbUpload.ota_step = ZBU_HARDWARE_RESET;
|
||||
return true;
|
||||
}
|
||||
|
@ -304,17 +304,17 @@ bool ZigbeeUploadXmodem(void) {
|
|||
case ZBU_PROMPT: { // *** Wait for prompt and select option upload ebl
|
||||
if (millis() > XModem.timeout) {
|
||||
if (ZBU_SOFTWARE_RESET == ZbUpload.bootloader) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset timeout"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader software reset timeout"));
|
||||
ZbUpload.ota_step = ZBU_HARDWARE_RESET;
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader hardware reset timeout"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader hardware reset timeout"));
|
||||
ZbUpload.ota_step = ZBU_ERROR;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else // No ZIGBEE_BOOTLOADER_SOFTWARE_RESET_FIRST
|
||||
case ZBU_INIT: { // *** Init ESF32 bootloader
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init bootloader"));
|
||||
ZigbeeUploadSetBootloader(0); // Reboot MCU EFR32 which returns below text
|
||||
XModem.timeout = millis() + (30 * 1000); // Allow 30 seconds to receive EBL prompt
|
||||
XModem.delay = millis() + (2 * XMODEM_FLUSH_DELAY);
|
||||
|
@ -324,7 +324,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
}
|
||||
case ZBU_PROMPT: { // *** Wait for prompt and select option upload ebl
|
||||
if (millis() > XModem.timeout) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout"));
|
||||
ZbUpload.ota_step = ZBU_ERROR;
|
||||
return true;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
// 3. ebl info
|
||||
// BL >
|
||||
if (ZigbeeUploadBootloaderPrompt()) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Init sync"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init sync"));
|
||||
ZigbeeSerial->flush();
|
||||
ZigbeeSerial->write('1'); // upload ebl
|
||||
if (TasmotaGlobal.sleep > 0) {
|
||||
|
@ -358,7 +358,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
}
|
||||
case ZBU_SYNC: { // *** Handle file upload using XModem - sync
|
||||
if (millis() > XModem.timeout) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: SYNC timeout"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: SYNC timeout"));
|
||||
ZbUpload.ota_step = ZBU_ERROR;
|
||||
return true;
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
XModem.packetNo = 1;
|
||||
ZbUpload.byte_counter = 0;
|
||||
ZbUpload.ota_step = ZBU_UPLOAD;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Init packet send"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Init packet send"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -379,7 +379,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
case ZBU_UPLOAD: { // *** Handle file upload using XModem - upload
|
||||
if (ZigbeeUploadAvailable()) {
|
||||
if (!XModemSendPacket(XModem.packetNo)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Packet send failed"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Packet send failed"));
|
||||
ZbUpload.ota_step = ZBU_ERROR;
|
||||
return true;
|
||||
}
|
||||
|
@ -401,14 +401,14 @@ bool ZigbeeUploadXmodem(void) {
|
|||
// its XModem state machine waits a sufficient amount of time to allow this checksum process
|
||||
// to occur without timing out on the response just before the EOT is sent.
|
||||
if (millis() > XModem.timeout) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: EOT ACK timeout"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: EOT ACK timeout"));
|
||||
ZbUpload.ota_step = ZBU_ERROR;
|
||||
return true;
|
||||
}
|
||||
if (ZigbeeSerial->available()) {
|
||||
char xmodem_ack = XModemWaitACK();
|
||||
if (XM_ACK == xmodem_ack) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: " D_SUCCESSFUL));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: " D_SUCCESSFUL));
|
||||
XModem.timeout = millis() + (30 * 1000); // Allow 30 seconds to receive EBL prompt
|
||||
ZbUpload.byte_counter = 0;
|
||||
ZbUpload.ota_step = ZBU_COMPLETE;
|
||||
|
@ -418,7 +418,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
}
|
||||
case ZBU_COMPLETE: { // *** Wait for Serial upload complete EBL prompt
|
||||
if (millis() > XModem.timeout) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: Bootloader timeout"));
|
||||
ZbUpload.ota_step = ZBU_ERROR;
|
||||
return true;
|
||||
} else {
|
||||
|
@ -440,7 +440,7 @@ bool ZigbeeUploadXmodem(void) {
|
|||
case ZBU_ERROR:
|
||||
ZbUpload.state = ZBU_ERROR;
|
||||
case ZBU_DONE: { // *** Clean up and restart to disable bootloader and use new firmware
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("XMD: " D_RESTARTING));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("XMD: " D_RESTARTING));
|
||||
ZigbeeUploadSetBootloader(1); // Disable bootloader and reset MCU - should happen at restart
|
||||
if (1 == TasmotaGlobal.sleep) {
|
||||
TasmotaGlobal.sleep = Settings.sleep; // Restore loop sleep
|
||||
|
@ -539,9 +539,9 @@ void HandleZigbeeXfer(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_UPLOAD_TRANSFER));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPLOAD_TRANSFER));
|
||||
|
||||
WSContentStart_P(S_INFORMATION);
|
||||
WSContentStart_P(PSTR(D_INFORMATION));
|
||||
WSContentSend_P(HTTP_SCRIPT_XFER_STATE);
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPLOAD_TRANSFER " ...</b></div>"));
|
||||
|
|
|
@ -32,7 +32,7 @@ const char kZbCommands[] PROGMEM = D_PRFX_ZB "|" // prefix
|
|||
D_CMND_ZIGBEE_STATUS "|" D_CMND_ZIGBEE_RESET "|" D_CMND_ZIGBEE_SEND "|" D_CMND_ZIGBEE_PROBE "|"
|
||||
D_CMND_ZIGBEE_FORGET "|" D_CMND_ZIGBEE_SAVE "|" D_CMND_ZIGBEE_NAME "|"
|
||||
D_CMND_ZIGBEE_BIND "|" D_CMND_ZIGBEE_UNBIND "|" D_CMND_ZIGBEE_PING "|" D_CMND_ZIGBEE_MODELID "|"
|
||||
D_CMND_ZIGBEE_LIGHT "|" D_CMND_ZIGBEE_OCCUPANCY "|"
|
||||
D_CMND_ZIGBEE_LIGHT "|" D_CMND_ZIGBEE_OCCUPANCY "|"
|
||||
D_CMND_ZIGBEE_RESTORE "|" D_CMND_ZIGBEE_BIND_STATE "|" D_CMND_ZIGBEE_MAP "|"
|
||||
D_CMND_ZIGBEE_CONFIG "|" D_CMND_ZIGBEE_DATA
|
||||
;
|
||||
|
@ -48,7 +48,7 @@ void (* const ZigbeeCommand[])(void) PROGMEM = {
|
|||
&CmndZbStatus, &CmndZbReset, &CmndZbSend, &CmndZbProbe,
|
||||
&CmndZbForget, &CmndZbSave, &CmndZbName,
|
||||
&CmndZbBind, &CmndZbUnbind, &CmndZbPing, &CmndZbModelId,
|
||||
&CmndZbLight, &CmndZbOccupancy,
|
||||
&CmndZbLight, &CmndZbOccupancy,
|
||||
&CmndZbRestore, &CmndZbBindState, &CmndZbMap,
|
||||
&CmndZbConfig, CmndZbData,
|
||||
};
|
||||
|
@ -65,7 +65,7 @@ void ZigbeeInit(void)
|
|||
// Check if settings in Flash are set
|
||||
if (PinUsed(GPIO_ZIGBEE_RX) && PinUsed(GPIO_ZIGBEE_TX)) {
|
||||
if (0 == Settings.zb_channel) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Randomizing Zigbee parameters, please check with 'ZbConfig'"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Randomizing Zigbee parameters, please check with 'ZbConfig'"));
|
||||
uint64_t mac64 = 0; // stuff mac address into 64 bits
|
||||
WiFi.macAddress((uint8_t*) &mac64);
|
||||
uint32_t esp_id = ESP_getChipId();
|
||||
|
@ -172,13 +172,13 @@ void zigbeeZCLSendStr(uint16_t shortaddr, uint16_t groupaddr, uint8_t endpoint,
|
|||
if ((0 == endpoint) && (BAD_SHORTADDR != shortaddr)) {
|
||||
// endpoint is not specified, let's try to find it from shortAddr, unless it's a group address
|
||||
endpoint = zigbee_devices.findFirstEndpoint(shortaddr);
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZbSend: guessing endpoint 0x%02X"), endpoint);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: guessing endpoint 0x%02X"), endpoint);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZbSend: shortaddr 0x%04X, groupaddr 0x%04X, cluster 0x%04X, endpoint 0x%02X, cmd 0x%02X, data %s"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: shortaddr 0x%04X, groupaddr 0x%04X, cluster 0x%04X, endpoint 0x%02X, cmd 0x%02X, data %s"),
|
||||
shortaddr, groupaddr, cluster, endpoint, cmd, param);
|
||||
|
||||
if ((0 == endpoint) && (BAD_SHORTADDR != shortaddr)) { // endpoint null is ok for group address
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZbSend: unspecified endpoint"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZbSend: unspecified endpoint"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ bool ZbTuyaWrite(SBuffer & buf, const Z_attribute & attr, uint8_t transid) {
|
|||
buf.add8(0); // fn
|
||||
int32_t res = encodeSingleAttribute(buf, val_d, val_str, attr.attr_type);
|
||||
if (res < 0) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Error for Tuya attribute type %04X/%04X '0x%02X'"), attr.key.id.cluster, attr.key.id.attr_id, attr.attr_type);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Error for Tuya attribute type %04X/%04X '0x%02X'"), attr.key.id.cluster, attr.key.id.attr_id, attr.attr_type);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -266,7 +266,7 @@ bool ZbAppendWriteBuf(SBuffer & buf, const Z_attribute & attr, bool prepend_stat
|
|||
if (res < 0) {
|
||||
// remove the attribute type we just added
|
||||
// buf.setLen(buf.len() - (operation == ZCL_READ_ATTRIBUTES_RESPONSE ? 4 : 3));
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Unsupported attribute type %04X/%04X '0x%02X'"), attr.key.id.cluster, attr.key.id.attr_id, attr.attr_type);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Unsupported attribute type %04X/%04X '0x%02X'"), attr.key.id.cluster, attr.key.id.attr_id, attr.attr_type);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -326,7 +326,7 @@ void ZbSendReportWrite(class JsonParserToken val_pubwrite, class ZigbeeZCLSendMe
|
|||
if ((packet.cluster == 0XEF00) && (packet.cmd == ZCL_WRITE_ATTRIBUTES)) {
|
||||
// special case of Tuya / Moes attributes
|
||||
if (buf.len() > 0) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Only 1 attribute allowed for Tuya"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Only 1 attribute allowed for Tuya"));
|
||||
return;
|
||||
}
|
||||
packet.clusterSpecific = true;
|
||||
|
@ -475,7 +475,7 @@ void ZbSendSend(class JsonParserToken val_cmd, uint16_t device, uint16_t groupad
|
|||
}
|
||||
}
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZbSend: command_template = %s"), cmd_str.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: command_template = %s"), cmd_str.c_str());
|
||||
if (0xFF == cmd_var) { // if command number is a variable, replace it with x
|
||||
cmd = x;
|
||||
x = y; // and shift other variables
|
||||
|
@ -484,7 +484,7 @@ void ZbSendSend(class JsonParserToken val_cmd, uint16_t device, uint16_t groupad
|
|||
cmd = cmd_var; // or simply copy the cmd number
|
||||
}
|
||||
cmd_str = zigbeeCmdAddParams(cmd_str.c_str(), x, y, z); // fill in parameters
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZbSend: command_final = %s"), cmd_str.c_str());
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZbSend: command_final = %s"), cmd_str.c_str());
|
||||
cmd_s = cmd_str.c_str();
|
||||
} else {
|
||||
// we have zero command, pass through until last error for missing command
|
||||
|
@ -526,7 +526,7 @@ void ZbSendSend(class JsonParserToken val_cmd, uint16_t device, uint16_t groupad
|
|||
// we have an unsupported command type, just ignore it and fallback to missing command
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZigbeeZCLSend device: 0x%04X, group: 0x%04X, endpoint:%d, cluster:0x%04X, cmd:0x%02X, send:\"%s\""),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZigbeeZCLSend device: 0x%04X, group: 0x%04X, endpoint:%d, cluster:0x%04X, cmd:0x%02X, send:\"%s\""),
|
||||
device, groupaddr, endpoint, cluster, cmd, cmd_s);
|
||||
zigbeeZCLSendStr(device, groupaddr, endpoint, clusterSpecific, manuf, cluster, cmd, cmd_s);
|
||||
ResponseCmndDone();
|
||||
|
@ -613,7 +613,7 @@ void ZbSendRead(JsonParserToken val_attr, ZigbeeZCLSendMessage & packet) {
|
|||
}
|
||||
}
|
||||
if (!found) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ZIG: Unknown attribute name (ignored): %s"), key);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ZIG: Unknown attribute name (ignored): %s"), key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,7 +708,7 @@ void CmndZbSend(void) {
|
|||
endpoint = 0xFF; // endpoint not used for group addresses, so use a dummy broadcast endpoint
|
||||
} else if (0 == endpoint) { // if it was not already specified, try to guess it
|
||||
endpoint = zigbee_devices.findFirstEndpoint(device);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ZIG: guessing endpoint %d"), endpoint);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ZIG: guessing endpoint %d"), endpoint);
|
||||
}
|
||||
if (0 == endpoint) { // after this, if it is still zero, then it's an error
|
||||
ResponseCmndChar_P(PSTR("Missing endpoint"));
|
||||
|
@ -1140,7 +1140,7 @@ void CmndZbOccupancy(void) {
|
|||
// parse first part, <device_id>
|
||||
Z_Device & device = zigbee_devices.parseDeviceFromName(XdrvMailbox.data, true); // in case of short_addr, it must be already registered
|
||||
if (!device.valid()) { ResponseCmndChar_P(PSTR("Unknown device")); return; }
|
||||
|
||||
|
||||
int8_t occupancy_time = -1;
|
||||
if (p) {
|
||||
Z_Data_PIR & pir = (Z_Data_PIR&) device.data.getByType(Z_Data_Type::Z_PIR);
|
||||
|
@ -1291,7 +1291,7 @@ void CmndZbPermitJoin(void) {
|
|||
Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":21,\"Message\":\"Pairing mode enabled\"}}"));
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE));
|
||||
zigbee.permit_end_time = millis() + duration * 1000;
|
||||
AddLog_P2(LOG_LEVEL_INFO, "zigbee.permit_end_time = %d", zigbee.permit_end_time);
|
||||
AddLog_P(LOG_LEVEL_INFO, "zigbee.permit_end_time = %d", zigbee.permit_end_time);
|
||||
} else {
|
||||
zigbee.permit_end_time = millis();
|
||||
}
|
||||
|
@ -1442,7 +1442,7 @@ bool parseDeviceInnerData(class Z_Device & device, JsonParserObject root) {
|
|||
case Zint32: *(int32_t*)attr_address = ival32; break;
|
||||
}
|
||||
} else if (conv_data_type != Z_Data_Type::Z_Unknown) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "attribute %s is wrong type %d (expected %d)"), attr.getStr(), (uint8_t)data_type, (uint8_t)conv_data_type);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "attribute %s is wrong type %d (expected %d)"), attr.getStr(), (uint8_t)data_type, (uint8_t)conv_data_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1603,7 +1603,7 @@ void CmndZbConfig(void) {
|
|||
if (zb_channel > 26) { zb_channel = 26; }
|
||||
// if network key is zero, we generate a truly random key with a hardware generator from ESP
|
||||
if ((0 == zb_precfgkey_l) && (0 == zb_precfgkey_h)) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "generating random Zigbee network key"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "generating random Zigbee network key"));
|
||||
zb_precfgkey_l = (uint64_t)HwRandom() << 32 | HwRandom();
|
||||
zb_precfgkey_h = (uint64_t)HwRandom() << 32 | HwRandom();
|
||||
}
|
||||
|
@ -1770,9 +1770,9 @@ void ZigbeeShow(bool json)
|
|||
"<td><b title='0x%04X %s - %s'>%s</b></td>" // name
|
||||
"<td>%s</td>" // sbatt (Battery Indicator)
|
||||
"<td><div title='" D_LQI " %s' class='ssi'>" // slqi
|
||||
), shortaddr,
|
||||
device.modelId ? device.modelId : "",
|
||||
device.manufacturerId ? device.manufacturerId : "",
|
||||
), shortaddr,
|
||||
device.modelId ? device.modelId : "",
|
||||
device.manufacturerId ? device.manufacturerId : "",
|
||||
name, sbatt, slqi);
|
||||
|
||||
if(device.validLqi()) {
|
||||
|
|
|
@ -97,7 +97,7 @@ void BuzzerBeep(uint32_t count, uint32_t on, uint32_t off, uint32_t tune, uint32
|
|||
Buzzer.freq_mode = 0;
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("BUZ: %d(%d),%d,%d,0x%08X(0x%08X),%d"), count, Buzzer.count, on, off, tune, Buzzer.tune, Buzzer.freq_mode);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("BUZ: %d(%d),%d,%d,0x%08X(0x%08X),%d"), count, Buzzer.count, on, off, tune, Buzzer.tune, Buzzer.freq_mode);
|
||||
|
||||
Buzzer.enable = (Buzzer.count > 0);
|
||||
if (Buzzer.enable) {
|
||||
|
|
|
@ -97,7 +97,8 @@ void AriluxRfHandler(void)
|
|||
}
|
||||
uint16_t stored_hostcode = Settings.rf_code[1][6] << 8 | Settings.rf_code[1][7];
|
||||
|
||||
DEBUG_DRIVER_LOG(PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, Arilux.rf_received_value);
|
||||
// DEBUG_DRIVER_LOG(PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, Arilux.rf_received_value);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, Arilux.rf_received_value);
|
||||
|
||||
if (hostcode == stored_hostcode) {
|
||||
char command[33];
|
||||
|
|
|
@ -107,7 +107,7 @@ void ShutterLogPos(uint32_t i)
|
|||
{
|
||||
char stemp2[10];
|
||||
dtostrfd((float)Shutter[i].time / STEPS_PER_SECOND, 2, stemp2);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Shutter %d Real %d, Start %d, Stop %d, Dir %d, Delay %d, Rtc %s [s], Freq %d, PWM %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Shutter %d Real %d, Start %d, Stop %d, Dir %d, Delay %d, Rtc %s [s], Freq %d, PWM %d"),
|
||||
i+1, Shutter[i].real_position, Shutter[i].start_position, Shutter[i].target_position, Shutter[i].direction, Shutter[i].motordelay, stemp2, Shutter[i].pwm_velocity, Shutter[i].pwm_value);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ void ShutterRtc50mS(void)
|
|||
|
||||
case SHT_COUNTER:
|
||||
if (Shutter[i].accelerator) {
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: accelerator i=%d -> %d"),i, Shutter[i].accelerator);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: accelerator i=%d -> %d"),i, Shutter[i].accelerator);
|
||||
ShutterUpdateVelocity(i);
|
||||
analogWriteFreq(Shutter[i].pwm_velocity);
|
||||
analogWrite(Pin(GPIO_PWM1, i), 50);
|
||||
|
@ -164,7 +164,7 @@ int32_t ShutterPercentToRealPosition(uint32_t percent, uint32_t index)
|
|||
// check against DIV 0
|
||||
for (uint32_t j = 0; j < 5; j++) {
|
||||
if (0 == Settings.shuttercoeff[j][index]) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("SHT: RESET/INIT CALIBRATION MATRIX DIV 0"));
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("SHT: RESET/INIT CALIBRATION MATRIX DIV 0"));
|
||||
for (uint32_t k = 0; k < 5; k++) {
|
||||
Settings.shuttercoeff[k][index] = SHT_DIV_ROUND(calibrate_pos[k+1] * 1000, calibrate_pos[5]);
|
||||
}
|
||||
|
@ -173,13 +173,13 @@ int32_t ShutterPercentToRealPosition(uint32_t percent, uint32_t index)
|
|||
for (uint32_t k = 0; k < 5; k++) {
|
||||
if ((percent * 10) >= Settings.shuttercoeff[k][index]) {
|
||||
realpos = SHT_DIV_ROUND(Shutter[index].open_max * calibrate_pos[k+1], 100);
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Realposition TEMP1: %d, %% %d, coeff %d"), realpos, percent, Settings.shuttercoeff[i][index]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Realposition TEMP1: %d, %% %d, coeff %d"), realpos, percent, Settings.shuttercoeff[i][index]);
|
||||
} else {
|
||||
if (0 == k) {
|
||||
realpos = SHT_DIV_ROUND(SHT_DIV_ROUND(percent * Shutter[index].open_max * calibrate_pos[k+1], Settings.shuttercoeff[k][index]), 10);
|
||||
} else {
|
||||
//uint16_t addon = ( percent*10 - Settings.shuttercoeff[i-1][index] ) * Shutter_Open_Max[index] * (calibrate_pos[i+1] - calibrate_pos[i]) / (Settings.shuttercoeff[i][index] -Settings.shuttercoeff[i-1][index]) / 100;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Realposition TEMP2: %d, %% %d, coeff %d"), addon, (calibrate_pos[i+1] - calibrate_pos[i]), (Settings.shuttercoeff[i][index] -Settings.shuttercoeff[i-1][index]));
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Realposition TEMP2: %d, %% %d, coeff %d"), addon, (calibrate_pos[i+1] - calibrate_pos[i]), (Settings.shuttercoeff[i][index] -Settings.shuttercoeff[i-1][index]));
|
||||
realpos += SHT_DIV_ROUND(SHT_DIV_ROUND((percent*10 - Settings.shuttercoeff[k-1][index] ) * Shutter[index].open_max * (calibrate_pos[k+1] - calibrate_pos[k]), Settings.shuttercoeff[k][index] - Settings.shuttercoeff[k-1][index]), 100);
|
||||
}
|
||||
break;
|
||||
|
@ -199,14 +199,14 @@ uint8_t ShutterRealToPercentPosition(int32_t realpos, uint32_t index)
|
|||
for (uint32_t j = 0; j < 5; j++) {
|
||||
if (realpos >= Shutter[index].open_max * calibrate_pos[j+1] / 100) {
|
||||
realpercent = SHT_DIV_ROUND(Settings.shuttercoeff[j][index], 10);
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Realpercent TEMP1: %d, %% %d, coeff %d"), realpercent, realpos, Shutter_Open_Max[index] * calibrate_pos[i+1] / 100);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Realpercent TEMP1: %d, %% %d, coeff %d"), realpercent, realpos, Shutter_Open_Max[index] * calibrate_pos[i+1] / 100);
|
||||
} else {
|
||||
if (0 == j) {
|
||||
realpercent = SHT_DIV_ROUND(SHT_DIV_ROUND((realpos - SHT_DIV_ROUND(Shutter[index].open_max * calibrate_pos[j], 100)) * 10 * Settings.shuttercoeff[j][index], calibrate_pos[j+1]), Shutter[index].open_max);
|
||||
} else {
|
||||
//uint16_t addon = ( realpos - (Shutter_Open_Max[index] * calibrate_pos[i] / 100) ) * 10 * (Settings.shuttercoeff[i][index] - Settings.shuttercoeff[i-1][index]) / (calibrate_pos[i+1] - calibrate_pos[i])/ Shutter_Open_Max[index];
|
||||
//uint16_t addon = ( percent*10 - Settings.shuttercoeff[i-1][index] ) * Shutter_Open_Max[index] * (calibrate_pos[i+1] - calibrate_pos[i]) / (Settings.shuttercoeff[i][index] -Settings.shuttercoeff[i-1][index]) / 100;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Realpercent TEMP2: %d, delta %d, %% %d, coeff %d"), addon,( realpos - (Shutter_Open_Max[index] * calibrate_pos[i] / 100) ) , (calibrate_pos[i+1] - calibrate_pos[i])* Shutter_Open_Max[index]/100, (Settings.shuttercoeff[i][index] -Settings.shuttercoeff[i-1][index]));
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("Realpercent TEMP2: %d, delta %d, %% %d, coeff %d"), addon,( realpos - (Shutter_Open_Max[index] * calibrate_pos[i] / 100) ) , (calibrate_pos[i+1] - calibrate_pos[i])* Shutter_Open_Max[index]/100, (Settings.shuttercoeff[i][index] -Settings.shuttercoeff[i-1][index]));
|
||||
realpercent += SHT_DIV_ROUND(SHT_DIV_ROUND((realpos - SHT_DIV_ROUND(Shutter[index].open_max * calibrate_pos[j], 100)) * 10 * (Settings.shuttercoeff[j][index] - Settings.shuttercoeff[j-1][index]), (calibrate_pos[j+1] - calibrate_pos[j])), Shutter[index].open_max) ;
|
||||
}
|
||||
break;
|
||||
|
@ -249,12 +249,12 @@ void ShutterInit(void)
|
|||
|
||||
if (Settings.shutter_mode == SHT_UNDEF) {
|
||||
bool relay_in_interlock = false;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: mode undef.. calculate..."));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: mode undef.. calculate..."));
|
||||
|
||||
for (uint32_t j = 0; j < MAX_INTERLOCKS * Settings.flag.interlock; j++) { // CMND_INTERLOCK - Enable/disable interlock
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Interlock state i=%d %d, flag %d, , shuttermask %d, maskedIL %d"),i, Settings.interlock[i], Settings.flag.interlock,ShutterGlobal.RelayShutterMask, Settings.interlock[i]&ShutterGlobal.RelayShutterMask);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Interlock state i=%d %d, flag %d, , shuttermask %d, maskedIL %d"),i, Settings.interlock[i], Settings.flag.interlock,ShutterGlobal.RelayShutterMask, Settings.interlock[i]&ShutterGlobal.RelayShutterMask);
|
||||
if (Settings.interlock[j] && (Settings.interlock[j] & ShutterGlobal.RelayShutterMask)) {
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Relay in Interlock group"));
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Relay in Interlock group"));
|
||||
relay_in_interlock = true;
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ void ShutterInit(void)
|
|||
Settings.shuttercoeff[1][i] = Shutter[i].open_max/10 * (100 - Settings.shutter_set50percent[i] ) / 5000 ;
|
||||
Settings.shuttercoeff[0][i] = Shutter[i].open_max/100 - (Settings.shuttercoeff[1][i] * 10);
|
||||
Settings.shuttercoeff[2][i] = (int32_t)(Settings.shuttercoeff[0][i]*10 + 5 * Settings.shuttercoeff[1][i]) / 5;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT%d: Shutter[i].open_max %d, 50perc:%d, 0:%d, 1:%d 2:%d"), i, Shutter[i].open_max, Settings.shutter_set50percent[i], Settings.shuttercoeff[0][i],Settings.shuttercoeff[1][i],Settings.shuttercoeff[2][i]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT%d: Shutter[i].open_max %d, 50perc:%d, 0:%d, 1:%d 2:%d"), i, Shutter[i].open_max, Settings.shutter_set50percent[i], Settings.shuttercoeff[0][i],Settings.shuttercoeff[1][i],Settings.shuttercoeff[2][i]);
|
||||
}
|
||||
ShutterGlobal.RelayShutterMask |= 3 << (Settings.shutter_startrelay[i] -1);
|
||||
|
||||
|
@ -311,8 +311,8 @@ void ShutterInit(void)
|
|||
}
|
||||
Shutter[i].close_velocity_max = ShutterGlobal.open_velocity_max*Shutter[i].open_time / Shutter[i].close_time;
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d Openvel %d, Closevel: %d"),i, ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT%d: Init. Pos: %d,inverted %d, locked %d, end stop time enabled %d, webButtons inverted %d"),
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d Openvel %d, Closevel: %d"),i, ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT%d: Init. Pos: %d,inverted %d, locked %d, end stop time enabled %d, webButtons inverted %d"),
|
||||
i+1, Shutter[i].real_position,
|
||||
(Settings.shutter_options[i]&1) ? 1 : 0, (Settings.shutter_options[i]&2) ? 1 : 0, (Settings.shutter_options[i]&4) ? 1 : 0, (Settings.shutter_options[i]&8) ? 1 : 0);
|
||||
|
||||
|
@ -336,7 +336,7 @@ void ShutterReportPosition(bool always, uint32_t index)
|
|||
n = index+1;
|
||||
}
|
||||
for (i; i < n; i++) {
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Shutter %d: Real Pos: %d"), i+1,Shutter[i].real_position);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Shutter %d: Real Pos: %d"), i+1,Shutter[i].real_position);
|
||||
uint32_t position = ShutterRealToPercentPosition(Shutter[i].real_position, i);
|
||||
if (Shutter[i].direction != 0) {
|
||||
TasmotaGlobal.rules_flag.shutter_moving = 1;
|
||||
|
@ -350,7 +350,7 @@ void ShutterReportPosition(bool always, uint32_t index)
|
|||
if (always || (TasmotaGlobal.rules_flag.shutter_moving)) {
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_STAT, PSTR(D_PRFX_SHUTTER)); // RulesProcess() now re-entry protected
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: TasmotaGlobal.rules_flag.shutter_moving: %d, moved %d"), TasmotaGlobal.rules_flag.shutter_moving, TasmotaGlobal.rules_flag.shutter_moved);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: TasmotaGlobal.rules_flag.shutter_moving: %d, moved %d"), TasmotaGlobal.rules_flag.shutter_moving, TasmotaGlobal.rules_flag.shutter_moved);
|
||||
}
|
||||
|
||||
void ShutterLimitRealAndTargetPositions(uint32_t i) {
|
||||
|
@ -398,7 +398,7 @@ void ShutterDecellerateForStop(uint8_t i)
|
|||
int16_t missing_steps;
|
||||
Shutter[i].accelerator = -(ShutterGlobal.open_velocity_max / (Shutter[i].motordelay>4 ? (Shutter[i].motordelay*11)/10 : 4) );
|
||||
while (Shutter[i].pwm_velocity > -2*Shutter[i].accelerator ) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: velocity: %ld, delta: %d"), Shutter[i].pwm_velocity, Shutter[i].accelerator );
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: velocity: %ld, delta: %d"), Shutter[i].pwm_velocity, Shutter[i].accelerator );
|
||||
//Shutter[i].pwm_velocity = tmax(Shutter[i].pwm_velocity-Shutter[i].accelerator , 0);
|
||||
// Control will be done in RTC Ticker.
|
||||
delay(50);
|
||||
|
@ -406,7 +406,7 @@ void ShutterDecellerateForStop(uint8_t i)
|
|||
if (ShutterGlobal.position_mode == SHT_COUNTER){
|
||||
missing_steps = ((Shutter[i].target_position-Shutter[i].start_position)*Shutter[i].direction*ShutterGlobal.open_velocity_max/RESOLUTION/STEPS_PER_SECOND) - RtcSettings.pulse_counter[i];
|
||||
//prepare for stop PWM
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Remain steps %d, counter %d, freq %d"), missing_steps, RtcSettings.pulse_counter[i] ,Shutter[i].pwm_velocity);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Remain steps %d, counter %d, freq %d"), missing_steps, RtcSettings.pulse_counter[i] ,Shutter[i].pwm_velocity);
|
||||
Shutter[i].accelerator = 0;
|
||||
Shutter[i].pwm_velocity = Shutter[i].pwm_velocity > 250 ? 250 : Shutter[i].pwm_velocity;
|
||||
analogWriteFreq(Shutter[i].pwm_velocity);
|
||||
|
@ -418,7 +418,7 @@ void ShutterDecellerateForStop(uint8_t i)
|
|||
}
|
||||
analogWrite(Pin(GPIO_PWM1, i), 0); // removed with 8.3 because of reset caused by watchog
|
||||
Shutter[i].real_position = ShutterCalculatePosition(i);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Real %d, pulsecount %d, start %d"), Shutter[i].real_position,RtcSettings.pulse_counter[i], Shutter[i].start_position);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Real %d, pulsecount %d, start %d"), Shutter[i].real_position,RtcSettings.pulse_counter[i], Shutter[i].start_position);
|
||||
|
||||
}
|
||||
Shutter[i].direction = 0;
|
||||
|
@ -428,7 +428,7 @@ void ShutterDecellerateForStop(uint8_t i)
|
|||
}
|
||||
|
||||
void ShutterPowerOff(uint8_t i) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Stop Shutter %d. Switchmode %d"), i,Shutter[i].switch_mode);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Stop Shutter %d. Switchmode %d"), i,Shutter[i].switch_mode);
|
||||
ShutterDecellerateForStop(i);
|
||||
if (Shutter[i].direction !=0) {
|
||||
Shutter[i].direction = 0;
|
||||
|
@ -479,7 +479,7 @@ void ShutterUpdatePosition(void)
|
|||
XdrvRulesProcess();
|
||||
ShutterGlobal.start_reported = 1;
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: time: %d, toBeAcc %d, current_stop_way %d,vel_cur %d, vel_max %d, act_vel_change %d, min_runtime_ms %d, act.pos %d, next_stop %d, target: %d, max_vel_change %d, dir: %d"),Shutter[i].time,toBeAcc,current_stop_way,
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: time: %d, toBeAcc %d, current_stop_way %d,vel_cur %d, vel_max %d, act_vel_change %d, min_runtime_ms %d, act.pos %d, next_stop %d, target: %d, max_vel_change %d, dir: %d"),Shutter[i].time,toBeAcc,current_stop_way,
|
||||
Shutter[i].pwm_velocity,velocity_max, Shutter[i].accelerator,min_runtime_ms,Shutter[i].real_position, next_possible_stop_position,Shutter[i].target_position,velocity_change_per_step_max,Shutter[i].direction);
|
||||
|
||||
|
||||
|
@ -519,20 +519,20 @@ void ShutterAllowPreStartProcedure(uint8_t i)
|
|||
{
|
||||
#ifdef USE_RULES
|
||||
uint32_t uptime_Local=0;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. var%d <99>=<%s>, max10s?"),i+i, rules_vars[i]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. var%d <99>=<%s>, max10s?"),i+i, rules_vars[i]);
|
||||
TasmotaGlobal.rules_flag.shutter_moving = 1;
|
||||
XdrvRulesProcess();
|
||||
uptime_Local = TasmotaGlobal.uptime;
|
||||
while (uptime_Local+10 > TasmotaGlobal.uptime && (String)rules_vars[i] == "99") {
|
||||
loop();
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. Done"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. Done"));
|
||||
#endif // USE_RULES
|
||||
}
|
||||
|
||||
void ShutterStartInit(uint32_t i, int32_t direction, int32_t target_pos)
|
||||
{
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: dir %d, delta1 %d, delta2 %d, grant %d"),direction, (Shutter[i].open_max - Shutter[i].real_position) / Shutter[i].close_velocity, Shutter[i].real_position / Shutter[i].close_velocity, 2+Shutter[i].motordelay);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: dir %d, delta1 %d, delta2 %d, grant %d"),direction, (Shutter[i].open_max - Shutter[i].real_position) / Shutter[i].close_velocity, Shutter[i].real_position / Shutter[i].close_velocity, 2+Shutter[i].motordelay);
|
||||
if ( ( (1 == direction) && ((Shutter[i].open_max - Shutter[i].real_position) / 100 <= 2) )
|
||||
|| ( (-1 == direction) && (Shutter[i].real_position / Shutter[i].close_velocity <= 2)) ) {
|
||||
ShutterGlobal.skip_relay_change = 1;
|
||||
|
@ -557,9 +557,9 @@ void ShutterStartInit(uint32_t i, int32_t direction, int32_t target_pos)
|
|||
ShutterGlobal.skip_relay_change = 0;
|
||||
TasmotaGlobal.rules_flag.shutter_moved = 0;
|
||||
ShutterGlobal.start_reported = 0;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: real %d, start %d, counter %d,freq_max %d, dir %d, freq %d"),Shutter[i].real_position, Shutter[i].start_position ,RtcSettings.pulse_counter[i],ShutterGlobal.open_velocity_max , Shutter[i].direction ,ShutterGlobal.open_velocity_max );
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: real %d, start %d, counter %d,freq_max %d, dir %d, freq %d"),Shutter[i].real_position, Shutter[i].start_position ,RtcSettings.pulse_counter[i],ShutterGlobal.open_velocity_max , Shutter[i].direction ,ShutterGlobal.open_velocity_max );
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Start shutter: %d from %d to %d in direction %d"), i, Shutter[i].start_position, Shutter[i].target_position, Shutter[i].direction);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Start shutter: %d from %d to %d in direction %d"), i, Shutter[i].start_position, Shutter[i].target_position, Shutter[i].direction);
|
||||
}
|
||||
|
||||
int32_t ShutterCalculatePosition(uint32_t i)
|
||||
|
@ -601,7 +601,7 @@ void ShutterRelayChanged(void)
|
|||
// SRC_IGNORE added because INTERLOCK function bite causes this as last source for changing the relay.
|
||||
//uint8 manual_relays_changed = ((ShutterGlobal.RelayCurrentMask >> (Settings.shutter_startrelay[i] -1)) & 3) && SRC_IGNORE != TasmotaGlobal.last_source && SRC_SHUTTER != TasmotaGlobal.last_source && SRC_PULSETIMER != TasmotaGlobal.last_source ;
|
||||
uint8 manual_relays_changed = ((ShutterGlobal.RelayCurrentMask >> (Settings.shutter_startrelay[i] -1)) & 3) && SRC_SHUTTER != TasmotaGlobal.last_source && SRC_PULSETIMER != TasmotaGlobal.last_source ;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: source: %s, powerstate_local %ld, ShutterGlobal.RelayCurrentMask %d, manual change %d"), i+1, GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource), powerstate_local,ShutterGlobal.RelayCurrentMask,manual_relays_changed);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: source: %s, powerstate_local %ld, ShutterGlobal.RelayCurrentMask %d, manual change %d"), i+1, GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource), powerstate_local,ShutterGlobal.RelayCurrentMask,manual_relays_changed);
|
||||
if (manual_relays_changed) {
|
||||
//ShutterGlobal.skip_relay_change = true;
|
||||
ShutterLimitRealAndTargetPositions(i);
|
||||
|
@ -610,7 +610,7 @@ void ShutterRelayChanged(void)
|
|||
if (Shutter[i].direction != 0 && powerstate_local) {
|
||||
Shutter[i].target_position = Shutter[i].real_position;
|
||||
powerstate_local = 0;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Switch OFF motor. Target: %ld, source: %s, powerstate_local %ld, ShutterGlobal.RelayCurrentMask %d, manual change %d"), i+1, Shutter[i].target_position, GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource), powerstate_local,ShutterGlobal.RelayCurrentMask,manual_relays_changed);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Switch OFF motor. Target: %ld, source: %s, powerstate_local %ld, ShutterGlobal.RelayCurrentMask %d, manual change %d"), i+1, Shutter[i].target_position, GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource), powerstate_local,ShutterGlobal.RelayCurrentMask,manual_relays_changed);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -632,7 +632,7 @@ void ShutterRelayChanged(void)
|
|||
ShutterStartInit(i, -1, 0);
|
||||
break;
|
||||
default:
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Switch OFF motor."),i);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Switch OFF motor."),i);
|
||||
Shutter[i].target_position = Shutter[i].real_position;
|
||||
}
|
||||
break;
|
||||
|
@ -645,7 +645,7 @@ void ShutterRelayChanged(void)
|
|||
ShutterStartInit(i, -1, 0);
|
||||
break;
|
||||
default:
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Switch OFF motor."),i);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Switch OFF motor."),i);
|
||||
Shutter[i].target_position = Shutter[i].real_position;
|
||||
}
|
||||
break;
|
||||
|
@ -653,7 +653,7 @@ void ShutterRelayChanged(void)
|
|||
switch (powerstate_local) {
|
||||
case 1:
|
||||
ShutterStartInit(i, Shutter[i].lastdirection*-1 , Shutter[i].lastdirection == 1 ? 0 : Shutter[i].open_max);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d Garage. NewTarget %d"), i, Shutter[i].target_position);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d Garage. NewTarget %d"), i, Shutter[i].target_position);
|
||||
break;
|
||||
default:
|
||||
Shutter[i].target_position = Shutter[i].real_position;
|
||||
|
@ -661,7 +661,7 @@ void ShutterRelayChanged(void)
|
|||
|
||||
|
||||
} // switch (ShutterGlobal.position_mode)
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Target: %ld, powerstatelocal %d"), i+1, Shutter[i].target_position, powerstate_local);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shutter %d: Target: %ld, powerstatelocal %d"), i+1, Shutter[i].target_position, powerstate_local);
|
||||
} // if (manual_relays_changed)
|
||||
} // for (uint32_t i = 0; i < TasmotaGlobal.shutters_present; i++)
|
||||
}
|
||||
|
@ -752,15 +752,15 @@ void ShutterButtonHandler(void)
|
|||
// check for simultaneous shutter button press
|
||||
uint32 min_shutterbutton_press_counter = -1; // -1 == max(uint32)
|
||||
for (uint32_t i = 0; i < MAX_KEYS; i++) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Settings.shutter_button[i] %ld, shutter_index %d, Button.press_counter[i] %d, min_shutterbutton_press_counter %d, i %d"), Settings.shutter_button[i], shutter_index, Button.press_counter[i] , min_shutterbutton_press_counter, i);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Settings.shutter_button[i] %ld, shutter_index %d, Button.press_counter[i] %d, min_shutterbutton_press_counter %d, i %d"), Settings.shutter_button[i], shutter_index, Button.press_counter[i] , min_shutterbutton_press_counter, i);
|
||||
if ((button_index != i) && (Settings.shutter_button[i] & (1<<31)) && ((Settings.shutter_button[i] & 0x03) == shutter_index) && (i != button_index) && (Button.press_counter[i] < min_shutterbutton_press_counter)) {
|
||||
min_shutterbutton_press_counter = Button.press_counter[i];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: min_shutterbutton_press_counter %d"), min_shutterbutton_press_counter);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: min_shutterbutton_press_counter %d"), min_shutterbutton_press_counter);
|
||||
}
|
||||
}
|
||||
if (min_shutterbutton_press_counter == Button.press_counter[button_index]) {
|
||||
// simultaneous shutter button press detected
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: simultanous presss deteced"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: simultanous presss deteced"));
|
||||
press_index = Button.press_counter[button_index];
|
||||
for (uint32_t i = 0; i < MAX_KEYS; i++)
|
||||
if ((Settings.shutter_button[i] & (1<<31)) && ((Settings.shutter_button[i] & 0x03) != shutter_index))
|
||||
|
@ -807,7 +807,7 @@ void ShutterButtonHandler(void)
|
|||
if (Settings.shutter_startrelay[shutter_index] && Settings.shutter_startrelay[shutter_index] <9) {
|
||||
uint8_t pos_press_index = (buttonState == SHT_PRESSED_HOLD) ? 3 : (press_index-1);
|
||||
if (pos_press_index>3) pos_press_index=3;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: shutter %d, button %d = %d (single=1, double=2, tripple=3, hold=4)"), shutter_index+1, button_index+1, pos_press_index+1);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: shutter %d, button %d = %d (single=1, double=2, tripple=3, hold=4)"), shutter_index+1, button_index+1, pos_press_index+1);
|
||||
XdrvMailbox.index = shutter_index +1;
|
||||
TasmotaGlobal.last_source = SRC_BUTTON;
|
||||
XdrvMailbox.data_len = 0;
|
||||
|
@ -825,7 +825,7 @@ void ShutterButtonHandler(void)
|
|||
CmndShutterStop();
|
||||
} else {
|
||||
XdrvMailbox.payload = position = (position-1)<<1;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: shutter %d -> %d"), shutter_index+1, position);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: shutter %d -> %d"), shutter_index+1, position);
|
||||
if (102 == position) {
|
||||
XdrvMailbox.payload = XdrvMailbox.index;
|
||||
CmndShutterToggle();
|
||||
|
@ -866,7 +866,7 @@ void ShutterSetPosition(uint32_t device, uint32_t position)
|
|||
|
||||
void ShutterToggle(bool dir)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Payload toggle: %d, i %d, dir %d"), XdrvMailbox.payload, XdrvMailbox.index, dir);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Payload toggle: %d, i %d, dir %d"), XdrvMailbox.payload, XdrvMailbox.index, dir);
|
||||
if ((1 == XdrvMailbox.index) && (XdrvMailbox.payload != -99)) {
|
||||
XdrvMailbox.index = XdrvMailbox.payload;
|
||||
}
|
||||
|
@ -890,7 +890,7 @@ void ShutterToggle(bool dir)
|
|||
|
||||
void CmndShutterOpen(void)
|
||||
{
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Payload open: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Payload open: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index);
|
||||
if ((1 == XdrvMailbox.index) && (XdrvMailbox.payload != -99)) {
|
||||
XdrvMailbox.index = XdrvMailbox.payload;
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ void CmndShutterStopOpen(void)
|
|||
|
||||
void CmndShutterClose(void)
|
||||
{
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Payload close: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Payload close: %d, i %d"), XdrvMailbox.payload, XdrvMailbox.index);
|
||||
if ((1 == XdrvMailbox.index) && (XdrvMailbox.payload != -99)) {
|
||||
XdrvMailbox.index = XdrvMailbox.payload;
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ void CmndShutterStop(void)
|
|||
uint32_t i = XdrvMailbox.index -1;
|
||||
if (Shutter[i].direction != 0) {
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Stop moving %d: dir: %d"), XdrvMailbox.index, Shutter[i].direction);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Stop moving %d: dir: %d"), XdrvMailbox.index, Shutter[i].direction);
|
||||
|
||||
int32_t temp_realpos = ShutterCalculatePosition(i);
|
||||
XdrvMailbox.payload = ShutterRealToPercentPosition(temp_realpos, i);
|
||||
|
@ -998,7 +998,7 @@ void CmndShutterStop(void)
|
|||
|
||||
void CmndShutterIncDec(void)
|
||||
{
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Change in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source );
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Change in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source );
|
||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= TasmotaGlobal.shutters_present)) {
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
XdrvMailbox.payload = ShutterRealToPercentPosition(Shutter[XdrvMailbox.index-1].target_position, XdrvMailbox.index-1)+XdrvMailbox.payload;
|
||||
|
@ -1016,7 +1016,7 @@ void CmndShutterPosition(void)
|
|||
if (!(Settings.shutter_options[XdrvMailbox.index-1] & 2)) {
|
||||
uint32_t index = XdrvMailbox.index-1;
|
||||
//limit the payload
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Pos. in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source );
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Pos. in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source );
|
||||
|
||||
// value 0 with data_len > 0 can mean Open
|
||||
// special handling fo UP,DOWN,TOGGLE,STOP command comming with payload -99
|
||||
|
@ -1053,7 +1053,7 @@ void CmndShutterPosition(void)
|
|||
Shutter[index].target_position = ShutterPercentToRealPosition(target_pos_percent, index);
|
||||
//Shutter[i].accelerator[index] = ShutterGlobal.open_velocity_max / ((Shutter[i].motordelay[index] > 0) ? Shutter[i].motordelay[index] : 1);
|
||||
//Shutter[i].target_position[index] = XdrvMailbox.payload < 5 ? Settings.shuttercoeff[2][index] * XdrvMailbox.payload : Settings.shuttercoeff[1][index] * XdrvMailbox.payload + Settings.shuttercoeff[0,index];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: lastsource %d:, real %d, target %d, payload %d"), TasmotaGlobal.last_source, Shutter[index].real_position ,Shutter[index].target_position,target_pos_percent);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: lastsource %d:, real %d, target %d, payload %d"), TasmotaGlobal.last_source, Shutter[index].real_position ,Shutter[index].target_position,target_pos_percent);
|
||||
}
|
||||
if ( (target_pos_percent >= 0) && (target_pos_percent <= 100) && abs(Shutter[index].target_position - Shutter[index].real_position ) / Shutter[index].close_velocity > 2) {
|
||||
if (Settings.shutter_options[index] & 4) {
|
||||
|
@ -1090,7 +1090,7 @@ void CmndShutterPosition(void)
|
|||
case SHT_TIME_GARAGE:
|
||||
if (!ShutterGlobal.skip_relay_change) {
|
||||
if (new_shutterdirection == Shutter[index].lastdirection) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("SHT: Garage not move in this direction: %d"), Shutter[index].switch_mode == SHT_PULSE);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("SHT: Garage not move in this direction: %d"), Shutter[index].switch_mode == SHT_PULSE);
|
||||
for (uint8_t k=0 ; k <= (uint8_t)(Shutter[index].switch_mode == SHT_PULSE) ; k++) {
|
||||
ExecuteCommandPowerShutter(Settings.shutter_startrelay[index], 1, SRC_SHUTTER);
|
||||
delay(500);
|
||||
|
@ -1400,7 +1400,7 @@ void CmndShutterPwmRange(void)
|
|||
}
|
||||
Settings.shutter_pwmrange[i][XdrvMailbox.index -1] = field;
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT%d: Init1. pwmmin %d, pwmmax %d"), XdrvMailbox.index , Settings.shutter_pwmrange[0][XdrvMailbox.index -1], Settings.shutter_pwmrange[1][XdrvMailbox.index -1]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT%d: Init1. pwmmin %d, pwmmax %d"), XdrvMailbox.index , Settings.shutter_pwmrange[0][XdrvMailbox.index -1], Settings.shutter_pwmrange[1][XdrvMailbox.index -1]);
|
||||
ShutterInit();
|
||||
ResponseCmndIdxChar(XdrvMailbox.data);
|
||||
} else {
|
||||
|
@ -1433,7 +1433,7 @@ void CmndShutterCalibration(void)
|
|||
Settings.shutter_set50percent[XdrvMailbox.index -1] = 50;
|
||||
for (i = 0; i < 5; i++) {
|
||||
Settings.shuttercoeff[i][XdrvMailbox.index -1] = SHT_DIV_ROUND((uint32_t)messwerte[i] * 1000, messwerte[4]);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Settings.shuttercoeff: %d, i: %d, value: %d, messwert %d"), i,XdrvMailbox.index -1,Settings.shuttercoeff[i][XdrvMailbox.index -1], messwerte[i]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Settings.shuttercoeff: %d, i: %d, value: %d, messwert %d"), i,XdrvMailbox.index -1,Settings.shuttercoeff[i][XdrvMailbox.index -1], messwerte[i]);
|
||||
}
|
||||
ShutterInit();
|
||||
ResponseCmndIdxChar(XdrvMailbox.data);
|
||||
|
@ -1514,7 +1514,7 @@ bool Xdrv27(uint8_t function)
|
|||
char stemp1[10];
|
||||
// extract the number of the relay that was switched and save for later in Update Position.
|
||||
ShutterGlobal.RelayCurrentMask = XdrvMailbox.index ^ ShutterGlobal.RelayOldMask;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Switched relay: %d by %s"), ShutterGlobal.RelayCurrentMask,GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Switched relay: %d by %s"), ShutterGlobal.RelayCurrentMask,GetTextIndexed(stemp1, sizeof(stemp1), TasmotaGlobal.last_source, kCommandSource));
|
||||
ShutterRelayChanged();
|
||||
ShutterGlobal.RelayOldMask = XdrvMailbox.index;
|
||||
break;
|
||||
|
@ -1527,10 +1527,10 @@ bool Xdrv27(uint8_t function)
|
|||
}
|
||||
ShutterGlobal.RelayCurrentMask >>= 1;
|
||||
}
|
||||
//AddLog_P2(LOG_LEVEL_ERROR, PSTR("SHT: skip relay change: %d"),i+1);
|
||||
//AddLog_P(LOG_LEVEL_ERROR, PSTR("SHT: skip relay change: %d"),i+1);
|
||||
result = true;
|
||||
ShutterGlobal.skip_relay_change = 0;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Skipping switch off relay %d"),i);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Skipping switch off relay %d"),i);
|
||||
ExecuteCommandPowerShutter(i+1, 0, SRC_SHUTTER);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -48,14 +48,14 @@ void Pcf8574SwitchRelay(void)
|
|||
for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) {
|
||||
uint8_t relay_state = bitRead(XdrvMailbox.index, i);
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574.max_devices %d requested pin %d"), Pcf8574.max_devices,Pcf8574.pin[i]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574.max_devices %d requested pin %d"), Pcf8574.max_devices,Pcf8574.pin[i]);
|
||||
|
||||
if (Pcf8574.max_devices > 0 && Pcf8574.pin[i] < 99) {
|
||||
uint8_t board = Pcf8574.pin[i]>>3;
|
||||
uint8_t oldpinmask = Pcf8574.pin_mask[board];
|
||||
uint8_t _val = bitRead(TasmotaGlobal.rel_inverted, i) ? !relay_state : relay_state;
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574SwitchRelay %d on pin %d"), i,state);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Pcf8574SwitchRelay %d on pin %d"), i,state);
|
||||
|
||||
if (_val) {
|
||||
Pcf8574.pin_mask[board] |= _val << (Pcf8574.pin[i]&0x7);
|
||||
|
@ -79,7 +79,7 @@ void Pcf8574Init(void)
|
|||
|
||||
#ifdef USE_MCP230xx_ADDR
|
||||
if (USE_MCP230xx_ADDR == pcf8574_address) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("PCF: Address 0x%02x reserved for MCP320xx skipped"), pcf8574_address);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("PCF: Address 0x%02x reserved for MCP320xx skipped"), pcf8574_address);
|
||||
pcf8574_address++;
|
||||
if ((PCF8574_ADDR1 +7) == pcf8574_address) { // Support I2C addresses 0x20 to 0x26 and 0x39 to 0x3F
|
||||
pcf8574_address = PCF8574_ADDR2 +1;
|
||||
|
@ -87,7 +87,7 @@ void Pcf8574Init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PCF: Probing addr: 0x%x for PCF8574"), pcf8574_address);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Probing addr: 0x%x for PCF8574"), pcf8574_address);
|
||||
|
||||
if (I2cSetDevice(pcf8574_address)) {
|
||||
Pcf8574.type = true;
|
||||
|
@ -115,11 +115,11 @@ void Pcf8574Init(void)
|
|||
Pcf8574.max_connected_ports = 0; // reset no of devices to avoid duplicate ports on duplicate init.
|
||||
for (uint32_t idx = 0; idx < Pcf8574.max_devices; idx++) { // suport up to 8 boards PCF8574
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PCF: Device %d config 0x%02x"), idx +1, Settings.pcf8574_config[idx]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: Device %d config 0x%02x"), idx +1, Settings.pcf8574_config[idx]);
|
||||
|
||||
for (uint32_t i = 0; i < 8; i++) {
|
||||
uint8_t _result = Settings.pcf8574_config[idx] >> i &1;
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PCF: I2C shift i %d: %d. Powerstate: %d, TasmotaGlobal.devices_present: %d"), i,_result, Settings.power>>i&1, TasmotaGlobal.devices_present);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("PCF: I2C shift i %d: %d. Powerstate: %d, TasmotaGlobal.devices_present: %d"), i,_result, Settings.power>>i&1, TasmotaGlobal.devices_present);
|
||||
if (_result > 0) {
|
||||
Pcf8574.pin[TasmotaGlobal.devices_present] = i + 8 * idx;
|
||||
bitWrite(TasmotaGlobal.rel_inverted, TasmotaGlobal.devices_present, Settings.flag3.pcf8574_ports_inverted); // SetOption81 - Invert all ports on PCF8574 devices
|
||||
|
@ -128,7 +128,7 @@ void Pcf8574Init(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("PCF: Total devices %d, PCF8574 output ports %d"), Pcf8574.max_devices, Pcf8574.max_connected_ports);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("PCF: Total devices %d, PCF8574 output ports %d"), Pcf8574.max_devices, Pcf8574.max_connected_ports);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ void Pcf8574SaveSettings(void)
|
|||
}
|
||||
}
|
||||
//Settings.pcf8574_config[0] = (!strlen(webServer->arg("i2cs0").c_str())) ? 0 : atoi(webServer->arg("i2cs0").c_str());
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("PCF: I2C Board: %d, Config: %2x")), idx, Settings.pcf8574_config[idx];
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("PCF: I2C Board: %d, Config: %2x")), idx, Settings.pcf8574_config[idx];
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ void DeepSleepReInit(void)
|
|||
if ((RtcSettings.ultradeepsleep > DEEPSLEEP_MAX_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) {
|
||||
// Go back to sleep after 60 minutes if requested deepsleep has not been reached
|
||||
RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - DEEPSLEEP_MAX_CYCLE;
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("DSL: Remain DeepSleep %d"), RtcSettings.ultradeepsleep);
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("DSL: Remain DeepSleep %d"), RtcSettings.ultradeepsleep);
|
||||
RtcSettingsSave();
|
||||
RtcRebootReset();
|
||||
#ifdef ESP8266
|
||||
|
@ -95,7 +95,7 @@ void DeepSleepPrepare(void)
|
|||
(RtcSettings.deepsleep_slip < 9000) ||
|
||||
(RtcSettings.deepsleep_slip > 11000) ||
|
||||
(RtcSettings.nextwakeup > (UtcTime() + Settings.deepsleep))) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("DSL: Reset wrong settings wakeup: %ld, slip %ld"), RtcSettings.nextwakeup, RtcSettings.deepsleep_slip );
|
||||
AddLog_P(LOG_LEVEL_ERROR, PSTR("DSL: Reset wrong settings wakeup: %ld, slip %ld"), RtcSettings.nextwakeup, RtcSettings.deepsleep_slip );
|
||||
RtcSettings.nextwakeup = 0;
|
||||
RtcSettings.deepsleep_slip = 10000;
|
||||
}
|
||||
|
|
|
@ -220,9 +220,9 @@ void ExsSetBri(uint8_t device, uint8_t bri)
|
|||
void ExsSyncState(uint8_t device)
|
||||
{
|
||||
#ifdef EXS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EXS: Channel %d Power Want %d, Is %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Channel %d Power Want %d, Is %d"),
|
||||
device, bitRead(Exs.power, device), Exs.dimmer.channel[device].dimm);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EXS: Set Channel %d Brightness Want %d, Is %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Set Channel %d Brightness Want %d, Is %d"),
|
||||
device, Exs.dimm[device], Exs.dimmer.channel[device].bright_tbl);
|
||||
#endif
|
||||
|
||||
|
@ -241,7 +241,7 @@ void ExsSyncState(uint8_t device)
|
|||
bool ExsSyncState()
|
||||
{
|
||||
#ifdef EXS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EXS: Serial %p, Cmd %d"), ExsSerial, Exs.cmd_status);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Serial %p, Cmd %d"), ExsSerial, Exs.cmd_status);
|
||||
#endif
|
||||
|
||||
if (!ExsSerial || Exs.cmd_status != 0)
|
||||
|
@ -255,7 +255,7 @@ bool ExsSyncState()
|
|||
void ExsDebugState()
|
||||
{
|
||||
#ifdef EXS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EXS: MCU v%d.%d, c0: On:%d,Dim:%d,Tbl:%d(%d%%), c1: On:%d,Dim:%d,Tbl:%d(%d%%), ChLock: %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: MCU v%d.%d, c0: On:%d,Dim:%d,Tbl:%d(%d%%), c1: On:%d,Dim:%d,Tbl:%d(%d%%), ChLock: %d"),
|
||||
Exs.dimmer.version_major, Exs.dimmer.version_minor,
|
||||
Exs.dimmer.channel[0].on, Exs.dimmer.channel[0].dimm,
|
||||
Exs.dimmer.channel[0].bright_tbl,
|
||||
|
@ -384,7 +384,7 @@ bool ExsSetChannels(void)
|
|||
|
||||
bool ExsSetPower(void)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("EXS: Set Power, Device %d, Power 0x%02x"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("EXS: Set Power, Device %d, Power 0x%02x"),
|
||||
TasmotaGlobal.active_device, XdrvMailbox.index);
|
||||
|
||||
Exs.power = XdrvMailbox.index;
|
||||
|
@ -396,7 +396,7 @@ void EsxMcuStart(void)
|
|||
int retries = 3;
|
||||
|
||||
#ifdef EXS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EXS: Request MCU configuration, PIN %d to Low"), Pin(GPIO_EXS_ENABLE));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EXS: Request MCU configuration, PIN %d to Low"), Pin(GPIO_EXS_ENABLE));
|
||||
#endif
|
||||
|
||||
pinMode(Pin(GPIO_EXS_ENABLE), OUTPUT);
|
||||
|
@ -414,7 +414,7 @@ void EsxMcuStart(void)
|
|||
void ExsInit(void)
|
||||
{
|
||||
#ifdef EXS_DEBUG
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("EXS: Starting Tx %d Rx %d"), Pin(GPIO_TXD), Pin(GPIO_RXD));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("EXS: Starting Tx %d Rx %d"), Pin(GPIO_TXD), Pin(GPIO_RXD));
|
||||
#endif
|
||||
|
||||
Exs.buffer = (uint8_t *)malloc(EXS_BUFFER_SIZE);
|
||||
|
@ -442,7 +442,7 @@ void ExsSerialInput(void)
|
|||
yield();
|
||||
uint8_t serial_in_byte = ExsSerial->read();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("EXS: Serial In Byte 0x%02x"), serial_in_byte);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("EXS: Serial In Byte 0x%02x"), serial_in_byte);
|
||||
|
||||
if (Exs.cmd_status == 0 &&
|
||||
serial_in_byte == 0x7B)
|
||||
|
|
|
@ -287,30 +287,30 @@ uint8_t TasmotaClient_SetupFlash(void) {
|
|||
delay(1);
|
||||
}
|
||||
if (no_error) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Found bootloader"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Found bootloader"));
|
||||
} else {
|
||||
no_error = 0;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Bootloader could not be found"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Bootloader could not be found"));
|
||||
}
|
||||
if (no_error) {
|
||||
if (TasmotaClient_execParam(CMND_STK_SET_DEVICE, ProgParams, sizeof(ProgParams))) {
|
||||
} else {
|
||||
no_error = 0;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Could not configure device for programming (1)"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Could not configure device for programming (1)"));
|
||||
}
|
||||
}
|
||||
if (no_error) {
|
||||
if (TasmotaClient_execParam(CMND_STK_SET_DEVICE_EXT, ExtProgParams, sizeof(ExtProgParams))) {
|
||||
} else {
|
||||
no_error = 0;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Could not configure device for programming (2)"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Could not configure device for programming (2)"));
|
||||
}
|
||||
}
|
||||
if (no_error) {
|
||||
if (TasmotaClient_execCmd(CMND_STK_ENTER_PROGMODE)) {
|
||||
} else {
|
||||
no_error = 0;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Failed to put bootloader into programming mode"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Failed to put bootloader into programming mode"));
|
||||
}
|
||||
}
|
||||
return no_error;
|
||||
|
@ -345,7 +345,7 @@ void TasmotaClient_Flash(void) {
|
|||
SimpleHexParse hexParse = SimpleHexParse();
|
||||
|
||||
if (!TasmotaClient_SetupFlash()) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Flashing aborted!"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Flashing aborted!"));
|
||||
TClient.flashing = false;
|
||||
TasmotaGlobal.restart_flag = 2;
|
||||
return;
|
||||
|
@ -383,7 +383,7 @@ void TasmotaClient_Flash(void) {
|
|||
}
|
||||
}
|
||||
TasmotaClient_exitProgMode();
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Flash done!"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Flash done!"));
|
||||
TClient.flashing = false;
|
||||
TasmotaGlobal.restart_flag = 2;
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ void TasmotaClient_Init(void) {
|
|||
pinMode(Pin(GPIO_TASMOTACLIENT_RST), OUTPUT);
|
||||
TClient.SerialEnabled = true;
|
||||
TasmotaClient_Reset();
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Enabled"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Enabled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -448,10 +448,10 @@ void TasmotaClient_Init(void) {
|
|||
memcpy(&TClientSettings, &buffer, sizeof(TClientSettings));
|
||||
if (20191129 == TClientSettings.features_version) {
|
||||
TClient.type = true;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Version %u"), TClientSettings.features_version);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Version %u"), TClientSettings.features_version);
|
||||
} else {
|
||||
if ((!TClient.unsupported) && (TClientSettings.features_version > 0)) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TCL: Version %u not supported!"), TClientSettings.features_version);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TCL: Version %u not supported!"), TClientSettings.features_version);
|
||||
TClient.unsupported = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,10 +69,10 @@ bool NRF24Detect(void)
|
|||
if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_DC)) {
|
||||
if(NRF24initRadio()){
|
||||
NRF24.chipType = 32; // SPACE
|
||||
AddLog_P2(LOG_LEVEL_INFO,PSTR("NRF24L01 initialized"));
|
||||
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF24L01 initialized"));
|
||||
if(NRF24radio.isPVariant()){
|
||||
NRF24.chipType = 43; // +
|
||||
AddLog_P2(LOG_LEVEL_INFO,PSTR("NRF24L01+ detected"));
|
||||
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF24L01+ detected"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ void GenerateDeviceCryptKey()
|
|||
jaroliftDevice.device_key_msb = k.decrypt(jaroliftDevice.serial | 0x60000000L);
|
||||
jaroliftDevice.device_key_lsb = k.decrypt(jaroliftDevice.serial | 0x20000000L);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("generated device keys: %08x %08x"), jaroliftDevice.device_key_msb, jaroliftDevice.device_key_lsb);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("generated device keys: %08x %08x"), jaroliftDevice.device_key_msb, jaroliftDevice.device_key_lsb);
|
||||
}
|
||||
|
||||
void CmdSendButton(void)
|
||||
|
@ -114,7 +114,7 @@ void CmdSendButton(void)
|
|||
DEBUG_DRIVER_LOG(LOG_LEVEL_DEBUG_MORE, PSTR("lsb: %08x"), jaroliftDevice.device_key_lsb);
|
||||
DEBUG_DRIVER_LOG(LOG_LEVEL_DEBUG_MORE, PSTR("serial: %08x"), jaroliftDevice.serial);
|
||||
DEBUG_DRIVER_LOG(LOG_LEVEL_DEBUG_MORE, PSTR("disc: %08x"), jaroliftDevice.disc);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("KLQ: count: %08x"), jaroliftDevice.count);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("KLQ: count: %08x"), jaroliftDevice.count);
|
||||
|
||||
CreateKeeloqPacket();
|
||||
jaroliftDevice.count++;
|
||||
|
@ -236,8 +236,8 @@ void CreateKeeloqPacket()
|
|||
jaroliftDevice.enc = k.encrypt(result);
|
||||
jaroliftDevice.pack |= jaroliftDevice.enc;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("pack high: %08x"), jaroliftDevice.pack>>32);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("pack low: %08x"), jaroliftDevice.pack);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("pack high: %08x"), jaroliftDevice.pack>>32);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("pack low: %08x"), jaroliftDevice.pack);
|
||||
}
|
||||
|
||||
void KeeloqInit()
|
||||
|
|
|
@ -50,7 +50,7 @@ void SonoffD1Received(void)
|
|||
if (action != SnfD1.power) {
|
||||
SnfD1.power = action;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SD1: Remote power (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Remote power (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
|
||||
ExecuteCommandPower(1, action, SRC_SWITCH);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void SonoffD1Received(void)
|
|||
if (dimmer != SnfD1.dimmer) {
|
||||
SnfD1.dimmer = dimmer;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SD1: Remote dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Remote dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
|
||||
char scmnd[20];
|
||||
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), SnfD1.dimmer);
|
||||
|
@ -137,7 +137,7 @@ bool SonoffD1SendPower(void)
|
|||
if (action != SnfD1.power) {
|
||||
SnfD1.power = action;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota power (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota power (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
|
||||
SonoffD1Send();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ bool SonoffD1SendDimmer(void)
|
|||
if (dimmer != SnfD1.dimmer) {
|
||||
SnfD1.dimmer = dimmer;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SD1: Tasmota dimmer (%d, %d)"), SnfD1.power, SnfD1.dimmer);
|
||||
|
||||
SonoffD1Send();
|
||||
}
|
||||
|
|
|
@ -1272,58 +1272,58 @@ void ThermostatVirtualSwitchCtrState(uint8_t ctr_output)
|
|||
void ThermostatDebug(uint8_t ctr_output)
|
||||
{
|
||||
char result_chr[FLOATSZ];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(""));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("------ Thermostat Start ------"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(""));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("------ Thermostat Start ------"));
|
||||
dtostrfd(Thermostat[ctr_output].status.counter_seconds, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.counter_seconds: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.counter_seconds: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.thermostat_mode, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.thermostat_mode: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.thermostat_mode: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].diag.state_emergency, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.state_emergency: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.state_emergency: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].diag.output_inconsist_ctr, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.output_inconsist_ctr: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].diag.output_inconsist_ctr: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.controller_mode, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.controller_mode: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.controller_mode: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.command_output, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.command_output: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.command_output: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.status_output, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_output: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_output: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.status_input, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_input: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_input: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.phase_hybrid_ctr, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.phase_hybrid_ctr: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.phase_hybrid_ctr: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.sensor_alive, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.sensor_alive: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.sensor_alive: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].status.status_cycle_active, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_cycle_active: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].status.status_cycle_active: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].temp_pi_error, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_error: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_error: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].temp_pi_accum_error, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_accum_error: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_pi_accum_error: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].time_proportional_pi, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_proportional_pi: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_proportional_pi: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].time_integral_pi, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_integral_pi: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_integral_pi: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].time_total_pi, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_total_pi: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_total_pi: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].temp_measured_gradient, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_measured_gradient: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_measured_gradient: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].time_rampup_deadtime, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_rampup_deadtime: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_rampup_deadtime: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].temp_rampup_meas_gradient, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_meas_gradient: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_meas_gradient: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].time_ctr_changepoint, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_changepoint: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_changepoint: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].temp_rampup_output_off, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_output_off: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].temp_rampup_output_off: %s"), result_chr);
|
||||
dtostrfd(Thermostat[ctr_output].time_ctr_checkpoint, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_checkpoint: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("Thermostat[ctr_output].time_ctr_checkpoint: %s"), result_chr);
|
||||
dtostrfd(TasmotaGlobal.uptime, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("uptime: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("uptime: %s"), result_chr);
|
||||
dtostrfd(TasmotaGlobal.power, 0, result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("power: %s"), result_chr);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("------ Thermostat End ------"));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(""));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("power: %s"), result_chr);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("------ Thermostat End ------"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(""));
|
||||
}
|
||||
#endif // DEBUG_THERMOSTAT
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ bool TelegramInit(void) {
|
|||
Telegram.next_update_id = 0; // Code of last read Message
|
||||
Telegram.message[0].text = "";
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TGM: Started"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TGM: Started"));
|
||||
}
|
||||
init_done = true;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ bool TelegramInit(void) {
|
|||
}
|
||||
|
||||
String TelegramConnectToTelegram(String command) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TGM: Cmnd %s"), command.c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Cmnd %s"), command.c_str());
|
||||
|
||||
if (!TelegramInit()) { return ""; }
|
||||
|
||||
|
@ -115,7 +115,7 @@ String TelegramConnectToTelegram(String command) {
|
|||
uint32_t tls_connect_time = millis();
|
||||
if (telegramClient->connect("api.telegram.org", 443)) {
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TGM: Connected in %d ms, max ThunkStack used %d"), millis() - tls_connect_time, telegramClient->getMaxThunkStackUse());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Connected in %d ms, max ThunkStack used %d"), millis() - tls_connect_time, telegramClient->getMaxThunkStackUse());
|
||||
|
||||
telegramClient->println("GET /"+command);
|
||||
|
||||
|
@ -144,7 +144,7 @@ String TelegramConnectToTelegram(String command) {
|
|||
}
|
||||
|
||||
void TelegramGetUpdates(uint32_t offset) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getUpdates"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getUpdates"));
|
||||
|
||||
if (!TelegramInit()) { return; }
|
||||
|
||||
|
@ -204,13 +204,13 @@ void TelegramGetUpdates(uint32_t offset) {
|
|||
// }
|
||||
// ]}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
||||
|
||||
JsonParser parser((char*)response.c_str());
|
||||
JsonParserObject root = parser.getRootObject();
|
||||
if (root) {
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TGM: Sent Update request messages up to %s"), offset.c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Sent Update request messages up to %s"), offset.c_str());
|
||||
|
||||
JsonParserArray arr = root[PSTR("result")];
|
||||
uint32_t max_updates = arr.size();
|
||||
|
@ -238,18 +238,18 @@ void TelegramGetUpdates(uint32_t offset) {
|
|||
}
|
||||
Telegram.next_update_id = Telegram.message[i].update_id +1; // Write id of last read message
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Parsed update_id %d, chat_id %d, text \"%s\""), Telegram.message[i].update_id, Telegram.message[i].chat_id, Telegram.message[i].text.c_str());
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Parsed update_id %d, chat_id %d, text \"%s\""), Telegram.message[i].update_id, Telegram.message[i].chat_id, Telegram.message[i].text.c_str());
|
||||
}
|
||||
} else {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TGM: No new messages"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: No new messages"));
|
||||
}
|
||||
} else {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TGM: Failed to update"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Failed to update"));
|
||||
}
|
||||
}
|
||||
|
||||
bool TelegramSendMessage(uint32_t chat_id, String text) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: sendMessage"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: sendMessage"));
|
||||
|
||||
if (!TelegramInit()) { return false; }
|
||||
|
||||
|
@ -259,10 +259,10 @@ bool TelegramSendMessage(uint32_t chat_id, String text) {
|
|||
String command = "bot" + _token + "/sendMessage?chat_id=" + String(chat_id) + "&text=" + text;
|
||||
String response = TelegramConnectToTelegram(command);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
||||
|
||||
if (response.startsWith("{\"ok\":true")) {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TGM: Message sent"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("TGM: Message sent"));
|
||||
sent = true;
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ bool TelegramSendMessage(uint32_t chat_id, String text) {
|
|||
|
||||
/*
|
||||
void TelegramSendGetMe(void) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getMe"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: getMe"));
|
||||
|
||||
if (!TelegramInit()) { return; }
|
||||
|
||||
|
@ -282,7 +282,7 @@ void TelegramSendGetMe(void) {
|
|||
|
||||
// {"ok":true,"result":{"id":1179906608,"is_bot":true,"first_name":"Tasmota","username":"tasmota_bot","can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false}}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
||||
// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("TGM: Response %s"), response.c_str());
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void TCPLoop(void)
|
|||
if (buf_len > 0) {
|
||||
char hex_char[TCP_BRIDGE_BUF_SIZE+1];
|
||||
ToHex_P(tcp_buf, buf_len, hex_char, 256);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_TCP "from MCU: %s"), hex_char);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_TCP "from MCU: %s"), hex_char);
|
||||
|
||||
for (uint32_t i=0; i<ARRAY_SIZE(client_tcp); i++) {
|
||||
WiFiClient &client = client_tcp[i];
|
||||
|
@ -114,7 +114,7 @@ void TCPLoop(void)
|
|||
if (buf_len > 0) {
|
||||
char hex_char[TCP_BRIDGE_BUF_SIZE+1];
|
||||
ToHex_P(tcp_buf, buf_len, hex_char, 256);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_TCP "to MCU/%d: %s"), i+1, hex_char);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_TCP "to MCU/%d: %s"), i+1, hex_char);
|
||||
TCPSerial->write(tcp_buf, buf_len);
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void TCPLoop(void)
|
|||
void TCPInit(void) {
|
||||
if (PinUsed(GPIO_TCP_RX) && PinUsed(GPIO_TCP_TX)) {
|
||||
tcp_buf = (uint8_t*) malloc(TCP_BRIDGE_BUF_SIZE);
|
||||
if (!tcp_buf) { AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_TCP "could not allocate buffer")); return; }
|
||||
if (!tcp_buf) { AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_TCP "could not allocate buffer")); return; }
|
||||
|
||||
if (!Settings.tcp_baudrate) { Settings.tcp_baudrate = 115200 / 1200; }
|
||||
TCPSerial = new TasmotaSerial(Pin(GPIO_TCP_RX), Pin(GPIO_TCP_TX), TasmotaGlobal.seriallog_level ? 1 : 2, 0, TCP_BRIDGE_BUF_SIZE); // set a receive buffer of 256 bytes
|
||||
|
@ -151,7 +151,7 @@ void CmndTCPStart(void) {
|
|||
int32_t tcp_port = XdrvMailbox.payload;
|
||||
|
||||
if (server_tcp) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Stopping TCP server"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Stopping TCP server"));
|
||||
server_tcp->stop();
|
||||
delete server_tcp;
|
||||
server_tcp = nullptr;
|
||||
|
@ -162,7 +162,7 @@ void CmndTCPStart(void) {
|
|||
}
|
||||
}
|
||||
if (tcp_port > 0) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Starting TCP server on port %d"), tcp_port);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_TCP "Starting TCP server on port %d"), tcp_port);
|
||||
server_tcp = new WiFiServer(tcp_port);
|
||||
server_tcp->begin(); // start TCP server
|
||||
server_tcp->setNoDelay(true);
|
||||
|
|
|
@ -54,8 +54,6 @@ AudioFileSourceID3 *id3;
|
|||
AudioGeneratorMP3 *decoder = NULL;
|
||||
void *mp3ram = NULL;
|
||||
|
||||
#define I2SAUDIO_TASK_STACK_SIZE 8192
|
||||
|
||||
|
||||
#ifdef ESP8266
|
||||
const int preallocateBufferSize = 5*1024;
|
||||
|
@ -191,7 +189,6 @@ void sayTime(int hour, int minutes, AudioGeneratorTalkie *talkie) {
|
|||
} else {
|
||||
talkie->say(spA_M_, sizeof(spA_M_));
|
||||
}
|
||||
out->stop();
|
||||
delete talkie;
|
||||
TTGO_PWR_OFF
|
||||
}
|
||||
|
@ -265,7 +262,7 @@ void MDCallback(void *cbData, const char *type, bool isUnicode, const char *str)
|
|||
if (strstr_P(type, PSTR("Title"))) {
|
||||
strncpy(wr_title, str, sizeof(wr_title));
|
||||
wr_title[sizeof(wr_title)-1] = 0;
|
||||
//AddLog_P2(LOG_LEVEL_INFO,PSTR("WR-Title: %s"),wr_title);
|
||||
//AddLog_P(LOG_LEVEL_INFO,PSTR("WR-Title: %s"),wr_title);
|
||||
} else {
|
||||
// Who knows what to do? Not me!
|
||||
}
|
||||
|
@ -296,7 +293,7 @@ void Webradio(const char *url) {
|
|||
retryms = millis() + 2000;
|
||||
}
|
||||
|
||||
xTaskCreatePinnedToCore(mp3_task2, "MP3-2", I2SAUDIO_TASK_STACK_SIZE, NULL, 3, &mp3_task_h, 1);
|
||||
xTaskCreatePinnedToCore(mp3_task2, "MP3-2", 8192, NULL, 3, &mp3_task_h, 1);
|
||||
}
|
||||
|
||||
void mp3_task2(void *arg){
|
||||
|
@ -376,27 +373,25 @@ void Play_mp3(const char *path) {
|
|||
}
|
||||
|
||||
file = new AudioFileSourceFS(*fsp,path);
|
||||
if (file->isOpen()) {
|
||||
id3 = new AudioFileSourceID3(file);
|
||||
id3 = new AudioFileSourceID3(file);
|
||||
|
||||
if (mp3ram) {
|
||||
mp3 = new AudioGeneratorMP3(mp3ram, preallocateCodecSize);
|
||||
} else {
|
||||
mp3 = new AudioGeneratorMP3();
|
||||
}
|
||||
mp3->begin(id3, out);
|
||||
if (mp3ram) {
|
||||
mp3 = new AudioGeneratorMP3(mp3ram, preallocateCodecSize);
|
||||
} else {
|
||||
mp3 = new AudioGeneratorMP3();
|
||||
}
|
||||
mp3->begin(id3, out);
|
||||
|
||||
if (I2S_Task) {
|
||||
xTaskCreatePinnedToCore(mp3_task, "MP3", I2SAUDIO_TASK_STACK_SIZE, NULL, 3, &mp3_task_h, 1);
|
||||
} else {
|
||||
while (mp3->isRunning()) {
|
||||
if (!mp3->loop()) {
|
||||
mp3->stop();
|
||||
mp3_delete();
|
||||
break;
|
||||
}
|
||||
OsWatchLoop();
|
||||
if (I2S_Task) {
|
||||
xTaskCreatePinnedToCore(mp3_task, "MP3", 8192, NULL, 3, &mp3_task_h, 1);
|
||||
} else {
|
||||
while (mp3->isRunning()) {
|
||||
if (!mp3->loop()) {
|
||||
mp3->stop();
|
||||
mp3_delete();
|
||||
break;
|
||||
}
|
||||
OsWatchLoop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -413,7 +413,7 @@ void MLX90640HandleWebGuiResponse(void){
|
|||
WebGetArg("ul", tmp, sizeof(tmp)); // update line
|
||||
if (strlen(tmp)) {
|
||||
uint8_t _line = atoi(tmp);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, "MLX90640: send line %u", _line);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, "MLX90640: send line %u", _line);
|
||||
float _buf[65];
|
||||
if(_line==0){_buf[0]=1000+MLX90640.Ta;} //ambient temperature modulation hack
|
||||
else{_buf[0]=(float)_line;}
|
||||
|
@ -431,9 +431,9 @@ void MLX90640HandleWebGuiResponse(void){
|
|||
uint32_t _poiNum = (_poi-(_poi%10000))/10000;
|
||||
MLX90640.pois[_poiNum*2] = (_poi%10000)/100;
|
||||
MLX90640.pois[(_poiNum*2)+1] = _poi%100;
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RAW: %u, POI-%u: x: %u, y: %u"),_poi,_poiNum,MLX90640.pois[_poiNum],MLX90640.pois[_poiNum+1]);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("RAW: %u, POI-%u: x: %u, y: %u"),_poi,_poiNum,MLX90640.pois[_poiNum],MLX90640.pois[_poiNum+1]);
|
||||
for(int i = 0;i<MLX90640_POI_NUM;i++){
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("POI-%u: x: %u, y: %u"),i+1,MLX90640.pois[i*2],MLX90640.pois[(i*2)+1]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("POI-%u: x: %u, y: %u"),i+1,MLX90640.pois[i*2],MLX90640.pois[(i*2)+1]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ bool MLX90640Cmd(void){
|
|||
MLX90640.pois[_idx+1] = _coord%100;
|
||||
if(MLX90640.pois[_idx+1]>23) MLX90640.pois[_idx+1]=23;
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("POI-%u = x:%u,y:%u"),XdrvMailbox.index,MLX90640.pois[_idx],MLX90640.pois[_idx+1]);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("POI-%u = x:%u,y:%u"),XdrvMailbox.index,MLX90640.pois[_idx],MLX90640.pois[_idx+1]);
|
||||
Response_P(S_JSON_MLX90640_COMMAND_NVALUE, command, XdrvMailbox.payload);
|
||||
break;
|
||||
default:
|
||||
|
@ -494,10 +494,10 @@ void MLX90640init()
|
|||
if(!MLX90640.dumpedEE){
|
||||
status = MLX90640_DumpEE(MLX90640_ADDRESS, MLX90640.Frame);
|
||||
if (status != 0){
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("Failed to load system parameters"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("Failed to load system parameters"));
|
||||
}
|
||||
else {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("MLX90640: started"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("MLX90640: started"));
|
||||
MLX90640.type = true;
|
||||
}
|
||||
MLX90640.params = new paramsMLX90640;
|
||||
|
@ -514,11 +514,11 @@ void MLX90640every100msec(){
|
|||
|
||||
if(!MLX90640.extractedParams){
|
||||
static uint32_t _chunk = 0;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MLX90640: will read chunk: %u"), _chunk);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: will read chunk: %u"), _chunk);
|
||||
_time = millis();
|
||||
status = MLX90640_ExtractParameters(MLX90640.Frame, MLX90640.params, _chunk);
|
||||
if (status == 0){
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MLX90640: parameter received after: %u msec, status: %u"), TimePassedSince(_time), status);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: parameter received after: %u msec, status: %u"), TimePassedSince(_time), status);
|
||||
}
|
||||
if (_chunk == 5) MLX90640.extractedParams = true;
|
||||
_chunk++;
|
||||
|
@ -529,12 +529,12 @@ void MLX90640every100msec(){
|
|||
case 0:
|
||||
if(MLX90640_SynchFrame(MLX90640_ADDRESS)!=0){
|
||||
_job=-1;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MLX90640: frame not ready"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: frame not ready"));
|
||||
break;
|
||||
}
|
||||
// _time = millis();
|
||||
status = MLX90640_GetFrameData(MLX90640_ADDRESS, MLX90640.Frame);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 0 in %u msecs, status: %i"), TimePassedSince(_time), status);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 0 in %u msecs, status: %i"), TimePassedSince(_time), status);
|
||||
break;
|
||||
case 1:
|
||||
MLX90640.Ta = MLX90640_GetTa(MLX90640.Frame, MLX90640.params);
|
||||
|
@ -542,7 +542,7 @@ void MLX90640every100msec(){
|
|||
case 2:
|
||||
// _time = millis();
|
||||
MLX90640_CalculateTo(MLX90640.Frame, MLX90640.params, 0.95f, MLX90640.Ta - 8, MLX90640.To, 0);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time));
|
||||
break;
|
||||
case 5:
|
||||
if(MLX90640_SynchFrame(MLX90640_ADDRESS)!=0){
|
||||
|
@ -551,12 +551,12 @@ void MLX90640every100msec(){
|
|||
}
|
||||
// _time = millis();
|
||||
status = MLX90640_GetFrameData(MLX90640_ADDRESS, MLX90640.Frame);
|
||||
// // AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 1 in %u msecs, status: %i"), TimePassedSince(_time), status);
|
||||
// // AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: got frame 1 in %u msecs, status: %i"), TimePassedSince(_time), status);
|
||||
break;
|
||||
case 7:
|
||||
// _time = millis();
|
||||
MLX90640_CalculateTo(MLX90640.Frame, MLX90640.params, 0.95f, MLX90640.Ta - 8, MLX90640.To, 1);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("MLX90640: calculated temperatures in %u msecs"), TimePassedSince(_time));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -580,8 +580,8 @@ void MLX90640Show(uint8_t json)
|
|||
char obj_tstr[FLOATSZ];
|
||||
dtostrfd(MLX90640.To[MLX90640.pois[i*2]+(MLX90640.pois[(i*2)+1]*32)], Settings.flag2.temperature_resolution, obj_tstr);
|
||||
ResponseAppend_P(PSTR(",%s"),obj_tstr);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Array pos: %u"),MLX90640.pois[i*2]+(MLX90640.pois[(i*2)+1]*32));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("POI-%u: x: %u, y: %u"),i+1,MLX90640.pois[i*2],MLX90640.pois[(i*2)+1]);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("Array pos: %u"),MLX90640.pois[i*2]+(MLX90640.pois[(i*2)+1]*32));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("POI-%u: x: %u, y: %u"),i+1,MLX90640.pois[i*2],MLX90640.pois[(i*2)+1]);
|
||||
}
|
||||
ResponseAppend_P(PSTR("]}"));
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte)
|
|||
|
||||
case MIEL_HVAC_P_MIDDLE1:
|
||||
if (byte != MIEL_HVAC_H_MIDDLE1) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": parse state MIDDLE1 expected %02x got %02x"
|
||||
", restarting"), MIEL_HVAC_H_MIDDLE1, byte);
|
||||
return (MIEL_HVAC_P_START);
|
||||
|
@ -377,7 +377,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte)
|
|||
|
||||
case MIEL_HVAC_P_MIDDLE2:
|
||||
if (byte != MIEL_HVAC_H_MIDDLE2) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": parse state MIDDLE2 expected %02x got %02x"
|
||||
", restarting"), MIEL_HVAC_H_MIDDLE2, byte);
|
||||
return (MIEL_HVAC_P_START);
|
||||
|
@ -388,7 +388,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte)
|
|||
|
||||
case MIEL_HVAC_P_LEN:
|
||||
if (byte == 0) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": skipping 0 byte message type 0x%02x"),
|
||||
p->p_type);
|
||||
return (MIEL_HVAC_P_SKIP_CKSUM);
|
||||
|
@ -403,14 +403,14 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte)
|
|||
case MIEL_HVAC_H_TYPE_UPDATED:
|
||||
break;
|
||||
default:
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": skipping unknown message type 0x%02x"),
|
||||
p->p_type);
|
||||
return (MIEL_HVAC_P_SKIP);
|
||||
}
|
||||
|
||||
if (byte > sizeof(p->p_data)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": skipping %u data bytes of message type 0x%02x"),
|
||||
p->p_len, p->p_type);
|
||||
return (MIEL_HVAC_P_SKIP);
|
||||
|
@ -427,7 +427,7 @@ miel_hvac_parse(struct miel_hvac_softc *sc, uint8_t byte)
|
|||
|
||||
case MIEL_HVAC_P_CKSUM:
|
||||
if (miel_hvac_cksum_fini(p->p_sum) != byte) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": checksum failed, restarting"));
|
||||
return (MIEL_HVAC_P_START);
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ miel_hvac_send(struct miel_hvac_softc *sc, uint8_t type,
|
|||
|
||||
char hex_h[(sizeof(h) + 1) * 2];
|
||||
char hex_d[(len + 1) * 2];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG,
|
||||
AddLog_P(LOG_LEVEL_DEBUG,
|
||||
PSTR(MIEL_HVAC_LOGNAME ": sending %s %s %02x"),
|
||||
ToHex_P((uint8_t *)&h, sizeof(h), hex_h, sizeof(hex_h)),
|
||||
ToHex_P((uint8_t *)data, len, hex_d, sizeof(hex_d)),
|
||||
|
@ -837,7 +837,7 @@ miel_hvac_log_bytes(struct miel_hvac_softc *sc, const char *name,
|
|||
char hex[(MIEL_HVAC_DATABUFLEN + 1) * 2];
|
||||
const unsigned char *b = (const unsigned char *)buf;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": response %s %s"), name, ToHex_P(b, len, hex, sizeof(hex)));
|
||||
}
|
||||
|
||||
|
@ -845,7 +845,7 @@ static void
|
|||
miel_hvac_input_connected(struct miel_hvac_softc *sc,
|
||||
const void *buf, size_t len)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_INFO,
|
||||
AddLog_P(LOG_LEVEL_INFO,
|
||||
PSTR(MIEL_HVAC_LOGNAME ": connected to Mitsubishi Electric HVAC"));
|
||||
sc->sc_connected = 1;
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ miel_hvac_input_data(struct miel_hvac_softc *sc,
|
|||
|
||||
miel_hvac_log_bytes(sc, "data", buf, len);
|
||||
if (len < sizeof(*d)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(MIEL_HVAC_LOGNAME
|
||||
": short data response (%zu < %zu)"), len, sizeof(*d));
|
||||
return;
|
||||
}
|
||||
|
@ -1033,7 +1033,7 @@ miel_hvac_pre_init(void)
|
|||
Pin(GPIO_MIEL_HVAC_TX), 2);
|
||||
|
||||
if (!sc->sc_serial->begin(baudrate, 2)) {
|
||||
AddLog_P2(LOG_LEVEL_ERROR,
|
||||
AddLog_P(LOG_LEVEL_ERROR,
|
||||
PSTR(MIEL_HVAC_LOGNAME ": unable to begin serial "
|
||||
"(baudrate %d)"), baudrate);
|
||||
goto del;
|
||||
|
|
|
@ -153,7 +153,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
|
||||
if (Wc.up) {
|
||||
esp_camera_deinit();
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Deinit"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Deinit"));
|
||||
//return Wc.up;
|
||||
}
|
||||
Wc.up = 0;
|
||||
|
@ -186,7 +186,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
config.pin_pwdn = (PinUsed(GPIO_WEBCAM_PWDN)) ? Pin(GPIO_WEBCAM_PWDN) : -1; // PWDN_GPIO_NUM;
|
||||
config.pin_reset = (PinUsed(GPIO_WEBCAM_RESET)) ? Pin(GPIO_WEBCAM_RESET) : -1; // RESET_GPIO_NUM;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: User template"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: User template"));
|
||||
} else {
|
||||
// defaults to AI THINKER
|
||||
config.pin_d0 = Y2_GPIO_NUM;
|
||||
|
@ -205,7 +205,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
config.pin_sscb_scl = SIOC_GPIO_NUM;
|
||||
config.pin_pwdn = PWDN_GPIO_NUM;
|
||||
config.pin_reset = RESET_GPIO_NUM;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Default template"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Default template"));
|
||||
}
|
||||
|
||||
//ESP.getPsramSize()
|
||||
|
@ -220,15 +220,15 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
config.frame_size = FRAMESIZE_UXGA;
|
||||
config.jpeg_quality = 10;
|
||||
config.fb_count = 2;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: PSRAM found"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: PSRAM found"));
|
||||
} else {
|
||||
config.frame_size = FRAMESIZE_VGA;
|
||||
config.jpeg_quality = 12;
|
||||
config.fb_count = 1;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: PSRAM not found"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: PSRAM not found"));
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: heap check 1: %d"),ESP_getFreeHeap());
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: heap check 1: %d"),ESP_getFreeHeap());
|
||||
|
||||
// stupid workaround camera diver eats up static ram should prefer PSRAM
|
||||
// so we steal static ram to force driver to alloc PSRAM
|
||||
|
@ -239,11 +239,11 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
if (x) { free(x); }
|
||||
|
||||
if (err != ESP_OK) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: Init failed with error 0x%x"), err);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: Init failed with error 0x%x"), err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: heap check 2: %d"),ESP_getFreeHeap());
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: heap check 2: %d"),ESP_getFreeHeap());
|
||||
|
||||
sensor_t * wc_s = esp_camera_sensor_get();
|
||||
|
||||
|
@ -258,7 +258,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
|
||||
camera_fb_t *wc_fb = esp_camera_fb_get();
|
||||
if (!wc_fb) {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: Init failed to get the frame on time"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: Init failed to get the frame on time"));
|
||||
return 0;
|
||||
}
|
||||
Wc.width = wc_fb->width;
|
||||
|
@ -269,7 +269,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
fd_init();
|
||||
#endif
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: Initialized"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: Initialized"));
|
||||
|
||||
Wc.up = 1;
|
||||
if (psram) { Wc.up = 2; }
|
||||
|
@ -493,7 +493,7 @@ uint32_t WcDetectFace(void) {
|
|||
|
||||
image_matrix = dl_matrix3du_alloc(1, fb->width, fb->height, 3);
|
||||
if (!image_matrix) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: dl_matrix3du_alloc failed"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: dl_matrix3du_alloc failed"));
|
||||
esp_camera_fb_return(fb);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ uint32_t WcDetectFace(void) {
|
|||
esp_camera_fb_return(fb);
|
||||
if (!s){
|
||||
dl_matrix3du_free(image_matrix);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: to rgb888 failed"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: to rgb888 failed"));
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ uint32_t WcGetFrame(int32_t bnum) {
|
|||
|
||||
wc_fb = esp_camera_fb_get();
|
||||
if (!wc_fb) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Can't get frame"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Can't get frame"));
|
||||
return 0;
|
||||
}
|
||||
if (!bnum) {
|
||||
|
@ -613,7 +613,7 @@ pcopy:
|
|||
memcpy(picstore[bnum].buff, _jpg_buf, _jpg_buf_len);
|
||||
picstore[bnum].len = _jpg_buf_len;
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Can't allocate picstore"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Can't allocate picstore"));
|
||||
picstore[bnum].len = 0;
|
||||
}
|
||||
if (wc_fb) { esp_camera_fb_return(wc_fb); }
|
||||
|
@ -657,14 +657,14 @@ void HandleImage(void) {
|
|||
} else {
|
||||
bnum--;
|
||||
if (!picstore[bnum].len) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: No image #: %d"), bnum);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: No image #: %d"), bnum);
|
||||
return;
|
||||
}
|
||||
client.write((char *)picstore[bnum].buff, picstore[bnum].len);
|
||||
}
|
||||
client.stop();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("CAM: Sending image #: %d"), bnum+1);
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("CAM: Sending image #: %d"), bnum+1);
|
||||
}
|
||||
|
||||
void HandleImageBasic(void) {
|
||||
|
@ -681,7 +681,7 @@ void HandleImageBasic(void) {
|
|||
camera_fb_t *wc_fb;
|
||||
wc_fb = esp_camera_fb_get(); // Acquire frame
|
||||
if (!wc_fb) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Frame buffer could not be acquired"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Frame buffer could not be acquired"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -708,16 +708,16 @@ void HandleImageBasic(void) {
|
|||
|
||||
esp_camera_fb_return(wc_fb); // Free frame buffer
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("CAM: Image sent"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("CAM: Image sent"));
|
||||
}
|
||||
|
||||
void HandleWebcamMjpeg(void) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Handle camserver"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Handle camserver"));
|
||||
// if (!Wc.stream_active) {
|
||||
// always restart stream
|
||||
Wc.stream_active = 1;
|
||||
client = CamServer->client();
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Create client"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Create client"));
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -731,13 +731,13 @@ void HandleWebcamMjpegTask(void) {
|
|||
bool jpeg_converted = false;
|
||||
|
||||
if (!client.connected()) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Client fail"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Client fail"));
|
||||
Wc.stream_active = 0;
|
||||
}
|
||||
if (1 == Wc.stream_active) {
|
||||
client.flush();
|
||||
client.setTimeout(3);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Start stream"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Start stream"));
|
||||
client.print("HTTP/1.1 200 OK\r\n"
|
||||
"Content-Type: multipart/x-mixed-replace;boundary=" BOUNDARY "\r\n"
|
||||
"\r\n");
|
||||
|
@ -746,7 +746,7 @@ void HandleWebcamMjpegTask(void) {
|
|||
if (2 == Wc.stream_active) {
|
||||
wc_fb = esp_camera_fb_get();
|
||||
if (!wc_fb) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Frame fail"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Frame fail"));
|
||||
Wc.stream_active = 0;
|
||||
}
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ void HandleWebcamMjpegTask(void) {
|
|||
if (wc_fb->format != PIXFORMAT_JPEG) {
|
||||
jpeg_converted = frame2jpg(wc_fb, 80, &_jpg_buf, &_jpg_buf_len);
|
||||
if (!jpeg_converted){
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: JPEG compression failed"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: JPEG compression failed"));
|
||||
_jpg_buf_len = wc_fb->len;
|
||||
_jpg_buf = wc_fb->buf;
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ void HandleWebcamMjpegTask(void) {
|
|||
if (tlen!=_jpg_buf_len) {
|
||||
esp_camera_fb_return(wc_fb);
|
||||
Wc.stream_active=0;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Send fail"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Send fail"));
|
||||
}*/
|
||||
client.print("\r\n--" BOUNDARY "\r\n");
|
||||
|
||||
|
@ -788,10 +788,10 @@ void HandleWebcamMjpegTask(void) {
|
|||
|
||||
if (jpeg_converted) { free(_jpg_buf); }
|
||||
esp_camera_fb_return(wc_fb);
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: send frame"));
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: send frame"));
|
||||
}
|
||||
if (0 == Wc.stream_active) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Stream exit"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Stream exit"));
|
||||
client.flush();
|
||||
client.stop();
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ void HandleWebcamRoot(void) {
|
|||
//CamServer->redirect("http://" + String(ip) + ":81/cam.mjpeg");
|
||||
CamServer->sendHeader("Location", WiFi.localIP().toString() + ":81/cam.mjpeg");
|
||||
CamServer->send(302, "", "");
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Root called"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Root called"));
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
@ -818,7 +818,7 @@ uint32_t WcSetStreamserver(uint32_t flag) {
|
|||
CamServer->on("/cam.mjpeg", HandleWebcamMjpeg);
|
||||
CamServer->on("/cam.jpg", HandleWebcamMjpeg);
|
||||
CamServer->on("/stream", HandleWebcamMjpeg);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Stream init"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Stream init"));
|
||||
CamServer->begin();
|
||||
}
|
||||
} else {
|
||||
|
@ -826,7 +826,7 @@ uint32_t WcSetStreamserver(uint32_t flag) {
|
|||
CamServer->stop();
|
||||
delete CamServer;
|
||||
CamServer = NULL;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Stream exit"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CAM: Stream exit"));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -860,7 +860,7 @@ void WcLoop(void) {
|
|||
if (!rtsp_start && !TasmotaGlobal.global_state.wifi_down && Wc.up) {
|
||||
rtspServer.begin();
|
||||
rtsp_start = 1;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: RTSP init"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: RTSP init"));
|
||||
rtsp_lastframe_time = millis();
|
||||
}
|
||||
|
||||
|
@ -873,7 +873,7 @@ void WcLoop(void) {
|
|||
if ((now-rtsp_lastframe_time) > RTSP_FRAME_TIME) {
|
||||
rtsp_session->broadcastCurrentFrame(now);
|
||||
rtsp_lastframe_time = now;
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: RTSP session frame"));
|
||||
// AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: RTSP session frame"));
|
||||
}
|
||||
|
||||
if (rtsp_session->m_stopped) {
|
||||
|
@ -881,7 +881,7 @@ void WcLoop(void) {
|
|||
delete rtsp_streamer;
|
||||
rtsp_session = NULL;
|
||||
rtsp_streamer = NULL;
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: RTSP stopped"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: RTSP stopped"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -889,7 +889,7 @@ void WcLoop(void) {
|
|||
if (rtsp_client) {
|
||||
rtsp_streamer = new OV2640Streamer(&rtsp_client, cam); // our streamer for UDP/TCP based RTP transport
|
||||
rtsp_session = new CRtspSession(&rtsp_client, rtsp_streamer); // our threads RTSP session and state
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("CAM: RTSP stream created"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("CAM: RTSP stream created"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -85,15 +85,15 @@ char eth_hostname[sizeof(TasmotaGlobal.hostname)];
|
|||
void EthernetEvent(WiFiEvent_t event) {
|
||||
switch (event) {
|
||||
case SYSTEM_EVENT_ETH_START:
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ETH: " D_ATTEMPTING_CONNECTION));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ETH: " D_ATTEMPTING_CONNECTION));
|
||||
ETH.setHostname(eth_hostname);
|
||||
break;
|
||||
case SYSTEM_EVENT_ETH_CONNECTED:
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ETH: " D_CONNECTED " at %dMbps%s"),
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ETH: " D_CONNECTED " at %dMbps%s"),
|
||||
ETH.linkSpeed(), (ETH.fullDuplex()) ? " Full Duplex" : "");
|
||||
break;
|
||||
case SYSTEM_EVENT_ETH_GOT_IP:
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ETH: Mac %s, IPAddress %s, Hostname %s"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ETH: Mac %s, IPAddress %s, Hostname %s"),
|
||||
ETH.macAddress().c_str(), ETH.localIP().toString().c_str(), eth_hostname);
|
||||
Settings.ip_address[1] = (uint32_t)ETH.gatewayIP();
|
||||
Settings.ip_address[2] = (uint32_t)ETH.subnetMask();
|
||||
|
@ -101,11 +101,11 @@ void EthernetEvent(WiFiEvent_t event) {
|
|||
TasmotaGlobal.global_state.eth_down = 0;
|
||||
break;
|
||||
case SYSTEM_EVENT_ETH_DISCONNECTED:
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ETH: Disconnected"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ETH: Disconnected"));
|
||||
TasmotaGlobal.global_state.eth_down = 1;
|
||||
break;
|
||||
case SYSTEM_EVENT_ETH_STOP:
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ETH: Stopped"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ETH: Stopped"));
|
||||
TasmotaGlobal.global_state.eth_down = 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -116,7 +116,7 @@ void EthernetEvent(WiFiEvent_t event) {
|
|||
void EthernetInit(void) {
|
||||
if (!Settings.flag4.network_ethernet) { return; }
|
||||
if (!PinUsed(GPIO_ETH_PHY_MDC) && !PinUsed(GPIO_ETH_PHY_MDIO)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ETH: No ETH MDC and/or ETH MDIO GPIO defined"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ETH: No ETH MDC and/or ETH MDIO GPIO defined"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ void EthernetInit(void) {
|
|||
int eth_mdc = Pin(GPIO_ETH_PHY_MDC);
|
||||
int eth_mdio = Pin(GPIO_ETH_PHY_MDIO);
|
||||
if (!ETH.begin(Settings.eth_address, eth_power, eth_mdc, eth_mdio, (eth_phy_type_t)Settings.eth_type, (eth_clock_mode_t)Settings.eth_clk_mode)) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ETH: Bad PHY type or init error"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ETH: Bad PHY type or init error"));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -378,11 +378,11 @@ uint8_t data;
|
|||
|
||||
if (ttgo_globs.bma->isDoubleClick()) {
|
||||
ttgo_globs.bma_double_click = true;
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("double click"));
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("double click"));
|
||||
}
|
||||
if (ttgo_globs.bma->isAnyNoMotion()) {
|
||||
ttgo_globs.bma_click = true;
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("click"));
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("click"));
|
||||
}
|
||||
|
||||
//! setp counter
|
||||
|
@ -408,7 +408,7 @@ uint8_t data;
|
|||
}
|
||||
if (ttgo_globs.ttgo_power->isPEKShortPressIRQ()) {
|
||||
ttgo_globs.bma_button = true;
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("button press"));
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("button press"));
|
||||
}
|
||||
ttgo_globs.ttgo_power->clearIRQ();
|
||||
break;
|
||||
|
|
|
@ -174,11 +174,11 @@ void CpuLoadLoop(void)
|
|||
#if defined(F_CPU) && (F_CPU == 160000000L)
|
||||
int CPU_load = 100 - ( (CPU_loops*(1 + 30*TasmotaGlobal.sleep)) / (CPU_load_check *800) );
|
||||
CPU_loops = CPU_loops / CPU_load_check;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(160MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(160MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops);
|
||||
#else
|
||||
int CPU_load = 100 - ( (CPU_loops*(1 + 30*TasmotaGlobal.sleep)) / (CPU_load_check *400) );
|
||||
CPU_loops = CPU_loops / CPU_load_check;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(80MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(80MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops);
|
||||
#endif
|
||||
CPU_last_millis = CPU_last_loop_time;
|
||||
CPU_loops = 0;
|
||||
|
@ -202,7 +202,7 @@ void DebugFreeMem(void)
|
|||
{
|
||||
register uint32_t *sp asm("a1");
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), ESP.getFreeHeap(), 4 * (sp - g_pcont->stack), XdrvMailbox.data);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), ESP.getFreeHeap(), 4 * (sp - g_pcont->stack), XdrvMailbox.data);
|
||||
}
|
||||
|
||||
#else // ESP32
|
||||
|
@ -211,7 +211,7 @@ void DebugFreeMem(void)
|
|||
{
|
||||
register uint8_t *sp asm("a1");
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), ESP.getFreeHeap(), sp - pxTaskGetStackStart(NULL), XdrvMailbox.data);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), ESP.getFreeHeap(), sp - pxTaskGetStackStart(NULL), XdrvMailbox.data);
|
||||
}
|
||||
|
||||
#endif // ESP8266 - ESP32
|
||||
|
@ -245,7 +245,7 @@ void DebugRtcDump(char* parms)
|
|||
uint16_t srow = strtol(parms, &p, 16) / CFG_COLS;
|
||||
uint16_t mrow = strtol(p, &p, 10);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow);
|
||||
|
||||
if (0 == mrow) { // Default only 8 lines
|
||||
mrow = 8;
|
||||
|
@ -297,7 +297,7 @@ void DebugCfgDump(char* parms)
|
|||
uint16_t srow = strtol(parms, &p, 16) / CFG_COLS;
|
||||
uint16_t mrow = strtol(p, &p, 10);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow);
|
||||
|
||||
if (0 == mrow) { // Default only 8 lines
|
||||
mrow = 8;
|
||||
|
@ -374,7 +374,7 @@ void DebugCfgPoke(char* parms)
|
|||
|
||||
uint32_t ndata32 = (buffer[address +3] << 24) + (buffer[address +2] << 16) + (buffer[address +1] << 8) + buffer[address];
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: 0x%0LX (%lu) poked to 0x%0LX (%lu)"), address, data32, data32, ndata32, ndata32);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%03X: 0x%0LX (%lu) poked to 0x%0LX (%lu)"), address, data32, data32, ndata32, ndata32);
|
||||
}
|
||||
|
||||
void SetFlashMode(uint8_t mode)
|
||||
|
@ -404,7 +404,7 @@ void SetFlashMode(uint8_t mode)
|
|||
|
||||
void CmndHelp(void)
|
||||
{
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("HLP: "), kDebugCommands);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("HLP: %s"), kDebugCommands);
|
||||
ResponseCmndDone();
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ void CmndFlashDump(void)
|
|||
|
||||
for (uint32_t pos = start; pos < end; pos += bytes_per_cols) {
|
||||
uint32_t* values = (uint32_t*)(pos);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("%06X: %08X %08X %08X %08X %08X %08X %08X %08X"), pos - flash_start,
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("%06X: %08X %08X %08X %08X %08X %08X %08X %08X"), pos - flash_start,
|
||||
DebugSwap32(values[0]), DebugSwap32(values[1]), DebugSwap32(values[2]), DebugSwap32(values[3]),
|
||||
DebugSwap32(values[4]), DebugSwap32(values[5]), DebugSwap32(values[6]), DebugSwap32(values[7]));
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ void CmndI2cWrite(void)
|
|||
Wire.write(buffer[i]);
|
||||
}
|
||||
int result = Wire.endTransmission();
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("I2C: Result %d"), result);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("I2C: Result %d"), result);
|
||||
}
|
||||
}
|
||||
ResponseCmndDone();
|
||||
|
|
|
@ -147,7 +147,7 @@ bool LcdPrintLog(void)
|
|||
strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols);
|
||||
DisplayFillScreen(last_row);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
|
||||
lcd->setCursor(0, last_row);
|
||||
lcd->print(disp_screen_buffer[last_row]);
|
||||
|
|
|
@ -124,7 +124,7 @@ void Ssd1306PrintLog(void)
|
|||
strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols);
|
||||
DisplayFillScreen(last_row);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
|
||||
renderer->println(disp_screen_buffer[last_row]);
|
||||
renderer->Updateframe();
|
||||
|
|
|
@ -95,7 +95,7 @@ void MatrixScrollLeft(char* txt, int loop)
|
|||
// Horiz. position of text -- starts off right edge
|
||||
mtx_x = 8 * mtx_matrices;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), txt);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), txt);
|
||||
|
||||
disp_refresh = Settings.display_refresh;
|
||||
case 2:
|
||||
|
@ -265,7 +265,7 @@ void MatrixPrintLog(uint8_t direction)
|
|||
i++;
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), mtx_buffer);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), mtx_buffer);
|
||||
|
||||
mtx_done = 1;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ void Ili9341InitDriver(void)
|
|||
|
||||
Ili9341InitMode();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("DSP: ILI9341"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: ILI9341"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ void Ili9341PrintLog(void)
|
|||
DisplayFillScreen(last_row);
|
||||
tft->print(disp_screen_buffer[last_row]);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), txt);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), txt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,11 +69,11 @@ void EpdInitDriver29()
|
|||
// whiten display with full update, takes 3 seconds
|
||||
if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MOSI)) {
|
||||
epd->Begin(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_MOSI),Pin(GPIO_SPI_CLK));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EPD: HardSPI CS %d, CLK %d, MOSI %d"),Pin(GPIO_SPI_CS), Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MOSI));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EPD: HardSPI CS %d, CLK %d, MOSI %d"),Pin(GPIO_SPI_CS), Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MOSI));
|
||||
}
|
||||
else if (PinUsed(GPIO_SSPI_CS) && PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_MOSI)) {
|
||||
epd->Begin(Pin(GPIO_SSPI_CS),Pin(GPIO_SSPI_MOSI),Pin(GPIO_SSPI_SCLK));
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EPD: SoftSPI CS %d, CLK %d, MOSI %d"),Pin(GPIO_SSPI_CS), Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSPI_MOSI));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("EPD: SoftSPI CS %d, CLK %d, MOSI %d"),Pin(GPIO_SSPI_CS), Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSPI_MOSI));
|
||||
} else {
|
||||
free(buffer);
|
||||
return;
|
||||
|
@ -136,7 +136,7 @@ void EpdPrintLog29(void)
|
|||
renderer->DrawStringAt(0, epd_scroll, disp_screen_buffer[last_row], COLORED, 0);
|
||||
// EpdDisplayFrame();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), txt);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), txt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ void SH1106PrintLog(void)
|
|||
strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols);
|
||||
DisplayFillScreen(last_row);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
|
||||
renderer->println(disp_screen_buffer[last_row]);
|
||||
renderer->Updateframe();
|
||||
|
|
|
@ -111,7 +111,7 @@ void SSD1351PrintLog(void)
|
|||
strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols);
|
||||
DisplayFillScreen(last_row);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]);
|
||||
|
||||
renderer->println(disp_screen_buffer[last_row]);
|
||||
renderer->Updateframe();
|
||||
|
|
|
@ -195,7 +195,7 @@ bool Xdsp12(uint8_t function)
|
|||
{
|
||||
bool result = false;
|
||||
|
||||
//AddLog_P2(LOG_LEVEL_INFO, PSTR("touch %d - %d"), FT5206_found, function);
|
||||
//AddLog_P(LOG_LEVEL_INFO, PSTR("touch %d - %d"), FT5206_found, function);
|
||||
|
||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||
ST7789_InitDriver();
|
||||
|
|
|
@ -138,7 +138,7 @@ void My92x1ModuleSelected(void)
|
|||
LightMy92x1Init();
|
||||
|
||||
TasmotaGlobal.light_driver = XLGT_02;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: MY29x1 Found"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: MY29x1 Found"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ bool Sm16716SetChannels(void)
|
|||
// handle any PWM pins, skipping the first 3 values for sm16716
|
||||
for (uint32_t i = 3; i < Light.subtype; i++) {
|
||||
if (PinUsed(GPIO_PWM1, i-3)) {
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d 10 bits %d, Pwm%d %d"), i, cur_col[i], i+1, curcol);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d 10 bits %d, Pwm%d %d"), i, cur_col[i], i+1, curcol);
|
||||
analogWrite(Pin(GPIO_PWM1, i-3), bitRead(TasmotaGlobal.pwm_inverted, i-3) ? Settings.pwm_range - cur_col_10bits[i] : cur_col_10bits[i]);
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ void Sm16716ModuleSelected(void)
|
|||
LightPwmOffset(LST_RGB); // Handle any PWM pins, skipping the first 3 color values for sm16716
|
||||
TasmotaGlobal.light_type += LST_RGB; // Add RGB to be controlled by sm16716
|
||||
TasmotaGlobal.light_driver = XLGT_03;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: SM16716 Found"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: SM16716 Found"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void Sm2135ModuleSelected(void)
|
|||
|
||||
TasmotaGlobal.light_type = LT_RGBWC;
|
||||
TasmotaGlobal.light_driver = XLGT_04;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: SM2135 (%s) Found"), (SM2135_WCBGR == Sm2135.model) ? PSTR("BGR") : PSTR("GRB"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("DBG: SM2135 (%s) Found"), (SM2135_WCBGR == Sm2135.model) ? PSTR("BGR") : PSTR("GRB"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ struct SNFL1 {
|
|||
|
||||
void SnfL1Send(const char *buffer)
|
||||
{
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SL1: Send %s"), buffer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SL1: Send %s"), buffer);
|
||||
|
||||
Serial.print(buffer);
|
||||
Serial.write(0x1B);
|
||||
|
@ -79,7 +79,7 @@ bool SnfL1SerialInput(void)
|
|||
// AT+RESULT="sequence":"1554682835320"
|
||||
// AT+UPDATE="sequence":"34906","switch":"on","light_type":1,"colorR":0,"colorG":16,"colorB":0,"bright":6,"mode":1
|
||||
// AT+UPDATE="switch":"on","light_type":1,"colorR":255,"colorG":0,"colorB":0,"bright":6,"mode":1,"speed":100,"sensitive":10
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd %s"), TasmotaGlobal.serial_in_buffer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd %s"), TasmotaGlobal.serial_in_buffer);
|
||||
|
||||
if (!strncmp(TasmotaGlobal.serial_in_buffer +3, "RESULT", 6)) {
|
||||
Snfl1.receive_ready = true;
|
||||
|
@ -107,7 +107,7 @@ bool SnfL1SerialInput(void)
|
|||
|
||||
if (!strncmp(token2, "\"sequence\"", 10)) {
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd sequence %s"), token3);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd sequence %s"), token3);
|
||||
|
||||
token = nullptr;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ bool SnfL1SerialInput(void)
|
|||
else if (!strncmp(token2, "\"switch\"", 8)) {
|
||||
switch_state = !strncmp(token3, "\"on\"", 4) ? true : false;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd switch %d (%d)"), switch_state, Light.power);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd switch %d (%d)"), switch_state, Light.power);
|
||||
|
||||
is_power_change = (switch_state != Light.power);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ bool SnfL1SerialInput(void)
|
|||
bool all_color_channels_updated = color_updated[0] && color_updated[1] && color_updated[2];
|
||||
if (all_color_channels_updated) {
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd color R%d G%d B%d (R%d G%d B%d)"),
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd color R%d G%d B%d (R%d G%d B%d)"),
|
||||
// current_color[0], current_color[1], current_color[2],
|
||||
// Settings.light_color[0], Settings.light_color[1], Settings.light_color[2]);
|
||||
|
||||
|
@ -151,7 +151,7 @@ bool SnfL1SerialInput(void)
|
|||
else if (!strncmp(token2, "\"bright\"", 8)) {
|
||||
uint8_t dimmer = atoi(token3);
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd dimmer %d (%d)"), dimmer, Settings.light_dimmer);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("SL1: Rcvd dimmer %d (%d)"), dimmer, Settings.light_dimmer);
|
||||
|
||||
is_brightness_change = (Light.power && (dimmer > 0) && (dimmer != Settings.light_dimmer));
|
||||
snprintf_P(cmnd_dimmer, sizeof(cmnd_dimmer), PSTR(D_CMND_DIMMER " %d"), dimmer);
|
||||
|
@ -226,7 +226,7 @@ void SnfL1ModuleSelected(void)
|
|||
|
||||
TasmotaGlobal.light_type = LT_RGB;
|
||||
TasmotaGlobal.light_driver = XLGT_05;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: Sonoff L1 Found"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: Sonoff L1 Found"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ void ElectriqMoodLModuleSelected(void)
|
|||
SetSerial(9600, TS_SERIAL_8N1);
|
||||
TasmotaGlobal.light_type = LT_RGBW;
|
||||
TasmotaGlobal.light_driver = XLGT_06;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: ElectriQ Mood Lamp Found"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: ElectriQ Mood Lamp Found"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ void HlwEvery200ms(void)
|
|||
}
|
||||
}
|
||||
uint32_t median = Hlw.debug[(Hlw.cf1_pulse_counter +1) / 2];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: power %d, ui %d, cnt %d, smpl%s, sum %d, mean %d, median %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: power %d, ui %d, cnt %d, smpl%s, sum %d, mean %d, median %d"),
|
||||
Hlw.cf_power_pulse_length , Hlw.select_ui_flag, Hlw.cf1_pulse_counter, stemp, Hlw.cf1_summed_pulse_length, cf1_pulse_length, median);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void CseReceived(void) {
|
|||
|
||||
uint8_t header = Cse.rx_buffer[0];
|
||||
if ((header & 0xFC) == 0xFC) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CSE: Abnormal hardware"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CSE: Abnormal hardware"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ void CseSerialInput(void) {
|
|||
Cse.byte_counter--;
|
||||
} while ((Cse.byte_counter > 2) && (0x5A != Cse.rx_buffer[1]));
|
||||
if (0x5A != Cse.rx_buffer[1]) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CSE: " D_CHECKSUM_FAILURE));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CSE: " D_CHECKSUM_FAILURE));
|
||||
Cse.received = false;
|
||||
Cse.byte_counter = 0;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ void CseEverySecond(void) {
|
|||
Energy.kWhtoday_delta += delta;
|
||||
}
|
||||
else {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CSE: Overload"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CSE: Overload"));
|
||||
Cse.cf_pulses_last_time = CSE_PULSES_NOT_INITIALIZED;
|
||||
}
|
||||
EnergyUpdateToday();
|
||||
|
|
|
@ -208,7 +208,7 @@ void PzemEvery250ms(void)
|
|||
Pzem.read_state = 1;
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PZM: Retry %d"), 5 - Pzem.send_retry);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PZM: Retry %d"), 5 - Pzem.send_retry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ void PzemEvery250ms(void)
|
|||
Pzem.phase--;
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PZM: Probing address %d, Max phases %d"), Pzem.phase +1, Energy.phase_count);
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("PZM: Probing address %d, Max phases %d"), Pzem.phase +1, Energy.phase_count);
|
||||
}
|
||||
|
||||
if (Pzem.address) {
|
||||
|
|
|
@ -63,7 +63,7 @@ void PzemAcEverySecond(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, PzemAcModbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PAC: PzemAc %d error %d"), PZEM_AC_DEVICE_ADDRESS + PzemAc.phase, error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("PAC: PzemAc %d error %d"), PZEM_AC_DEVICE_ADDRESS + PzemAc.phase, error);
|
||||
} else {
|
||||
Energy.data_valid[PzemAc.phase] = 0;
|
||||
if (10 == registers) {
|
||||
|
|
|
@ -62,7 +62,7 @@ void PzemDcEverySecond(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, PzemDcModbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PDC: PzemDc %d error %d"), PZEM_DC_DEVICE_ADDRESS + PzemDc.channel, error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("PDC: PzemDc %d error %d"), PZEM_DC_DEVICE_ADDRESS + PzemDc.channel, error);
|
||||
} else {
|
||||
Energy.data_valid[PzemDc.channel] = 0;
|
||||
if (8 == registers) {
|
||||
|
|
|
@ -131,7 +131,7 @@ void Ade7953GetData(void)
|
|||
reg[i >> 2][i &3] = value;
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("ADE: %d, %d, [%d, %d, %d, %d], [%d, %d, %d, %d]"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("ADE: %d, %d, [%d, %d, %d, %d], [%d, %d, %d, %d]"),
|
||||
Ade7953.voltage_rms, Ade7953.period,
|
||||
reg[0][0], reg[0][1], reg[0][2], reg[0][3],
|
||||
reg[1][0], reg[1][1], reg[1][2], reg[1][3]);
|
||||
|
@ -154,7 +154,7 @@ void Ade7953GetData(void)
|
|||
uint32_t current_rms_sum = Ade7953.current_rms[0] + Ade7953.current_rms[1];
|
||||
uint32_t active_power_sum = Ade7953.active_power[0] + Ade7953.active_power[1];
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ADE: U %d, C %d, I %d + %d = %d, P %d + %d = %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ADE: U %d, C %d, I %d + %d = %d, P %d + %d = %d"),
|
||||
Ade7953.voltage_rms, Ade7953.period,
|
||||
Ade7953.current_rms[0], Ade7953.current_rms[1], current_rms_sum,
|
||||
Ade7953.active_power[0], Ade7953.active_power[1], active_power_sum);
|
||||
|
|
|
@ -83,7 +83,7 @@ void SDM120Every250ms(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Sdm120Modbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SDM: SDM120 error %d"), error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SDM: SDM120 error %d"), error);
|
||||
} else {
|
||||
Energy.data_valid[0] = 0;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ void Dds2382EverySecond(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Dds2382Modbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "DDS2382 response error %d"), error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "DDS2382 response error %d"), error);
|
||||
} else {
|
||||
Energy.data_valid[0] = 0;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ void SDM630Every250ms(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Sdm630Modbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SDM: SDM630 error %d"), error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SDM: SDM630 error %d"), error);
|
||||
} else {
|
||||
Energy.data_valid[0] = 0;
|
||||
Energy.data_valid[1] = 0;
|
||||
|
|
|
@ -67,7 +67,7 @@ void DDSU666Every250ms(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Ddsu666Modbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SDM: Ddsu666 error %d"), error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SDM: Ddsu666 error %d"), error);
|
||||
} else {
|
||||
Energy.data_valid[0] = 0;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ void FifLEEvery250ms(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, FifLEModbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("FiF-LE: LE01MR Modbus error %d"), error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("FiF-LE: LE01MR Modbus error %d"), error);
|
||||
} else {
|
||||
Energy.data_valid[0] = 0;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ void Bl0940Received(void) {
|
|||
if ((Bl0940.rx_buffer[0] != BL0940_PACKET_HEADER) || // Bad header
|
||||
(Bl0940.tps1 && ((tps1 < (Bl0940.tps1 -10)) || (tps1 > (Bl0940.tps1 +10)))) // Invalid temperature change
|
||||
) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("BL9: Invalid data"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("BL9: Invalid data"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ void Bl0940Received(void) {
|
|||
int32_t cf_cnt = Bl0940.rx_buffer[24] << 24 | Bl0940.rx_buffer[23] << 16 | Bl0940.rx_buffer[22] << 8; // CF_CNT signed
|
||||
Bl0940.cf_pulses = abs(cf_cnt) >> 8;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("BL9: U %d, I %d, P %d, C %d, T %d"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("BL9: U %d, I %d, P %d, C %d, T %d"),
|
||||
Bl0940.voltage, Bl0940.current, Bl0940.power, Bl0940.cf_pulses, Bl0940.tps1);
|
||||
|
||||
if (Energy.power_on) { // Powered on
|
||||
|
@ -149,7 +149,7 @@ void Bl0940SerialInput(void) {
|
|||
Bl0940.byte_counter--;
|
||||
} while ((Bl0940.byte_counter > 1) && (BL0940_PACKET_HEADER != Bl0940.rx_buffer[0]));
|
||||
if (BL0940_PACKET_HEADER != Bl0940.rx_buffer[0]) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("BL9: " D_CHECKSUM_FAILURE));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("BL9: " D_CHECKSUM_FAILURE));
|
||||
Bl0940.received = false;
|
||||
Bl0940.byte_counter = 0;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ void Bl0940EverySecond(void) {
|
|||
Bl0940.cf_pulses_last_time = Bl0940.cf_pulses;
|
||||
Energy.kWhtoday_delta += delta;
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("BL9: Overload"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("BL9: Overload"));
|
||||
Bl0940.cf_pulses_last_time = BL0940_PULSES_NOT_INITIALIZED;
|
||||
}
|
||||
EnergyUpdateToday();
|
||||
|
@ -200,7 +200,7 @@ void Bl0940EverySecond(void) {
|
|||
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("BL9: Poll"));
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("BL9: Poll"));
|
||||
|
||||
Bl0940Serial->flush();
|
||||
Bl0940Serial->write(BL0940_READ_COMMAND);
|
||||
|
|
|
@ -158,7 +158,7 @@ void ADPSCallback(uint8_t phase)
|
|||
// Publish adding ADCO serial number into the topic
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_TELE, serialNumber, false);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("ADPS on phase %d"), phase);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("ADPS on phase %d"), phase);
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
|
@ -187,7 +187,7 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
|
||||
if (flags & TINFO_FLAGS_ADDED) { c = '#'; }
|
||||
if (flags & TINFO_FLAGS_UPDATED) { c = '*'; }
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: [%d]%c %s=%s"), ilabel, c , me->name, me->value);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: [%d]%c %s=%s"), ilabel, c , me->name, me->value);
|
||||
|
||||
if (ilabel<LABEL_END) {
|
||||
|
||||
|
@ -202,19 +202,19 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
break;
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Tarif changed, now '%s' (%d)"), me->value, tarif);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Tarif changed, now '%s' (%d)"), me->value, tarif);
|
||||
}
|
||||
|
||||
// Current tariff (standard is in clear text in value)
|
||||
else if (ilabel == LABEL_LTARF)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Tarif name changed, now '%s'"), me->value);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Tarif name changed, now '%s'"), me->value);
|
||||
}
|
||||
// Current tariff (standard index is is in clear text in value)
|
||||
else if (ilabel == LABEL_NTARF)
|
||||
{
|
||||
tarif = atoi(me->value);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Tarif index changed, now '%d'"), tarif);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Tarif index changed, now '%d'"), tarif);
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,21 +223,21 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
{
|
||||
Energy.voltage_available = true;
|
||||
Energy.voltage[0] = (float) atoi(me->value);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Voltage %s, now %d"), me->value, (int) Energy.voltage[0]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Voltage %s, now %d"), me->value, (int) Energy.voltage[0]);
|
||||
}
|
||||
|
||||
// Current I
|
||||
else if (ilabel == LABEL_IINST || ilabel == LABEL_IRMS1)
|
||||
{
|
||||
Energy.current[0] = (float) atoi(me->value);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Current %s, now %d"), me->value, (int) Energy.current[0]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Current %s, now %d"), me->value, (int) Energy.current[0]);
|
||||
}
|
||||
|
||||
// Power P
|
||||
else if (ilabel == LABEL_PAPP || ilabel == LABEL_SINSTS)
|
||||
{
|
||||
Energy.active_power[0] = (float) atoi(me->value);;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Power %s, now %d"), me->value, (int) Energy.active_power[0]);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Power %s, now %d"), me->value, (int) Energy.active_power[0]);
|
||||
}
|
||||
|
||||
// Wh indexes (legacy)
|
||||
|
@ -251,7 +251,7 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
// Base, un seul index
|
||||
if (ilabel == LABEL_BASE) {
|
||||
total = atoi(me->value);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Base:%u"), total);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Base:%u"), total);
|
||||
// Heures creuses/pleines calculer total
|
||||
} else {
|
||||
// Heures creuses get heures pleines
|
||||
|
@ -269,7 +269,7 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
}
|
||||
}
|
||||
total = hc + hp;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: HC:%u HP:%u Total:%u"), hc, hp, total);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: HC:%u HP:%u Total:%u"), hc, hp, total);
|
||||
}
|
||||
|
||||
if (!Settings.flag4.teleinfo_rawdata) {
|
||||
|
@ -284,17 +284,17 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
if (!Settings.flag4.teleinfo_rawdata) {
|
||||
EnergyUpdateTotal(total/1000.0f, true);
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Total:%uWh"), total);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Total:%uWh"), total);
|
||||
}
|
||||
|
||||
// Wh indexes (standard)
|
||||
else if ( ilabel == LABEL_EASF01)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: HC:%u"), atoi(me->value));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: HC:%u"), atoi(me->value));
|
||||
}
|
||||
else if ( ilabel == LABEL_EASF02)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: HP:%u"), atoi(me->value));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: HP:%u"), atoi(me->value));
|
||||
}
|
||||
|
||||
// Contract subscribed (legacy)
|
||||
|
@ -308,26 +308,26 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
break;
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Contract changed, now '%s' (%d)"), me->value, contrat);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Contract changed, now '%s' (%d)"), me->value, contrat);
|
||||
}
|
||||
// Contract subscribed (standard is in clear text in value)
|
||||
else if (ilabel == LABEL_NGTF)
|
||||
{
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: Contract changed, now '%s'"), me->value);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: Contract changed, now '%s'"), me->value);
|
||||
}
|
||||
|
||||
// Contract subscribed (Power)
|
||||
else if (ilabel == LABEL_ISOUSC || ilabel == LABEL_PREF)
|
||||
{
|
||||
isousc = atoi( me->value);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: ISousc set to %d"), isousc);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: ISousc set to %d"), isousc);
|
||||
}
|
||||
|
||||
// Serial Number of device
|
||||
else if (ilabel == LABEL_ADCO || ilabel == LABEL_ADSC)
|
||||
{
|
||||
strcpy(serialNumber, me->value);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: %s set to %s"), me->name, serialNumber);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: %s set to %s"), me->name, serialNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -447,20 +447,20 @@ void TInfoInit(void)
|
|||
tinfo_mode = TINFO_MODE_HISTORIQUE;
|
||||
}
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TIC: inferface speed %d bps"),baudrate);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TIC: inferface speed %d bps"),baudrate);
|
||||
|
||||
if (PinUsed(GPIO_TELEINFO_RX)) {
|
||||
uint8_t rx_pin = Pin(GPIO_TELEINFO_RX);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TIC: RX on GPIO%d"), rx_pin);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TIC: RX on GPIO%d"), rx_pin);
|
||||
|
||||
// Enable Teleinfo pin used, control it
|
||||
if (PinUsed(GPIO_TELEINFO_ENABLE)) {
|
||||
uint8_t en_pin = Pin(GPIO_TELEINFO_ENABLE);
|
||||
pinMode(en_pin, OUTPUT);
|
||||
digitalWrite(en_pin, HIGH);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TIC: Enable with GPIO%d"), en_pin);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TIC: Enable with GPIO%d"), en_pin);
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TIC: always enabled"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TIC: always enabled"));
|
||||
}
|
||||
|
||||
#if defined (ESP8266)
|
||||
|
@ -487,13 +487,13 @@ void TInfoInit(void)
|
|||
//SetSerialConfig(TS_SERIAL_7E1);
|
||||
//TInfoSerial->setTimeout(TINFO_READ_TIMEOUT);
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TIC: using hardware serial"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TIC: using hardware serial"));
|
||||
} else {
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TIC: using software serial"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TIC: using software serial"));
|
||||
}
|
||||
|
||||
#elif defined (ESP32)
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TIC: using ESP32 hardware serial"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TIC: using ESP32 hardware serial"));
|
||||
#endif
|
||||
// Init teleinfo
|
||||
tinfo.init(tinfo_mode);
|
||||
|
@ -503,7 +503,7 @@ void TInfoInit(void)
|
|||
tinfo.attachNewFrame(NewFrameCallback);
|
||||
tinfo_found = true;
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("TIC: Ready"));
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("TIC: Ready"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ void IEM3000Every250ms(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Iem3000Modbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SDM: Iem3000 error %d"), error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SDM: Iem3000 error %d"), error);
|
||||
} else {
|
||||
Energy.data_valid[0] = 0;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ void WE517Every250ms(void)
|
|||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, We517Modbus->ReceiveCount());
|
||||
|
||||
if (error) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ORNO: WE517 error %d"), error);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ORNO: WE517 error %d"), error);
|
||||
} else {
|
||||
Energy.data_valid[0] = 0;
|
||||
Energy.data_valid[1] = 0;
|
||||
|
@ -188,7 +188,7 @@ void We517SnsInit(void)
|
|||
uint8_t result = We517Modbus->Begin(WE517_SPEED);
|
||||
if (result) {
|
||||
if (2 == result) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ORNO: WE517 HW serial init 8E1 at %d baud"), WE517_SPEED);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("ORNO: WE517 HW serial init 8E1 at %d baud"), WE517_SPEED);
|
||||
Serial.begin(WE517_SPEED, SERIAL_8E1);
|
||||
ClaimSerial();
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ void SyncACDimmer(void)
|
|||
#else // ESP32
|
||||
analogWrite(Pin(GPIO_PWM1, i), 5);
|
||||
#endif // ESP8266 - ESP32
|
||||
//AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("CNT: [%d] dimm_time_CCs %d, current_cycle_CC: %d, timelag %lu, lastcc %lu, currentSteps %d, curr %d"), i, ac_zero_cross_dimmer.dimm_timeClockCycles,ac_zero_cross_dimmer.current_cycle_ClockCycles , timelag_ClockCycles, ac_zero_cross_dimmer.currentCycleCount, ac_zero_cross_dimmer.currentSteps, Light.fade_cur_10[i]);
|
||||
//AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("CNT: [%d] dimm_time_CCs %d, current_cycle_CC: %d, timelag %lu, lastcc %lu, currentSteps %d, curr %d"), i, ac_zero_cross_dimmer.dimm_timeClockCycles,ac_zero_cross_dimmer.current_cycle_ClockCycles , timelag_ClockCycles, ac_zero_cross_dimmer.currentCycleCount, ac_zero_cross_dimmer.currentSteps, Light.fade_cur_10[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void SonoffScSend(const char *data)
|
|||
{
|
||||
Serial.write(data);
|
||||
Serial.write('\x1B');
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL D_TRANSMIT " %s"), data);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL D_TRANSMIT " %s"), data);
|
||||
}
|
||||
|
||||
void SonoffScInit(void)
|
||||
|
@ -78,7 +78,7 @@ void SonoffScSerialInput(char *rcvstat)
|
|||
char *str;
|
||||
uint16_t value[5] = { 0 };
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL D_RECEIVED " %s"), rcvstat);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL D_RECEIVED " %s"), rcvstat);
|
||||
|
||||
if (!strncasecmp_P(rcvstat, PSTR("AT+UPDATE="), 10)) {
|
||||
int8_t i = -1;
|
||||
|
|
|
@ -341,7 +341,7 @@ void Ds18x20Init(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DSB D_SENSORS_FOUND " %d"), ds18x20_sensors);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DSB D_SENSORS_FOUND " %d"), ds18x20_sensors);
|
||||
}
|
||||
|
||||
void Ds18x20Convert(void)
|
||||
|
|
|
@ -56,7 +56,7 @@ void Ds18x20Init(void) {
|
|||
ds = new OneWire(Pin(GPIO_DSB));
|
||||
|
||||
Ds18x20Search();
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DSB D_SENSORS_FOUND " %d"), ds18x20_sensors);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DSB D_SENSORS_FOUND " %d"), ds18x20_sensors);
|
||||
}
|
||||
|
||||
void Ds18x20Search(void) {
|
||||
|
|
|
@ -52,7 +52,7 @@ bool DhtWaitState(uint32_t sensor, uint32_t level)
|
|||
unsigned long timeout = micros() + 100;
|
||||
while (digitalRead(Dht[sensor].pin) != level) {
|
||||
if (TimeReachedUsec(timeout)) {
|
||||
PrepLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_TIMEOUT_WAITING_FOR " %s " D_PULSE),
|
||||
PrepLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_TIMEOUT_WAITING_FOR " %s " D_PULSE),
|
||||
(level) ? D_START_SIGNAL_HIGH : D_START_SIGNAL_LOW);
|
||||
return false;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ bool DhtRead(uint32_t sensor)
|
|||
uint8_t checksum = (dht_data[0] + dht_data[1] + dht_data[2] + dht_data[3]) & 0xFF;
|
||||
if (dht_data[4] != checksum) {
|
||||
char hex_char[15];
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_CHECKSUM_FAILURE " %s =? %02X"),
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_CHECKSUM_FAILURE " %s =? %02X"),
|
||||
ToHex_P(dht_data, 5, hex_char, sizeof(hex_char), ' '), checksum);
|
||||
return false;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ void DhtInit(void)
|
|||
snprintf_P(Dht[i].stype, sizeof(Dht[i].stype), PSTR("%s%c%02d"), Dht[i].stype, IndexSeparator(), Dht[i].pin);
|
||||
}
|
||||
}
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT "(v5) " D_SENSORS_FOUND " %d"), dht_sensors);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT "(v5) " D_SENSORS_FOUND " %d"), dht_sensors);
|
||||
} else {
|
||||
dht_active = false;
|
||||
}
|
||||
|
|
|
@ -155,11 +155,11 @@ void Veml6070UvTableInit(void)
|
|||
uv_risk_map[i] = ( (USE_VEML6070_RSET / VEML6070_TABLE_COEFFCIENT) / VEML6070_UV_MAX_DEFAULT ) * (i+1);
|
||||
} else {
|
||||
uv_risk_map[i] = ( (VEML6070_RSET_DEFAULT / VEML6070_TABLE_COEFFCIENT) / VEML6070_UV_MAX_DEFAULT ) * (i+1);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 resistor error %d"), USE_VEML6070_RSET);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 resistor error %d"), USE_VEML6070_RSET);
|
||||
}
|
||||
#else
|
||||
uv_risk_map[i] = ( (VEML6070_RSET_DEFAULT / VEML6070_TABLE_COEFFCIENT) / VEML6070_UV_MAX_DEFAULT ) * (i+1);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 resistor default used %d"), VEML6070_RSET_DEFAULT);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 resistor default used %d"), VEML6070_RSET_DEFAULT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void Veml6070ModeCmd(bool mode_cmd)
|
|||
uint8_t status = Wire.endTransmission();
|
||||
// action on status
|
||||
if (!status) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 mode_cmd"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 mode_cmd"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ double Veml6070UvRiskLevel(uint16_t uv_level)
|
|||
// out of range and much to high - it must be outerspace or sensor damaged
|
||||
snprintf_P(str_uvrisk_text, sizeof(str_uvrisk_text), D_UV_INDEX_7);
|
||||
return ( risk = 99 );
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 out of range %d"), risk);
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 out of range %d"), risk);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -231,10 +231,10 @@ void AdsEvery250ms(void)
|
|||
}
|
||||
}
|
||||
ResponseJsonEndEnd();
|
||||
|
||||
|
||||
XdrvRulesProcess();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,14 +245,14 @@ void Ads1115Show(bool json)
|
|||
int16_t values[4];
|
||||
|
||||
for (uint32_t t = 0; t < sizeof(Ads1115.addresses); t++) {
|
||||
//AddLog_P2(LOG_LEVEL_INFO, "Logging ADS1115 %02x", Ads1115.addresses[t]);
|
||||
//AddLog_P(LOG_LEVEL_INFO, "Logging ADS1115 %02x", Ads1115.addresses[t]);
|
||||
if (Ads1115.found[t]) {
|
||||
|
||||
uint8_t old_address = Ads1115.address;
|
||||
Ads1115.address = Ads1115.addresses[t];
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
values[i] = Ads1115GetConversion(i);
|
||||
//AddLog_P2(LOG_LEVEL_INFO, "Logging ADS1115 %02x (%i) = %i", Ads1115.address, i, values[i] );
|
||||
//AddLog_P(LOG_LEVEL_INFO, "Logging ADS1115 %02x (%i) = %i", Ads1115.address, i, values[i] );
|
||||
}
|
||||
Ads1115.address = old_address;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue