Fix exception 9 restart on log message

Fix exception 9 restart on log message in Ticker interrupt service routines NTP, Wemos and Hue emulation (#7496)
This commit is contained in:
Theo Arends 2020-01-14 12:47:48 +01:00
parent fc9fafc19b
commit 0db458c774
8 changed files with 28 additions and 15 deletions

View File

@ -56,6 +56,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- Change Lights: simplified gamma correction and 10 bits internal computation
- Change commands ``Prefix``, ``Ssid``, ``StateText``, ``NTPServer``, and ``FriendlyName`` displaying all items
- Change IRremoteESP8266 library updated to v2.7.2
- Fix Sonoff Bridge, Sc, L1, iFan03 and CSE7766 serial interface to forced speed, config and disable logging
- Fix commands ``Display`` and ``Counter`` from overruling command processing (#7322)
- Fix ``White`` added to light status (#7142)
@ -63,6 +64,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- Fix LCD line and column positioning (#7387)
- Fix Display handling of hexadecimal escape characters (#7387)
- Fix ``WakeUp <x>`` ignores provided value (#7473)
- Fix exception 9 restart on log message in Ticker interrupt service routines NTP, Wemos and Hue emulation (#7496)
- Add command ``SetOption79 0/1`` to enable reset of counters at teleperiod time by Andre Thomas (#7355)
- Add command ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380
- Add command ``ShutterButton <parameters>`` to control shutter(s) by to-scho (#7403)

View File

@ -3,9 +3,10 @@
### 8.1.0.3 20200106
- Change commands ``Prefix``, ``Ssid``, ``StateText``, ``NTPServer``, and ``FriendlyName`` displaying all items
- Add support for gzipped binaries
- Update IRremoteESP8266 lib updated to v2.7.2
- Change IRremoteESP8266 library updated to v2.7.2
- Fix ``WakeUp <x>`` ignores provided value (#7473)
- Fix exception 9 restart on log message in Ticker interrupt service routines NTP, Wemos and Hue emulation (#7496)
- Add support for gzipped binaries
### 8.1.0.2 20191230

View File

@ -1678,6 +1678,16 @@ void AddLog_P(uint32_t loglevel, const char *formatP, const char *formatP2)
AddLog(loglevel);
}
void PrepLog_P2(uint32_t loglevel, PGM_P formatP, ...)
{
va_list arg;
va_start(arg, formatP);
vsnprintf_P(log_data, sizeof(log_data), formatP, arg);
va_end(arg);
prepped_loglevel = loglevel;
}
void AddLog_P2(uint32_t loglevel, PGM_P formatP, ...)
{
va_list arg;

View File

@ -396,9 +396,9 @@ 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 here if syslog is enabled. UDP will force exception 9
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
ntp_synced_message = true;
// 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("NTP: Drift %d, (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"),
DriftTime(), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
if (Rtc.local_time < START_VALID_TIME) { // 2016-01-01
rules_flag.time_init = 1;

View File

@ -698,13 +698,6 @@ void PerformEverySecond(void)
{
uptime++;
if (ntp_synced_message) {
// Moved here to fix syslog UDP exception 9 during RtcSecond
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NTP: Drift %d, (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"),
DriftTime(), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
ntp_synced_message = false;
}
if (POWER_CYCLE_TIME == uptime) {
UpdateQuickPowerCycle(false);
}
@ -782,6 +775,11 @@ void Every100mSeconds(void)
// As the max amount of sleep = 250 mSec this loop will shift in time...
power_t power_now;
if (prepped_loglevel) {
AddLog(prepped_loglevel);
prepped_loglevel = 0;
}
if (latching_relay_pulse) {
latching_relay_pulse--;
if (!latching_relay_pulse) SetLatchingRelay(0, 0);

View File

@ -139,6 +139,7 @@ uint8_t my_module_type; // Current copy of Settings.module o
uint8_t my_adc0; // Active copy of Module ADC0
uint8_t last_source = 0; // Last command source
uint8_t shutters_present = 0; // Number of actual define shutters
uint8_t prepped_loglevel = 0; // Delayed log level message
//uint8_t mdns_delayed_start = 0; // mDNS delayed start
bool serial_local = false; // Handle serial locally;
bool fallback_topic_flag = false; // Use Topic or FallbackTopic
@ -152,7 +153,6 @@ bool i2c_flg = false; // I2C configured
bool spi_flg = false; // SPI configured
bool soft_spi_flg = false; // Software SPI configured
bool ntp_force_sync = false; // Force NTP sync
bool ntp_synced_message = false; // NTP synced message flag
bool is_8285 = false; // Hardware device ESP8266EX (0) or ESP8285 (1)
myio my_module; // Active copy of Module GPIOs (17 x 8 bits)
gpio_flag my_module_flag; // Active copy of Template GPIO flags

View File

@ -100,7 +100,8 @@ void HueRespondToMSearch(void)
} else {
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
}
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"),
// 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"),
message, udp_remote_ip.toString().c_str(), udp_remote_port);
udp_response_mutex = false;

View File

@ -74,7 +74,8 @@ void WemoRespondToMSearch(int echo_type)
} else {
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
}
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"),
// 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"),
echo_type, message, udp_remote_ip.toString().c_str(), udp_remote_port);
udp_response_mutex = false;